@rzl-zone/utils-js 3.4.0 → 3.5.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 (118) hide show
  1. package/LICENSE.md +1 -1
  2. package/README.md +94 -45
  3. package/dist/assertions/index.cjs +41 -1
  4. package/dist/assertions/index.d.ts +11 -2
  5. package/dist/assertions/index.js +14 -1
  6. package/dist/chunk-2CQX5CBG.js +262 -1
  7. package/dist/chunk-2IOOEY45.cjs +30 -1
  8. package/dist/chunk-2WA36TC5.cjs +189 -0
  9. package/dist/chunk-3IBQ5MOM.js +16 -1
  10. package/dist/chunk-3VA554KW.js +34 -1
  11. package/dist/chunk-5757UBXJ.cjs +157 -1
  12. package/dist/chunk-5IGC6PBH.js +33 -1
  13. package/dist/chunk-5KJFVIQT.cjs +65 -1
  14. package/dist/chunk-6JFCSH7J.js +35 -1
  15. package/dist/chunk-6JFZL7YE.cjs +24 -1
  16. package/dist/chunk-7ODAAXX5.cjs +397 -1
  17. package/dist/chunk-BAV5T2E3.cjs +15 -1
  18. package/dist/chunk-CAH33WOQ.cjs +36 -1
  19. package/dist/chunk-CDCERIZ2.js +177 -0
  20. package/dist/chunk-CKTLUNWX.js +22 -1
  21. package/dist/chunk-CMW2TBOQ.js +567 -1
  22. package/dist/chunk-D3ENH7H6.cjs +101 -1
  23. package/dist/chunk-DEZZUYE2.js +152 -1
  24. package/dist/chunk-DVMHRLKP.cjs +16 -1
  25. package/dist/chunk-DWF2R5GD.cjs +225 -1
  26. package/dist/chunk-E55EQK2U.cjs +18 -1
  27. package/dist/chunk-E74U6CYP.cjs +18 -1
  28. package/dist/chunk-EL6A35UR.cjs +64 -1
  29. package/dist/chunk-F6IPNNSJ.cjs +554 -1
  30. package/dist/chunk-FJZGG54N.cjs +267 -1
  31. package/dist/chunk-FWCKOJZM.js +542 -1
  32. package/dist/chunk-FWHNWL2P.cjs +419 -1
  33. package/dist/chunk-GGEADHZO.js +90 -1
  34. package/dist/chunk-GQR4R5WY.js +31 -1
  35. package/dist/chunk-H66AC7GK.cjs +93 -1
  36. package/dist/chunk-HQWOFR56.cjs +33 -1
  37. package/dist/chunk-HYRQMTRH.cjs +24 -1
  38. package/dist/chunk-IRFL4MAX.js +63 -1
  39. package/dist/chunk-IVL7CKVH.cjs +37 -1
  40. package/dist/chunk-IZPBKKPO.js +16 -1
  41. package/dist/chunk-JBQMXC5I.cjs +106 -1
  42. package/dist/chunk-JEQEF5WD.js +95 -1
  43. package/dist/chunk-JMJQCN74.js +370 -1
  44. package/dist/chunk-KHO2SBNA.cjs +16 -1
  45. package/dist/chunk-KVAL5PAG.cjs +26 -1
  46. package/dist/chunk-L5RDAVVH.js +14 -1
  47. package/dist/chunk-LS6U7FAY.cjs +110 -1
  48. package/dist/chunk-NBZWMBO6.js +101 -1
  49. package/dist/chunk-NRF6LWBC.cjs +56 -1
  50. package/dist/chunk-OI5XKNZO.js +53 -1
  51. package/dist/chunk-ONZFBJVW.js +14 -1
  52. package/dist/chunk-OYTYSY7G.js +106 -1
  53. package/dist/chunk-PET42Z7W.js +119 -1
  54. package/dist/chunk-PZQ6I4JJ.cjs +605 -1
  55. package/dist/chunk-QBKAEVYG.js +113 -1
  56. package/dist/chunk-QNKGP5DY.js +14 -1
  57. package/dist/chunk-RIPKY4RU.js +417 -1
  58. package/dist/chunk-RZW35UN5.cjs +116 -1
  59. package/dist/chunk-SBFNXGTJ.js +220 -1
  60. package/dist/chunk-SBKGWRS5.js +22 -1
  61. package/dist/chunk-SIM77PU4.js +59 -1
  62. package/dist/chunk-T2T7K3KR.js +28 -1
  63. package/dist/chunk-T7PU2V7X.cjs +123 -1
  64. package/dist/chunk-UDA26MCU.cjs +16 -1
  65. package/dist/chunk-V45XJKHW.cjs +18 -1
  66. package/dist/chunk-VJDDGRIK.cjs +16 -1
  67. package/dist/chunk-W2WNBUDE.js +16 -1
  68. package/dist/chunk-WVSPXFTY.js +14 -1
  69. package/dist/chunk-XABCB3Y7.cjs +582 -1
  70. package/dist/chunk-XEDXFSGI.js +24 -1
  71. package/dist/chunk-YKPSRP5G.js +571 -1
  72. package/dist/chunk-YWHHVDT4.js +13 -1
  73. package/dist/chunk-ZETAZZLD.cjs +38 -1
  74. package/dist/conversions/index.cjs +104 -1
  75. package/dist/conversions/index.d.ts +10 -1
  76. package/dist/conversions/index.js +25 -1
  77. package/dist/events/index.cjs +32 -1
  78. package/dist/events/index.d.ts +10 -1
  79. package/dist/events/index.js +13 -1
  80. package/dist/formatters/index.cjs +62 -1
  81. package/dist/formatters/index.d.ts +10 -1
  82. package/dist/formatters/index.js +19 -1
  83. package/dist/generators/index.cjs +38 -1
  84. package/dist/generators/index.d.ts +10 -1
  85. package/dist/generators/index.js +15 -1
  86. package/dist/index.d.ts +39 -12
  87. package/dist/{isPlainObject-CEPWPiXh.d.ts → isPlainObject-FWmcJF6k.d.ts} +13 -4
  88. package/dist/next/index.cjs +218 -1
  89. package/dist/next/index.d.ts +10 -1
  90. package/dist/next/index.js +213 -1
  91. package/dist/next/server/index.cjs +43 -1
  92. package/dist/next/server/index.d.ts +10 -1
  93. package/dist/next/server/index.js +41 -1
  94. package/dist/operations/index.cjs +33 -1
  95. package/dist/operations/index.d.ts +10 -1
  96. package/dist/operations/index.js +18 -1
  97. package/dist/parsers/index.cjs +18 -1
  98. package/dist/parsers/index.d.ts +10 -1
  99. package/dist/parsers/index.js +11 -1
  100. package/dist/predicates/index.cjs +299 -1
  101. package/dist/predicates/index.d.ts +13 -4
  102. package/dist/predicates/index.js +24 -1
  103. package/dist/promises/index.cjs +25 -1
  104. package/dist/promises/index.d.ts +10 -1
  105. package/dist/promises/index.js +14 -1
  106. package/dist/rzl-utils.global.js +25 -1
  107. package/dist/strings/index.cjs +82 -1
  108. package/dist/strings/index.d.ts +10 -1
  109. package/dist/strings/index.js +15 -1
  110. package/dist/tailwind/index.cjs +43 -1
  111. package/dist/tailwind/index.d.ts +10 -1
  112. package/dist/tailwind/index.js +12 -1
  113. package/dist/urls/index.cjs +51 -1
  114. package/dist/urls/index.d.ts +10 -1
  115. package/dist/urls/index.js +24 -1
  116. package/package.json +60 -179
  117. package/dist/chunk-JYQTCICM.js +0 -1
  118. package/dist/chunk-YLA3DURS.cjs +0 -1
