@rzl-zone/utils-js 3.10.0 → 3.11.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 (122) hide show
  1. package/README.md +36 -18
  2. package/dist/assertions/index.cjs +11 -11
  3. package/dist/assertions/index.d.ts +487 -215
  4. package/dist/assertions/index.js +5 -5
  5. package/dist/{chunk-SN5HAK3Y.js → chunk-22V4WP3H.js} +4 -4
  6. package/dist/{chunk-EJV5AF4L.js → chunk-2XSZ2ANI.js} +2 -2
  7. package/dist/{chunk-OSSFLQDD.js → chunk-3T6VSWYX.js} +2 -2
  8. package/dist/{chunk-3LE6NX57.js → chunk-5WIEDF2J.js} +4 -4
  9. package/dist/{chunk-WLEZ2KSG.cjs → chunk-6EDFZJZ5.cjs} +126 -126
  10. package/dist/{chunk-GHU356XQ.js → chunk-6LXWT2I5.js} +3 -3
  11. package/dist/{chunk-GKDSBOYE.js → chunk-6YGBRENU.js} +3 -3
  12. package/dist/{chunk-NAOVH4OH.cjs → chunk-7FGNVDEV.cjs} +7 -7
  13. package/dist/{chunk-X6ULJZ3X.js → chunk-AXDYWO67.js} +2 -2
  14. package/dist/{chunk-UV5BKAYW.cjs → chunk-B6PMNZ4M.cjs} +7 -7
  15. package/dist/chunk-BAV5T2E3.cjs +1 -1
  16. package/dist/{chunk-YHFRCVTN.js → chunk-BLF7SD66.js} +3 -3
  17. package/dist/{chunk-QZI5PVCI.cjs → chunk-BMZZXZJ2.cjs} +4 -4
  18. package/dist/{chunk-DXPM4NOU.js → chunk-BOYP3ARU.js} +4 -4
  19. package/dist/{chunk-UXT4XSUK.js → chunk-BPYW5YL7.js} +2 -2
  20. package/dist/{chunk-QGTFQ7RO.cjs → chunk-C2PV3VWC.cjs} +6 -6
  21. package/dist/{chunk-MZ3T6L7Z.js → chunk-CCJ2MSN7.js} +2 -2
  22. package/dist/{chunk-H44QVAZL.cjs → chunk-DAPAK2W3.cjs} +31 -31
  23. package/dist/{chunk-OYFUBKEG.cjs → chunk-DLS3G6WQ.cjs} +4 -4
  24. package/dist/{chunk-MS2KSKD7.js → chunk-DNMCR5JH.js} +9 -9
  25. package/dist/chunk-DVMHRLKP.cjs +1 -1
  26. package/dist/{chunk-IX6PF5ZP.cjs → chunk-EBYFYZW4.cjs} +4 -4
  27. package/dist/{chunk-5Y6JL47L.js → chunk-ENMRZ4BE.js} +3 -3
  28. package/dist/{chunk-7EIFPHV3.js → chunk-FJ4BQFVO.js} +8 -8
  29. package/dist/{chunk-TJ5OY6MC.cjs → chunk-GIKL4PUF.cjs} +10 -10
  30. package/dist/{chunk-M5QB2GM5.js → chunk-GOFINGT6.js} +2 -2
  31. package/dist/{chunk-J6VLFVIL.js → chunk-GXKQ3LHF.js} +3 -3
  32. package/dist/{chunk-5KDVIEVO.js → chunk-HNBRGN4R.js} +2 -2
  33. package/dist/{chunk-OCTHWEZK.cjs → chunk-HYN6FC5A.cjs} +34 -34
  34. package/dist/{chunk-MBFVTGYS.js → chunk-IZGVBYFN.js} +4 -4
  35. package/dist/{chunk-QXTJVDWE.js → chunk-JIE447J5.js} +3 -3
  36. package/dist/{chunk-UFYMRRJH.cjs → chunk-JXEIJM5M.cjs} +61 -61
  37. package/dist/{chunk-WB3FT62A.js → chunk-K47GZDBH.js} +3 -3
  38. package/dist/{chunk-KUVRZ2JW.cjs → chunk-K5536YHG.cjs} +50 -50
  39. package/dist/chunk-KHO2SBNA.cjs +1 -1
  40. package/dist/{chunk-NJ24M6ZH.cjs → chunk-KXJ7X325.cjs} +37 -37
  41. package/dist/chunk-L5RDAVVH.js +1 -1
  42. package/dist/{chunk-SRWL4YCP.js → chunk-LJHPTLWB.js} +7 -7
  43. package/dist/{chunk-6AMDHVS2.cjs → chunk-M7ELWZXM.cjs} +9 -9
  44. package/dist/chunk-MSUW5VHZ.js +1590 -0
  45. package/dist/{chunk-2XGQQZ6A.cjs → chunk-MUHRPRR7.cjs} +3 -3
  46. package/dist/{chunk-XYWC4EQ3.cjs → chunk-MV3TSQSH.cjs} +71 -71
  47. package/dist/{chunk-VCYXNIZ2.cjs → chunk-NLZLXWAU.cjs} +9 -9
  48. package/dist/{chunk-76ATVDCR.cjs → chunk-NVRZPF5M.cjs} +3 -3
  49. package/dist/chunk-ONZFBJVW.js +1 -1
  50. package/dist/{chunk-62FS7WMB.cjs → chunk-PGNL7JXO.cjs} +31 -31
  51. package/dist/{chunk-JI57K7D4.cjs → chunk-Q4GEQS7X.cjs} +161 -161
  52. package/dist/chunk-QNKGP5DY.js +1 -1
  53. package/dist/{chunk-ZTHJQJ5F.cjs → chunk-QYI2VJLS.cjs} +9 -9
  54. package/dist/{chunk-C7GC2PFX.js → chunk-RBWZII5I.js} +3 -3
  55. package/dist/{chunk-MMRHKYT6.cjs → chunk-RMP7VMPB.cjs} +12 -12
  56. package/dist/{chunk-TXOVQZPU.js → chunk-RZOGBYIS.js} +2 -2
  57. package/dist/{chunk-ALRISPTL.cjs → chunk-SU3UELUB.cjs} +3 -3
  58. package/dist/chunk-SYHPSOUU.cjs +1626 -0
  59. package/dist/{chunk-R2DR7SPJ.js → chunk-SZUNAEMR.js} +6 -6
  60. package/dist/{chunk-YVRUY4EW.cjs → chunk-TER22LO4.cjs} +8 -8
  61. package/dist/{chunk-WRGN6UBK.js → chunk-TJHGRQ4P.js} +2 -2
  62. package/dist/{chunk-I33PB44Q.cjs → chunk-U23I7JPB.cjs} +15 -15
  63. package/dist/{chunk-VBSLIIDB.js → chunk-U7HHN47R.js} +10 -10
  64. package/dist/chunk-UDA26MCU.cjs +1 -1
  65. package/dist/{chunk-44X74C26.js → chunk-UIAWUZ4H.js} +4 -4
  66. package/dist/{chunk-5O66AUEC.js → chunk-ULQPCIA2.js} +2 -2
  67. package/dist/chunk-VJDDGRIK.cjs +1 -1
  68. package/dist/{chunk-6WVOUVWD.js → chunk-WETQI6HM.js} +9 -9
  69. package/dist/{chunk-FWWPEL7J.cjs → chunk-WLOQQFDS.cjs} +3 -3
  70. package/dist/chunk-WVSPXFTY.js +1 -1
  71. package/dist/{chunk-WKM6UVMG.cjs → chunk-WXFTVXBF.cjs} +4 -4
  72. package/dist/{chunk-YQHJB7KR.cjs → chunk-XPVTIGU2.cjs} +26 -26
  73. package/dist/{chunk-PWKOFPAH.cjs → chunk-XX6RUGTM.cjs} +3 -3
  74. package/dist/chunk-YWHHVDT4.js +1 -1
  75. package/dist/{chunk-7NXFGJJE.cjs → chunk-ZPDMWDGZ.cjs} +14 -14
  76. package/dist/{chunk-JYOCB6OV.js → chunk-ZVWZEGQP.js} +2 -2
  77. package/dist/conversions/index.cjs +34 -34
  78. package/dist/conversions/index.d.ts +489 -333
  79. package/dist/conversions/index.js +15 -15
  80. package/dist/events/index.cjs +8 -8
  81. package/dist/events/index.d.ts +35 -29
  82. package/dist/events/index.js +4 -4
  83. package/dist/formatters/index.cjs +19 -19
  84. package/dist/formatters/index.d.ts +917 -873
  85. package/dist/formatters/index.js +9 -9
  86. package/dist/generators/index.cjs +9 -9
  87. package/dist/generators/index.d.ts +104 -86
  88. package/dist/generators/index.js +4 -4
  89. package/dist/index.d.ts +1 -1
  90. package/dist/isPlainObject-0p3VveWr.d.ts +534 -0
  91. package/dist/next/index.cjs +37 -37
  92. package/dist/next/index.d.ts +36 -21
  93. package/dist/next/index.js +9 -9
  94. package/dist/next/server/index.cjs +4 -4
  95. package/dist/next/server/index.d.ts +6 -3
  96. package/dist/next/server/index.js +2 -2
  97. package/dist/operations/index.cjs +11 -11
  98. package/dist/operations/index.d.ts +14 -5
  99. package/dist/operations/index.js +8 -8
  100. package/dist/parsers/index.cjs +6 -6
  101. package/dist/parsers/index.d.ts +68 -65
  102. package/dist/parsers/index.js +5 -5
  103. package/dist/predicates/index.cjs +77 -77
  104. package/dist/predicates/index.d.ts +442 -258
  105. package/dist/predicates/index.js +14 -14
  106. package/dist/promises/index.cjs +6 -6
  107. package/dist/promises/index.d.ts +28 -16
  108. package/dist/promises/index.js +4 -4
  109. package/dist/rzl-utils.global.js +2 -2
  110. package/dist/strings/index.cjs +23 -23
  111. package/dist/strings/index.d.ts +82 -54
  112. package/dist/strings/index.js +7 -7
  113. package/dist/tailwind/index.cjs +13 -13
  114. package/dist/tailwind/index.d.ts +186 -169
  115. package/dist/tailwind/index.js +5 -5
  116. package/dist/urls/index.cjs +23 -23
  117. package/dist/urls/index.d.ts +252 -229
  118. package/dist/urls/index.js +16 -16
  119. package/package.json +2 -2
  120. package/dist/chunk-7C7TQC5J.cjs +0 -620
  121. package/dist/chunk-J4TT33ZX.js +0 -584
  122. package/dist/isPlainObject-BTPjv6zB.d.ts +0 -178
