katanakit-js 6.2.0 → 6.6.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 (116) hide show
  1. package/README.md +11 -3
  2. package/dist/adapters/better-auth/better-auth.service.d.ts +83 -0
  3. package/dist/adapters/better-auth/better-auth.service.d.ts.map +1 -0
  4. package/dist/adapters/better-auth/better-auth.service.js +110 -0
  5. package/dist/adapters/better-auth/better-auth.service.js.map +1 -0
  6. package/dist/adapters/better-auth/client.d.ts +51 -0
  7. package/dist/adapters/better-auth/client.d.ts.map +1 -0
  8. package/dist/adapters/better-auth/client.js +67 -0
  9. package/dist/adapters/better-auth/client.js.map +1 -0
  10. package/dist/adapters/better-auth/index.d.ts +3 -0
  11. package/dist/adapters/better-auth/index.d.ts.map +1 -0
  12. package/dist/adapters/better-auth/index.js +3 -0
  13. package/dist/adapters/better-auth/index.js.map +1 -0
  14. package/dist/adapters/express/server.d.ts +133 -1
  15. package/dist/adapters/express/server.d.ts.map +1 -1
  16. package/dist/adapters/express/server.js +199 -97
  17. package/dist/adapters/express/server.js.map +1 -1
  18. package/dist/adapters/index.d.ts +2 -0
  19. package/dist/adapters/index.d.ts.map +1 -1
  20. package/dist/adapters/index.js +2 -0
  21. package/dist/adapters/index.js.map +1 -1
  22. package/dist/adapters/insforge/insforge.service.d.ts +139 -4
  23. package/dist/adapters/insforge/insforge.service.d.ts.map +1 -1
  24. package/dist/adapters/insforge/insforge.service.js +383 -213
  25. package/dist/adapters/insforge/insforge.service.js.map +1 -1
  26. package/dist/adapters/notion/notion.service.d.ts +130 -144
  27. package/dist/adapters/notion/notion.service.d.ts.map +1 -1
  28. package/dist/adapters/notion/notion.service.js +330 -341
  29. package/dist/adapters/notion/notion.service.js.map +1 -1
  30. package/dist/adapters/photoswipe/index.d.ts +2 -0
  31. package/dist/adapters/photoswipe/index.d.ts.map +1 -0
  32. package/dist/adapters/photoswipe/index.js +2 -0
  33. package/dist/adapters/photoswipe/index.js.map +1 -0
  34. package/dist/adapters/photoswipe/photoswipe.service.d.ts +99 -0
  35. package/dist/adapters/photoswipe/photoswipe.service.d.ts.map +1 -0
  36. package/dist/adapters/photoswipe/photoswipe.service.js +150 -0
  37. package/dist/adapters/photoswipe/photoswipe.service.js.map +1 -0
  38. package/dist/adapters/telegram/telegram.service.d.ts +82 -13
  39. package/dist/adapters/telegram/telegram.service.d.ts.map +1 -1
  40. package/dist/adapters/telegram/telegram.service.js +133 -55
  41. package/dist/adapters/telegram/telegram.service.js.map +1 -1
  42. package/dist/adapters/wordpress/wordpress.service.d.ts +181 -110
  43. package/dist/adapters/wordpress/wordpress.service.d.ts.map +1 -1
  44. package/dist/adapters/wordpress/wordpress.service.js +556 -465
  45. package/dist/adapters/wordpress/wordpress.service.js.map +1 -1
  46. package/dist/config/seo.service.d.ts +1 -1
  47. package/dist/config/seo.service.d.ts.map +1 -1
  48. package/dist/config/seo.service.js +1 -1
  49. package/dist/config/seo.service.js.map +1 -1
  50. package/dist/core/services/access.service.d.ts +167 -4
  51. package/dist/core/services/access.service.d.ts.map +1 -1
  52. package/dist/core/services/access.service.js +241 -31
  53. package/dist/core/services/access.service.js.map +1 -1
  54. package/dist/core/services/agent.service.d.ts +182 -27
  55. package/dist/core/services/agent.service.d.ts.map +1 -1
  56. package/dist/core/services/agent.service.js +296 -164
  57. package/dist/core/services/agent.service.js.map +1 -1
  58. package/dist/core/services/assistant.service.d.ts +96 -5
  59. package/dist/core/services/assistant.service.d.ts.map +1 -1
  60. package/dist/core/services/assistant.service.js +171 -66
  61. package/dist/core/services/assistant.service.js.map +1 -1
  62. package/dist/core/services/dates.service.d.ts +183 -11
  63. package/dist/core/services/dates.service.d.ts.map +1 -1
  64. package/dist/core/services/dates.service.js +256 -57
  65. package/dist/core/services/dates.service.js.map +1 -1
  66. package/dist/core/services/http.service.d.ts +172 -133
  67. package/dist/core/services/http.service.d.ts.map +1 -1
  68. package/dist/core/services/http.service.js +367 -310
  69. package/dist/core/services/http.service.js.map +1 -1
  70. package/dist/core/services/logger.service.d.ts +96 -34
  71. package/dist/core/services/logger.service.d.ts.map +1 -1
  72. package/dist/core/services/logger.service.js +128 -41
  73. package/dist/core/services/logger.service.js.map +1 -1
  74. package/dist/core/services/query.service.d.ts +101 -0
  75. package/dist/core/services/query.service.d.ts.map +1 -1
  76. package/dist/core/services/query.service.js +131 -14
  77. package/dist/core/services/query.service.js.map +1 -1
  78. package/dist/core/services/utils.service.d.ts +286 -131
  79. package/dist/core/services/utils.service.d.ts.map +1 -1
  80. package/dist/core/services/utils.service.js +417 -227
  81. package/dist/core/services/utils.service.js.map +1 -1
  82. package/dist/core/services/validation.service.d.ts +48 -3
  83. package/dist/core/services/validation.service.d.ts.map +1 -1
  84. package/dist/core/services/validation.service.js +75 -23
  85. package/dist/core/services/validation.service.js.map +1 -1
  86. package/dist/infrastructure/decorators/cache.decorator.d.ts +53 -0
  87. package/dist/infrastructure/decorators/cache.decorator.d.ts.map +1 -0
  88. package/dist/infrastructure/decorators/cache.decorator.js +47 -0
  89. package/dist/infrastructure/decorators/cache.decorator.js.map +1 -0
  90. package/dist/infrastructure/decorators/index.d.ts +4 -0
  91. package/dist/infrastructure/decorators/index.d.ts.map +1 -0
  92. package/dist/infrastructure/decorators/index.js +4 -0
  93. package/dist/infrastructure/decorators/index.js.map +1 -0
  94. package/dist/infrastructure/decorators/logger.decorator.d.ts +38 -0
  95. package/dist/infrastructure/decorators/logger.decorator.d.ts.map +1 -0
  96. package/dist/infrastructure/decorators/logger.decorator.js +66 -0
  97. package/dist/infrastructure/decorators/logger.decorator.js.map +1 -0
  98. package/dist/infrastructure/decorators/retry.decorator.d.ts +37 -0
  99. package/dist/infrastructure/decorators/retry.decorator.d.ts.map +1 -0
  100. package/dist/infrastructure/decorators/retry.decorator.js +54 -0
  101. package/dist/infrastructure/decorators/retry.decorator.js.map +1 -0
  102. package/dist/infrastructure/index.d.ts +1 -0
  103. package/dist/infrastructure/index.d.ts.map +1 -1
  104. package/dist/infrastructure/index.js +1 -0
  105. package/dist/infrastructure/index.js.map +1 -1
  106. package/dist/styles.css +2 -0
  107. package/package.json +49 -14
  108. package/scss/_flags.scss +179 -0
  109. package/scss/_functions.scss +168 -0
  110. package/scss/_mixins.scss +658 -0
  111. package/scss/_reset.scss +275 -0
  112. package/scss/_utilities.scss +449 -0
  113. package/scss/_variables.scss +539 -0
  114. package/scss/components/_index.scss +50 -0
  115. package/scss/demo.scss +12 -0
  116. package/scss/main.scss +56 -0