@@ -1 +1,218 @@
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
+ /*!
2
+ * ====================================================
3
+ * Rzl Utils-JS.
4
+ * ----------------------------------------------------
5
+ * Version: 3.5.1.
6
+ * Author: Rizalvin Dwiky.
7
+ * Repository: https://github.com/rzl-zone/utils-js.
8
+ * ====================================================
9
+ */
10
+ 'use strict';
11
+
12
+ var chunkH66AC7GK_cjs = require('../chunk-H66AC7GK.cjs');
13
+ var chunkKVAL5PAG_cjs = require('../chunk-KVAL5PAG.cjs');
14
+ var chunkE55EQK2U_cjs = require('../chunk-E55EQK2U.cjs');
15
+ var chunkHYRQMTRH_cjs = require('../chunk-HYRQMTRH.cjs');
16
+ var chunkT7PU2V7X_cjs = require('../chunk-T7PU2V7X.cjs');
17
+ require('../chunk-UDA26MCU.cjs');
18
+ var chunkPZQ6I4JJ_cjs = require('../chunk-PZQ6I4JJ.cjs');
19
+
20
+ function generateRoute(route, params) {
21
+ if (!chunkPZQ6I4JJ_cjs.isString(route) || chunkE55EQK2U_cjs.isEmptyString(route)) {
22
+ throw new TypeError(
23
+ `\u274C 'generateRoute' Failed:
24
+ - Invalid 'route' value.
25
+ - Must be of type \`string\` and non-empty string, but received: "${chunkPZQ6I4JJ_cjs.getPreciseType(
26
+ route
27
+ )}": \`${chunkT7PU2V7X_cjs.safeStableStringify(route)}\`.`
28
+ );
29
+ }
30
+ if (!/[\\[\]]/.test(route)) {
31
+ return route;
32
+ }
33
+ chunkPZQ6I4JJ_cjs.assertIsPlainObject(params, {
34
+ message: ({ validType }) => `\u274C 'generateRoute' Failed cause in route "${route}":
35
+ - Missing or invalid parameters \`${validType}\` for route: "${route}", must be of type \`${validType}\` mapping parameters.`
36
+ });
37
+ if (chunkPZQ6I4JJ_cjs.isNil(params)) {
38
+ throw new TypeError(
39
+ `\u274C 'generateRoute' Failed cause in route "${route}":
40
+ - Missing parameters \`plain-object\` for route: "${route}".`
41
+ );
42
+ }
43
+ const invalidChars = [
44
+ "?",
45
+ "&",
46
+ "#",
47
+ "=",
48
+ "/",
49
+ // "`",
50
+ // " ",
51
+ // ".",
52
+ "'",
53
+ '"',
54
+ "(",
55
+ ")",
56
+ "+",
57
+ ";",
58
+ "%",
59
+ "@",
60
+ ":"
61
+ ];
62
+ const errors = [];
63
+ const requiredKeys = Array.from(route.matchAll(/\[(\w+)\]/g)).map((m) => m[1]);
64
+ for (const key of requiredKeys) {
65
+ const value = params[key];
66
+ if (!chunkPZQ6I4JJ_cjs.isString(value)) {
67
+ errors.push(
68
+ `- Invalid parameter: "${key}" must be of type \`string\`, but received: \`${chunkPZQ6I4JJ_cjs.getPreciseType(
69
+ value
70
+ )}\`.`
71
+ );
72
+ continue;
73
+ }
74
+ if (chunkE55EQK2U_cjs.isEmptyString(value)) {
75
+ errors.push(`- Parameter "${key}" cannot be empty string.`);
76
+ continue;
77
+ }
78
+ const foundInvalidChars = invalidChars.filter((char) => value.includes(char));
79
+ if (/\s/.test(value)) {
80
+ foundInvalidChars.push("white-space(s)");
81
+ }
82
+ if (foundInvalidChars.length > 0) {
83
+ const formattedChars = foundInvalidChars.map(
84
+ (c) => c === "`" ? "backtick - (`)" : `\`${c}\``
85
+ );
86
+ if (!invalidChars.includes("white-space(s)")) invalidChars.push("white-space(s)");
87
+ const formattedInvalidChars = invalidChars.map(
88
+ (c) => c === "`" ? "backtick - (`)" : `\`${c}\``
89
+ );
90
+ errors.push(
91
+ `- Parameter "${key}" contains invalid characters (${formattedChars.join(
92
+ ", "
93
+ )}). These characters are not allowed because they could cause issues in URL structure. The following characters are forbidden in route parameters: (${formattedInvalidChars.join(
94
+ ", "
95
+ )}).`
96
+ );
97
+ }
98
+ }
99
+ if (chunkPZQ6I4JJ_cjs.isNonEmptyArray(errors)) {
100
+ throw new Error(
101
+ `\u274C 'generateRoute' Failed cause in route "${route}":
102
+ ${errors.join("\n")}.`
103
+ );
104
+ }
105
+ return route.replace(/\[(\w+)\]/g, (_, key) => {
106
+ const paramKey = chunkPZQ6I4JJ_cjs.isNonEmptyString(params[key]) ? params[key] : "";
107
+ return paramKey.trim().replace(/^\/+|\/+$/g, "");
108
+ }).replace(/\/+/g, "/");
109
+ }
110
+
111
+ var createBeApiUrl = (pathname, options = {}) => {
112
+ try {
113
+ let joinPath2 = function(a, b) {
114
+ return `${a.replace(/\/+$/, "")}/${b.replace(/^\/+/, "")}`;
115
+ };
116
+ var joinPath = joinPath2;
117
+ chunkHYRQMTRH_cjs.assertIsString(chunkPZQ6I4JJ_cjs.isNil(pathname) ? "" : pathname, {
118
+ message({ currentType, validType }) {
119
+ return `First parameter (\`pathname\`) must be of type \`${validType}\`, but received: \`${currentType}\`.`;
120
+ }
121
+ });
122
+ if (!chunkPZQ6I4JJ_cjs.isPlainObject(options)) {
123
+ options = {};
124
+ }
125
+ let {
126
+ prefix = "/api",
127
+ withOrigin = true
128
+ } = options;
129
+ if (!chunkPZQ6I4JJ_cjs.isUndefined(prefix) && !chunkPZQ6I4JJ_cjs.isString(prefix)) {
130
+ throw new TypeError(
131
+ `Parameter \`prefix\` property of the \`options\` (second parameter) must be of type \`string\`, but received: \`${chunkPZQ6I4JJ_cjs.getPreciseType(
132
+ prefix
133
+ )}\`.`
134
+ );
135
+ }
136
+ chunkPZQ6I4JJ_cjs.assertIsBoolean(withOrigin, {
137
+ message: ({ currentType, validType }) => `Parameter \`withOrigin\` property of the \`options\` (second parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.`
138
+ });
139
+ pathname = chunkH66AC7GK_cjs.normalizePathname(pathname);
140
+ prefix = chunkH66AC7GK_cjs.normalizePathname(prefix);
141
+ const normalizedPrefix = prefix.endsWith("/") ? prefix : prefix + "/";
142
+ if (pathname === prefix || pathname === prefix + "/" || pathname.startsWith(normalizedPrefix)) {
143
+ pathname = pathname.slice(prefix.length);
144
+ pathname = chunkH66AC7GK_cjs.normalizePathname(pathname);
145
+ }
146
+ const baseApiUrl = getBeApiUrl({ suffix: prefix });
147
+ const fullPath = withOrigin ? joinPath2(baseApiUrl, pathname) : joinPath2(new URL(baseApiUrl).pathname, pathname);
148
+ return fullPath.replace(/\/+$/, "");
149
+ } catch (err) {
150
+ if (chunkPZQ6I4JJ_cjs.isError(err)) {
151
+ throw err;
152
+ } else
153
+ throw new Error(
154
+ "Failed to generate backend API URL in `createBeApiUrl()`, Error: " + new Error(String(err)).message.trim()
155
+ );
156
+ }
157
+ };
158
+
159
+ var getBeApiUrl = (options = {}) => {
160
+ if (!chunkPZQ6I4JJ_cjs.isPlainObject(options)) options = {};
161
+ let suffix = chunkPZQ6I4JJ_cjs.hasOwnProp(options, "suffix") ? options.suffix : "/";
162
+ chunkHYRQMTRH_cjs.assertIsString(suffix, {
163
+ message({ currentType, validType }) {
164
+ return `Parameter \`suffix\` property of the first parameter must be of type \`${validType}\`, but received: \`${currentType}\`.`;
165
+ }
166
+ });
167
+ try {
168
+ let rawBaseUrl = process.env.NEXT_PUBLIC_BACKEND_API_URL?.trim();
169
+ if (rawBaseUrl) {
170
+ rawBaseUrl = chunkKVAL5PAG_cjs.removeSpaces(rawBaseUrl);
171
+ const urlObj = new URL(rawBaseUrl);
172
+ const hasPort = !!urlObj.port;
173
+ if (!hasPort && process.env.NEXT_PUBLIC_PORT_BE) {
174
+ rawBaseUrl = urlObj.origin + chunkH66AC7GK_cjs.formatEnvPort(process.env.NEXT_PUBLIC_PORT_BE, {
175
+ prefixColon: true
176
+ });
177
+ }
178
+ } else {
179
+ rawBaseUrl = "http://localhost" + chunkH66AC7GK_cjs.formatEnvPort(process.env.NEXT_PUBLIC_PORT_BE || "8000", {
180
+ prefixColon: true
181
+ });
182
+ }
183
+ suffix = chunkKVAL5PAG_cjs.removeSpaces(suffix).length ? chunkKVAL5PAG_cjs.removeSpaces(suffix) : "/";
184
+ const baseApiUrl = new URL(rawBaseUrl.replace(/\/+$/, "")).origin;
185
+ const finalSuffix = suffix === "/" ? "/" : `${suffix.startsWith("/") ? "" : "/"}${suffix.replace(/\/+$/, "")}`;
186
+ return `${baseApiUrl}${finalSuffix}`;
187
+ } catch (error) {
188
+ throw new Error(
189
+ "Invalid `NEXT_PUBLIC_BACKEND_API_URL`, failed to generate from `getBeApiUrl()`, Error:" + error
190
+ );
191
+ }
192
+ };
193
+
194
+ var getBaseUrl = () => {
195
+ try {
196
+ const baseEnv = process.env.NEXT_PUBLIC_BASE_URL?.trim();
197
+ const portEnv = process.env.NEXT_PUBLIC_PORT_FE?.trim();
198
+ let baseUrl = baseEnv || "http://localhost";
199
+ baseUrl = chunkKVAL5PAG_cjs.removeSpaces(baseUrl).replace(/\/+$/, "");
200
+ const hasPort = /:\/\/[^/]+:\d+/.test(baseUrl);
201
+ if (!hasPort && portEnv) {
202
+ baseUrl += chunkH66AC7GK_cjs.formatEnvPort(portEnv, { prefixColon: true });
203
+ } else if (!hasPort && !baseEnv) {
204
+ baseUrl += ":3000";
205
+ }
206
+ const url = new URL(baseUrl);
207
+ return `${url.protocol}//${url.hostname}${url.port ? `:${url.port}` : ""}`;
208
+ } catch (error) {
209
+ throw new Error(
210
+ "Invalid `NEXT_PUBLIC_BASE_URL`, failed to generate from `getBaseUrl()`, Error:" + error
211
+ );
212
+ }
213
+ };
214
+
215
+ exports.createBeApiUrl = createBeApiUrl;
216
+ exports.generateRoute = generateRoute;
217
+ exports.getBaseUrl = getBaseUrl;
218
+ exports.getBeApiUrl = getBeApiUrl;
@@ -1,3 +1,12 @@
1
+ /*!
2
+ * ====================================================
3
+ * Rzl Utils-JS.
4
+ * ----------------------------------------------------
5
+ * Version: 3.5.1.
6
+ * Author: Rizalvin Dwiky.
7
+ * Repository: https://github.com/rzl-zone/utils-js.
8
+ * ====================================================
9
+ */
1
10
  import{IsAny}from'@rzl-zone/ts-types-plus';
