@rzl-zone/utils-js 3.4.0 → 3.5.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.
Files changed (117) hide show
  1. package/README.md +94 -45
  2. package/dist/assertions/index.cjs +34 -1
  3. package/dist/assertions/index.d.ts +2 -2
  4. package/dist/assertions/index.js +5 -1
  5. package/dist/chunk-2CQX5CBG.js +247 -1
  6. package/dist/chunk-2IOOEY45.cjs +20 -1
  7. package/dist/chunk-2WA36TC5.cjs +176 -0
  8. package/dist/chunk-3IBQ5MOM.js +6 -1
  9. package/dist/chunk-3VA554KW.js +23 -1
  10. package/dist/chunk-5757UBXJ.cjs +144 -1
  11. package/dist/chunk-5IGC6PBH.js +22 -1
  12. package/dist/chunk-5KJFVIQT.cjs +55 -1
  13. package/dist/chunk-6JFCSH7J.js +24 -1
  14. package/dist/chunk-6JFZL7YE.cjs +14 -1
  15. package/dist/chunk-7ODAAXX5.cjs +361 -1
  16. package/dist/chunk-BAV5T2E3.cjs +5 -1
  17. package/dist/chunk-CAH33WOQ.cjs +25 -1
  18. package/dist/chunk-CDCERIZ2.js +164 -0
  19. package/dist/chunk-CKTLUNWX.js +12 -1
  20. package/dist/chunk-CMW2TBOQ.js +522 -1
  21. package/dist/chunk-D3ENH7H6.cjs +87 -1
  22. package/dist/chunk-DEZZUYE2.js +139 -1
  23. package/dist/chunk-DVMHRLKP.cjs +6 -1
  24. package/dist/chunk-DWF2R5GD.cjs +212 -1
  25. package/dist/chunk-E55EQK2U.cjs +8 -1
  26. package/dist/chunk-E74U6CYP.cjs +8 -1
  27. package/dist/chunk-EL6A35UR.cjs +51 -1
  28. package/dist/chunk-F6IPNNSJ.cjs +531 -1
  29. package/dist/chunk-FJZGG54N.cjs +252 -1
  30. package/dist/chunk-FWCKOJZM.js +519 -1
  31. package/dist/chunk-FWHNWL2P.cjs +409 -1
  32. package/dist/chunk-GGEADHZO.js +78 -1
  33. package/dist/chunk-GQR4R5WY.js +21 -1
  34. package/dist/chunk-H66AC7GK.cjs +81 -1
  35. package/dist/chunk-HQWOFR56.cjs +23 -1
  36. package/dist/chunk-HYRQMTRH.cjs +14 -1
  37. package/dist/chunk-IRFL4MAX.js +53 -1
  38. package/dist/chunk-IVL7CKVH.cjs +26 -1
  39. package/dist/chunk-IZPBKKPO.js +6 -1
  40. package/dist/chunk-JBQMXC5I.cjs +93 -1
  41. package/dist/chunk-JEQEF5WD.js +81 -1
  42. package/dist/chunk-JMJQCN74.js +334 -1
  43. package/dist/chunk-KHO2SBNA.cjs +6 -1
  44. package/dist/chunk-KVAL5PAG.cjs +16 -1
  45. package/dist/chunk-L5RDAVVH.js +5 -1
  46. package/dist/chunk-LS6U7FAY.cjs +98 -1
  47. package/dist/chunk-NBZWMBO6.js +88 -1
  48. package/dist/chunk-NRF6LWBC.cjs +45 -1
  49. package/dist/chunk-OI5XKNZO.js +42 -1
  50. package/dist/chunk-ONZFBJVW.js +5 -1
  51. package/dist/chunk-OYTYSY7G.js +94 -1
  52. package/dist/chunk-PET42Z7W.js +107 -1
  53. package/dist/chunk-PZQ6I4JJ.cjs +559 -1
  54. package/dist/chunk-QBKAEVYG.js +102 -1
  55. package/dist/chunk-QNKGP5DY.js +5 -1
  56. package/dist/chunk-RIPKY4RU.js +407 -1
  57. package/dist/chunk-RZW35UN5.cjs +105 -1
  58. package/dist/chunk-SBFNXGTJ.js +207 -1
  59. package/dist/chunk-SBKGWRS5.js +12 -1
  60. package/dist/chunk-SIM77PU4.js +46 -1
  61. package/dist/chunk-T2T7K3KR.js +18 -1
  62. package/dist/chunk-T7PU2V7X.cjs +111 -1
  63. package/dist/chunk-UDA26MCU.cjs +6 -1
  64. package/dist/chunk-V45XJKHW.cjs +8 -1
  65. package/dist/chunk-VJDDGRIK.cjs +6 -1
  66. package/dist/chunk-W2WNBUDE.js +6 -1
  67. package/dist/chunk-WVSPXFTY.js +5 -1
  68. package/dist/chunk-XABCB3Y7.cjs +563 -1
  69. package/dist/chunk-XEDXFSGI.js +14 -1
  70. package/dist/chunk-YKPSRP5G.js +552 -1
  71. package/dist/chunk-YWHHVDT4.js +4 -1
  72. package/dist/chunk-ZETAZZLD.cjs +27 -1
  73. package/dist/conversions/index.cjs +97 -1
  74. package/dist/conversions/index.d.ts +1 -1
  75. package/dist/conversions/index.js +16 -1
  76. package/dist/events/index.cjs +25 -1
  77. package/dist/events/index.d.ts +1 -1
  78. package/dist/events/index.js +4 -1
  79. package/dist/formatters/index.cjs +55 -1
  80. package/dist/formatters/index.d.ts +1 -1
  81. package/dist/formatters/index.js +10 -1
  82. package/dist/generators/index.cjs +31 -1
  83. package/dist/generators/index.d.ts +1 -1
  84. package/dist/generators/index.js +6 -1
  85. package/dist/index.d.ts +1 -0
  86. package/dist/{isPlainObject-CEPWPiXh.d.ts → isPlainObject-FWmcJF6k.d.ts} +4 -4
  87. package/dist/next/index.cjs +205 -1
  88. package/dist/next/index.d.ts +1 -1
  89. package/dist/next/index.js +200 -1
  90. package/dist/next/server/index.cjs +34 -1
  91. package/dist/next/server/index.d.ts +1 -1
  92. package/dist/next/server/index.js +32 -1
  93. package/dist/operations/index.cjs +26 -1
  94. package/dist/operations/index.d.ts +1 -1
  95. package/dist/operations/index.js +9 -1
  96. package/dist/parsers/index.cjs +11 -1
  97. package/dist/parsers/index.d.ts +1 -1
  98. package/dist/parsers/index.js +2 -1
  99. package/dist/predicates/index.cjs +292 -1
  100. package/dist/predicates/index.d.ts +4 -4
  101. package/dist/predicates/index.js +15 -1
  102. package/dist/promises/index.cjs +18 -1
  103. package/dist/promises/index.d.ts +1 -1
  104. package/dist/promises/index.js +5 -1
  105. package/dist/rzl-utils.global.js +16 -1
  106. package/dist/strings/index.cjs +75 -1
  107. package/dist/strings/index.d.ts +1 -1
  108. package/dist/strings/index.js +6 -1
  109. package/dist/tailwind/index.cjs +36 -1
  110. package/dist/tailwind/index.d.ts +1 -1
  111. package/dist/tailwind/index.js +3 -1
  112. package/dist/urls/index.cjs +44 -1
  113. package/dist/urls/index.d.ts +1 -1
  114. package/dist/urls/index.js +15 -1
  115. package/package.json +16 -19
  116. package/dist/chunk-JYQTCICM.js +0 -1
  117. package/dist/chunk-YLA3DURS.cjs +0 -1