@@ -2,31 +2,31 @@
2
2
  * ====================================================
3
3
  * Rzl Utils-JS.
4
4
  * ----------------------------------------------------
5
- * Version: 3.10.0.
5
+ * Version: 3.11.0.
6
6
  * Author: Rizalvin Dwiky.
7
7
  * Repository: https://github.com/rzl-zone/utils-js.
8
8
  * ====================================================
9
9
  */
10
10
  'use strict';
11
11
 
12
- var chunkOCTHWEZK_cjs = require('../chunk-OCTHWEZK.cjs');
13
- require('../chunk-6AMDHVS2.cjs');
14
- require('../chunk-ZTHJQJ5F.cjs');
15
- var chunkIX6PF5ZP_cjs = require('../chunk-IX6PF5ZP.cjs');
16
- var chunkFWWPEL7J_cjs = require('../chunk-FWWPEL7J.cjs');
17
- var chunkWKM6UVMG_cjs = require('../chunk-WKM6UVMG.cjs');
18
- var chunkH44QVAZL_cjs = require('../chunk-H44QVAZL.cjs');
12
+ var chunkHYN6FC5A_cjs = require('../chunk-HYN6FC5A.cjs');
13
+ require('../chunk-M7ELWZXM.cjs');
14
+ require('../chunk-QYI2VJLS.cjs');
15
+ var chunkEBYFYZW4_cjs = require('../chunk-EBYFYZW4.cjs');
16
+ var chunkWLOQQFDS_cjs = require('../chunk-WLOQQFDS.cjs');
17
+ var chunkWXFTVXBF_cjs = require('../chunk-WXFTVXBF.cjs');
18
+ var chunkDAPAK2W3_cjs = require('../chunk-DAPAK2W3.cjs');
19
19
  require('../chunk-UDA26MCU.cjs');
