@settlemint/sdk-utils 2.3.2-pre186542e → 2.3.2-prede7bc05

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 (98) hide show
  1. package/README.md +51 -7
  2. package/dist/environment.cjs +17708 -384
  3. package/dist/environment.cjs.map +1 -1
  4. package/dist/environment.d.cts +263 -98
  5. package/dist/environment.d.ts +263 -98
  6. package/dist/environment.js +17746 -0
  7. package/dist/environment.js.map +1 -0
  8. package/dist/filesystem.cjs +6746 -113
  9. package/dist/filesystem.cjs.map +1 -1
  10. package/dist/filesystem.d.cts +22 -1
  11. package/dist/filesystem.d.ts +22 -1
  12. package/dist/filesystem.js +6766 -0
  13. package/dist/filesystem.js.map +1 -0
  14. package/dist/http.cjs +214 -94
  15. package/dist/http.cjs.map +1 -1
  16. package/dist/http.d.cts +9 -1
  17. package/dist/http.d.ts +9 -1
  18. package/dist/http.js +226 -0
  19. package/dist/http.js.map +1 -0
  20. package/dist/index.cjs +295 -104
  21. package/dist/index.cjs.map +1 -1
  22. package/dist/index.d.cts +26 -1
  23. package/dist/index.d.ts +26 -1
  24. package/dist/index.js +306 -0
  25. package/dist/index.js.map +1 -0
  26. package/dist/json.cjs +83 -0
  27. package/dist/json.cjs.map +1 -0
  28. package/dist/json.d.cts +56 -0
  29. package/dist/json.d.ts +56 -0
  30. package/dist/json.js +80 -0
  31. package/dist/json.js.map +1 -0
  32. package/dist/logging.cjs +209 -137
  33. package/dist/logging.cjs.map +1 -1
  34. package/dist/logging.d.cts +23 -14
  35. package/dist/logging.d.ts +23 -14
  36. package/dist/logging.js +221 -0
  37. package/dist/logging.js.map +1 -0
  38. package/dist/package-manager.cjs +7353 -173
  39. package/dist/package-manager.cjs.map +1 -1
  40. package/dist/package-manager.d.cts +26 -3
  41. package/dist/package-manager.d.ts +26 -3
  42. package/dist/package-manager.js +7385 -0
  43. package/dist/package-manager.js.map +1 -0
  44. package/dist/retry.cjs +137 -0
  45. package/dist/retry.cjs.map +1 -0
  46. package/dist/retry.d.cts +19 -0
  47. package/dist/retry.d.ts +19 -0
  48. package/dist/retry.js +136 -0
  49. package/dist/retry.js.map +1 -0
  50. package/dist/runtime.cjs +58 -40
  51. package/dist/runtime.cjs.map +1 -1
  52. package/dist/runtime.d.cts +3 -0
  53. package/dist/runtime.d.ts +3 -0
  54. package/dist/runtime.js +45 -0
  55. package/dist/runtime.js.map +1 -0
  56. package/dist/string.cjs +76 -0
  57. package/dist/string.cjs.map +1 -0
  58. package/dist/string.d.cts +58 -0
  59. package/dist/string.d.ts +58 -0
  60. package/dist/string.js +72 -0
  61. package/dist/string.js.map +1 -0
  62. package/dist/terminal.cjs +426 -229
  63. package/dist/terminal.cjs.map +1 -1
  64. package/dist/terminal.d.cts +54 -24
  65. package/dist/terminal.d.ts +54 -24
  66. package/dist/terminal.js +441 -0
  67. package/dist/terminal.js.map +1 -0
  68. package/dist/url.cjs +25 -0
  69. package/dist/url.cjs.map +1 -0
  70. package/dist/url.d.cts +20 -0
  71. package/dist/url.d.ts +20 -0
  72. package/dist/url.js +24 -0
  73. package/dist/url.js.map +1 -0
  74. package/dist/validation.cjs +10486 -193
  75. package/dist/validation.cjs.map +1 -1
  76. package/dist/validation.d.cts +124 -94
  77. package/dist/validation.d.ts +124 -94
  78. package/dist/validation.js +10482 -0
  79. package/dist/validation.js.map +1 -0
  80. package/package.json +6 -6
  81. package/dist/environment.mjs +0 -384
  82. package/dist/environment.mjs.map +0 -1
  83. package/dist/filesystem.mjs +0 -105
  84. package/dist/filesystem.mjs.map +0 -1
  85. package/dist/http.mjs +0 -80
  86. package/dist/http.mjs.map +0 -1
  87. package/dist/index.mjs +0 -90
  88. package/dist/index.mjs.map +0 -1
  89. package/dist/logging.mjs +0 -123
  90. package/dist/logging.mjs.map +0 -1
  91. package/dist/package-manager.mjs +0 -167
  92. package/dist/package-manager.mjs.map +0 -1
  93. package/dist/runtime.mjs +0 -23
  94. package/dist/runtime.mjs.map +0 -1
  95. package/dist/terminal.mjs +0 -230
  96. package/dist/terminal.mjs.map +0 -1
  97. package/dist/validation.mjs +0 -161
  98. package/dist/validation.mjs.map +0 -1