@@ -1 +1,97 @@
1
- "use strict";var e=require("../chunk-F6IPNNSJ.cjs");require("../chunk-CAH33WOQ.cjs");var r=require("../chunk-NRF6LWBC.cjs");require("../chunk-HQWOFR56.cjs");var t=require("../chunk-5KJFVIQT.cjs");require("../chunk-V45XJKHW.cjs"),require("../chunk-E55EQK2U.cjs"),require("../chunk-HYRQMTRH.cjs");var n=require("../chunk-FJZGG54N.cjs");require("../chunk-JBQMXC5I.cjs"),require("../chunk-ZETAZZLD.cjs"),require("../chunk-6JFZL7YE.cjs"),require("../chunk-BAV5T2E3.cjs");var o=require("../chunk-T7PU2V7X.cjs");require("../chunk-UDA26MCU.cjs"),require("../chunk-PZQ6I4JJ.cjs"),Object.defineProperty(exports,"convertType",{enumerable:!0,get:function(){return e.convertType}}),Object.defineProperty(exports,"dedupeArray",{enumerable:!0,get:function(){return e.dedupeArray}}),Object.defineProperty(exports,"removeObjectPaths",{enumerable:!0,get:function(){return e.removeObjectPaths}}),Object.defineProperty(exports,"toBooleanContent",{enumerable:!0,get:function(){return e.toBooleanContent}}),Object.defineProperty(exports,"toBooleanContentDeep",{enumerable:!0,get:function(){return e.toBooleanContentDeep}}),Object.defineProperty(exports,"toBooleanExplicit",{enumerable:!0,get:function(){return e.toBooleanExplicit}}),Object.defineProperty(exports,"toBooleanLoose",{enumerable:!0,get:function(){return e.toBooleanLoose}}),Object.defineProperty(exports,"toNumberArrayUnRecursive",{enumerable:!0,get:function(){return e.toNumberArrayUnRecursive}}),Object.defineProperty(exports,"toNumberDeep",{enumerable:!0,get:function(){return e.toNumberDeep}}),Object.defineProperty(exports,"toStringDeep",{enumerable:!0,get:function(){return e.toStringDeep}}),Object.defineProperty(exports,"toStringDeepForce",{enumerable:!0,get:function(){return e.toStringDeepForce}}),Object.defineProperty(exports,"filterNilArray",{enumerable:!0,get:function(){return r.filterNilArray}}),Object.defineProperty(exports,"toStringArrayUnRecursive",{enumerable:!0,get:function(){return r.toStringArrayUnRecursive}}),Object.defineProperty(exports,"parseCurrencyString",{enumerable:!0,get:function(){return t.parseCurrencyString}}),Object.defineProperty(exports,"cleanParsedData",{enumerable:!0,get:function(){return n.cleanParsedData}}),Object.defineProperty(exports,"extractDigits",{enumerable:!0,get:function(){return n.extractDigits}}),Object.defineProperty(exports,"parseCustomDate",{enumerable:!0,get:function(){return n.parseCustomDate}}),Object.defineProperty(exports,"safeJsonParse",{enumerable:!0,get:function(){return n.safeJsonParse}}),Object.defineProperty(exports,"safeStableStringify",{enumerable:!0,get:function(){return o.safeStableStringify}});
1
+ 'use strict';
2
+
3
+ var chunkF6IPNNSJ_cjs = require('../chunk-F6IPNNSJ.cjs');
4
+ require('../chunk-CAH33WOQ.cjs');
5
+ var chunkNRF6LWBC_cjs = require('../chunk-NRF6LWBC.cjs');
6
+ require('../chunk-HQWOFR56.cjs');
7
+ var chunk5KJFVIQT_cjs = require('../chunk-5KJFVIQT.cjs');
8
+ require('../chunk-V45XJKHW.cjs');
9
+ require('../chunk-E55EQK2U.cjs');
10
+ require('../chunk-HYRQMTRH.cjs');
11
+ var chunkFJZGG54N_cjs = require('../chunk-FJZGG54N.cjs');
12
+ require('../chunk-JBQMXC5I.cjs');
13
+ require('../chunk-ZETAZZLD.cjs');
14
+ require('../chunk-6JFZL7YE.cjs');
15
+ require('../chunk-BAV5T2E3.cjs');
16
+ var chunkT7PU2V7X_cjs = require('../chunk-T7PU2V7X.cjs');
17
+ require('../chunk-UDA26MCU.cjs');
18
+ require('../chunk-PZQ6I4JJ.cjs');
19
+
20
+
21
+
22
+ Object.defineProperty(exports, "convertType", {
23
+ enumerable: true,
24
+ get: function () { return chunkF6IPNNSJ_cjs.convertType; }
25
+ });
26
+ Object.defineProperty(exports, "dedupeArray", {
27
+ enumerable: true,
28
+ get: function () { return chunkF6IPNNSJ_cjs.dedupeArray; }
29
+ });
30
+ Object.defineProperty(exports, "removeObjectPaths", {
31
+ enumerable: true,
32
+ get: function () { return chunkF6IPNNSJ_cjs.removeObjectPaths; }
33
+ });
34
+ Object.defineProperty(exports, "toBooleanContent", {
35
+ enumerable: true,
36
+ get: function () { return chunkF6IPNNSJ_cjs.toBooleanContent; }
37
+ });
38
+ Object.defineProperty(exports, "toBooleanContentDeep", {
39
+ enumerable: true,
40
+ get: function () { return chunkF6IPNNSJ_cjs.toBooleanContentDeep; }
41
+ });
42
+ Object.defineProperty(exports, "toBooleanExplicit", {
43
+ enumerable: true,
44
+ get: function () { return chunkF6IPNNSJ_cjs.toBooleanExplicit; }
45
+ });
46
+ Object.defineProperty(exports, "toBooleanLoose", {
47
+ enumerable: true,
48
+ get: function () { return chunkF6IPNNSJ_cjs.toBooleanLoose; }
49
+ });
50
+ Object.defineProperty(exports, "toNumberArrayUnRecursive", {
51
+ enumerable: true,
52
+ get: function () { return chunkF6IPNNSJ_cjs.toNumberArrayUnRecursive; }
53
+ });
54
+ Object.defineProperty(exports, "toNumberDeep", {
55
+ enumerable: true,
56
+ get: function () { return chunkF6IPNNSJ_cjs.toNumberDeep; }
57
+ });
58
+ Object.defineProperty(exports, "toStringDeep", {
59
+ enumerable: true,
60
+ get: function () { return chunkF6IPNNSJ_cjs.toStringDeep; }
61
+ });
62
+ Object.defineProperty(exports, "toStringDeepForce", {
63
+ enumerable: true,
64
+ get: function () { return chunkF6IPNNSJ_cjs.toStringDeepForce; }
65
+ });
66
+ Object.defineProperty(exports, "filterNilArray", {
67
+ enumerable: true,
68
+ get: function () { return chunkNRF6LWBC_cjs.filterNilArray; }
69
+ });
70
+ Object.defineProperty(exports, "toStringArrayUnRecursive", {
71
+ enumerable: true,
72
+ get: function () { return chunkNRF6LWBC_cjs.toStringArrayUnRecursive; }
73
+ });
74
+ Object.defineProperty(exports, "parseCurrencyString", {
75
+ enumerable: true,
76
+ get: function () { return chunk5KJFVIQT_cjs.parseCurrencyString; }
77
+ });
78
+ Object.defineProperty(exports, "cleanParsedData", {
79
+ enumerable: true,
80
+ get: function () { return chunkFJZGG54N_cjs.cleanParsedData; }
81
+ });
82
+ Object.defineProperty(exports, "extractDigits", {
83
+ enumerable: true,
84
+ get: function () { return chunkFJZGG54N_cjs.extractDigits; }
85
+ });
86
+ Object.defineProperty(exports, "parseCustomDate", {
87
+ enumerable: true,
88
+ get: function () { return chunkFJZGG54N_cjs.parseCustomDate; }
89
+ });
90
+ Object.defineProperty(exports, "safeJsonParse", {
91
+ enumerable: true,
92
+ get: function () { return chunkFJZGG54N_cjs.safeJsonParse; }
93
+ });
94
+ Object.defineProperty(exports, "safeStableStringify", {
95
+ enumerable: true,
96
+ get: function () { return chunkT7PU2V7X_cjs.safeStableStringify; }
97
+ });
@@ -1627,4 +1627,4 @@ declare function toStringDeep(input?:null|undefined,options?:ToStringDeepOptions
1627
1627
  * toStringDeepForce([1, "a", { b: 2 }], false);
1628
1628
  * // ➔ [1, "a", { b: 2 }]
1629
1629
  */
1630
- declare function toStringDeepForce<T>(value:unknown,forceToString:false|"stringOrNumber"|"primitives"|"all"):T;export{cleanParsedData,convertType,dedupeArray,extractDigits,filterNilArray,parseCurrencyString,parseCustomDate,removeObjectPaths,safeJsonParse,safeStableStringify,toBooleanContent,toBooleanContentDeep,toBooleanExplicit,toBooleanLoose,toNumberArrayUnRecursive,toNumberDeep,toStringArrayUnRecursive,toStringDeep,toStringDeepForce};
1630
+ declare function toStringDeepForce<T>(value:unknown,forceToString:false|"stringOrNumber"|"primitives"|"all"):T;export{cleanParsedData,convertType,dedupeArray,extractDigits,filterNilArray,parseCurrencyString,parseCustomDate,removeObjectPaths,safeJsonParse,safeStableStringify,toBooleanContent,toBooleanContentDeep,toBooleanExplicit,toBooleanLoose,toNumberArrayUnRecursive,toNumberDeep,toStringArrayUnRecursive,toStringDeep,toStringDeepForce};
@@ -1 +1,16 @@
1
- export{convertType,dedupeArray,removeObjectPaths,toBooleanContent,toBooleanContentDeep,toBooleanExplicit,toBooleanLoose,toNumberArrayUnRecursive,toNumberDeep,toStringDeep,toStringDeepForce}from"../chunk-FWCKOJZM.js";import"../chunk-5IGC6PBH.js";export{filterNilArray,toStringArrayUnRecursive}from"../chunk-OI5XKNZO.js";import"../chunk-GQR4R5WY.js";export{parseCurrencyString}from"../chunk-IRFL4MAX.js";import"../chunk-3IBQ5MOM.js";import"../chunk-W2WNBUDE.js";import"../chunk-SBKGWRS5.js";export{cleanParsedData,extractDigits,parseCustomDate,safeJsonParse}from"../chunk-2CQX5CBG.js";import"../chunk-NBZWMBO6.js";import"../chunk-6JFCSH7J.js";import"../chunk-CKTLUNWX.js";import"../chunk-YWHHVDT4.js";export{safeStableStringify}from"../chunk-PET42Z7W.js";import"../chunk-QNKGP5DY.js";import"../chunk-CMW2TBOQ.js";
1
+ export { convertType, dedupeArray, removeObjectPaths, toBooleanContent, toBooleanContentDeep, toBooleanExplicit, toBooleanLoose, toNumberArrayUnRecursive, toNumberDeep, toStringDeep, toStringDeepForce } from '../chunk-FWCKOJZM.js';
2
+ import '../chunk-5IGC6PBH.js';
3
+ export { filterNilArray, toStringArrayUnRecursive } from '../chunk-OI5XKNZO.js';
4
+ import '../chunk-GQR4R5WY.js';
5
+ export { parseCurrencyString } from '../chunk-IRFL4MAX.js';
6
+ import '../chunk-3IBQ5MOM.js';
7
+ import '../chunk-W2WNBUDE.js';
8
+ import '../chunk-SBKGWRS5.js';
9
+ export { cleanParsedData, extractDigits, parseCustomDate, safeJsonParse } from '../chunk-2CQX5CBG.js';
10
+ import '../chunk-NBZWMBO6.js';
11
+ import '../chunk-6JFCSH7J.js';
12
+ import '../chunk-CKTLUNWX.js';
13
+ import '../chunk-YWHHVDT4.js';
14
+ export { safeStableStringify } from '../chunk-PET42Z7W.js';
15
+ import '../chunk-QNKGP5DY.js';
16
+ import '../chunk-CMW2TBOQ.js';
@@ -1 +1,25 @@
1
- "use strict";var e=require("../chunk-EL6A35UR.cjs");require("../chunk-VJDDGRIK.cjs"),require("../chunk-HYRQMTRH.cjs"),require("../chunk-PZQ6I4JJ.cjs"),Object.defineProperty(exports,"disableUserInteraction",{enumerable:!0,get:function(){return e.disableUserInteraction}}),Object.defineProperty(exports,"enableUserInteraction",{enumerable:!0,get:function(){return e.enableUserInteraction}}),Object.defineProperty(exports,"removeElementFocus",{enumerable:!0,get:function(){return e.removeElementFocus}}),Object.defineProperty(exports,"scrollToTop",{enumerable:!0,get:function(){return e.scrollToTop}});
1
+ 'use strict';
2
+
3
+ var chunkEL6A35UR_cjs = require('../chunk-EL6A35UR.cjs');
4
+ require('../chunk-VJDDGRIK.cjs');
5
+ require('../chunk-HYRQMTRH.cjs');
6
+ require('../chunk-PZQ6I4JJ.cjs');
7
+
8
+
9
+
10
+ Object.defineProperty(exports, "disableUserInteraction", {
11
+ enumerable: true,
12
+ get: function () { return chunkEL6A35UR_cjs.disableUserInteraction; }
13
+ });
14
+ Object.defineProperty(exports, "enableUserInteraction", {
15
+ enumerable: true,
16
+ get: function () { return chunkEL6A35UR_cjs.enableUserInteraction; }
17
+ });
18
+ Object.defineProperty(exports, "removeElementFocus", {
19
+ enumerable: true,
20
+ get: function () { return chunkEL6A35UR_cjs.removeElementFocus; }
21
+ });
22
+ Object.defineProperty(exports, "scrollToTop", {
23
+ enumerable: true,
24
+ get: function () { return chunkEL6A35UR_cjs.scrollToTop; }
25
+ });
@@ -124,4 +124,4 @@ timeout?:number|undefined;};
124
124
  * scrollToTop({ behavior: "fly", timeout: 123.55 });
