@h3ravel/support 0.15.6 → 0.16.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.
package/dist/index.d.ts CHANGED
@@ -1,10 +1,64 @@
1
1
  /// <reference path="./app.globals.d.ts" />
2
2
  import "node:module";
3
+ import { CallableConstructor, ClassConstructor, ConcreteConstructor, IApplication, IServiceProvider } from "@h3ravel/contracts";
4
+ import { Collection as Collection$1 } from "@h3ravel/collect.js";
5
+ import * as _h3ravel_shared0 from "@h3ravel/shared";
3
6
  import { DotFlatten, DotNestedKeys, DotNestedValue } from "@h3ravel/shared";
4
- import dayjs, { ConfigType, Dayjs, OpUnitType } from "dayjs";
7
+ import dayjs, { ConfigType, Dayjs, OpUnitType, OptionType } from "dayjs";
5
8
 
6
9
  //#region rolldown:runtime
7
10
  //#endregion
11
+ //#region src/Collection.d.ts
12
+ declare class Collection<Item = any> extends Collection$1<Item> {
13
+ /**
14
+ *
15
+ * @param collection
16
+ */
17
+ constructor(collection?: Item[] | Item | Record<string, Item>);
18
+ }
19
+ /**
20
+ *
21
+ * @param collection
22
+ * @returns
23
+ */
24
+ declare const collect: <T$1>(collection?: T$1 | T$1[] | Record<string, T$1> | undefined) => Collection<T$1>;
25
+ //#endregion
26
+ //#region src/HigherOrderTapProxy.d.ts
27
+ declare class HigherOrderTapProxy<Target extends Record<string, (...args: any[]) => any>> {
28
+ /**
29
+ * The target being tapped.
30
+ */
31
+ target: Target;
32
+ /**
33
+ * Create a new tap proxy instance.
34
+ */
35
+ constructor(target: Target);
36
+ /**
37
+ * Dynamically pass method calls to the target.
38
+ *
39
+ * @param method
40
+ * @param parameters
41
+ */
42
+ __call(method: string, parameters: any[]): Target;
43
+ }
44
+ //#endregion
45
+ //#region src/Contracts/Helpers.d.ts
46
+ interface Tap {
47
+ <X extends Record<string, any>>(value: X): HigherOrderTapProxy<X>;
48
+ <X extends Record<string, any>>(value: X, callback?: (val: X) => void): X;
49
+ }
50
+ interface OptionalFn {
51
+ <T$1>(value: Nullable<T$1>): OptionalProxy<T$1>;
52
+ <T$1, R$1>(value: Nullable<T$1>, callback: (value: T$1) => R$1): R$1 | undefined;
53
+ }
54
+ type Macro = (...args: any[]) => any;
55
+ type MacroMap = Record<string, (...args: any[]) => any>;
56
+ type WithMacros<M extends MacroMap> = { [K in keyof M]: M[K] };
57
+ type Nullable<T$1> = T$1 | null | undefined;
58
+ type OptionalProxy<T$1> = { [K in keyof T$1]: T$1[K] extends ((...args: infer A) => infer R) ? (...args: A) => OptionalProxy<R> : OptionalProxy<T$1[K]> } & {
59
+ value(): T$1 | undefined;
60
+ };
61
+ //#endregion
8
62
  //#region src/Contracts/StrContract.d.ts
9
63
  /**
10
64
  * Converts CamelCased strings to snake_case
@@ -55,6 +109,12 @@ type JsonSerializable = {
55
109
  jsonSerialize(): any;
56
110
  };
57
111
  //#endregion
112
+ //#region src/Exceptions/BadMethodCallException.d.ts
113
+ /**
114
+ * Exception thrown if an error with a method call occurs.
115
+ */
116
+ declare class BadMethodCallException extends Error {}
117
+ //#endregion
58
118
  //#region src/Exceptions/InvalidArgumentException.d.ts
59
119
  /**
60
120
  * Custom error for invalid type coercion
@@ -65,10 +125,10 @@ declare class InvalidArgumentException extends Error {
65
125
  //#endregion
66
126
  //#region src/Exceptions/RuntimeException.d.ts
67
127
  /**
68
- * Custom error for invalid type coercion
128
+ * Exception thrown if an error which can only be found on runtime occurs.
69
129
  */
70
130
  declare class RuntimeException extends Error {
71
- constructor(message: string);
131
+ constructor(message?: string);
72
132
  }