@@ -1,252 +1,407 @@
1
1
  import type { ConfigData, ConfigMethodEntries } from "../../types/index.js";
2
2
  /**
3
- * Returns a new array with duplicate values removed, preserving first-seen order.
3
+ * UtilsService - Singleton para utilidades genéricas.
4
4
  *
5
- * @typeParam T - Element type.
6
- * @param array - The input array.
7
- * @returns A new array with unique values.
5
+ * Aplica el patrón Singleton: una única instancia que centraliza utilidades
6
+ * de arrays, objetos, tiempo y configuración. Puro, sin I/O, seguro para SSR.
7
+ */
8
+ export declare class UtilsService {
9
+ private static instance;
10
+ /**
11
+ * Constructor privado - enforce singleton.
12
+ */
13
+ private constructor();
14
+ /**
15
+ * Obtiene la instancia única del UtilsService (Singleton).
16
+ *
17
+ * @returns La instancia única de {@link UtilsService}.
18
+ *
19
+ * @example
20
+ * ```ts
21
+ * const utils = UtilsService.getInstance();
22
+ * utils.useUnique([1, 2, 2, 3, 1]);
23
+ * ```
24
+ */
25
+ static getInstance(): UtilsService;
26
+ /**
27
+ * Returns a new array with duplicate values removed, preserving first-seen order.
28
+ *
29
+ * @typeParam T - Element type.
30
+ * @param array - The input array.
31
+ * @returns A new array with unique values.
32
+ *
33
+ * @example
34
+ * ```ts
35
+ * useUnique([1, 2, 2, 3, 1]); // [1, 2, 3]
36
+ * useUnique(["a", "b", "a"]); // ["a", "b"]
37
+ * ```
38
+ */
39
+ useUnique<T>(array: T[]): T[];
40
+ /**
41
+ * Splits an array into chunks of the given size.
42
+ *
43
+ * @typeParam T - Element type.
44
+ * @param array - The input array.
45
+ * @param size - Number of elements per chunk (must be > 0).
46
+ * @returns An array of chunks.
47
+ * @throws {Error} If `size` is less than or equal to 0.
48
+ *
49
+ * @example
50
+ * ```ts
51
+ * useChunk([1, 2, 3, 4, 5], 2); // [[1, 2], [3, 4], [5]]
52
+ * useChunk(["a", "b", "c"], 1); // [["a"], ["b"], ["c"]]
53
+ * ```
54
+ */
55
+ useChunk<T>(array: T[], size: number): T[][];
56
+ /**
57
+ * Groups array items by a key property or key selector function.
58
+ *
59
+ * @typeParam T - Element type.
60
+ * @param array - The input array.
61
+ * @param key - A property name or a function that returns the group key.
62
+ * @returns An object mapping group keys to arrays of items.
63
+ *
64
+ * @example
65
+ * ```ts
66
+ * const items = [
67
+ * { type: "fruit", name: "apple" },
68
+ * { type: "veggie", name: "carrot" },
69
+ * { type: "fruit", name: "banana" },
70
+ * ];
71
+ * useGroupBy(items, "type");
72
+ * // { fruit: [{ type: "fruit", name: "apple" }, { type: "fruit", name: "banana" }], veggie: [...] }
73
+ * ```
74
+ */
75
+ useGroupBy<T>(array: T[], key: keyof T | ((item: T) => string)): Record<string, T[]>;
76
+ /**
77
+ * Type guard that checks whether a value is a plain object (not null, not
78
+ * an array).
79
+ *
80
+ * @param item - The value to test.
81
+ * @returns `true` if the value is a plain `Record<string, unknown>`.
82
+ *
83
+ * @example
84
+ * ```ts
85
+ * useIsObject({ a: 1 }); // true
86
+ * useIsObject([1, 2]); // false
87
+ * useIsObject(null); // false
88
+ * ```
89
+ */
90
+ useIsObject(item: unknown): item is Record<string, unknown>;
91
+ /**
92
+ * Deep clones a value using `structuredClone` with a JSON fallback for
93
+ * environments that do not support it.
94
+ *
95
+ * @typeParam T - Value type.
96
+ * @param value - The value to clone.
97
+ * @returns A deep copy of the value.
98
+ *
99
+ * @example
100
+ * ```ts
101
+ * const original = { a: { b: 1 } };
102
+ * const copy = useDeepClone(original);
103
+ * copy.a.b = 2;
104
+ * original.a.b; // 1 (unchanged)
105
+ * ```
106
+ */
107
+ useDeepClone<T>(value: T): T;
108
+ /**
109
+ * Deep merges `source` into a shallow copy of `target`. Nested plain
110
+ * objects are merged recursively. Skips prototype-pollution keys
111
+ * (`__proto__`, `constructor`, `prototype`).
112
+ *
113
+ * @typeParam T - Target object type.
114
+ * @param target - The base object (not mutated).
115
+ * @param source - The object to merge in.
116
+ * @returns A new merged object.
117
+ *
118
+ * @example
119
+ * ```ts
120
+ * const base = { a: 1, b: { c: 2, d: 3 } };
121
+ * const override = { b: { c: 99, e: 4 }, f: 5 };
122
+ * useDeepMerge(base, override);
123
+ * // { a: 1, b: { c: 99, d: 3, e: 4 }, f: 5 }
124
+ * ```
125
+ */
126
+ useDeepMerge<T extends Record<string, unknown>>(target: T, source: Record<string, unknown>): T;
127
+ /**
128
+ * Picks the listed keys from an object into a new object.
129
+ *
130
+ * @typeParam T - Source object type.
131
+ * @typeParam K - Keys to pick.
132
+ * @param obj - The source object.
133
+ * @param keys - Array of keys to include.
134
+ * @returns A new object with only the picked keys.
135
+ *
136
+ * @example
137
+ * ```ts
138
+ * const user = { id: 1, name: "Alice", email: "a@b.com" };
139
+ * usePick(user, ["id", "name"]); // { id: 1, name: "Alice" }
140
+ * ```
141
+ */
142
+ usePick<T extends object, K extends keyof T>(obj: T, keys: K[]): Pick<T, K>;
143
+ /**
144
+ * Omits the listed keys from an object, returning a shallow copy without
145
+ * them. Shallow on purpose to avoid `structuredClone` failures on
146
+ * non-cloneable values.
147
+ *
148
+ * @typeParam T - Source object type.
149
+ * @typeParam K - Keys to omit.
150
+ * @param obj - The source object.
151
+ * @param keys - Array of keys to exclude.
152
+ * @returns A new object without the omitted keys.
153
+ *
154
+ * @example
155
+ * ```ts
156
+ * const user = { id: 1, name: "Alice", password: "secret" };
157
+ * useOmit(user, ["password"]); // { id: 1, name: "Alice" }
158
+ * ```
159
+ */
160
+ useOmit<T extends object, K extends keyof T>(obj: T, keys: K[]): Omit<T, K>;
161
+ /**
162
+ * Returns a promise that resolves after `ms` milliseconds.
163
+ *
164
+ * @param ms - Delay in milliseconds.
165
+ * @returns A promise that resolves after the delay.
166
+ *
167
+ * @example
168
+ * ```ts
169
+ * await useSleep(1000); // waits 1 second
170
+ * ```
171
+ */
172
+ useSleep(ms: number): Promise<void>;
173
+ /**
174
+ * Retries an async function with a fixed delay between attempts.
175
+ *
176
+ * @typeParam T - The resolved value type.
177
+ * @param fn - The async function to retry.
178
+ * @param retries - Maximum number of retries (defaults to `3`).
179
+ * @param delayMs - Delay between retries in milliseconds (defaults to `1000`).
180
+ * @returns The resolved value of `fn`.
181
+ * @throws The last error if all retries are exhausted.
182
+ *
183
+ * @example
184
+ * ```ts
185
+ * const data = await useRetry(() => fetch("/api").then(r => r.json()), 3, 500);
186
+ * ```
187
+ */
188
+ useRetry<T>(fn: () => Promise<T>, retries?: number, delayMs?: number): Promise<T>;
189
+ /**
190
+ * Copies text to the clipboard (browser only). Returns `false` on failure
191
+ * or in non-browser environments (SSR).
192
+ *
193
+ * @param text - The text to copy.
194
+ * @returns `true` if the text was copied, `false` otherwise.
195
+ *
196
+ * @example
197
+ * ```ts
198
+ * const ok = await useCopyToClipboard("Hello, world!");
199
+ * console.log(ok); // true (in a browser with clipboard API)
200
+ * ```
201
+ */
202
+ useCopyToClipboard(text: string): Promise<boolean>;
203
+ /**
204
+ * Parses query parameters from a URL string into a plain object.
205
+ * Returns an empty object for invalid URLs.
206
+ *
207
+ * @param urlString - The URL to parse.
208
+ * @returns An object mapping parameter names to values.
209
+ *
210
+ * @example
211
+ * ```ts
212
+ * useGetUrlParams("https://example.com?q=hello&page=1");
213
+ * // { q: "hello", page: "1" }
214
+ * ```
215
+ */
216
+ useGetUrlParams(urlString: string): Record<string, string>;
217
+ /**
218
+ * Rounds a number (or numeric string) to the specified number of decimal
219
+ * places. Returns `0` for non-numeric input.
220
+ *
221
+ * @param value - The number or numeric string to round.
222
+ * @param decimals - Number of decimal places (defaults to `2`).
223
+ * @returns The rounded number.
224
+ *
225
+ * @example
226
+ * ```ts
227
+ * useRound(3.14159, 2); // 3.14
228
+ * useRound("5.678", 1); // 5.7
229
+ * ```
230
+ */
231
+ useRound(value: string | number, decimals?: number): number;
232
+ /**
233
+ * Computes the arithmetic mean of an array of numbers. Returns `0` for an
234
+ * empty array.
235
+ *
236
+ * @param numbers - The input numbers.
237
+ * @returns The arithmetic mean.
238
+ *
239
+ * @example
240
+ * ```ts
241
+ * useAverage([1, 2, 3, 4, 5]); // 3
242
+ * useAverage([]); // 0
243
+ * ```
244
+ */
245
+ useAverage(numbers: number[]): number;
246
+ /**
247
+ * Splits a `define*Config` literal into its config half (props and booleans)
248
+ * and its method half (values declared with `function`).
249
+ *
250
+ * Shared by every `define*Config` so they all read the same way: register
251
+ * `config`, then return `{ config, ...methods }` as a `ConfigFacade`.
252
+ *
253
+ * @typeParam T - The literal passed to a `define*Config` call.
254
+ * @param input - Object literal holding props, booleans and methods.
255
+ * @returns The config entries and the method entries, split apart.
256
+ *
257
+ * @example
258
+ * ```ts
259
+ * const { config, methods } = useSplitConfig({
260
+ * token: "abc",
261
+ * debug: true,
262
+ * send: async function () {},
263
+ * });
264
+ * // config → { token: "abc", debug: true }
265
+ * // methods → { send }
266
+ * ```
267
+ */
268
+ useSplitConfig<T extends object>(input: T): {
269
+ config: ConfigData<T>;
270
+ methods: ConfigMethodEntries<T>;
271
+ };
272
+ }
273
+ /**
274
+ * Returns a new array with duplicate values removed, preserving first-seen order.
8
275
  *
9
276
  * @example
10
277
  * ```ts
11
278
  * useUnique([1, 2, 2, 3, 1]); // [1, 2, 3]
12
- * useUnique(["a", "b", "a"]); // ["a", "b"]
13
279
  * ```
14
280
  */