@@ -0,0 +1,58 @@
1
+ //#region src/string.d.ts
2
+ /**
3
+ * Capitalizes the first letter of a string.
4
+ *
5
+ * @param val - The string to capitalize
6
+ * @returns The input string with its first letter capitalized
7
+ *
8
+ * @example
9
+ * import { capitalizeFirstLetter } from "@settlemint/sdk-utils";
10
+ *
11
+ * const capitalized = capitalizeFirstLetter("hello");
12
+ * // Returns: "Hello"
13
+ */
14
+ declare function capitalizeFirstLetter(val: string): string;
15
+ /**
16
+ * Converts a camelCase string to a human-readable string.
17
+ *
18
+ * @param s - The camelCase string to convert
19
+ * @returns The human-readable string
20
+ *
21
+ * @example
22
+ * import { camelCaseToWords } from "@settlemint/sdk-utils";
23
+ *
24
+ * const words = camelCaseToWords("camelCaseString");
25
+ * // Returns: "Camel Case String"
26
+ */
27
+ declare function camelCaseToWords(s: string): string;
28
+ /**
29
+ * Replaces underscores and hyphens with spaces.
30
+ *
31
+ * @param s - The string to replace underscores and hyphens with spaces
32
+ * @returns The input string with underscores and hyphens replaced with spaces
33
+ *
34
+ * @example
35
+ * import { replaceUnderscoresAndHyphensWithSpaces } from "@settlemint/sdk-utils";
36
+ *
37
+ * const result = replaceUnderscoresAndHyphensWithSpaces("Already_Spaced-Second");
38
+ * // Returns: "Already Spaced Second"
39
+ */
40
+ declare function replaceUnderscoresAndHyphensWithSpaces(s: string): string;
41
+ /**
42
+ * Truncates a string to a maximum length and appends "..." if it is longer.
43
+ *
44
+ * @param value - The string to truncate
45
+ * @param maxLength - The maximum length of the string
46
+ * @returns The truncated string or the original string if it is shorter than the maximum length
47
+ *
48
+ * @example
49
+ * import { truncate } from "@settlemint/sdk-utils";
50
+ *
51
+ * const truncated = truncate("Hello, world!", 10);
52
+ * // Returns: "Hello, wor..."
53
+ */
54
+ declare function truncate(value: string, maxLength: number): string;
55
+
56
+ //#endregion
57
+ export { camelCaseToWords, capitalizeFirstLetter, replaceUnderscoresAndHyphensWithSpaces, truncate };
58
+ //# sourceMappingURL=string.d.cts.map
@@ -0,0 +1,58 @@
1
+ //#region src/string.d.ts
2
+ /**
3
+ * Capitalizes the first letter of a string.
4
+ *
5
+ * @param val - The string to capitalize
6
+ * @returns The input string with its first letter capitalized
7
+ *
8
+ * @example
9
+ * import { capitalizeFirstLetter } from "@settlemint/sdk-utils";
10
+ *
11
+ * const capitalized = capitalizeFirstLetter("hello");
12
+ * // Returns: "Hello"
13
+ */
14
+ declare function capitalizeFirstLetter(val: string): string;
15
+ /**
16
+ * Converts a camelCase string to a human-readable string.
17
+ *
18
+ * @param s - The camelCase string to convert
19
+ * @returns The human-readable string
20
+ *
21
+ * @example
22
+ * import { camelCaseToWords } from "@settlemint/sdk-utils";
23
+ *
24
+ * const words = camelCaseToWords("camelCaseString");
25
+ * // Returns: "Camel Case String"
26
+ */
27
+ declare function camelCaseToWords(s: string): string;
28
+ /**
29
+ * Replaces underscores and hyphens with spaces.
30
+ *
31
+ * @param s - The string to replace underscores and hyphens with spaces
32
+ * @returns The input string with underscores and hyphens replaced with spaces
33
+ *
34
+ * @example
35
+ * import { replaceUnderscoresAndHyphensWithSpaces } from "@settlemint/sdk-utils";
36
+ *
37
+ * const result = replaceUnderscoresAndHyphensWithSpaces("Already_Spaced-Second");
38
+ * // Returns: "Already Spaced Second"
39
+ */
40
+ declare function replaceUnderscoresAndHyphensWithSpaces(s: string): string;
41
+ /**
42
+ * Truncates a string to a maximum length and appends "..." if it is longer.
43
+ *
44
+ * @param value - The string to truncate
45
+ * @param maxLength - The maximum length of the string
46
+ * @returns The truncated string or the original string if it is shorter than the maximum length
47
+ *
48
+ * @example
49
+ * import { truncate } from "@settlemint/sdk-utils";
50
+ *
51
+ * const truncated = truncate("Hello, world!", 10);
52
+ * // Returns: "Hello, wor..."
53
+ */
54
+ declare function truncate(value: string, maxLength: number): string;
55
+
56
+ //#endregion
57
+ export { camelCaseToWords, capitalizeFirstLetter, replaceUnderscoresAndHyphensWithSpaces, truncate };
58
+ //# sourceMappingURL=string.d.ts.map
package/dist/string.js ADDED
@@ -0,0 +1,72 @@
1
+ //#region src/string.ts
2
+ /**
3
+ * Capitalizes the first letter of a string.
4
+ *
5
+ * @param val - The string to capitalize
6
+ * @returns The input string with its first letter capitalized
7
+ *
8
+ * @example
9
+ * import { capitalizeFirstLetter } from "@settlemint/sdk-utils";
10
+ *
11
+ * const capitalized = capitalizeFirstLetter("hello");
12
+ * // Returns: "Hello"
13
+ */
14
+ function capitalizeFirstLetter(val) {
15
+ return String(val).charAt(0).toUpperCase() + String(val).slice(1);
16
+ }
17
+ /**
18
+ * Converts a camelCase string to a human-readable string.
19
+ *
20
+ * @param s - The camelCase string to convert
21
+ * @returns The human-readable string
22
+ *
23
+ * @example
24
+ * import { camelCaseToWords } from "@settlemint/sdk-utils";
25
+ *
26
+ * const words = camelCaseToWords("camelCaseString");
27
+ * // Returns: "Camel Case String"
28
+ */
29
+ function camelCaseToWords(s) {
30
+ const result = s.replace(/([a-z])([A-Z])/g, "$1 $2");
31
+ const withSpaces = result.replace(/([A-Z])([a-z])/g, " $1$2");
32
+ const capitalized = capitalizeFirstLetter(withSpaces);
33
+ return capitalized.replace(/\s+/g, " ").trim();
34
+ }
35
+ /**
36
+ * Replaces underscores and hyphens with spaces.
37
+ *
38
+ * @param s - The string to replace underscores and hyphens with spaces
39
+ * @returns The input string with underscores and hyphens replaced with spaces
40
+ *
41
+ * @example
42
+ * import { replaceUnderscoresAndHyphensWithSpaces } from "@settlemint/sdk-utils";
43
+ *
44
+ * const result = replaceUnderscoresAndHyphensWithSpaces("Already_Spaced-Second");
45
+ * // Returns: "Already Spaced Second"
46
+ */
47
+ function replaceUnderscoresAndHyphensWithSpaces(s) {
48
+ return s.replace(/[-_]/g, " ");
49
+ }
50
+ /**
51
+ * Truncates a string to a maximum length and appends "..." if it is longer.
52
+ *
53
+ * @param value - The string to truncate
54
+ * @param maxLength - The maximum length of the string
55
+ * @returns The truncated string or the original string if it is shorter than the maximum length
56
+ *
57
+ * @example
58
+ * import { truncate } from "@settlemint/sdk-utils";
59
+ *
60
+ * const truncated = truncate("Hello, world!", 10);
61
+ * // Returns: "Hello, wor..."
62
+ */
63
+ function truncate(value, maxLength) {
64
+ if (value.length <= maxLength) {
65
+ return value;
66
+ }
67
+ return `${value.slice(0, maxLength)}...`;
68
+ }
69
+
70
+ //#endregion
71
+ export { camelCaseToWords, capitalizeFirstLetter, replaceUnderscoresAndHyphensWithSpaces, truncate };
72
+ //# sourceMappingURL=string.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"string.js","names":["val: string","s: string","value: string","maxLength: number"],"sources":["../src/string.ts"],"sourcesContent":["/**\n * Capitalizes the first letter of a string.\n *\n * @param val - The string to capitalize\n * @returns The input string with its first letter capitalized\n *\n * @example\n * import { capitalizeFirstLetter } from \"@settlemint/sdk-utils\";\n *\n * const capitalized = capitalizeFirstLetter(\"hello\");\n * // Returns: \"Hello\"\n */\nexport function capitalizeFirstLetter(val: string) {\n return String(val).charAt(0).toUpperCase() + String(val).slice(1);\n}\n\n/**\n * Converts a camelCase string to a human-readable string.\n *\n * @param s - The camelCase string to convert\n * @returns The human-readable string\n *\n * @example\n * import { camelCaseToWords } from \"@settlemint/sdk-utils\";\n *\n * const words = camelCaseToWords(\"camelCaseString\");\n * // Returns: \"Camel Case String\"\n */\nexport function camelCaseToWords(s: string) {\n const result = s.replace(/([a-z])([A-Z])/g, \"$1 $2\");\n const withSpaces = result.replace(/([A-Z])([a-z])/g, \" $1$2\");\n const capitalized = capitalizeFirstLetter(withSpaces);\n return capitalized.replace(/\\s+/g, \" \").trim();\n}\n\n/**\n * Replaces underscores and hyphens with spaces.\n *\n * @param s - The string to replace underscores and hyphens with spaces\n * @returns The input string with underscores and hyphens replaced with spaces\n *\n * @example\n * import { replaceUnderscoresAndHyphensWithSpaces } from \"@settlemint/sdk-utils\";\n *\n * const result = replaceUnderscoresAndHyphensWithSpaces(\"Already_Spaced-Second\");\n * // Returns: \"Already Spaced Second\"\n */\nexport function replaceUnderscoresAndHyphensWithSpaces(s: string) {\n return s.replace(/[-_]/g, \" \");\n}\n\n/**\n * Truncates a string to a maximum length and appends \"...\" if it is longer.\n *\n * @param value - The string to truncate\n * @param maxLength - The maximum length of the string\n * @returns The truncated string or the original string if it is shorter than the maximum length\n *\n * @example\n * import { truncate } from \"@settlemint/sdk-utils\";\n *\n * const truncated = truncate(\"Hello, world!\", 10);\n * // Returns: \"Hello, wor...\"\n */\nexport function truncate(value: string, maxLength: number) {\n if (value.length <= maxLength) {\n return value;\n }\n return `${value.slice(0, maxLength)}...`;\n}\n"],"mappings":";;;;;;;;;;;;;AAYA,SAAgB,sBAAsBA,KAAa;AACjD,QAAO,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC,aAAa,GAAG,OAAO,IAAI,CAAC,MAAM,EAAE;AAClE;;;;;;;;;;;;;AAcD,SAAgB,iBAAiBC,GAAW;CAC1C,MAAM,SAAS,EAAE,QAAQ,mBAAmB,QAAQ;CACpD,MAAM,aAAa,OAAO,QAAQ,mBAAmB,QAAQ;CAC7D,MAAM,cAAc,sBAAsB,WAAW;AACrD,QAAO,YAAY,QAAQ,QAAQ,IAAI,CAAC,MAAM;AAC/C;;;;;;;;;;;;;AAcD,SAAgB,uCAAuCA,GAAW;AAChE,QAAO,EAAE,QAAQ,SAAS,IAAI;AAC/B;;;;;;;;;;;;;;AAeD,SAAgB,SAASC,OAAeC,WAAmB;AACzD,KAAI,MAAM,UAAU,WAAW;AAC7B,SAAO;CACR;AACD,SAAQ,EAAE,MAAM,MAAM,GAAG,UAAU,CAAC;AACrC"}