125
125
  * // ➔ Fallback: behavior="smooth", timeout=123
126
126
  */
127
- declare const scrollToTop:(options?:ScrollToTopOptions)=>void;export{disableUserInteraction,enableUserInteraction,removeElementFocus,scrollToTop};
127
+ declare const scrollToTop:(options?:ScrollToTopOptions)=>void;export{disableUserInteraction,enableUserInteraction,removeElementFocus,scrollToTop};
@@ -1 +1,4 @@
1
- export{disableUserInteraction,enableUserInteraction,removeElementFocus,scrollToTop}from"../chunk-SIM77PU4.js";import"../chunk-L5RDAVVH.js";import"../chunk-SBKGWRS5.js";import"../chunk-CMW2TBOQ.js";
1
+ export { disableUserInteraction, enableUserInteraction, removeElementFocus, scrollToTop } from '../chunk-SIM77PU4.js';
2
+ import '../chunk-L5RDAVVH.js';
3
+ import '../chunk-SBKGWRS5.js';
4
+ import '../chunk-CMW2TBOQ.js';
@@ -1 +1,55 @@
1
- "use strict";var e=require("../chunk-XABCB3Y7.cjs");require("../chunk-2IOOEY45.cjs"),require("../chunk-5KJFVIQT.cjs"),require("../chunk-V45XJKHW.cjs"),require("../chunk-DVMHRLKP.cjs"),require("../chunk-E55EQK2U.cjs"),require("../chunk-HYRQMTRH.cjs"),require("../chunk-T7PU2V7X.cjs"),require("../chunk-UDA26MCU.cjs"),require("../chunk-PZQ6I4JJ.cjs"),Object.defineProperty(exports,"censorEmail",{enumerable:!0,get:function(){return e.censorEmail}}),Object.defineProperty(exports,"chunkString",{enumerable:!0,get:function(){return e.chunkString}}),Object.defineProperty(exports,"formatCurrency",{enumerable:!0,get:function(){return e.formatCurrency}}),Object.defineProperty(exports,"formatDateFns",{enumerable:!0,get:function(){return e.formatDateFns}}),Object.defineProperty(exports,"formatDateIntl",{enumerable:!0,get:function(){return e.formatDateIntl}}),Object.defineProperty(exports,"formatDateTime",{enumerable:!0,get:function(){return e.formatDateTime}}),Object.defineProperty(exports,"formatNumber",{enumerable:!0,get:function(){return e.formatNumber}}),Object.defineProperty(exports,"formatPhoneNumber",{enumerable:!0,get:function(){return e.formatPhoneNumber}}),Object.defineProperty(exports,"getGMTOffset",{enumerable:!0,get:function(){return e.getGMTOffset}}),Object.defineProperty(exports,"truncateString",{enumerable:!0,get:function(){return e.truncateString}});
1
+ 'use strict';
2
+
3
+ var chunkXABCB3Y7_cjs = require('../chunk-XABCB3Y7.cjs');
4
+ require('../chunk-2IOOEY45.cjs');
5
+ require('../chunk-5KJFVIQT.cjs');
6
+ require('../chunk-V45XJKHW.cjs');
7
+ require('../chunk-DVMHRLKP.cjs');
8
+ require('../chunk-E55EQK2U.cjs');
9
+ require('../chunk-HYRQMTRH.cjs');
10
+ require('../chunk-T7PU2V7X.cjs');
11
+ require('../chunk-UDA26MCU.cjs');
12
+ require('../chunk-PZQ6I4JJ.cjs');
13
+
14
+
15
+
16
+ Object.defineProperty(exports, "censorEmail", {
17
+ enumerable: true,
18
+ get: function () { return chunkXABCB3Y7_cjs.censorEmail; }
19
+ });
20
+ Object.defineProperty(exports, "chunkString", {
21
+ enumerable: true,
22
+ get: function () { return chunkXABCB3Y7_cjs.chunkString; }
23
+ });
24
+ Object.defineProperty(exports, "formatCurrency", {
25
+ enumerable: true,
26
+ get: function () { return chunkXABCB3Y7_cjs.formatCurrency; }
27
+ });
28
+ Object.defineProperty(exports, "formatDateFns", {
29
+ enumerable: true,
30
+ get: function () { return chunkXABCB3Y7_cjs.formatDateFns; }
31
+ });
32
+ Object.defineProperty(exports, "formatDateIntl", {
33
+ enumerable: true,
34
+ get: function () { return chunkXABCB3Y7_cjs.formatDateIntl; }
35
+ });
36
+ Object.defineProperty(exports, "formatDateTime", {
37
+ enumerable: true,
38
+ get: function () { return chunkXABCB3Y7_cjs.formatDateTime; }
39
+ });
40
+ Object.defineProperty(exports, "formatNumber", {
41
+ enumerable: true,
42
+ get: function () { return chunkXABCB3Y7_cjs.formatNumber; }
43
+ });
44
+ Object.defineProperty(exports, "formatPhoneNumber", {
45
+ enumerable: true,
46
+ get: function () { return chunkXABCB3Y7_cjs.formatPhoneNumber; }
47
+ });
48
+ Object.defineProperty(exports, "getGMTOffset", {
49
+ enumerable: true,
50
+ get: function () { return chunkXABCB3Y7_cjs.getGMTOffset; }
51
+ });
52
+ Object.defineProperty(exports, "truncateString", {
53
+ enumerable: true,
54
+ get: function () { return chunkXABCB3Y7_cjs.truncateString; }
55
+ });
@@ -2103,4 +2103,4 @@ declare const formatDateTime:(date:string|Date|null|undefined,format?:string)=>s
2103
2103
  * getGMTOffset(123);