15
281
  export declare function useUnique<T>(array: T[]): T[];
16
282
  /**
17
283
  * Splits an array into chunks of the given size.
18
284
  *
19
- * @typeParam T - Element type.
20
- * @param array - The input array.
21
- * @param size - Number of elements per chunk (must be > 0).
22
- * @returns An array of chunks.
23
- * @throws {Error} If `size` is less than or equal to 0.
24
- *
25
285
  * @example
26
286
  * ```ts
27
287
  * useChunk([1, 2, 3, 4, 5], 2); // [[1, 2], [3, 4], [5]]
28
- * useChunk(["a", "b", "c"], 1); // [["a"], ["b"], ["c"]]
29
288
  * ```
30
289
  */
31
290
  export declare function useChunk<T>(array: T[], size: number): T[][];
32
291
  /**
33
292
  * Groups array items by a key property or key selector function.
34
293
  *
35
- * @typeParam T - Element type.
36
- * @param array - The input array.
37
- * @param key - A property name or a function that returns the group key.
38
- * @returns An object mapping group keys to arrays of items.
39
- *
40
294
  * @example
41
295
  * ```ts
42
- * const items = [
43
- * { type: "fruit", name: "apple" },
44
- * { type: "veggie", name: "carrot" },
45
- * { type: "fruit", name: "banana" },
46
- * ];
47
296
  * useGroupBy(items, "type");
48
- * // { fruit: [{ type: "fruit", name: "apple" }, { type: "fruit", name: "banana" }], veggie: [...] }
49
- *
50
- * useGroupBy(items, (item) => item.type.toUpperCase());
51
- * // { FRUIT: [...], VEGGIE: [...] }
52
297
  * ```
53
298
  */