20
- var chunk7C7TQC5J_cjs = require('../chunk-7C7TQC5J.cjs');
20
+ var chunkSYHPSOUU_cjs = require('../chunk-SYHPSOUU.cjs');
21
21
 
22
22
  function generateRoute(route, params) {
23
- if (!chunk7C7TQC5J_cjs.isString(route) || chunkFWWPEL7J_cjs.isEmptyString(route)) {
23
+ if (!chunkSYHPSOUU_cjs.isString(route) || chunkWLOQQFDS_cjs.isEmptyString(route)) {
24
24
  throw new TypeError(
25
25
  `\u274C 'generateRoute' Failed:
26
26
  - Invalid 'route' value.
27
- - Must be of type \`string\` and non-empty string, but received: "${chunk7C7TQC5J_cjs.getPreciseType(
27
+ - Must be of type \`string\` and non-empty string, but received: "${chunkSYHPSOUU_cjs.getPreciseType(
28
28
  route
29
- )}": \`${chunkH44QVAZL_cjs.safeStableStringify(route, {
29
+ )}": \`${chunkDAPAK2W3_cjs.safeStableStringify(route, {
30
30
  keepUndefined: true
31
31
  })}\`.`
32
32
  );
@@ -34,11 +34,11 @@ function generateRoute(route, params) {
34
34
  if (!/[\\[\]]/.test(route)) {
35
35
  return route;
36
36
  }
37
- chunk7C7TQC5J_cjs.assertIsPlainObject(params, {
37
+ chunkSYHPSOUU_cjs.assertIsPlainObject(params, {
38
38
  message: ({ validType }) => `\u274C 'generateRoute' Failed cause in route "${route}":
39
39
  - Missing or invalid parameters \`${validType}\` for route: "${route}", must be of type \`${validType}\` mapping parameters.`
40
40
  });
41
- if (chunk7C7TQC5J_cjs.isNil(params)) {
41
+ if (chunkSYHPSOUU_cjs.isNil(params)) {
42
42
  throw new TypeError(
43
43
  `\u274C 'generateRoute' Failed cause in route "${route}":
44
44
  - Missing parameters \`plain-object\` for route: "${route}".`
@@ -67,15 +67,15 @@ function generateRoute(route, params) {
67
67
  const requiredKeys = Array.from(route.matchAll(/\[(\w+)\]/g)).map((m) => m[1]);
68
68
  for (const key of requiredKeys) {
69
69
  const value = params[key];
70
- if (!chunk7C7TQC5J_cjs.isString(value)) {
70
+ if (!chunkSYHPSOUU_cjs.isString(value)) {
71
71
  errors.push(
72
- `- Invalid parameter: "${key}" must be of type \`string\`, but received: \`${chunk7C7TQC5J_cjs.getPreciseType(
72
+ `- Invalid parameter: "${key}" must be of type \`string\`, but received: \`${chunkSYHPSOUU_cjs.getPreciseType(
73
73
  value
74
74
  )}\`.`
75
75
  );
76
76
  continue;
77
77
  }
78
- if (chunkFWWPEL7J_cjs.isEmptyString(value)) {
78
+ if (chunkWLOQQFDS_cjs.isEmptyString(value)) {
79
79
  errors.push(`- Parameter "${key}" cannot be empty string.`);
80
80
  continue;
81
81
  }
@@ -100,14 +100,14 @@ function generateRoute(route, params) {
100
100
  );
101
101
  }
102
102
  }
103
- if (chunk7C7TQC5J_cjs.isNonEmptyArray(errors)) {
103
+ if (chunkSYHPSOUU_cjs.isNonEmptyArray(errors)) {
104
104
  throw new Error(
105
105
  `\u274C 'generateRoute' Failed cause in route "${route}":
106
106
  ${errors.join("\n")}.`
107
107
  );
108
108
  }
109
109
  return route.replace(/\[(\w+)\]/g, (_, key) => {
110
- const paramKey = chunk7C7TQC5J_cjs.isNonEmptyString(params[key]) ? params[key] : "";
110
+ const paramKey = chunkSYHPSOUU_cjs.isNonEmptyString(params[key]) ? params[key] : "";
111
111
  return paramKey.trim().replace(/^\/+|\/+$/g, "");
112
112
  }).replace(/\/+/g, "/");
113
113
  }
@@ -118,40 +118,40 @@ var createBeApiUrl = (pathname, options = {}) => {
118
118
  return `${a.replace(/\/+$/, "")}/${b.replace(/^\/+/, "")}`;
119
119
  };
120
120
  var joinPath = joinPath2;
121
- chunkWKM6UVMG_cjs.assertIsString(chunk7C7TQC5J_cjs.isNil(pathname) ? "" : pathname, {
121
+ chunkWXFTVXBF_cjs.assertIsString(chunkSYHPSOUU_cjs.isNil(pathname) ? "" : pathname, {
122
122
  message({ currentType, validType }) {
123
123
  return `First parameter (\`pathname\`) must be of type \`${validType}\`, but received: \`${currentType}\`.`;
124
124
  }
125
125
  });
126
- if (!chunk7C7TQC5J_cjs.isPlainObject(options)) {
126
+ if (!chunkSYHPSOUU_cjs.isPlainObject(options)) {
127
127
  options = {};
128
128
  }
129
129
  let {
130
130
  prefix = "/api",
131
131
  withOrigin = true
132
132
  } = options;
133
- if (!chunk7C7TQC5J_cjs.isUndefined(prefix) && !chunk7C7TQC5J_cjs.isString(prefix)) {
133
+ if (!chunkSYHPSOUU_cjs.isUndefined(prefix) && !chunkSYHPSOUU_cjs.isString(prefix)) {
134
134
  throw new TypeError(
135
- `Parameter \`prefix\` property of the \`options\` (second parameter) must be of type \`string\`, but received: \`${chunk7C7TQC5J_cjs.getPreciseType(
135
+ `Parameter \`prefix\` property of the \`options\` (second parameter) must be of type \`string\`, but received: \`${chunkSYHPSOUU_cjs.getPreciseType(
136
136
  prefix
137
137
  )}\`.`
138
138
  );
139
139
  }
140
- chunk7C7TQC5J_cjs.assertIsBoolean(withOrigin, {
140
+ chunkSYHPSOUU_cjs.assertIsBoolean(withOrigin, {
141
141
  message: ({ currentType, validType }) => `Parameter \`withOrigin\` property of the \`options\` (second parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.`
142
142
  });
143
- pathname = chunkOCTHWEZK_cjs.normalizePathname(pathname);
144
- prefix = chunkOCTHWEZK_cjs.normalizePathname(prefix);
143
+ pathname = chunkHYN6FC5A_cjs.normalizePathname(pathname);
144
+ prefix = chunkHYN6FC5A_cjs.normalizePathname(prefix);
145
145
  const normalizedPrefix = prefix.endsWith("/") ? prefix : prefix + "/";
146
146
  if (pathname === prefix || pathname === prefix + "/" || pathname.startsWith(normalizedPrefix)) {
147
147
  pathname = pathname.slice(prefix.length);
148
- pathname = chunkOCTHWEZK_cjs.normalizePathname(pathname);
148
+ pathname = chunkHYN6FC5A_cjs.normalizePathname(pathname);
149
149
  }
150
150
  const baseApiUrl = getBeApiUrl({ suffix: prefix });
151
151
  const fullPath = withOrigin ? joinPath2(baseApiUrl, pathname) : joinPath2(new URL(baseApiUrl).pathname, pathname);
152
152
  return fullPath.replace(/\/+$/, "");
153
153
  } catch (err) {
154
- if (chunk7C7TQC5J_cjs.isError(err)) {
154
+ if (chunkSYHPSOUU_cjs.isError(err)) {
155
155
  throw err;
156
156
  } else
157
157
  throw new Error(
@@ -161,9 +161,9 @@ var createBeApiUrl = (pathname, options = {}) => {
161
161
  };
162
162
 
163
163
  var getBeApiUrl = (options = {}) => {
164
- if (!chunk7C7TQC5J_cjs.isPlainObject(options)) options = {};
165
- let suffix = chunk7C7TQC5J_cjs.hasOwnProp(options, "suffix") ? options.suffix : "/";
166
- chunkWKM6UVMG_cjs.assertIsString(suffix, {
164
+ if (!chunkSYHPSOUU_cjs.isPlainObject(options)) options = {};
165
+ let suffix = chunkSYHPSOUU_cjs.hasOwnProp(options, "suffix") ? options.suffix : "/";
166
+ chunkWXFTVXBF_cjs.assertIsString(suffix, {
167
167
  message({ currentType, validType }) {
168
168
  return `Parameter \`suffix\` property of the first parameter must be of type \`${validType}\`, but received: \`${currentType}\`.`;
169
169
  }
@@ -171,20 +171,20 @@ var getBeApiUrl = (options = {}) => {
171
171
  try {
172
172
  let rawBaseUrl = process.env.NEXT_PUBLIC_BACKEND_API_URL?.trim();
173
173
  if (rawBaseUrl) {
174
- rawBaseUrl = chunkIX6PF5ZP_cjs.removeSpaces(rawBaseUrl);
174
+ rawBaseUrl = chunkEBYFYZW4_cjs.removeSpaces(rawBaseUrl);
175
175
  const urlObj = new URL(rawBaseUrl);
176
176
  const hasPort = !!urlObj.port;
177
177
  if (!hasPort && process.env.NEXT_PUBLIC_PORT_BE) {
178
- rawBaseUrl = urlObj.origin + chunkOCTHWEZK_cjs.formatEnvPort(process.env.NEXT_PUBLIC_PORT_BE, {
178
+ rawBaseUrl = urlObj.origin + chunkHYN6FC5A_cjs.formatEnvPort(process.env.NEXT_PUBLIC_PORT_BE, {
179
179
  prefixColon: true
180
180
  });
181
181
  }
182
182
  } else {
183
- rawBaseUrl = "http://localhost" + chunkOCTHWEZK_cjs.formatEnvPort(process.env.NEXT_PUBLIC_PORT_BE || "8000", {
183
+ rawBaseUrl = "http://localhost" + chunkHYN6FC5A_cjs.formatEnvPort(process.env.NEXT_PUBLIC_PORT_BE || "8000", {
184
184
  prefixColon: true
185
185
  });
186
186
  }
187
- suffix = chunkIX6PF5ZP_cjs.removeSpaces(suffix).length ? chunkIX6PF5ZP_cjs.removeSpaces(suffix) : "/";
187
+ suffix = chunkEBYFYZW4_cjs.removeSpaces(suffix).length ? chunkEBYFYZW4_cjs.removeSpaces(suffix) : "/";
188
188
  const baseApiUrl = new URL(rawBaseUrl.replace(/\/+$/, "")).origin;
189
189
  const finalSuffix = suffix === "/" ? "/" : `${suffix.startsWith("/") ? "" : "/"}${suffix.replace(/\/+$/, "")}`;
190
190
  return `${baseApiUrl}${finalSuffix}`;
@@ -200,10 +200,10 @@ var getBaseUrl = () => {
200
200
  const baseEnv = process.env.NEXT_PUBLIC_BASE_URL?.trim();
201
201
  const portEnv = process.env.NEXT_PUBLIC_PORT_FE?.trim();
202
202
  let baseUrl = baseEnv || "http://localhost";
203
- baseUrl = chunkIX6PF5ZP_cjs.removeSpaces(baseUrl).replace(/\/+$/, "");
203
+ baseUrl = chunkEBYFYZW4_cjs.removeSpaces(baseUrl).replace(/\/+$/, "");
204
204
  const hasPort = /:\/\/[^/]+:\d+/.test(baseUrl);
205
205
  if (!hasPort && portEnv) {
206
- baseUrl += chunkOCTHWEZK_cjs.formatEnvPort(portEnv, { prefixColon: true });
206
+ baseUrl += chunkHYN6FC5A_cjs.formatEnvPort(portEnv, { prefixColon: true });
207
207
  } else if (!hasPort && !baseEnv) {
208
208
  baseUrl += ":3000";
209
209
  }
@@ -2,12 +2,13 @@
2
2
  * ====================================================
3
3
  * Rzl Utils-JS.
4
4
  * ----------------------------------------------------
5
- * Version: 3.10.0.
5
+ * Version: 3.11.0.
6
6
  * Author: Rizalvin Dwiky.
7
7
  * Repository: https://github.com/rzl-zone/utils-js.
8
8
  * ====================================================
9
9
  */
10
- import{IsAny}from'@rzl-zone/ts-types-plus';
10
+ import { IsAny } from '@rzl-zone/ts-types-plus';
11
+
11
12
  /** ---------------------------------------------------------
12
13
  * * ***Extracts dynamic route parameters from a given route string.***
13
14
  * ---------------------------------------------------------
@@ -27,7 +28,9 @@ import{IsAny}from'@rzl-zone/ts-types-plus';
27
28
  * // ➔ {} (no dynamic parameters)
28
29
  * ```
29
30
  */
30
- type ExtractRouteParams<T>=T extends string?HasDynamicSegments<T>extends true?T extends`${infer _Start}[${infer Param}]${infer Rest}`?{[K in Param|keyof ExtractRouteParams<Rest>]:string;}:unknown:unknown:unknown;
31
+ type ExtractRouteParams<T> = T extends string ? HasDynamicSegments<T> extends true ? T extends `${infer _Start}[${infer Param}]${infer Rest}` ? {
32
+ [K in Param | keyof ExtractRouteParams<Rest>]: string;
33
+ } : unknown : unknown : unknown;
31
34
  /** ---------------------------------------------------------
32
35
  * * ***Determines whether a given route contains dynamic segments.***
33
36
  * ---------------------------------------------------------
@@ -46,7 +49,8 @@ type ExtractRouteParams<T>=T extends string?HasDynamicSegments<T>extends true?T
46
49
  * // ➔ true
47
50
  * ```
48
51
  */
49
- type HasDynamicSegments<T>=T extends`${string}[${string}]${string}`?true:false;type GenerateRouteResult<T>=true extends IsAny<T>?unknown:T extends string?string:unknown;
52
+ type HasDynamicSegments<T> = T extends `${string}[${string}]${string}` ? true : false;
53
+ type GenerateRouteResult<T> = true extends IsAny<T> ? unknown : T extends string ? string : unknown;
50
54
  /** ---------------------------------
51
55
  * * ***Utility for NextJS: `generateRoute`.***
52
56
  * ---------------------------------
@@ -86,15 +90,20 @@ type HasDynamicSegments<T>=T extends`${string}[${string}]${string}`?true:false;t
86
90
  * generateRoute("/blog/[category]/[slug]", { category: "/news/", slug: "/latest-update/" });
87
91
  * // ➔ ❌ Error: ❌ Parameter "category" and "slug" contains slashes "/" which is not allowed.
88
92
  */
89
- declare function generateRoute<T extends string>(route:T extends string?(HasDynamicSegments<T>extends true?T:never):never,params:T extends string?ExtractRouteParams<T>:undefined):GenerateRouteResult<T>;declare function generateRoute<T extends string>(route:T extends string?T:never,params?:Extract<ExtractRouteParams<T>,Record<string,unknown>>):GenerateRouteResult<T>;declare function generateRoute<T=unknown>(route:T extends string?(HasDynamicSegments<T>extends true?T:unknown):unknown,params?:T extends string?ExtractRouteParams<T>:undefined):unknown;type OptionsCreateBeApiUrl={
90
- /** * The prefix pathname api url, e.g:`"http://localhost.com/your-target-prefix-entri-point-api-is-here"`, default: `"/api"`.
91
- *
92
- * @default "/api" */
93
- prefix?:string;
94
- /** * Option to getting `prefix` and `pathname` of api url only `(removing origin base api url)`, default: `true`.
95
- *
96
- * @default true */
97
- withOrigin?:boolean;};
93
+ declare function generateRoute<T extends string>(route: T extends string ? (HasDynamicSegments<T> extends true ? T : never) : never, params: T extends string ? ExtractRouteParams<T> : undefined): GenerateRouteResult<T>;
94
+ declare function generateRoute<T extends string>(route: T extends string ? T : never, params?: Extract<ExtractRouteParams<T>, Record<string, unknown>>): GenerateRouteResult<T>;
95
+ declare function generateRoute<T = unknown>(route: T extends string ? (HasDynamicSegments<T> extends true ? T : unknown) : unknown, params?: T extends string ? ExtractRouteParams<T> : undefined): unknown;
96
+
97
+ type OptionsCreateBeApiUrl = {
98
+ /** * The prefix pathname api url, e.g:`"http://localhost.com/your-target-prefix-entri-point-api-is-here"`, default: `"/api"`.
99
+ *
100
+ * @default "/api" */
101
+ prefix?: string;
102
+ /** * Option to getting `prefix` and `pathname` of api url only `(removing origin base api url)`, default: `true`.
103
+ *
104
+ * @default true */
105
+ withOrigin?: boolean;
106
+ };
98
107
  /** ---------------------------------
99
108
  * * ***Utility for NextJS: `createBeApiUrl`.***
100
109
  * ---------------------------------
@@ -136,16 +145,19 @@ withOrigin?:boolean;};
136
145
  * createBeApiUrl(undefined, { withOrigin: false })
137
146
  * // ➔ "/api"
138
147
  */
139
- declare const createBeApiUrl:(
148
+ declare const createBeApiUrl: (
140
149
  /** * The pathname api url, e.g:`"http://localhost.com/your-target-prefix-entri-point-api-is-here/your-target-pathname-is-here"`.
141
150
  *
142
151
  * @default ""
143
152
  */
144
- pathname:string|null|undefined,options?:OptionsCreateBeApiUrl)=>string;type OptionsGetBeApiUrl={
145
- /** * ***The Suffix origin base api url, e.g:`http://localhost.com/api`, default: `"/"`.***
146
- *
147
- * @default "/" */
148
- suffix?:string;};
153
+ pathname: string | null | undefined, options?: OptionsCreateBeApiUrl) => string;
154
+
155
+ type OptionsGetBeApiUrl = {
156
+ /** * ***The Suffix origin base api url, e.g:`http://localhost.com/api`, default: `"/"`.***
157
+ *
158
+ * @default "/" */
159
+ suffix?: string;
160
+ };
149
161
  /** ---------------------------------------------------
150
162
  * * ***Utility for NextJS: `getBeApiUrl`.***
151
163
  * ---------------------------------------------------
@@ -182,7 +194,8 @@ suffix?:string;};
182
194
  * getBeApiUrl({ suffix: "/v1" });
183
195
  * // ➔ "http://localhost:8000/v1"
184
196
  */
185
- declare const getBeApiUrl:(options?:OptionsGetBeApiUrl)=>string;
197
+ declare const getBeApiUrl: (options?: OptionsGetBeApiUrl) => string;
198
+
186
199
  /** ---------------------------------------------------
187
200
  * * ***Utility for NextJS: `getBaseUrl`.***
188
201
  * ---------------------------------------------------
@@ -213,4 +226,6 @@ declare const getBeApiUrl:(options?:OptionsGetBeApiUrl)=>string;
213
226
  * getBaseUrl();
214
227
  * // ➔ "http://localhost:3000"
215
228
  */
216
- declare const getBaseUrl:()=>string;export{type ExtractRouteParams,type HasDynamicSegments,createBeApiUrl,generateRoute,getBaseUrl,getBeApiUrl};
229
+ declare const getBaseUrl: () => string;
230
+
231
+ export { type ExtractRouteParams, type HasDynamicSegments, createBeApiUrl, generateRoute, getBaseUrl, getBeApiUrl };
@@ -2,20 +2,20 @@
2
2
  * ====================================================
3
3
  * Rzl Utils-JS.
4
4
  * ----------------------------------------------------
5
- * Version: 3.10.0.
5
+ * Version: 3.11.0.
6
6
  * Author: Rizalvin Dwiky.
7
7
  * Repository: https://github.com/rzl-zone/utils-js.
8
8
  * ====================================================
9
9
  */
10
- import { normalizePathname, formatEnvPort } from '../chunk-R2DR7SPJ.js';
11
- import '../chunk-3LE6NX57.js';
12
- import '../chunk-GKDSBOYE.js';
13
- import { removeSpaces } from '../chunk-5KDVIEVO.js';
14
- import { isEmptyString } from '../chunk-5O66AUEC.js';
15
- import { assertIsString } from '../chunk-OSSFLQDD.js';
16
- import { safeStableStringify } from '../chunk-X6ULJZ3X.js';
10
+ import { normalizePathname, formatEnvPort } from '../chunk-SZUNAEMR.js';
11
+ import '../chunk-5WIEDF2J.js';
12
+ import '../chunk-6YGBRENU.js';
13
+ import { removeSpaces } from '../chunk-HNBRGN4R.js';
14
+ import { isEmptyString } from '../chunk-ULQPCIA2.js';
15
+ import { assertIsString } from '../chunk-3T6VSWYX.js';
16
+ import { safeStableStringify } from '../chunk-AXDYWO67.js';
17
17
  import '../chunk-QNKGP5DY.js';
18
- import { isString, getPreciseType, assertIsPlainObject, isNil, isNonEmptyArray, isNonEmptyString, isPlainObject, isUndefined, assertIsBoolean, isError, hasOwnProp } from '../chunk-J4TT33ZX.js';
18
+ import { isString, getPreciseType, assertIsPlainObject, isNil, isNonEmptyArray, isNonEmptyString, isPlainObject, isUndefined, assertIsBoolean, isError, hasOwnProp } from '../chunk-MSUW5VHZ.js';
19
19
 
20
20
  function generateRoute(route, params) {
21
21
  if (!isString(route) || isEmptyString(route)) {
@@ -2,19 +2,19 @@
2
2
  * ====================================================
3
3
  * Rzl Utils-JS.
4
4
  * ----------------------------------------------------
5
- * Version: 3.10.0.
5
+ * Version: 3.11.0.
6
6
  * Author: Rizalvin Dwiky.
7
7
  * Repository: https://github.com/rzl-zone/utils-js.
8
8
  * ====================================================
9
9
  */
10
10
  'use strict';
11
11
 
12
- var chunk7C7TQC5J_cjs = require('../../chunk-7C7TQC5J.cjs');
12
+ var chunkSYHPSOUU_cjs = require('../../chunk-SYHPSOUU.cjs');
13
13
  require('server-only');
14
14
  var server = require('next/server');
15
15
 
16
16
  var getClientIpOrUrl = (request, includeFullUrl = true) => {
17
- if (!chunk7C7TQC5J_cjs.isFunction(server.NextRequest)) {
17
+ if (!chunkSYHPSOUU_cjs.isFunction(server.NextRequest)) {
18
18
  throw new Error(
19
19
  "Function `getClientIpOrUrl` is designed to be used in a `NextJS` environment."
20
20
  );
@@ -24,7 +24,7 @@ var getClientIpOrUrl = (request, includeFullUrl = true) => {
24
24
  "First parameter (`request`) must be an `instance of NextRequest` from `NextJS`."
25
25
  );
26
26
  }
27
- chunk7C7TQC5J_cjs.assertIsBoolean(includeFullUrl, {
27
+ chunkSYHPSOUU_cjs.assertIsBoolean(includeFullUrl, {
28
28
  message: ({ currentType, validType }) => `Second parameter (\`includeFullUrl\`) must be of type \`${validType}\`, but received: \`${currentType}\`.`
29
29
  });
30
30
  const forwardedIps = (request.headers.get("x-forwarded-for") ?? "127.0.0.1").trim().split(",");
@@ -2,12 +2,13 @@
2
2
  * ====================================================
3
3
  * Rzl Utils-JS.
4
4
  * ----------------------------------------------------
5
- * Version: 3.10.0.
5
+ * Version: 3.11.0.
6
6
  * Author: Rizalvin Dwiky.
7
7
  * Repository: https://github.com/rzl-zone/utils-js.
8
8
  * ====================================================
9
9
  */
10
- import{NextRequest}from'next/server';
10
+ import { NextRequest } from 'next/server';
11
+
11
12
  /** ---------------------------------
12
13
  * * ***Utility for NextJS Server: `getClientIpOrUrl`.***
13
14
  * ---------------------------------
@@ -34,4 +35,6 @@ import{NextRequest}from'next/server';
34
35
  * const url = getClientIpOrUrl(request);
35
36
  * console.log("Client full URL:", url);
36
37
  */
37
- declare const getClientIpOrUrl:(request:NextRequest,includeFullUrl?:boolean)=>string;export{getClientIpOrUrl};
38
+ declare const getClientIpOrUrl: (request: NextRequest, includeFullUrl?: boolean) => string;
39
+
40
+ export { getClientIpOrUrl };
@@ -2,12 +2,12 @@
2
2
  * ====================================================
3
3
  * Rzl Utils-JS.
4
4
  * ----------------------------------------------------
5
- * Version: 3.10.0.
5
+ * Version: 3.11.0.
6
6
  * Author: Rizalvin Dwiky.
7
7
  * Repository: https://github.com/rzl-zone/utils-js.
8
8
  * ====================================================
9
9
  */
10
- import { isFunction, assertIsBoolean } from '../../chunk-J4TT33ZX.js';
10
+ import { isFunction, assertIsBoolean } from '../../chunk-MSUW5VHZ.js';
11
11
  import 'server-only';
12
12
  import { NextRequest } from 'next/server';
13
13
 
@@ -2,32 +2,32 @@
2
2
  * ====================================================
3
3
  * Rzl Utils-JS.
4
4
  * ----------------------------------------------------
5
- * Version: 3.10.0.
5
+ * Version: 3.11.0.
6
6
  * Author: Rizalvin Dwiky.
7
7
  * Repository: https://github.com/rzl-zone/utils-js.
8
8
  * ====================================================
9
9
  */
10
10
  'use strict';
11
11
 
12
- var chunkYQHJB7KR_cjs = require('../chunk-YQHJB7KR.cjs');
13
- require('../chunk-KUVRZ2JW.cjs');
14
- require('../chunk-TJ5OY6MC.cjs');
15
- require('../chunk-NAOVH4OH.cjs');
16
- require('../chunk-OYFUBKEG.cjs');
12
+ var chunkXPVTIGU2_cjs = require('../chunk-XPVTIGU2.cjs');
13
+ require('../chunk-K5536YHG.cjs');
14
+ require('../chunk-GIKL4PUF.cjs');
15
+ require('../chunk-7FGNVDEV.cjs');
16
+ require('../chunk-DLS3G6WQ.cjs');
17
17
  require('../chunk-BAV5T2E3.cjs');
18
- require('../chunk-H44QVAZL.cjs');
18
+ require('../chunk-DAPAK2W3.cjs');
19
19
  require('../chunk-UDA26MCU.cjs');
20
- require('../chunk-7C7TQC5J.cjs');
20
+ require('../chunk-SYHPSOUU.cjs');
21
21
 
22
22
  Object.defineProperty(exports, "findDuplicates", {
23
23
  enumerable: true,
24
- get: function () { return chunkYQHJB7KR_cjs.findDuplicates; }
24
+ get: function () { return chunkXPVTIGU2_cjs.findDuplicates; }
25
25
  });
26
26
  Object.defineProperty(exports, "omitKeys", {
27
27
  enumerable: true,
28
- get: function () { return chunkYQHJB7KR_cjs.omitKeys; }
28
+ get: function () { return chunkXPVTIGU2_cjs.omitKeys; }
29
29
  });
30
30
  Object.defineProperty(exports, "omitKeysDeep", {
31
31
  enumerable: true,
32
- get: function () { return chunkYQHJB7KR_cjs.omitKeysDeep; }
32
+ get: function () { return chunkXPVTIGU2_cjs.omitKeysDeep; }
33
33
  });
@@ -2,12 +2,13 @@
2
2
  * ====================================================
3
3
  * Rzl Utils-JS.
4
4
  * ----------------------------------------------------
5
- * Version: 3.10.0.
5
+ * Version: 3.11.0.
6
6
  * Author: Rizalvin Dwiky.
7
7
  * Repository: https://github.com/rzl-zone/utils-js.
8
8
  * ====================================================
9
9
  */
10
- import{NumberRangeUnion}from'@rzl-zone/ts-types-plus';
10
+ import { NumberRangeUnion } from '@rzl-zone/ts-types-plus';
11
+
11
12
  /** ----------------------------------------------------------------------
12
13
  * * ***Utility: `findDuplicates`.***
13
14
  * ----------------------------------------------------------------------
@@ -37,7 +38,8 @@ import{NumberRangeUnion}from'@rzl-zone/ts-types-plus';
37
38
  * findDuplicates([1, 2, 3]);
38
39
  * // ➔ []
39
40
  */
40
- declare const findDuplicates:<T>(values:T[])=>T[];
41
+ declare const findDuplicates: <T>(values: T[]) => T[];
42
+
41
43
  /** --------------------------------
42
44
  * * ***Utility: `omitKeys`.***
43
45
  * --------------------------------
@@ -64,7 +66,12 @@ declare const findDuplicates:<T>(values:T[])=>T[];
64
66
  * omitKeys({ a: 1, b: 2 }, []);
65
67
  * //➔ { a: 1, b: 2 } (no changes)
66
68
  */
67
- declare const omitKeys:<I extends Record<string,unknown>,K extends keyof I>(object:I,keysToOmit:K[])=>Omit<I,K>;type IndexArray=NumberRangeUnion<0,30>;type DotPath<T,Prev extends string="">=T extends Array<infer U>?DotPath<U,`${Prev}${Prev extends "" ? "" : "."}${IndexArray}`>:T extends object?{[K in keyof T & string]:`${Prev}${Prev extends "" ? "" : "."}${K}`|DotPath<T[K],`${Prev}${Prev extends "" ? "" : "."}${K}`>;}[keyof T & string]:never;
69
+ declare const omitKeys: <I extends Record<string, unknown>, K extends keyof I>(object: I, keysToOmit: K[]) => Omit<I, K>;
70
+
71
+ type IndexArray = NumberRangeUnion<0, 30>;
72
+ type DotPath<T, Prev extends string = ""> = T extends Array<infer U> ? DotPath<U, `${Prev}${Prev extends "" ? "" : "."}${IndexArray}`> : T extends object ? {
73
+ [K in keyof T & string]: `${Prev}${Prev extends "" ? "" : "."}${K}` | DotPath<T[K], `${Prev}${Prev extends "" ? "" : "."}${K}`>;
74
+ }[keyof T & string] : never;
68
75
  /** ------------------------------------------------------
69
76
  * * ***Utility: `omitKeysDeep`.***
70
77
  * ------------------------------------------------------
@@ -132,4 +139,6 @@ declare const omitKeys:<I extends Record<string,unknown>,K extends keyof I>(obje
132
139
  * omitKeysDeep({ mixed: { a: [1, 2, 3], b: { c: 4 } } }, ["mixed.b.c"]);
133
140
  * // ➔ { mixed: { a: [1, 2, 3] } }
134
141
  */
135
- declare const omitKeysDeep:<I extends Record<string,unknown>>(object:I,keysToOmit:DotPath<I>[])=>Partial<I>;export{findDuplicates,omitKeys,omitKeysDeep};
142
+ declare const omitKeysDeep: <I extends Record<string, unknown>>(object: I, keysToOmit: DotPath<I>[]) => Partial<I>;
143
+
144
+ export { findDuplicates, omitKeys, omitKeysDeep };
@@ -2,17 +2,17 @@
2
2
  * ====================================================
3
3
  * Rzl Utils-JS.
4
4
  * ----------------------------------------------------
5
- * Version: 3.10.0.
5
+ * Version: 3.11.0.
6
6
  * Author: Rizalvin Dwiky.
7
7
  * Repository: https://github.com/rzl-zone/utils-js.
8
8
  * ====================================================
9
9
  */
10
- export { findDuplicates, omitKeys, omitKeysDeep } from '../chunk-SRWL4YCP.js';
11
- import '../chunk-DXPM4NOU.js';
12
- import '../chunk-J6VLFVIL.js';
13
- import '../chunk-M5QB2GM5.js';
14
- import '../chunk-TXOVQZPU.js';
10
+ export { findDuplicates, omitKeys, omitKeysDeep } from '../chunk-LJHPTLWB.js';
11
+ import '../chunk-BOYP3ARU.js';
12
+ import '../chunk-GXKQ3LHF.js';
13
+ import '../chunk-GOFINGT6.js';
14
+ import '../chunk-RZOGBYIS.js';
15
15
  import '../chunk-YWHHVDT4.js';
16
- import '../chunk-X6ULJZ3X.js';
16
+ import '../chunk-AXDYWO67.js';
17
17
  import '../chunk-QNKGP5DY.js';
18
- import '../chunk-J4TT33ZX.js';
18
+ import '../chunk-MSUW5VHZ.js';
@@ -2,19 +2,19 @@
2
2
  * ====================================================
3
3
  * Rzl Utils-JS.
4
4
  * ----------------------------------------------------
5
- * Version: 3.10.0.
5
+ * Version: 3.11.0.
6
6
  * Author: Rizalvin Dwiky.
7
7
  * Repository: https://github.com/rzl-zone/utils-js.
8
8
  * ====================================================
9
9
  */
10
10
  'use strict';
11
11
 
12
- var chunkVCYXNIZ2_cjs = require('../chunk-VCYXNIZ2.cjs');
13
- require('../chunk-ZTHJQJ5F.cjs');
14
- require('../chunk-WKM6UVMG.cjs');
15
- require('../chunk-7C7TQC5J.cjs');
12
+ var chunkNLZLXWAU_cjs = require('../chunk-NLZLXWAU.cjs');
13
+ require('../chunk-QYI2VJLS.cjs');
14
+ require('../chunk-WXFTVXBF.cjs');
15
+ require('../chunk-SYHPSOUU.cjs');
16
16
 
17
17
  Object.defineProperty(exports, "extractFileName", {
18
18
  enumerable: true,
19
- get: function () { return chunkVCYXNIZ2_cjs.extractFileName; }
19
+ get: function () { return chunkNLZLXWAU_cjs.extractFileName; }
20
20
  });