2104
2104
  * // ➔ "0"
2105
2105
  */
2106
- declare const getGMTOffset:(date?:string|Date|null)=>string;export{censorEmail,chunkString,formatCurrency,formatDateFns,formatDateIntl,formatDateTime,formatNumber,formatPhoneNumber,getGMTOffset,truncateString};
2106
+ declare const getGMTOffset:(date?:string|Date|null)=>string;export{censorEmail,chunkString,formatCurrency,formatDateFns,formatDateIntl,formatDateTime,formatNumber,formatPhoneNumber,getGMTOffset,truncateString};
@@ -1 +1,10 @@
1
- export{censorEmail,chunkString,formatCurrency,formatDateFns,formatDateIntl,formatDateTime,formatNumber,formatPhoneNumber,getGMTOffset,truncateString}from"../chunk-YKPSRP5G.js";import"../chunk-T2T7K3KR.js";import"../chunk-IRFL4MAX.js";import"../chunk-3IBQ5MOM.js";import"../chunk-WVSPXFTY.js";import"../chunk-W2WNBUDE.js";import"../chunk-SBKGWRS5.js";import"../chunk-PET42Z7W.js";import"../chunk-QNKGP5DY.js";import"../chunk-CMW2TBOQ.js";
1
+ export { censorEmail, chunkString, formatCurrency, formatDateFns, formatDateIntl, formatDateTime, formatNumber, formatPhoneNumber, getGMTOffset, truncateString } from '../chunk-YKPSRP5G.js';
2
+ import '../chunk-T2T7K3KR.js';
3
+ import '../chunk-IRFL4MAX.js';
4
+ import '../chunk-3IBQ5MOM.js';
5
+ import '../chunk-WVSPXFTY.js';
6
+ import '../chunk-W2WNBUDE.js';
7
+ import '../chunk-SBKGWRS5.js';
8
+ import '../chunk-PET42Z7W.js';
9
+ import '../chunk-QNKGP5DY.js';
10
+ import '../chunk-CMW2TBOQ.js';
@@ -1 +1,31 @@
1
- "use strict";var e=require("../chunk-5757UBXJ.cjs");require("../chunk-DVMHRLKP.cjs");var r=require("../chunk-BAV5T2E3.cjs");require("../chunk-T7PU2V7X.cjs"),require("../chunk-UDA26MCU.cjs"),require("../chunk-PZQ6I4JJ.cjs"),Object.defineProperty(exports,"getRandomItem",{enumerable:!0,get:function(){return e.getRandomItem}}),Object.defineProperty(exports,"randomInt",{enumerable:!0,get:function(){return e.randomInt}}),Object.defineProperty(exports,"randomIntByLength",{enumerable:!0,get:function(){return e.randomIntByLength}}),Object.defineProperty(exports,"randomStr",{enumerable:!0,get:function(){return e.randomStr}}),Object.defineProperty(exports,"noop",{enumerable:!0,get:function(){return r.noop}});
1
+ 'use strict';
2
+
3
+ var chunk5757UBXJ_cjs = require('../chunk-5757UBXJ.cjs');
4
+ require('../chunk-DVMHRLKP.cjs');
5
+ var chunkBAV5T2E3_cjs = require('../chunk-BAV5T2E3.cjs');
6
+ require('../chunk-T7PU2V7X.cjs');
7
+ require('../chunk-UDA26MCU.cjs');
8
+ require('../chunk-PZQ6I4JJ.cjs');
9
+
10
+
11
+
12
+ Object.defineProperty(exports, "getRandomItem", {
13
+ enumerable: true,
14
+ get: function () { return chunk5757UBXJ_cjs.getRandomItem; }
15
+ });
16
+ Object.defineProperty(exports, "randomInt", {
17
+ enumerable: true,
18
+ get: function () { return chunk5757UBXJ_cjs.randomInt; }
19
+ });
20
+ Object.defineProperty(exports, "randomIntByLength", {
21
+ enumerable: true,
22
+ get: function () { return chunk5757UBXJ_cjs.randomIntByLength; }
23
+ });
24
+ Object.defineProperty(exports, "randomStr", {
25
+ enumerable: true,
26
+ get: function () { return chunk5757UBXJ_cjs.randomStr; }
27
+ });
28
+ Object.defineProperty(exports, "noop", {
29
+ enumerable: true,
30
+ get: function () { return chunkBAV5T2E3_cjs.noop; }
31
+ });
@@ -181,4 +181,4 @@ declare const randomStr:(options?:OptionsRandomStr)=>string;
181
181
  * callback();