54
299
  export declare function useGroupBy<T>(array: T[], key: keyof T | ((item: T) => string)): Record<string, T[]>;
55
300
  /**
56
- * Type guard that checks whether a value is a plain object (not null, not
57
- * an array).
58
- *
59
- * @param item - The value to test.
60
- * @returns `true` if the value is a plain `Record<string, unknown>`.
301
+ * Type guard that checks whether a value is a plain object (not null, not an array).
61
302
  *
62
303
  * @example
63
304
  * ```ts
64
- * useIsObject({ a: 1 }); // true
65
- * useIsObject([1, 2]); // false
66
- * useIsObject(null); // false
67
- * useIsObject("hello"); // false
305
+ * useIsObject({ a: 1 }); // true
68
306
  * ```
69
307
  */
70
308
  export declare function useIsObject(item: unknown): item is Record<string, unknown>;
71
309
  /**
72
- * Deep clones a value using `structuredClone` with a JSON fallback for
73
- * environments that do not support it.
74
- *
75
- * @typeParam T - Value type.
76
- * @param value - The value to clone.
77
- * @returns A deep copy of the value.
310
+ * Deep clones a value using `structuredClone` with a JSON fallback.
78
311
  *
79
312
  * @example
80
313
  * ```ts
81
- * const original = { a: { b: 1 } };
82
314
  * const copy = useDeepClone(original);
83
- * copy.a.b = 2;
84
- * original.a.b; // 1 (unchanged)
85
315
  * ```
86
316
  */