2
11
  /** ---------------------------------------------------------
3
12
  * * ***Extracts dynamic route parameters from a given route string.***
@@ -204,4 +213,4 @@ declare const getBeApiUrl:(options?:OptionsGetBeApiUrl)=>string;
204
213
  * getBaseUrl();
205
214
  * // ➔ "http://localhost:3000"
206
215
  */
207
- declare const getBaseUrl:()=>string;export{type ExtractRouteParams,type HasDynamicSegments,createBeApiUrl,generateRoute,getBaseUrl,getBeApiUrl};
216
+ declare const getBaseUrl:()=>string;export{type ExtractRouteParams,type HasDynamicSegments,createBeApiUrl,generateRoute,getBaseUrl,getBeApiUrl};
@@ -1 +1,213 @@
1
- import{normalizePathname as e,formatEnvPort as r}from"../chunk-GGEADHZO.js";import{removeSpaces as t}from"../chunk-XEDXFSGI.js";import{isEmptyString as o}from"../chunk-W2WNBUDE.js";import{assertIsString as n}from"../chunk-SBKGWRS5.js";import{safeStableStringify as s}from"../chunk-PET42Z7W.js";import"../chunk-QNKGP5DY.js";import{isString as a,getPreciseType as i,assertIsPlainObject as p,isNil as c,isNonEmptyArray as u,isNonEmptyString as l,isPlainObject as m,isUndefined as f,assertIsBoolean as h,isError as $,hasOwnProp as d}from"../chunk-CMW2TBOQ.js";function g(e,r){if(!a(e)||o(e))throw new TypeError(`❌ 'generateRoute' Failed:\n- Invalid 'route' value.\n- Must be of type \`string\` and non-empty string, but received: "${i(e)}": \`${s(e)}\`.`);if(!/[\\[\]]/.test(e))return e;if(p(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.`}),c(r))throw new TypeError(`❌ 'generateRoute' Failed cause in route "${e}":\n- Missing parameters \`plain-object\` for route: "${e}".`);const t=["?","&","#","=","/","'",'"',"(",")","+",";","%","@",":"],n=[],m=Array.from(e.matchAll(/\[(\w+)\]/g)).map(e=>e[1]);for(const e of m){const s=r[e];if(!a(s)){n.push(`- Invalid parameter: "${e}" must be of type \`string\`, but received: \`${i(s)}\`.`);continue}if(o(s)){n.push(`- Parameter "${e}" cannot be empty string.`);continue}const p=t.filter(e=>s.includes(e));if(/\s/.test(s)&&p.push("white-space(s)"),p.length>0){const r=p.map(e=>"`"===e?"backtick - (`)":`\`${e}\``);t.includes("white-space(s)")||t.push("white-space(s)");const o=t.map(e=>"`"===e?"backtick - (`)":`\`${e}\``);n.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: (${o.join(", ")}).`)}}if(u(n))throw new Error(`❌ 'generateRoute' Failed cause in route "${e}":\n${n.join("\n")}.`);return e.replace(/\[(\w+)\]/g,(e,t)=>(l(r[t])?r[t]:"").trim().replace(/^\/+|\/+$/g,"")).replace(/\/+/g,"/")}var E=(r,t={})=>{try{let o=function(e,r){return`${e.replace(/\/+$/,"")}/${r.replace(/^\/+/,"")}`};n(c(r)?"":r,{message:({currentType:e,validType:r})=>`First parameter (\`pathname\`) must be of type \`${r}\`, but received: \`${e}\`.`}),m(t)||(t={});let{prefix:s="/api",withOrigin:p=!0}=t;if(!f(s)&&!a(s))throw new TypeError(`Parameter \`prefix\` property of the \`options\` (second parameter) must be of type \`string\`, but received: \`${i(s)}\`.`);h(p,{message:({currentType:e,validType:r})=>`Parameter \`withOrigin\` property of the \`options\` (second parameter) must be of type \`${r}\`, but received: \`${e}\`.`}),r=e(r),s=e(s);const u=s.endsWith("/")?s:s+"/";(r===s||r===s+"/"||r.startsWith(u))&&(r=r.slice(s.length),r=e(r));const l=w({suffix:s});return o(p?l:new URL(l).pathname,r).replace(/\/+$/,"")}catch(e){throw $(e)?e:new Error("Failed to generate backend API URL in `createBeApiUrl()`, Error: "+new Error(String(e)).message.trim())}},w=(e={})=>{m(e)||(e={});let o=d(e,"suffix")?e.suffix:"/";n(o,{message:({currentType:e,validType:r})=>`Parameter \`suffix\` property of the first parameter must be of type \`${r}\`, but received: \`${e}\`.`});try{let e=process.env.NEXT_PUBLIC_BACKEND_API_URL?.trim();if(e){e=t(e);const o=new URL(e);!!!o.port&&process.env.NEXT_PUBLIC_PORT_BE&&(e=o.origin+r(process.env.NEXT_PUBLIC_PORT_BE,{prefixColon:!0}))}else e="http://localhost"+r(process.env.NEXT_PUBLIC_PORT_BE||"8000",{prefixColon:!0});o=t(o).length?t(o):"/";const n=new URL(e.replace(/\/+$/,"")).origin;return`${n}${"/"===o?"/":`${o.startsWith("/")?"":"/"}${o.replace(/\/+$/,"")}`}`}catch(e){throw new Error("Invalid `NEXT_PUBLIC_BACKEND_API_URL`, failed to generate from `getBeApiUrl()`, Error:"+e)}},y=()=>{try{const e=process.env.NEXT_PUBLIC_BASE_URL?.trim(),o=process.env.NEXT_PUBLIC_PORT_FE?.trim();let n=e||"http://localhost";n=t(n).replace(/\/+$/,"");const s=/:\/\/[^/]+:\d+/.test(n);!s&&o?n+=r(o,{prefixColon:!0}):s||e||(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)}};export{E as createBeApiUrl,g as generateRoute,y as getBaseUrl,w as getBeApiUrl};
1
+ /*!
2
+ * ====================================================
3
+ * Rzl Utils-JS.
4
+ * ----------------------------------------------------
5
+ * Version: 3.5.1.
6
+ * Author: Rizalvin Dwiky.
7
+ * Repository: https://github.com/rzl-zone/utils-js.
8
+ * ====================================================
9
+ */
10
+ import { normalizePathname, formatEnvPort } from '../chunk-GGEADHZO.js';
11
+ import { removeSpaces } from '../chunk-XEDXFSGI.js';
12
+ import { isEmptyString } from '../chunk-W2WNBUDE.js';
13
+ import { assertIsString } from '../chunk-SBKGWRS5.js';
14
+ import { safeStableStringify } from '../chunk-PET42Z7W.js';
15
+ import '../chunk-QNKGP5DY.js';
16
+ import { isString, getPreciseType, assertIsPlainObject, isNil, isNonEmptyArray, isNonEmptyString, isPlainObject, isUndefined, assertIsBoolean, isError, hasOwnProp } from '../chunk-CMW2TBOQ.js';
17
+
18
+ function generateRoute(route, params) {
19
+ if (!isString(route) || isEmptyString(route)) {
20
+ throw new TypeError(
21
+ `\u274C 'generateRoute' Failed:
22
+ - Invalid 'route' value.
23
+ - Must be of type \`string\` and non-empty string, but received: "${getPreciseType(
24
+ route
25
+ )}": \`${safeStableStringify(route)}\`.`
26
+ );
27
+ }
28
+ if (!/[\\[\]]/.test(route)) {
29
+ return route;
30
+ }
31
+ assertIsPlainObject(params, {
32
+ message: ({ validType }) => `\u274C 'generateRoute' Failed cause in route "${route}":
33
+ - Missing or invalid parameters \`${validType}\` for route: "${route}", must be of type \`${validType}\` mapping parameters.`
34
+ });
35
+ if (isNil(params)) {
36
+ throw new TypeError(
37
+ `\u274C 'generateRoute' Failed cause in route "${route}":
38
+ - Missing parameters \`plain-object\` for route: "${route}".`
39
+ );
40
+ }
41
+ const invalidChars = [
42
+ "?",
43
+ "&",
44
+ "#",
45
+ "=",
46
+ "/",
47
+ // "`",
48
+ // " ",
49
+ // ".",
50
+ "'",
51
+ '"',
52
+ "(",
53
+ ")",
54
+ "+",
55
+ ";",
56
+ "%",
57
+ "@",
58
+ ":"
59
+ ];
60
+ const errors = [];
61
+ const requiredKeys = Array.from(route.matchAll(/\[(\w+)\]/g)).map((m) => m[1]);
62
+ for (const key of requiredKeys) {
63
+ const value = params[key];
64
+ if (!isString(value)) {
65
+ errors.push(
66
+ `- Invalid parameter: "${key}" must be of type \`string\`, but received: \`${getPreciseType(
67
+ value
68
+ )}\`.`
69
+ );
70
+ continue;
71
+ }
72
+ if (isEmptyString(value)) {
73
+ errors.push(`- Parameter "${key}" cannot be empty string.`);
74
+ continue;
75
+ }
76
+ const foundInvalidChars = invalidChars.filter((char) => value.includes(char));
77
+ if (/\s/.test(value)) {
78
+ foundInvalidChars.push("white-space(s)");
79
+ }
80
+ if (foundInvalidChars.length > 0) {
81
+ const formattedChars = foundInvalidChars.map(
82
+ (c) => c === "`" ? "backtick - (`)" : `\`${c}\``
83
+ );
84
+ if (!invalidChars.includes("white-space(s)")) invalidChars.push("white-space(s)");
85
+ const formattedInvalidChars = invalidChars.map(
86
+ (c) => c === "`" ? "backtick - (`)" : `\`${c}\``
87
+ );
88
+ errors.push(
89
+ `- Parameter "${key}" contains invalid characters (${formattedChars.join(
90
+ ", "
91
+ )}). These characters are not allowed because they could cause issues in URL structure. The following characters are forbidden in route parameters: (${formattedInvalidChars.join(
92
+ ", "
93
+ )}).`
94
+ );
95
+ }
96
+ }
97
+ if (isNonEmptyArray(errors)) {
98
+ throw new Error(
99
+ `\u274C 'generateRoute' Failed cause in route "${route}":
100
+ ${errors.join("\n")}.`
101
+ );
102
+ }
103
+ return route.replace(/\[(\w+)\]/g, (_, key) => {
104
+ const paramKey = isNonEmptyString(params[key]) ? params[key] : "";
105
+ return paramKey.trim().replace(/^\/+|\/+$/g, "");
106
+ }).replace(/\/+/g, "/");
107
+ }
108
+
109
+ var createBeApiUrl = (pathname, options = {}) => {
110
+ try {
111
+ let joinPath2 = function(a, b) {
112
+ return `${a.replace(/\/+$/, "")}/${b.replace(/^\/+/, "")}`;
113
+ };
114
+ var joinPath = joinPath2;
115
+ assertIsString(isNil(pathname) ? "" : pathname, {
116
+ message({ currentType, validType }) {
117
+ return `First parameter (\`pathname\`) must be of type \`${validType}\`, but received: \`${currentType}\`.`;
118
+ }
119
+ });
120
+ if (!isPlainObject(options)) {
121
+ options = {};
122
+ }
123
+ let {
124
+ prefix = "/api",
125
+ withOrigin = true
126
+ } = options;
127
+ if (!isUndefined(prefix) && !isString(prefix)) {
128
+ throw new TypeError(
129
+ `Parameter \`prefix\` property of the \`options\` (second parameter) must be of type \`string\`, but received: \`${getPreciseType(
130
+ prefix
131
+ )}\`.`
132
+ );
133
+ }
134
+ assertIsBoolean(withOrigin, {
135
+ message: ({ currentType, validType }) => `Parameter \`withOrigin\` property of the \`options\` (second parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.`
136
+ });
137
+ pathname = normalizePathname(pathname);
138
+ prefix = normalizePathname(prefix);
139
+ const normalizedPrefix = prefix.endsWith("/") ? prefix : prefix + "/";
140
+ if (pathname === prefix || pathname === prefix + "/" || pathname.startsWith(normalizedPrefix)) {
141
+ pathname = pathname.slice(prefix.length);
142
+ pathname = normalizePathname(pathname);
143
+ }
144
+ const baseApiUrl = getBeApiUrl({ suffix: prefix });
145
+ const fullPath = withOrigin ? joinPath2(baseApiUrl, pathname) : joinPath2(new URL(baseApiUrl).pathname, pathname);
146
+ return fullPath.replace(/\/+$/, "");
147
+ } catch (err) {
148
+ if (isError(err)) {
149
+ throw err;
150
+ } else
151
+ throw new Error(
152
+ "Failed to generate backend API URL in `createBeApiUrl()`, Error: " + new Error(String(err)).message.trim()
153
+ );
154
+ }
155
+ };
156
+
157
+ var getBeApiUrl = (options = {}) => {
158
+ if (!isPlainObject(options)) options = {};
159
+ let suffix = hasOwnProp(options, "suffix") ? options.suffix : "/";
160
+ assertIsString(suffix, {
161
+ message({ currentType, validType }) {
162
+ return `Parameter \`suffix\` property of the first parameter must be of type \`${validType}\`, but received: \`${currentType}\`.`;
163
+ }
164
+ });
165
+ try {
166
+ let rawBaseUrl = process.env.NEXT_PUBLIC_BACKEND_API_URL?.trim();
167
+ if (rawBaseUrl) {
168
+ rawBaseUrl = removeSpaces(rawBaseUrl);
169
+ const urlObj = new URL(rawBaseUrl);
170
+ const hasPort = !!urlObj.port;
171
+ if (!hasPort && process.env.NEXT_PUBLIC_PORT_BE) {
172
+ rawBaseUrl = urlObj.origin + formatEnvPort(process.env.NEXT_PUBLIC_PORT_BE, {
173
+ prefixColon: true
174
+ });
175
+ }
176
+ } else {
177
+ rawBaseUrl = "http://localhost" + formatEnvPort(process.env.NEXT_PUBLIC_PORT_BE || "8000", {
178
+ prefixColon: true
179
+ });
180
+ }
181
+ suffix = removeSpaces(suffix).length ? removeSpaces(suffix) : "/";
182
+ const baseApiUrl = new URL(rawBaseUrl.replace(/\/+$/, "")).origin;
183
+ const finalSuffix = suffix === "/" ? "/" : `${suffix.startsWith("/") ? "" : "/"}${suffix.replace(/\/+$/, "")}`;
184
+ return `${baseApiUrl}${finalSuffix}`;
185
+ } catch (error) {
186
+ throw new Error(
187
+ "Invalid `NEXT_PUBLIC_BACKEND_API_URL`, failed to generate from `getBeApiUrl()`, Error:" + error
188
+ );
189
+ }
190
+ };
191
+
192
+ var getBaseUrl = () => {
193
+ try {
194
+ const baseEnv = process.env.NEXT_PUBLIC_BASE_URL?.trim();
195
+ const portEnv = process.env.NEXT_PUBLIC_PORT_FE?.trim();
196
+ let baseUrl = baseEnv || "http://localhost";
197
+ baseUrl = removeSpaces(baseUrl).replace(/\/+$/, "");
198
+ const hasPort = /:\/\/[^/]+:\d+/.test(baseUrl);
199
+ if (!hasPort && portEnv) {
200
+ baseUrl += formatEnvPort(portEnv, { prefixColon: true });
201
+ } else if (!hasPort && !baseEnv) {
202
+ baseUrl += ":3000";
203
+ }
204
+ const url = new URL(baseUrl);
205
+ return `${url.protocol}//${url.hostname}${url.port ? `:${url.port}` : ""}`;
206
+ } catch (error) {
207
+ throw new Error(
208
+ "Invalid `NEXT_PUBLIC_BASE_URL`, failed to generate from `getBaseUrl()`, Error:" + error
209
+ );
210
+ }
211
+ };
212
+
213
+ export { createBeApiUrl, generateRoute, getBaseUrl, getBeApiUrl };
@@ -1 +1,43 @@
1
- "use strict";var e=require("../../chunk-PZQ6I4JJ.cjs");require("server-only");var r=require("next/server");exports.getClientIpOrUrl=(t,n=!0)=>{if(!e.isFunction(r.NextRequest))throw new Error("Function `getClientIpOrUrl` is designed to be used in a `NextJS` environment.");if(!(t instanceof r.NextRequest))throw new TypeError("First parameter (`request`) must be an `instance of NextRequest` from `NextJS`.");e.assertIsBoolean(n,{message:({currentType:e,validType:r})=>`Second parameter (\`includeFullUrl\`) must be of type \`${r}\`, but received: \`${e}\`.`});const s=(t.headers.get("x-forwarded-for")??"127.0.0.1").trim().split(",");"::ffff:127.0.0.1"!==s[0]&&"::1"!==s[0]||(s[0]="127.0.0.1");const o=s.length>1?s[s.length-1].trim():s[0];if(!n)return o;const i=t.headers.get("x-forwarded-proto")||"http",u=t.headers.get("x-forwarded-port")||"3000";return`${"production"===process.env.NODE_ENV?i:"http"}://${o}:${u}`};
1
+ /*!
2
+ * ====================================================
3
+ * Rzl Utils-JS.
4
+ * ----------------------------------------------------
5
+ * Version: 3.5.1.
6
+ * Author: Rizalvin Dwiky.
7
+ * Repository: https://github.com/rzl-zone/utils-js.
8
+ * ====================================================
9
+ */
10
+ 'use strict';
11
+
12
+ var chunkPZQ6I4JJ_cjs = require('../../chunk-PZQ6I4JJ.cjs');
13
+ require('server-only');
14
+ var server = require('next/server');
15
+
16
+ var getClientIpOrUrl = (request, includeFullUrl = true) => {
17
+ if (!chunkPZQ6I4JJ_cjs.isFunction(server.NextRequest)) {
18
+ throw new Error(
19
+ "Function `getClientIpOrUrl` is designed to be used in a `NextJS` environment."
20
+ );
21
+ }
22
+ if (!(request instanceof server.NextRequest)) {
23
+ throw new TypeError(
24
+ "First parameter (`request`) must be an `instance of NextRequest` from `NextJS`."
25
+ );
26
+ }
27
+ chunkPZQ6I4JJ_cjs.assertIsBoolean(includeFullUrl, {
28
+ message: ({ currentType, validType }) => `Second parameter (\`includeFullUrl\`) must be of type \`${validType}\`, but received: \`${currentType}\`.`
29
+ });
30
+ const forwardedIps = (request.headers.get("x-forwarded-for") ?? "127.0.0.1").trim().split(",");
31
+ if (forwardedIps[0] === "::ffff:127.0.0.1" || forwardedIps[0] === "::1") {
32
+ forwardedIps[0] = "127.0.0.1";
33
+ }
34
+ const clientIp = forwardedIps.length > 1 ? forwardedIps[forwardedIps.length - 1].trim() : forwardedIps[0];
35
+ if (!includeFullUrl) {
36
+ return clientIp;
37
+ }
38
+ const protocol = request.headers.get("x-forwarded-proto") || "http";
39
+ const port = request.headers.get("x-forwarded-port") || "3000";
40
+ return `${process.env.NODE_ENV === "production" ? protocol : "http"}://${clientIp}:${port}`;
41
+ };
42
+
43
+ exports.getClientIpOrUrl = getClientIpOrUrl;
@@ -1,3 +1,12 @@
1
+ /*!
2
+ * ====================================================
3
+ * Rzl Utils-JS.
4
+ * ----------------------------------------------------
5
+ * Version: 3.5.1.
6
+ * Author: Rizalvin Dwiky.
7
+ * Repository: https://github.com/rzl-zone/utils-js.
8
+ * ====================================================
9
+ */
1
10
  import{NextRequest}from'next/server';
2
11
  /** ---------------------------------
3
12
  * * ***Utility for NextJS Server: `getClientIpOrUrl`.***
@@ -25,4 +34,4 @@ import{NextRequest}from'next/server';
25
34
  * const url = getClientIpOrUrl(request);
26
35
  * console.log("Client full URL:", url);
27
36
  */
28
- declare const getClientIpOrUrl:(request:NextRequest,includeFullUrl?:boolean)=>string;export{getClientIpOrUrl};
37
+ declare const getClientIpOrUrl:(request:NextRequest,includeFullUrl?:boolean)=>string;export{getClientIpOrUrl};
@@ -1 +1,41 @@
1
- import{isFunction as e,assertIsBoolean as r}from"../../chunk-CMW2TBOQ.js";import"server-only";import{NextRequest as t}from"next/server";var o=(o,n=!0)=>{if(!e(t))throw new Error("Function `getClientIpOrUrl` is designed to be used in a `NextJS` environment.");if(!(o instanceof t))throw new TypeError("First parameter (`request`) must be an `instance of NextRequest` from `NextJS`.");r(n,{message:({currentType:e,validType:r})=>`Second parameter (\`includeFullUrl\`) must be of type \`${r}\`, but received: \`${e}\`.`});const s=(o.headers.get("x-forwarded-for")??"127.0.0.1").trim().split(",");"::ffff:127.0.0.1"!==s[0]&&"::1"!==s[0]||(s[0]="127.0.0.1");const i=s.length>1?s[s.length-1].trim():s[0];if(!n)return i;const p=o.headers.get("x-forwarded-proto")||"http",a=o.headers.get("x-forwarded-port")||"3000";return`${"production"===process.env.NODE_ENV?p:"http"}://${i}:${a}`};export{o as getClientIpOrUrl};
1
+ /*!
2
+ * ====================================================
3
+ * Rzl Utils-JS.
4
+ * ----------------------------------------------------
5
+ * Version: 3.5.1.
6
+ * Author: Rizalvin Dwiky.
7
+ * Repository: https://github.com/rzl-zone/utils-js.
8
+ * ====================================================
9
+ */
10
+ import { isFunction, assertIsBoolean } from '../../chunk-CMW2TBOQ.js';
11
+ import 'server-only';
12
+ import { NextRequest } from 'next/server';
13
+
14
+ var getClientIpOrUrl = (request, includeFullUrl = true) => {
15
+ if (!isFunction(NextRequest)) {
16
+ throw new Error(
17
+ "Function `getClientIpOrUrl` is designed to be used in a `NextJS` environment."
18
+ );
19
+ }
20
+ if (!(request instanceof NextRequest)) {
21
+ throw new TypeError(
22
+ "First parameter (`request`) must be an `instance of NextRequest` from `NextJS`."
23
+ );
24
+ }
25
+ assertIsBoolean(includeFullUrl, {
26
+ message: ({ currentType, validType }) => `Second parameter (\`includeFullUrl\`) must be of type \`${validType}\`, but received: \`${currentType}\`.`
27
+ });
28
+ const forwardedIps = (request.headers.get("x-forwarded-for") ?? "127.0.0.1").trim().split(",");
29
+ if (forwardedIps[0] === "::ffff:127.0.0.1" || forwardedIps[0] === "::1") {
30
+ forwardedIps[0] = "127.0.0.1";
31
+ }
32
+ const clientIp = forwardedIps.length > 1 ? forwardedIps[forwardedIps.length - 1].trim() : forwardedIps[0];
33
+ if (!includeFullUrl) {
34
+ return clientIp;
35
+ }
36
+ const protocol = request.headers.get("x-forwarded-proto") || "http";
37
+ const port = request.headers.get("x-forwarded-port") || "3000";
38
+ return `${process.env.NODE_ENV === "production" ? protocol : "http"}://${clientIp}:${port}`;
39
+ };
40
+
41
+ export { getClientIpOrUrl };
@@ -1 +1,33 @@
1
- "use strict";var e=require("../chunk-LS6U7FAY.cjs");require("../chunk-FJZGG54N.cjs"),require("../chunk-JBQMXC5I.cjs"),require("../chunk-ZETAZZLD.cjs"),require("../chunk-6JFZL7YE.cjs"),require("../chunk-BAV5T2E3.cjs"),require("../chunk-T7PU2V7X.cjs"),require("../chunk-UDA26MCU.cjs"),require("../chunk-PZQ6I4JJ.cjs"),Object.defineProperty(exports,"findDuplicates",{enumerable:!0,get:function(){return e.findDuplicates}}),Object.defineProperty(exports,"omitKeys",{enumerable:!0,get:function(){return e.omitKeys}}),Object.defineProperty(exports,"omitKeysDeep",{enumerable:!0,get:function(){return e.omitKeysDeep}});
1
+ /*!
2
+ * ====================================================
3
+ * Rzl Utils-JS.
4
+ * ----------------------------------------------------
5
+ * Version: 3.5.1.
6
+ * Author: Rizalvin Dwiky.
7
+ * Repository: https://github.com/rzl-zone/utils-js.
8
+ * ====================================================
9
+ */
10
+ 'use strict';
11
+
12
+ var chunkLS6U7FAY_cjs = require('../chunk-LS6U7FAY.cjs');
13
+ require('../chunk-FJZGG54N.cjs');
14
+ require('../chunk-JBQMXC5I.cjs');
15
+ require('../chunk-ZETAZZLD.cjs');
16
+ require('../chunk-6JFZL7YE.cjs');
17
+ require('../chunk-BAV5T2E3.cjs');
18
+ require('../chunk-T7PU2V7X.cjs');
19
+ require('../chunk-UDA26MCU.cjs');
20
+ require('../chunk-PZQ6I4JJ.cjs');
21
+
22
+ Object.defineProperty(exports, "findDuplicates", {
23
+ enumerable: true,
24
+ get: function () { return chunkLS6U7FAY_cjs.findDuplicates; }
25
+ });
26
+ Object.defineProperty(exports, "omitKeys", {
27
+ enumerable: true,
28
+ get: function () { return chunkLS6U7FAY_cjs.omitKeys; }
29
+ });
30
+ Object.defineProperty(exports, "omitKeysDeep", {
31
+ enumerable: true,
32
+ get: function () { return chunkLS6U7FAY_cjs.omitKeysDeep; }
33
+ });
@@ -1,3 +1,12 @@
1
+ /*!
2
+ * ====================================================
3
+ * Rzl Utils-JS.
4
+ * ----------------------------------------------------
5
+ * Version: 3.5.1.
6
+ * Author: Rizalvin Dwiky.
7
+ * Repository: https://github.com/rzl-zone/utils-js.
8
+ * ====================================================
9
+ */
1
10
  import{NumberRangeUnion}from'@rzl-zone/ts-types-plus';
2
11
  /** ----------------------------------------------------------------------
3
12
  * * ***Utility: `findDuplicates`.***
@@ -124,4 +133,4 @@ declare const omitKeys:<I extends Record<string,unknown>,K extends keyof I>(obje
124
133
  * omitKeysDeep({ mixed: { a: [1, 2, 3], b: { c: 4 } } }, ["mixed.b.c"]);
125
134
  * // ➔ { mixed: { a: [1, 2, 3] } }
126
135
  */
127
- declare const omitKeysDeep:<I extends Record<string,unknown>>(object:I,keysToOmit:DotPath<I>[])=>Partial<I>;export{findDuplicates,omitKeys,omitKeysDeep};
136
+ declare const omitKeysDeep:<I extends Record<string,unknown>>(object:I,keysToOmit:DotPath<I>[])=>Partial<I>;export{findDuplicates,omitKeys,omitKeysDeep};
@@ -1 +1,18 @@
1
- export{findDuplicates,omitKeys,omitKeysDeep}from"../chunk-OYTYSY7G.js";import"../chunk-2CQX5CBG.js";import"../chunk-NBZWMBO6.js";import"../chunk-6JFCSH7J.js";import"../chunk-CKTLUNWX.js";import"../chunk-YWHHVDT4.js";import"../chunk-PET42Z7W.js";import"../chunk-QNKGP5DY.js";import"../chunk-CMW2TBOQ.js";
1
+ /*!
2
+ * ====================================================
3
+ * Rzl Utils-JS.
4
+ * ----------------------------------------------------
5
+ * Version: 3.5.1.
6
+ * Author: Rizalvin Dwiky.
7
+ * Repository: https://github.com/rzl-zone/utils-js.
8
+ * ====================================================
9
+ */
10
+ export { findDuplicates, omitKeys, omitKeysDeep } from '../chunk-OYTYSY7G.js';
11
+ import '../chunk-2CQX5CBG.js';
12
+ import '../chunk-NBZWMBO6.js';
13
+ import '../chunk-6JFCSH7J.js';
14
+ import '../chunk-CKTLUNWX.js';
15
+ import '../chunk-YWHHVDT4.js';
16
+ import '../chunk-PET42Z7W.js';
17
+ import '../chunk-QNKGP5DY.js';
18
+ import '../chunk-CMW2TBOQ.js';