182
182
  * // ➔ undefined
183
183
  */
184
- declare const noop:()=>void;export{getRandomItem,noop,randomInt,randomIntByLength,randomStr};
184
+ declare const noop:()=>void;export{getRandomItem,noop,randomInt,randomIntByLength,randomStr};
@@ -1 +1,6 @@
1
- export{getRandomItem,randomInt,randomIntByLength,randomStr}from"../chunk-DEZZUYE2.js";import"../chunk-WVSPXFTY.js";export{noop}from"../chunk-YWHHVDT4.js";import"../chunk-PET42Z7W.js";import"../chunk-QNKGP5DY.js";import"../chunk-CMW2TBOQ.js";
1
+ export { getRandomItem, randomInt, randomIntByLength, randomStr } from '../chunk-DEZZUYE2.js';
2
+ import '../chunk-WVSPXFTY.js';
3
+ export { noop } from '../chunk-YWHHVDT4.js';
4
+ import '../chunk-PET42Z7W.js';
5
+ import '../chunk-QNKGP5DY.js';
6
+ import '../chunk-CMW2TBOQ.js';
package/dist/index.d.ts CHANGED
@@ -6,6 +6,7 @@
6
6
  /// <reference path="./parsers/index.d.ts" />
7
7
  /// <reference path="./operations/index.d.ts" />
8
8
  /// <reference path="./next/index.d.ts" />
9
+ /// <reference path="./next/server/index.d.ts" />
9
10
  /// <reference path="./generators/index.d.ts" />
10
11
  /// <reference path="./formatters/index.d.ts" />
11
12
  /// <reference path="./events/index.d.ts" />
@@ -101,7 +101,7 @@ includeNaN?:boolean;};
101
101
  * isNumber("42");
102
102
  * // ➔ false
103
103
  */