87
317
  export declare function useDeepClone<T>(value: T): T;
88
318
  /**
89
- * Deep merges `source` into a shallow copy of `target`. Nested plain
90
- * objects are merged recursively. Skips prototype-pollution keys
91
- * (`__proto__`, `constructor`, `prototype`).
92
- *
93
- * @typeParam T - Target object type.
94
- * @param target - The base object (not mutated).
95
- * @param source - The object to merge in.
96
- * @returns A new merged object.
319
+ * Deep merges `source` into a shallow copy of `target`.
97
320
  *
98
321
  * @example
99
322
  * ```ts
100
- * const base = { a: 1, b: { c: 2, d: 3 } };
101
- * const override = { b: { c: 99, e: 4 }, f: 5 };
102
323
  * useDeepMerge(base, override);
103
- * // { a: 1, b: { c: 99, d: 3, e: 4 }, f: 5 }
104
324
  * ```
105
325
  */
106
326
  export declare function useDeepMerge<T extends Record<string, unknown>>(target: T, source: Record<string, unknown>): T;
107
327
  /**
108
328
  * Picks the listed keys from an object into a new object.
109
329
  *
110
- * @typeParam T - Source object type.
111
- * @typeParam K - Keys to pick.
112
- * @param obj - The source object.
113
- * @param keys - Array of keys to include.
114
- * @returns A new object with only the picked keys.
115
- *
116
330
  * @example
117
331
  * ```ts
118
- * const user = { id: 1, name: "Alice", email: "a@b.com" };
119
- * usePick(user, ["id", "name"]); // { id: 1, name: "Alice" }
332
+ * usePick(user, ["id", "name"]);
120
333
  * ```
121
334
  */