73
133
  declare namespace Crypto_d_exports {
74
134
  export { base64Decode, base64Encode, caesarCipher, checksum, hash, hmac, random, randomColor, randomPassword, randomSecure, secureToken, uuid, verifyChecksum, xor };
@@ -247,7 +307,7 @@ declare namespace Obj_d_exports {
247
307
  * with dot-separated keys.
248
308
  *
249
309
  * Example:
250
- * doter({
310
+ * dot({
251
311
  * user: { name: "John", address: { city: "NY" } },
252
312
  * active: true
253
313
  * })
@@ -293,9 +353,14 @@ declare const getValue: <T$1 extends Record<string, any>>(key: string | [keyof T
293
353
  * @param callback - Function that receives [key, value] and returns [newKey, newValue]
294
354
  * @returns A new object with transformed entries
295
355
  */
296
- declare const modObj: <T$1 extends object, R>(obj: T$1, callback: (_entry: [keyof T$1 & string, T$1[keyof T$1]]) => [string, R]) => Record<string, R>;
297
- declare function safeDot<T$1 extends Record<string, any>>(_data: T$1): T$1;
298
- declare function safeDot<T$1 extends Record<string, any>, K$1 extends DotNestedKeys<T$1>>(_data: T$1, _key?: K$1): DotNestedValue<T$1, K$1>;
356
+ declare const modObj: <T$1 extends object, R$1>(obj: T$1, callback: (_entry: [keyof T$1 & string, T$1[keyof T$1]]) => [string, R$1]) => Record<string, R$1>;
357
+ /**
358
+ * Safely convert an object to dot notation
359
+ *
360
+ * @param data
361
+ */
362
+ declare function safeDot<T$1 extends Record<string, any>>(data: T$1): T$1;
363
+ declare function safeDot<T$1 extends Record<string, any>, K$1 extends DotNestedKeys<T$1>>(data: T$1, key?: K$1): DotNestedValue<T$1, K$1>;
299
364
  /**
300
365
  * Sets a nested property on an object using dot notation.
301
366
  *
@@ -327,6 +392,9 @@ declare const slugifyKeys: <T$1 extends object>(obj: T$1, only?: string[], separ
327
392
  * - Arrays: included if truthy
328
393
  * - Objects: keys included if value is truthy
329
394
  * - Strings: included as-is
395
+ *
396
+ * @param input
397
+ * @returns
330
398
  */
331
399
  declare function toCssClasses<T$1 extends string | Record<string, boolean> | Array<string | false | null | undefined>>(input: T$1): string;
332
400
  /**
@@ -334,6 +402,9 @@ declare function toCssClasses<T$1 extends string | Record<string, boolean> | Arr
334
402
  *
335
403
  * Convert object input into CSS style string.
336
404
  * - Only includes truthy values (ignores null/undefined/false)
405
+ *
406
+ * @param styles
407
+ * @returns
337
408
  */
338
409
  declare function toCssStyles<T$1 extends Record<string, string | number | boolean | null | undefined>>(styles: T$1): string;
339
410
  /**
@@ -343,48 +414,76 @@ declare function toCssStyles<T$1 extends Record<string, string | number | boolea
343
414
  *
344
415
  * Example:
345
416
  * undot({ 'a.b': 1, 'c.0': 2 }) -> { a: { b: 1 }, c: [2] }
417
+ *
418
+ * @param obj
419
+ * @returns
346
420
  */
347
421
  declare function undot(obj: Record<string, any>): Record<string, any>;
348
422
  /**
349
423
  * data_get
350
424
  *
351
425
  * Get a value from an object using dot notation.
426
+ *
427
+ * @param obj
428
+ * @param path
429
+ * @param defaultValue
430
+ * @returns
352
431
  */
353
432
  declare function data_get<T$1 extends object, P extends DotPath<T$1> | DotPath<T$1>[], D = undefined>(obj: T$1, path: P, defaultValue?: D): T$1 | any;
354
433
  /**
355
434
  * data_set
356
435
  *
357
436
  * Set a value in an object using dot notation. Mutates the object.
437
+ *
438
+ * @param obj
439
+ * @param path
440
+ * @param value
358
441
  */
359
442
  declare function data_set<T$1 extends Record<string, any>, P extends string | string[], V>(obj: T$1, path: P, value: V): asserts obj is T$1 & Record<P extends string ? P : P[0], V>;
360
443
  /**
361
444
  * data_fill
362
445
  *
363
446
  * Like data_set, but only sets the value if the key does NOT exist.
447
+ *
448
+ * @param obj
449
+ * @param path
450
+ * @param value
364
451
  */
365
452
  declare function data_fill(obj: Record<string, any>, path: string | string[], value: any): void;
366
453
  /**
367
454
  * data_forget
368
455
  *
369
456
  * Remove a key from an object using dot notation.
457
+ *
458
+ * @param obj
459
+ * @param path
370
460
  */
371
461
  declare function data_forget(obj: Record<string, any>, path: string | string[]): void;
372
462
  /**
373
463
  * Checks if a value is a plain object (not array, function, etc.)
374
464
  *
375
465
  * @param value
466
+ * @param allowArray
376
467
  * @returns
377
468
  */
378
- declare function isPlainObject(value: any): value is Record<string, any>;
469
+ declare function isPlainObject<P = any>(value: P, allowArray?: boolean): value is P;
379
470
  declare class Obj {
380
471
  /**
381
472
  * Check if the value is a non-null object (associative/accessible).
473
+ *
474
+ * @param value
475
+ * @returns
382
476
  */
383
477
  static accessible(value: unknown): value is Record<string, any>;
384
478
  /**
385
479
  * Add a key-value pair to an object only if the key does not already exist.
386
480
  *
387
481
  * Returns a new object (does not mutate original).
482
+ *
483
+ * @param obj
484
+ * @param key
485
+ * @param value
486
+ * @returns
388
487
  */
389
488
  static add<T$1 extends Record<string, any>, K$1 extends string, V>(obj: T$1, key: K$1, value: V): T$1 & Record<K$1, V>;
390
489
  /**
@@ -399,10 +498,39 @@ declare class Obj {
399
498
  static deepMerge<T$1 extends Record<string, any>>(...objects: (Partial<T$1> | undefined | null)[]): T$1;
400
499
  /**
401
500
  * Split object into [keys, values]
501
+ *
502
+ * @param obj
503
+ * @returns
402
504
  */
403
505
  static divide<T$1 extends Record<string, any>>(obj: T$1): [string[], any[]];
506
+ /**
507
+ * Flattens a nested object into a single-level object
508
+ * with dot-separated keys.
509
+ *
510
+ * Example:
511
+ * dot({
512
+ * user: { name: "John", address: { city: "NY" } },
513
+ * active: true
514
+ * })
515
+ *
516
+ * Output:
517
+ * {
518
+ * "user.name": "John",
519
+ * "user.address.city": "NY",
520
+ * "active": true
521
+ * }
522
+ *
523
+ * @template T - The type of the input object
524
+ * @param obj - The nested object to flatten
525
+ * @returns A flattened object with dotted keys and inferred types
526
+ */
527
+ static dot<T$1 extends Record<string, any>>(obj: T$1): DotFlatten<T$1>;
404
528
  /**
405
529
  * Check if a key exists in the object.
530
+ *
531
+ * @param obj
532
+ * @param key
533
+ * @returns
406
534
  */
407
535
  static exists<T$1 extends Record<string, any>>(obj: T$1, key: string | number): boolean;
408
536
  /**
@@ -410,26 +538,65 @@ declare class Obj {
410
538
  *
411
539
  * Example:
412
540
  * Obj.get({a:{b:1}}, 'a.b') -> 1
541
+ *
542
+ * @param obj
543
+ * @param path
544
+ * @param defaultValue
545
+ * @returns
413
546
  */
414
547
  static get<T$1 extends object, P extends DotPath<T$1>, D = undefined>(obj: T$1, path: P, defaultValue?: D): any;
415
548
  /**
416
549
  * Check if the object has a given key or keys (dot notation supported).
550
+ *
551
+ * @param obj
552
+ * @param keys
553
+ * @returns
417
554
  */
418
555
  static has<T$1 extends object, P extends DotPath<T$1>>(obj: T$1, keys: P | P[]): boolean;
419
556
  /**
420
557
  * Check if an object is associative (has at least one non-numeric key).
558
+ *
559
+ * @param obj
560
+ * @returns
421
561
  */
422
562
  static isAssoc(obj: unknown): obj is Record<string, any>;
563
+ /**
564
+ * Checks if a value is a plain object (not array, function, etc.)
565
+ *
566
+ * @param value
567
+ * @param allowArray
568
+ * @returns
569
+ */
570
+ static isPlainObject<P = any>(value: P, allowArray?: boolean): value is P;
423
571
  /**
424
572
  * Add a prefix to all keys of the object.
573
+ *
574
+ * @param obj
575
+ * @param prefix
576
+ * @returns
425
577
  */
426
578
  static prependKeysWith<T$1 extends Record<string, any>>(obj: T$1, prefix: string): Record<string, any>;
427
579
  /**
428
580
  * Convert an object into a URL query string.
429
581
  *
430
582
  * Nested objects/arrays are flattened using bracket notation.
583
+ *
584
+ * @param obj
585
+ * @returns
431
586
  */
432
587
  static query(obj: Record<string, any>): string;
588
+ /**
589
+ * undot
590
+ *
591
+ * Convert a dot-notated object back into nested structure.
592
+ *
593
+ * Example:
594
+ * undot({ 'a.b': 1, 'c.0': 2 }) -> { a: { b: 1 }, c: [2] }
595
+ *
596
+ * @param obj
597
+ * @returns
598
+ */
599
+ undot(obj: Record<string, any>): Record<string, any>;
433
600
  }
434
601
  //#endregion
435
602
  //#region src/Helpers/Arr.d.ts
@@ -448,7 +615,7 @@ declare class Arr {
448
615
  * Helper: deep clone for safety (simple).
449
616
  * Uses JSON methods — good for typical data shapes (no functions, Dates, Maps).
450
617
  */
451
- static _clone<A = any>(value: A): A;
618
+ static _clone<A$1 = any>(value: A$1): A$1;
452
619
  /**
453
620
  * Retrieve a value using dot notation
454
621
  * Throws if value is not an array
@@ -474,7 +641,7 @@ declare class Arr {
474
641
  *
475
642
  * Accepts any number of array arguments (or single array-of-arrays).
476
643
  */
477
- static crossJoin<A>(...arrays: A[][]): A[][];
644
+ static crossJoin<A$1>(...arrays: A$1[][]): A$1[][];
478
645
  /**
479
646
  * Split an array (or object) into two arrays: [keys, values].
480
647
  *
@@ -484,7 +651,7 @@ declare class Arr {
484
651
  * Arr.divide(['a','b']) -> [[0,1], ['a','b']]
485
652
  * Arr.divide({x:1,y:2}) -> [['x','y'], [1,2]]
486
653
  */
487
- static divide<A>(input: A[] | Record<string, A>): (A[] | number[])[] | (A[] | string[])[];
654
+ static divide<A$1>(input: A$1[] | Record<string, A$1>): (number[] | A$1[])[] | (string[] | A$1[])[];
488
655
  /**
489
656
  * Flatten a nested array/object structure into a single-level object
490
657
  * with dot-notated keys.
@@ -494,7 +661,7 @@ declare class Arr {
494
661
  *
495
662
  * Works for arrays and plain objects.
496
663
  */
497
- static dot<A>(input: A[] | Record<string, A>, prefix?: string): Record<string, A>;
664
+ static dot<A$1>(input: A$1[] | Record<string, A$1>, prefix?: string): Record<string, A$1>;
498
665
  /**
499
666
  * Checks if all elements satisfy the predicate
500
667
  */
@@ -509,7 +676,7 @@ declare class Arr {
509
676
  * Example:
510
677
  * Arr.except([10,20,30], [1]) -> [10,30]
511
678
  */
512
- static except<A extends any[] | Record<string, any>, X>(input: A, keys: X[]): A;
679
+ static except<A$1 extends any[] | Record<string, any>, X>(input: A$1, keys: X[]): A$1;
513
680
  /**
514
681
  * Return the first element of an array that satisfies the predicate,
515
682
  * or the first element if no predicate is provided, otherwise the defaultValue.
@@ -524,14 +691,14 @@ declare class Arr {
524
691
  *
525
692
  * @returns
526
693
  */
527
- static first<A, P extends (((arg: A) => true) | true)>(array: A[], predicate?: P | undefined, defaultValue?: A | undefined): P extends true ? [A, A[]] : A | undefined;
694
+ static first<A$1, P extends (((arg: A$1) => true) | true)>(array: A$1[], predicate?: P | undefined, defaultValue?: A$1 | undefined): P extends true ? [A$1, A$1[]] : A$1 | undefined;
528
695
  /**
529
696
  * Recursively flatten an array up to `depth` levels (default: Infinity).
530
697
  *
531
698
  * Example:
532
699
  * Arr.flatten([1, [2, [3]]], 1) -> [1,2,[3]]
533
700
  */
534
- static flatten<A>(array: A[], depth?: number): A[];
701
+ static flatten<A$1>(array: A$1[], depth?: number): A$1[];
535
702
  /**
536
703
  * Retrieve a value from an array/object using dot notation
537
704
  * Throws if value is not a float
@@ -548,7 +715,7 @@ declare class Arr {
548
715
  * Arr.forget([1,2,3], 1) -> [1,3]
549
716
  * Arr.forget({a:{b:1}}, 'a.b') -> { a: {} }
550
717
  */
551
- static forget<A extends any[] | Record<string, any>>(input: A, keys: any): A;
718
+ static forget<A$1 extends any[] | Record<string, any>>(input: A$1, keys: any): A$1;
552
719
  /**
553
720
  * Converts various input types into a plain array
554
721
  * Supports Arrays, Objects, Iterables, Map, WeakMap, and custom toArray/toJSON/jsonSerialize methods
@@ -566,7 +733,7 @@ declare class Arr {
566
733
  * Example:
567
734
  * Arr.hasAny([1,2,3], [4,2]) -> true
568
735
  */
569
- static hasAny<A>(array: A[], values: A[] | A): boolean;
736
+ static hasAny<A$1>(array: A$1[], values: A$1[] | A$1): boolean;
570
737
  /**
571
738
  * Retrieve a value using dot notation
572
739
  * Throws if value is not an integer
@@ -580,7 +747,7 @@ declare class Arr {
580
747
  * Arr.isList([1,2,3]) -> true
581
748
  * const a = []; a[2] = 5; Arr.isList(a) -> false
582
749
  */
583
- static isList<A>(value: A[]): boolean;
750
+ static isList<A$1>(value: A$1[]): boolean;
584
751
  /**
585
752
  * Join array elements into a string using the given separator.
586
753
  *
@@ -721,7 +888,7 @@ declare class Arr {
721
888
  /**
722
889
  * Filter an array of objects, keeping elements where the given key is not null/undefined.
723
890
  */
724
- static whereNotNull<T$1>(array: T$1[], key: keyof T$1): T$1[];
891
+ static whereNotNull<T$1>(array: T$1[], key?: keyof T$1): T$1[];
725
892
  /**
726
893
  * If the given value is not an array and not null, wrap it in one.
727
894
  *
@@ -730,7 +897,7 @@ declare class Arr {
730
897
  * @param value
731
898
  * @returns
732
899
  */
733
- static wrap<T$1>(value: T$1 | T$1[] | null | undefined): T$1[];
900
+ static wrap<T$1 = any>(value: T$1 | T$1[] | null | undefined): T$1[];
734
901
  /**
735
902
  * Return the first element of an array, undefined if empty.
736
903
  */
@@ -810,7 +977,7 @@ declare class Arr {
810
977
  * @alias Arr.first()
811
978
  * @returns
812
979
  */
813
- static shift<A, P extends (((arg: A) => true) | true)>(array: A[], predicate?: P | undefined, defaultValue?: A | undefined): P extends true ? [A, A[]] : A | undefined;
980
+ static shift<A$1, P extends (((arg: A$1) => true) | true)>(array: A$1[], predicate?: P | undefined, defaultValue?: A$1 | undefined): P extends true ? [A$1, A$1[]] : A$1 | undefined;
814
981
  /**
815
982
  * Generates an array of sequential numbers.
816
983
  *
@@ -819,6 +986,13 @@ declare class Arr {
819
986
  * @returns An array of numbers from startAt to startAt + size - 1
820
987
  */
821
988
  static range(size: number, startAt?: number): number[];
989
+ /**
990
+ * Filters an array and returns only unique values
991
+ *
992
+ * @param items
993
+ * @returns
994
+ */
995
+ static unique<T$1 = any>(items: T$1[]): T$1[];
822
996
  }
823
997
  //#endregion
824
998
  //#region src/Helpers/Time.d.ts
@@ -829,6 +1003,7 @@ declare const TimeClass: {
829
1003
  declare class DateTime extends TimeClass {
830
1004
  private instance;
831
1005
  constructor(config?: ConfigType);
1006
+ constructor(config?: ConfigType, format?: OptionType, locale?: boolean);
832
1007
  /**
833
1008
  * Start time of a specific unit.
834
1009
  *
@@ -1086,6 +1261,22 @@ declare class Str {
1086
1261
  * @return { boolean }
1087
1262
  */
1088
1263
  static containsAll(haystack: string, needles: string[], ignoreCase?: boolean): boolean;
1264
+ /**
1265
+ * Convert the case of a string.
1266
+ *
1267
+ * @param { string } string
1268
+ * @param { Mode | number } mode
1269
+ *
1270
+ * @return { string }
1271
+ */
1272
+ static convertCase(string: string, mode?: Mode | number): string;
1273
+ /**
1274
+ * Detect content type
1275
+ *
1276
+ * @param content
1277
+ * @returns
1278
+ */
1279
+ static detectContentType(content: any): "json" | "xml" | "html" | "text";
1089
1280
  /**
1090
1281
  * Determine if a given string doesn't contain a given substring.
1091
1282
  *
@@ -1096,15 +1287,6 @@ declare class Str {
1096
1287
  * @return { boolean }
1097
1288
  */
1098
1289
  static doesntContain(haystack: string, needles: string | string[], ignoreCase?: boolean): boolean;
1099
- /**
1100
- * Convert the case of a string.
1101
- *
1102
- * @param { string } string
1103
- * @param { Mode | number } mode
1104
- *
1105
- * @return { string }
1106
- */
1107
- static convertCase(string: string, mode?: Mode | number): string;
1108
1290
  /**
1109
1291
  * Replace consecutive instances of a given character with a single character in the given string.
1110
1292
  *
@@ -1293,6 +1475,13 @@ declare class Str {
1293
1475
  * @return { string }
1294
1476
  */
1295
1477
  static lower(value: string): string;
1478
+ /**
1479
+ * Parse a Class[@]method style callback into class and method.
1480
+ *
1481
+ * @param callback
1482
+ * @param defaultValue
1483
+ */
1484
+ static parseCallback(callback: string, defaultValue?: string): (string | undefined)[];
1296
1485
  /**
1297
1486
  * Get substring by start/stop indexes.
1298
1487
  *
@@ -1960,6 +2149,15 @@ declare class Str {
1960
2149
  * @return { string }
1961
2150
  */
1962
2151
  static uuid7(time?: Date | null): string;
2152
+ /**
2153
+ * Validate an IP address
2154
+ *
2155
+ * @param host
2156
+ * @param type
2157
+ *
2158
+ * @return { boolean }
2159
+ */
2160
+ static validateIp(host: string, type?: 'ipv4' | 'ipv6'): boolean;
1963
2161
  /**
1964
2162
  * Generate a time-ordered UUID (version 4).
1965
2163
  *
@@ -2177,6 +2375,14 @@ declare class Stringable {
2177
2375
  * @return { boolean }
2178
2376
  */
2179
2377
  containsAll(needles: string[], ignoreCase?: boolean): boolean;
2378
+ /**
2379
+ * Convert the case of a string.
2380
+ *
2381
+ * @param { Mode | number } mode
2382
+ *
2383
+ * @return { Stringable }
2384
+ */
2385
+ convertCase(mode?: Mode | number): Stringable;
2180
2386
  /**
2181
2387
  * Determine if a given string doesn't contain a given substring.
2182
2388
  *
@@ -2187,13 +2393,12 @@ declare class Stringable {
2187
2393
  */
2188
2394
  doesntContain(needles: string | string[], ignoreCase?: boolean): boolean;
2189
2395
  /**
2190
- * Convert the case of a string.
2191
- *
2192
- * @param { Mode | number } mode
2396
+ * Detect content type
2193
2397
  *
2194
- * @return { Stringable }
2398
+ * @param content
2399
+ * @returns
2195
2400
  */
2196
- convertCase(mode?: Mode | number): Stringable;
2401
+ static detectContentType(content: any): "json" | "xml" | "html" | "text";
2197
2402
  /**
2198
2403
  * Replace consecutive instances of a given character with a single character in the given string.
2199
2404
  *
@@ -2808,6 +3013,14 @@ declare class Stringable {
2808
3013
  * @return { this }
2809
3014
  */
2810
3015
  unless(value: Value<this>, callback: Callback<this>, fallback?: Fallback<this>): this;
3016
+ /**
3017
+ * Validate an IP address
3018
+ *
3019
+ * @param host
3020
+ * @param type
3021
+ * @returns
3022
+ */
3023
+ validateIp(type?: 'ipv4' | 'ipv6'): boolean;
2811
3024
  /**
2812
3025
  * Execute the given callback if the string contains a given substring.
2813
3026
  *
@@ -3219,4 +3432,225 @@ declare function loadHelpers(target?: any): void;
3219
3432
  */
3220
3433
  declare function cleanHelpers(target?: any): void;
3221
3434
  //#endregion
3222
- export { Arr, Arrayable, Callback, CamelToSnakeCase, Crypto_d_exports as Crypto, DateTime, DotPath, ExcerptOptions, Fallback, Function, GlobalHelpers, HtmlString, HtmlStringType, InvalidArgumentException, JsonSerializable, Jsonable, KeysToSnakeCase, Mode, Number_d_exports as Number, Obj, RuntimeException, SnakeToCamelCase, SnakeToTitleCase, Str, Stringable, TGeneric, Value, XGeneric, abbreviate, base64Decode, base64Encode, caesarCipher, checksum, cleanHelpers, data_fill, data_forget, data_get, data_set, dd, dot, dump, extractProperties, format, getValue, hash, hmac, humanize, isPlainObject, loadHelpers, modObj, random, randomColor, randomPassword, randomSecure, safeDot, secureToken, setNested, slugifyKeys, str, toBytes, toCssClasses, toCssStyles, toHumanTime, undot, uuid, verifyChecksum, xor };
3435
+ //#region src/Helpers.d.ts
3436
+ /**
3437
+ * Call the given Closure with the given value then return the value.
3438
+ *
3439
+ * @param value
3440
+ * @param callback
3441
+ */
3442
+ declare const tap: Tap;
3443
+ /**
3444
+ * Optional Proxy factory
3445
+ *
3446
+ * @param value
3447
+ * @returns
3448
+ */
3449
+ declare const createOptionalProxy: <T$1>(value: Nullable<T$1>) => OptionalProxy<T$1>;
3450
+ /**
3451
+ * Provide access to optional objects.
3452
+ *
3453
+ * @param value
3454
+ * @param callback
3455
+ */
3456
+ declare const optional: OptionalFn;
3457
+ /**
3458
+ * Checks if the givevn value is a class
3459
+ *
3460
+ * @param C
3461
+ */
3462
+ declare const isClass: (C: any) => C is new (...args: any[]) => any;
3463
+ /**
3464
+ * Checks if the givevn value is an abstract class
3465
+ *
3466
+ * @param C
3467
+ */
3468
+ declare const isAbstract: (C: any) => C is new (...args: any[]) => any;
3469
+ /**
3470
+ * Checks if the givevn value is callable
3471
+ *
3472
+ * @param C
3473
+ */
3474
+ declare const isCallable: (C: any) => C is (...args: any[]) => any;
3475
+ //#endregion
3476
+ //#region src/Macroable.d.ts
3477
+ declare const Macroable: <M extends MacroMap = MacroMap>() => _h3ravel_shared0.Trait<(Base: any) => {
3478
+ new (...args: any[]): this & WithMacros<M>;
3479
+ [x: string]: any;
3480
+ macros: Record<string, Macro>;
3481
+ macro(name: string, macro: Macro): void;
3482
+ hasMacro(name: string): boolean;
3483
+ flushMacros(): void;
3484
+ mixin(mixin: object, replace?: boolean): void;
3485
+ createProxy<T$1 extends /*elided*/any>(this: T$1): T$1;
3486
+ /**
3487
+ * Dynamically handle calls to the class.
3488
+ *
3489
+ * @param method
3490
+ * @param parameters
3491
+ *
3492
+ * @throws {BadMethodCallException}
3493
+ */
3494
+ macroCallStatic(method: string, parameters?: any[]): any;
3495
+ }, undefined>;
3496
+ declare const MacroableClass: {
3497
+ new (...args: any[]): {
3498
+ [x: string]: any;
3499
+ /**
3500
+ * Dynamically handle calls to the class.
3501
+ *
3502
+ * @param method
3503
+ * @param parameters
3504
+ *
3505
+ * @throws {BadMethodCallException}
3506
+ */
3507
+ macroCall(method: string, parameters?: any[]): any;
3508
+ };
3509
+ [x: string]: any;
3510
+ macros: Record<string, Macro>;
3511
+ macro(name: string, macro: Macro): void;
3512
+ hasMacro(name: string): boolean;
3513
+ flushMacros(): void;
3514
+ mixin(mixin: object, replace?: boolean): void;
3515
+ createProxy<T$1 extends /*elided*/any>(this: T$1): T$1;
3516
+ /**
3517
+ * Dynamically handle calls to the class.
3518
+ *
3519
+ * @param method
3520
+ * @param parameters
3521
+ *
3522
+ * @throws {BadMethodCallException}
3523
+ */
3524
+ macroCallStatic(method: string, parameters?: any[]): any;
3525
+ };
3526
+ //#endregion
3527
+ //#region src/Providers/ServiceProvider.d.ts
3528
+ declare abstract class ServiceProvider extends IServiceProvider {
3529
+ /**
3530
+ * The current app instance
3531
+ */
3532
+ protected app: IApplication;
3533
+ /**
3534
+ * Unique Identifier for the service providers
3535
+ */
3536
+ static uid?: number;
3537
+ /**
3538
+ * Sort order
3539
+ */
3540
+ static order?: `before:${string}` | `after:${string}` | string | undefined;
3541
+ /**
3542
+ * Sort priority
3543
+ */
3544
+ static priority: number;
3545
+ /**
3546
+ * Indicate that this service provider only runs in console
3547
+ */
3548
+ static console?: boolean;
3549
+ /**
3550
+ * Indicate that this service provider only runs in console
3551
+ */
3552
+ console?: boolean;
3553
+ /**
3554
+ * Indicate that this service provider only runs in console
3555
+ */
3556
+ runsInConsole: boolean;
3557
+ /**
3558
+ * List of registered console commands
3559
+ */
3560
+ registeredCommands: (new (app: any, kernel: any) => any)[];
3561
+ /**
3562
+ * All of the registered booted callbacks.
3563
+ */
3564
+ protected bootedCallbacks: Array<(...args: any[]) => void>;
3565
+ constructor(app: IApplication);
3566
+ /**
3567
+ * Register a booted callback to be run after the "boot" method is called.
3568
+ *
3569
+ * @param callback
3570
+ */
3571
+ booted(callback: (...args: any[]) => void): void | Promise<void>;
3572
+ /**
3573
+ * Call the registered booted callbacks.
3574
+ */
3575
+ callBootedCallbacks(): Promise<void>;
3576
+ /**
3577
+ * Register the listed service providers.
3578
+ *
3579
+ * @param commands An array of console commands to register.
3580
+ *
3581
+ * @deprecated since version 1.16.0. Will be removed in future versions, use `registerCommands` instead
3582
+ */
3583
+ commands(commands: (new (app: any, kernel: any) => any)[]): void;
3584
+ /**
3585
+ * Register the listed service providers.
3586
+ *
3587
+ * @param commands An array of console commands to register.
3588
+ */
3589
+ registerCommands(commands: (new (app: any, kernel: any) => any)[]): void;
3590
+ }
3591
+ //#endregion
3592
+ //#region src/Providers/AssetsServiceProvider.d.ts
3593
+ /**
3594
+ * Handles public assets loading
3595
+ *
3596
+ * Auto-Registered
3597
+ */
3598
+ declare class AssetsServiceProvider extends ServiceProvider {
3599
+ static priority: number;
3600
+ register(): void;
3601
+ }
3602
+ //#endregion
3603
+ //#region src/Providers/RouteServiceProvider.d.ts
3604
+ /**
3605
+ * Handles routing registration
3606
+ *
3607
+ * Load route files (web.ts, api.ts).
3608
+ * Map controllers to routes.
3609
+ * Register route-related middleware.
3610
+ */
3611
+ declare class RouteServiceProvider extends ServiceProvider {
3612
+ static priority: number;
3613
+ /**
3614
+ * The callback that should be used to load the application's routes.
3615
+ */
3616
+ protected loadRoutesUsing?: CallableConstructor;
3617
+ /**
3618
+ * The global callback that should be used to load the application's routes.
3619
+ */
3620
+ protected static alwaysLoadRoutesUsing?: CallableConstructor;
3621
+ register(): Promise<void>;
3622
+ /**
3623
+ * Load routes from src/routes
3624
+ */
3625
+ boot(): Promise<void>;
3626
+ /**
3627
+ * Register the callback that will be used to load the application's routes.
3628
+ *
3629
+ * @param routesCallback
3630
+ */
3631
+ protected routes(routesCallback: CallableConstructor): this;
3632
+ /**
3633
+ * Register the callback that will be used to load the application's routes.
3634
+ *
3635
+ * @param routesCallback
3636
+ */
3637
+ static loadRoutesUsing(routesCallback?: CallableConstructor): void;
3638
+ /**
3639
+ * Load the application routes.
3640
+ */
3641
+ protected loadRoutes(): Promise<void>;
3642
+ }
3643
+ //#endregion
3644
+ //#region src/Tappable.d.ts
3645
+ declare const Tappable: <X extends ConcreteConstructor<ClassConstructor>>(Base: X) => {
3646
+ new (...args: any[]): {
3647
+ /**
3648
+ * Call the given Closure with this instance then return the instance.
3649
+ *
3650
+ * @param callback
3651
+ */
3652
+ tap(callback?: CallableConstructor): /*elided*/any;
3653
+ };
3654
+ } & X;
3655
+ //#endregion
3656
+ export { Arr, Arrayable, AssetsServiceProvider, BadMethodCallException, Callback, CamelToSnakeCase, Collection, Crypto_d_exports as Crypto, DateTime, DotPath, ExcerptOptions, Fallback, Function, GlobalHelpers, HigherOrderTapProxy, HtmlString, HtmlStringType, InvalidArgumentException, JsonSerializable, Jsonable, KeysToSnakeCase, Macro, MacroMap, Macroable, MacroableClass, Mode, Nullable, Number_d_exports as Number, Obj, OptionalFn, OptionalProxy, RouteServiceProvider, RuntimeException, ServiceProvider, SnakeToCamelCase, SnakeToTitleCase, Str, Stringable, TGeneric, Tap, Tappable, Value, WithMacros, XGeneric, abbreviate, base64Decode, base64Encode, caesarCipher, checksum, cleanHelpers, collect, createOptionalProxy, data_fill, data_forget, data_get, data_set, dd, dot, dump, extractProperties, format, getValue, hash, hmac, humanize, isAbstract, isCallable, isClass, isPlainObject, loadHelpers, modObj, optional, random, randomColor, randomPassword, randomSecure, safeDot, secureToken, setNested, slugifyKeys, str, tap, toBytes, toCssClasses, toCssStyles, toHumanTime, undot, uuid, verifyChecksum, xor };