104
- declare const isNumber:(value:unknown,options?:IsNumberOptions)=>value is number;type HasKeys<T>=keyof T extends never?false:true;
104
+ declare const isNumber:(value:unknown,options?:IsNumberOptions)=>value is number;type IsHasKeysObject<T>=keyof T extends never?false:true;
105
105
  /** ----------------------------------------------------------
106
106
  * * ***Utility type: `IsPlainObjectResult`.***
107
107
  * ----------------------------------------------------------
@@ -110,7 +110,7 @@ declare const isNumber:(value:unknown,options?:IsNumberOptions)=>value is number
110
110
  * - If `T` is `unknown`, the resulting type is `Record<PropertyKey, unknown> & T`.
111
111
  * - If `T` is an object:
112
112
  * - If it is a non-plain object (class instance, built-in object, etc.), the result is `never`.
113
- * - If it has no keys (`HasKeys<T>` checked by **{@link HasKeys}** is false), the result is `Record<PropertyKey, unknown> & T`.
113
+ * - If it has no keys (`IsHasKeysObject<T>` checked by **{@link IsHasKeysObject}** is false), the result is `Record<PropertyKey, unknown> & T`.
114
114
  * - Otherwise, the result is `T` itself.
115
115
  * - For any other types, the result is `never`.
116
116
  * @template T - The input type to be asserted as a plain object.
@@ -126,7 +126,7 @@ declare const isNumber:(value:unknown,options?:IsNumberOptions)=>value is number
126
126
  * // ➔ never
127
127
  * ```
128
128
  */
129
- type IsPlainObjectResult<T>=unknown extends T?Record<PropertyKey,unknown>& T:T extends object?T extends NonPlainObject?never:HasKeys<T>extends false?Record<PropertyKey,unknown>& T:T:Extract<T,Record<PropertyKey,unknown>>;
129
+ type IsPlainObjectResult<T>=unknown extends T?Record<PropertyKey,unknown>& T:T extends object?T extends NonPlainObject?never:IsHasKeysObject<T>extends false?Record<PropertyKey,unknown>& T:T:Extract<T,Record<PropertyKey,unknown>>;
130
130
  /** ----------------------------------------------------------
131
131
  * * ***Type guard: `isPlainObject`.***
132
132
  * ----------------------------------------------------------
@@ -166,4 +166,4 @@ type IsPlainObjectResult<T>=unknown extends T?Record<PropertyKey,unknown>& T:T e
166
166
  * isPlainObject(new String("x"));
167
167
  * // ➔ false
168
168
  */