122
335
  export declare function usePick<T extends object, K extends keyof T>(obj: T, keys: K[]): Pick<T, K>;
123
336
  /**
124
- * Omits the listed keys from an object, returning a shallow copy without
125
- * them. Shallow on purpose to avoid `structuredClone` failures on
126
- * non-cloneable values.
127
- *
128
- * @typeParam T - Source object type.
129
- * @typeParam K - Keys to omit.
130
- * @param obj - The source object.
131
- * @param keys - Array of keys to exclude.
132
- * @returns A new object without the omitted keys.
337
+ * Omits the listed keys from an object, returning a shallow copy without them.
133
338
  *
134
339
  * @example
135
340
  * ```ts
136
- * const user = { id: 1, name: "Alice", password: "secret" };
137
- * useOmit(user, ["password"]); // { id: 1, name: "Alice" }
341
+ * useOmit(user, ["password"]);
138
342
  * ```
139
343
  */
140
344
  export declare function useOmit<T extends object, K extends keyof T>(obj: T, keys: K[]): Omit<T, K>;
141
345
  /**
142
346
  * Returns a promise that resolves after `ms` milliseconds.
143
347
  *
144
- * @param ms - Delay in milliseconds.
145
- * @returns A promise that resolves after the delay.
146
- *
147
348
  * @example
148
349
  * ```ts
149
- * await useSleep(1000); // waits 1 second
150
- * console.log("done");
350
+ * await useSleep(1000);
151
351
  * ```
152
352
  */
153
353
  export declare function useSleep(ms: number): Promise<void>;
154
354
  /**
155
355
  * Retries an async function with a fixed delay between attempts.
156
356
  *
157
- * @typeParam T - The resolved value type.
158
- * @param fn - The async function to retry.
159
- * @param retries - Maximum number of retries (defaults to `3`).
160
- * @param delayMs - Delay between retries in milliseconds (defaults to `1000`).
161
- * @returns The resolved value of `fn`.
162
- * @throws The last error if all retries are exhausted.
163
- *
164
357
  * @example
165
358
  * ```ts
166
- * const data = await useRetry(() => fetch("/api").then(r => r.json()), 3, 500);
359
+ * const data = await useRetry(() => fetch("/api"), 3, 500);
167
360
  * ```
168
361
  */
169
362
  export declare function useRetry<T>(fn: () => Promise<T>, retries?: number, delayMs?: number): Promise<T>;
170
363
  /**
171
- * Copies text to the clipboard (browser only). Returns `false` on failure
172
- * or in non-browser environments (SSR).
173
- *
174
- * @param text - The text to copy.
175
- * @returns `true` if the text was copied, `false` otherwise.
364
+ * Copies text to the clipboard (browser only).
176
365
  *
177
366
  * @example
178
367
  * ```ts
179
368
  * const ok = await useCopyToClipboard("Hello, world!");
180
- * console.log(ok); // true (in a browser with clipboard API)
181
369
  * ```
182
370
  */