169
- declare function isPlainObject<T>(value:T):value is IsPlainObjectResult<T>;declare function isPlainObject<T>(value:T):value is NonNullable<Extract<T,Record<PropertyKey,unknown>>>;export{type GetPreciseTypeOptions as G,type IsNumberOptions as I,type IsPlainObjectResult as a,isPlainObject as b,getPreciseType as g,isNumber as i};
169
+ declare function isPlainObject<T>(value:T):value is IsPlainObjectResult<T>;declare function isPlainObject<T>(value:T):value is NonNullable<Extract<T,Record<PropertyKey,unknown>>>;export{type GetPreciseTypeOptions as G,type IsNumberOptions as I,type IsPlainObjectResult as a,isPlainObject as b,type IsHasKeysObject as c,getPreciseType as g,isNumber as i};
@@ -1 +1,205 @@
1
- "use strict";var e=require("../chunk-H66AC7GK.cjs"),r=require("../chunk-KVAL5PAG.cjs"),t=require("../chunk-E55EQK2U.cjs"),s=require("../chunk-HYRQMTRH.cjs"),n=require("../chunk-T7PU2V7X.cjs");require("../chunk-UDA26MCU.cjs");var i=require("../chunk-PZQ6I4JJ.cjs");var a=(t={})=>{i.isPlainObject(t)||(t={});let n=i.hasOwnProp(t,"suffix")?t.suffix:"/";s.assertIsString(n,{message:({currentType:e,validType:r})=>`Parameter \`suffix\` property of the first parameter must be of type \`${r}\`, but received: \`${e}\`.`});try{let t=process.env.NEXT_PUBLIC_BACKEND_API_URL?.trim();if(t){t=r.removeSpaces(t);const s=new URL(t);!!!s.port&&process.env.NEXT_PUBLIC_PORT_BE&&(t=s.origin+e.formatEnvPort(process.env.NEXT_PUBLIC_PORT_BE,{prefixColon:!0}))}else t="http://localhost"+e.formatEnvPort(process.env.NEXT_PUBLIC_PORT_BE||"8000",{prefixColon:!0});n=r.removeSpaces(n).length?r.removeSpaces(n):"/";const s=new URL(t.replace(/\/+$/,"")).origin;return`${s}${"/"===n?"/":`${n.startsWith("/")?"":"/"}${n.replace(/\/+$/,"")}`}`}catch(e){throw new Error("Invalid `NEXT_PUBLIC_BACKEND_API_URL`, failed to generate from `getBeApiUrl()`, Error:"+e)}};exports.createBeApiUrl=(r,t={})=>{try{let n=function(e,r){return`${e.replace(/\/+$/,"")}/${r.replace(/^\/+/,"")}`};s.assertIsString(i.isNil(r)?"":r,{message:({currentType:e,validType:r})=>`First parameter (\`pathname\`) must be of type \`${r}\`, but received: \`${e}\`.`}),i.isPlainObject(t)||(t={});let{prefix:o="/api",withOrigin:c=!0}=t;if(!i.isUndefined(o)&&!i.isString(o))throw new TypeError(`Parameter \`prefix\` property of the \`options\` (second parameter) must be of type \`string\`, but received: \`${i.getPreciseType(o)}\`.`);i.assertIsBoolean(c,{message:({currentType:e,validType:r})=>`Parameter \`withOrigin\` property of the \`options\` (second parameter) must be of type \`${r}\`, but received: \`${e}\`.`}),r=e.normalizePathname(r),o=e.normalizePathname(o);const p=o.endsWith("/")?o:o+"/";(r===o||r===o+"/"||r.startsWith(p))&&(r=r.slice(o.length),r=e.normalizePathname(r));const u=a({suffix:o});return n(c?u:new URL(u).pathname,r).replace(/\/+$/,"")}catch(e){throw i.isError(e)?e:new Error("Failed to generate backend API URL in `createBeApiUrl()`, Error: "+new Error(String(e)).message.trim())}},exports.generateRoute=function(e,r){if(!i.isString(e)||t.isEmptyString(e))throw new TypeError(`❌ 'generateRoute' Failed:\n- Invalid 'route' value.\n- Must be of type \`string\` and non-empty string, but received: "${i.getPreciseType(e)}": \`${n.safeStableStringify(e)}\`.`);if(!/[\\[\]]/.test(e))return e;if(i.assertIsPlainObject(r,{message:({validType:r})=>`❌ 'generateRoute' Failed cause in route "${e}":\n- Missing or invalid parameters \`${r}\` for route: "${e}", must be of type \`${r}\` mapping parameters.`}),i.isNil(r))throw new TypeError(`❌ 'generateRoute' Failed cause in route "${e}":\n- Missing parameters \`plain-object\` for route: "${e}".`);const s=["?","&","#","=","/","'",'"',"(",")","+",";","%","@",":"],a=[],o=Array.from(e.matchAll(/\[(\w+)\]/g)).map(e=>e[1]);for(const e of o){const n=r[e];if(!i.isString(n)){a.push(`- Invalid parameter: "${e}" must be of type \`string\`, but received: \`${i.getPreciseType(n)}\`.`);continue}if(t.isEmptyString(n)){a.push(`- Parameter "${e}" cannot be empty string.`);continue}const o=s.filter(e=>n.includes(e));if(/\s/.test(n)&&o.push("white-space(s)"),o.length>0){const r=o.map(e=>"`"===e?"backtick - (`)":`\`${e}\``);s.includes("white-space(s)")||s.push("white-space(s)");const t=s.map(e=>"`"===e?"backtick - (`)":`\`${e}\``);a.push(`- Parameter "${e}" contains invalid characters (${r.join(", ")}). These characters are not allowed because they could cause issues in URL structure. The following characters are forbidden in route parameters: (${t.join(", ")}).`)}}if(i.isNonEmptyArray(a))throw new Error(`❌ 'generateRoute' Failed cause in route "${e}":\n${a.join("\n")}.`);return e.replace(/\[(\w+)\]/g,(e,t)=>(i.isNonEmptyString(r[t])?r[t]:"").trim().replace(/^\/+|\/+$/g,"")).replace(/\/+/g,"/")},exports.getBaseUrl=()=>{try{const t=process.env.NEXT_PUBLIC_BASE_URL?.trim(),s=process.env.NEXT_PUBLIC_PORT_FE?.trim();let n=t||"http://localhost";n=r.removeSpaces(n).replace(/\/+$/,"");const i=/:\/\/[^/]+:\d+/.test(n);!i&&s?n+=e.formatEnvPort(s,{prefixColon:!0}):i||t||(n+=":3000");const a=new URL(n);return`${a.protocol}//${a.hostname}${a.port?`:${a.port}`:""}`}catch(e){throw new Error("Invalid `NEXT_PUBLIC_BASE_URL`, failed to generate from `getBaseUrl()`, Error:"+e)}},exports.getBeApiUrl=a;
1
+ 'use strict';
2
+
3
+ var chunkH66AC7GK_cjs = require('../chunk-H66AC7GK.cjs');
4
+ var chunkKVAL5PAG_cjs = require('../chunk-KVAL5PAG.cjs');
5
+ var chunkE55EQK2U_cjs = require('../chunk-E55EQK2U.cjs');
6
+ var chunkHYRQMTRH_cjs = require('../chunk-HYRQMTRH.cjs');
7
+ var chunkT7PU2V7X_cjs = require('../chunk-T7PU2V7X.cjs');
8
+ require('../chunk-UDA26MCU.cjs');
9
+ var chunkPZQ6I4JJ_cjs = require('../chunk-PZQ6I4JJ.cjs');
10
+ function generateRoute(route, params) {
11
+ if (!chunkPZQ6I4JJ_cjs.isString(route) || chunkE55EQK2U_cjs.isEmptyString(route)) {
12
+ throw new TypeError(
13
+ `\u274C 'generateRoute' Failed:
14
+ - Invalid 'route' value.
15
+ - Must be of type \`string\` and non-empty string, but received: "${chunkPZQ6I4JJ_cjs.getPreciseType(
16
+ route
17
+ )}": \`${chunkT7PU2V7X_cjs.safeStableStringify(route)}\`.`
18
+ );
19
+ }
20
+ if (!/[\\[\]]/.test(route)) {
21
+ return route;
22
+ }
23
+ chunkPZQ6I4JJ_cjs.assertIsPlainObject(params, {
24
+ message: ({ validType }) => `\u274C 'generateRoute' Failed cause in route "${route}":
25
+ - Missing or invalid parameters \`${validType}\` for route: "${route}", must be of type \`${validType}\` mapping parameters.`
26
+ });
27
+ if (chunkPZQ6I4JJ_cjs.isNil(params)) {
28
+ throw new TypeError(
29
+ `\u274C 'generateRoute' Failed cause in route "${route}":
30
+ - Missing parameters \`plain-object\` for route: "${route}".`
31
+ );
32
+ }
33
+ const invalidChars = [
34
+ "?",
35
+ "&",
36
+ "#",
37
+ "=",
38
+ "/",
39
+ // "`",
40
+ // " ",
41
+ // ".",
42
+ "'",
43
+ '"',
44
+ "(",
45
+ ")",
46
+ "+",
47
+ ";",
48
+ "%",
49
+ "@",
50
+ ":"
51
+ ];
52
+ const errors = [];
53
+ const requiredKeys = Array.from(route.matchAll(/\[(\w+)\]/g)).map((m) => m[1]);
54
+ for (const key of requiredKeys) {
55
+ const value = params[key];
56
+ if (!chunkPZQ6I4JJ_cjs.isString(value)) {
57
+ errors.push(
58
+ `- Invalid parameter: "${key}" must be of type \`string\`, but received: \`${chunkPZQ6I4JJ_cjs.getPreciseType(
59
+ value
60
+ )}\`.`
61
+ );
62
+ continue;
63
+ }
64
+ if (chunkE55EQK2U_cjs.isEmptyString(value)) {
65
+ errors.push(`- Parameter "${key}" cannot be empty string.`);
66
+ continue;
67
+ }
68
+ const foundInvalidChars = invalidChars.filter((char) => value.includes(char));
69
+ if (/\s/.test(value)) {
70
+ foundInvalidChars.push("white-space(s)");
71
+ }
72
+ if (foundInvalidChars.length > 0) {
73
+ const formattedChars = foundInvalidChars.map(
74
+ (c) => c === "`" ? "backtick - (`)" : `\`${c}\``
75
+ );
76
+ if (!invalidChars.includes("white-space(s)")) invalidChars.push("white-space(s)");
77
+ const formattedInvalidChars = invalidChars.map(
78
+ (c) => c === "`" ? "backtick - (`)" : `\`${c}\``
79
+ );
80
+ errors.push(
81
+ `- Parameter "${key}" contains invalid characters (${formattedChars.join(
82
+ ", "
83
+ )}). These characters are not allowed because they could cause issues in URL structure. The following characters are forbidden in route parameters: (${formattedInvalidChars.join(
84
+ ", "
85
+ )}).`
86
+ );
87
+ }
88
+ }
89
+ if (chunkPZQ6I4JJ_cjs.isNonEmptyArray(errors)) {
90
+ throw new Error(
91
+ `\u274C 'generateRoute' Failed cause in route "${route}":
92
+ ${errors.join("\n")}.`
93
+ );
94
+ }
95
+ return route.replace(/\[(\w+)\]/g, (_, key) => {
96
+ const paramKey = chunkPZQ6I4JJ_cjs.isNonEmptyString(params[key]) ? params[key] : "";
97
+ return paramKey.trim().replace(/^\/+|\/+$/g, "");
98
+ }).replace(/\/+/g, "/");
99
+ }
100
+ var createBeApiUrl = (pathname, options = {}) => {
101
+ try {
102
+ let joinPath2 = function(a, b) {
103
+ return `${a.replace(/\/+$/, "")}/${b.replace(/^\/+/, "")}`;
104
+ };
105
+ var joinPath = joinPath2;
106
+ chunkHYRQMTRH_cjs.assertIsString(chunkPZQ6I4JJ_cjs.isNil(pathname) ? "" : pathname, {
107
+ message({ currentType, validType }) {
108
+ return `First parameter (\`pathname\`) must be of type \`${validType}\`, but received: \`${currentType}\`.`;
109
+ }
110
+ });
111
+ if (!chunkPZQ6I4JJ_cjs.isPlainObject(options)) {
112
+ options = {};
113
+ }
114
+ let {
115
+ prefix = "/api",
116
+ withOrigin = true
117
+ } = options;
118
+ if (!chunkPZQ6I4JJ_cjs.isUndefined(prefix) && !chunkPZQ6I4JJ_cjs.isString(prefix)) {
119
+ throw new TypeError(
120
+ `Parameter \`prefix\` property of the \`options\` (second parameter) must be of type \`string\`, but received: \`${chunkPZQ6I4JJ_cjs.getPreciseType(
121
+ prefix
122
+ )}\`.`
123
+ );
124
+ }
125
+ chunkPZQ6I4JJ_cjs.assertIsBoolean(withOrigin, {
126
+ message: ({ currentType, validType }) => `Parameter \`withOrigin\` property of the \`options\` (second parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.`
127
+ });
128
+ pathname = chunkH66AC7GK_cjs.normalizePathname(pathname);
129
+ prefix = chunkH66AC7GK_cjs.normalizePathname(prefix);
130
+ const normalizedPrefix = prefix.endsWith("/") ? prefix : prefix + "/";
131
+ if (pathname === prefix || pathname === prefix + "/" || pathname.startsWith(normalizedPrefix)) {
132
+ pathname = pathname.slice(prefix.length);
133
+ pathname = chunkH66AC7GK_cjs.normalizePathname(pathname);
134
+ }
135
+ const baseApiUrl = getBeApiUrl({ suffix: prefix });
136
+ const fullPath = withOrigin ? joinPath2(baseApiUrl, pathname) : joinPath2(new URL(baseApiUrl).pathname, pathname);
137
+ return fullPath.replace(/\/+$/, "");
138
+ } catch (err) {
139
+ if (chunkPZQ6I4JJ_cjs.isError(err)) {
140
+ throw err;
141
+ } else
142
+ throw new Error(
143
+ "Failed to generate backend API URL in `createBeApiUrl()`, Error: " + new Error(String(err)).message.trim()
144
+ );
145
+ }
146
+ };
147
+ var getBeApiUrl = (options = {}) => {
148
+ if (!chunkPZQ6I4JJ_cjs.isPlainObject(options)) options = {};
149
+ let suffix = chunkPZQ6I4JJ_cjs.hasOwnProp(options, "suffix") ? options.suffix : "/";
150
+ chunkHYRQMTRH_cjs.assertIsString(suffix, {
151
+ message({ currentType, validType }) {
152
+ return `Parameter \`suffix\` property of the first parameter must be of type \`${validType}\`, but received: \`${currentType}\`.`;
153
+ }
154
+ });
155
+ try {
156
+ let rawBaseUrl = process.env.NEXT_PUBLIC_BACKEND_API_URL?.trim();
157
+ if (rawBaseUrl) {
158
+ rawBaseUrl = chunkKVAL5PAG_cjs.removeSpaces(rawBaseUrl);
159
+ const urlObj = new URL(rawBaseUrl);
160
+ const hasPort = !!urlObj.port;
161
+ if (!hasPort && process.env.NEXT_PUBLIC_PORT_BE) {
162
+ rawBaseUrl = urlObj.origin + chunkH66AC7GK_cjs.formatEnvPort(process.env.NEXT_PUBLIC_PORT_BE, {
163
+ prefixColon: true
164
+ });
165
+ }
166
+ } else {
167
+ rawBaseUrl = "http://localhost" + chunkH66AC7GK_cjs.formatEnvPort(process.env.NEXT_PUBLIC_PORT_BE || "8000", {
168
+ prefixColon: true
169
+ });
170
+ }
171
+ suffix = chunkKVAL5PAG_cjs.removeSpaces(suffix).length ? chunkKVAL5PAG_cjs.removeSpaces(suffix) : "/";
172
+ const baseApiUrl = new URL(rawBaseUrl.replace(/\/+$/, "")).origin;
173
+ const finalSuffix = suffix === "/" ? "/" : `${suffix.startsWith("/") ? "" : "/"}${suffix.replace(/\/+$/, "")}`;
174
+ return `${baseApiUrl}${finalSuffix}`;
175
+ } catch (error) {
176
+ throw new Error(
177
+ "Invalid `NEXT_PUBLIC_BACKEND_API_URL`, failed to generate from `getBeApiUrl()`, Error:" + error
178
+ );
179
+ }
180
+ };
181
+ var getBaseUrl = () => {
182
+ try {
183
+ const baseEnv = process.env.NEXT_PUBLIC_BASE_URL?.trim();
184
+ const portEnv = process.env.NEXT_PUBLIC_PORT_FE?.trim();
185
+ let baseUrl = baseEnv || "http://localhost";
186
+ baseUrl = chunkKVAL5PAG_cjs.removeSpaces(baseUrl).replace(/\/+$/, "");
187
+ const hasPort = /:\/\/[^/]+:\d+/.test(baseUrl);
188
+ if (!hasPort && portEnv) {
189
+ baseUrl += chunkH66AC7GK_cjs.formatEnvPort(portEnv, { prefixColon: true });
190
+ } else if (!hasPort && !baseEnv) {
191
+ baseUrl += ":3000";
192
+ }
193
+ const url = new URL(baseUrl);
194
+ return `${url.protocol}//${url.hostname}${url.port ? `:${url.port}` : ""}`;
195
+ } catch (error) {
196
+ throw new Error(
197
+ "Invalid `NEXT_PUBLIC_BASE_URL`, failed to generate from `getBaseUrl()`, Error:" + error
198
+ );
199
+ }
200
+ };
201
+
202
+ exports.createBeApiUrl = createBeApiUrl;
203
+ exports.generateRoute = generateRoute;
204
+ exports.getBaseUrl = getBaseUrl;
205
+ exports.getBeApiUrl = getBeApiUrl;
@@ -204,4 +204,4 @@ declare const getBeApiUrl:(options?:OptionsGetBeApiUrl)=>string;
204
204
  * getBaseUrl();
205
205
  * // ➔ "http://localhost:3000"
206
206
  */
207
- declare const getBaseUrl:()=>string;export{type ExtractRouteParams,type HasDynamicSegments,createBeApiUrl,generateRoute,getBaseUrl,getBeApiUrl};
207
+ declare const getBaseUrl:()=>string;export{type ExtractRouteParams,type HasDynamicSegments,createBeApiUrl,generateRoute,getBaseUrl,getBeApiUrl};