183
371
  export declare function useCopyToClipboard(text: string): Promise<boolean>;
184
372
  /**
185
373
  * Parses query parameters from a URL string into a plain object.
186
- * Returns an empty object for invalid URLs.
187
- *
188
- * @param urlString - The URL to parse.
189
- * @returns An object mapping parameter names to values.
190
374
  *
191
375
  * @example
192
376
  * ```ts
193
377
  * useGetUrlParams("https://example.com?q=hello&page=1");
194
- * // { q: "hello", page: "1" }
195
- *
196
- * useGetUrlParams("not-a-url"); // {}
197
378
  * ```
198
379
  */
199
380
  export declare function useGetUrlParams(urlString: string): Record<string, string>;
200
381
  /**
201
- * Rounds a number (or numeric string) to the specified number of decimal
202
- * places. Returns `0` for non-numeric input.
203
- *
204
- * @param value - The number or numeric string to round.
205
- * @param decimals - Number of decimal places (defaults to `2`).
206
- * @returns The rounded number.
382
+ * Rounds a number (or numeric string) to the specified number of decimal places.
207
383
  *
208
384
  * @example
209
385
  * ```ts
210
- * useRound(3.14159, 2); // 3.14
211
- * useRound("5.678", 1); // 5.7
212
- * useRound("not-a-num"); // 0
386
+ * useRound(3.14159, 2); // 3.14
213
387
  * ```
214
388
  */
215
389
  export declare function useRound(value: string | number, decimals?: number): number;
216
390
  /**
217
- * Computes the arithmetic mean of an array of numbers. Returns `0` for an
218
- * empty array.
219
- *
220
- * @param numbers - The input numbers.
221
- * @returns The arithmetic mean.
391
+ * Computes the arithmetic mean of an array of numbers.
222
392
  *
223
393
  * @example
224
394
  * ```ts
225
395
  * useAverage([1, 2, 3, 4, 5]); // 3
226
- * useAverage([]); // 0
227
396
  * ```
228
397
  */
229
398
  export declare function useAverage(numbers: number[]): number;
230
399
  /**
231
- * Splits a `define*Config` literal into its config half (props and booleans)
232
- * and its method half (values declared with `function`).
233
- *
234
- * Shared by every `define*Config` so they all read the same way: register
235
- * `config`, then return `{ config, ...methods }` as a {@link ConfigFacade}.
236
- *
237
- * @typeParam T - The literal passed to a `define*Config` call.
238
- * @param input - Object literal holding props, booleans and methods.
239
- * @returns The config entries and the method entries, split apart.
400
+ * Splits a `define*Config` literal into its config half and its method half.
240
401
  *
241
402
  * @example
242
403
  * ```ts
243
- * const { config, methods } = useSplitConfig({
244
- * token: "abc",
245
- * debug: true,
246
- * send: async function () {},
247
- * });
248
- * // config → { token: "abc", debug: true }
249
- * // methods → { send }
404
+ * const { config, methods } = useSplitConfig({ token: "abc", send: async function () {} });
250
405
  * ```
251
406
  */
252
407
  export declare function useSplitConfig<T extends object>(input: T): {
@@ -1 +1 @@
1
- {"version":3,"file":"utils.service.d.ts","sourceRoot":"","sources":["../../../src/core/services/utils.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE5E;;;;;;;;;;;;GAYG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAE5C;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,EAAE,EAAE,CAK3D;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAC3B,KAAK,EAAE,CAAC,EAAE,EACV,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,CAAC,GAClC,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,CAYrB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAE1E;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAK3C;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7D,MAAM,EAAE,CAAC,EACT,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7B,CAAC,CAkBH;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,OAAO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