@utilix-tech/sdk 0.1.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 (106) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +199 -0
  3. package/dist/api-8aZtWhSj.d.cts +308 -0
  4. package/dist/api-8aZtWhSj.d.ts +308 -0
  5. package/dist/chunk-2CJSLYWI.js +520 -0
  6. package/dist/chunk-3BAHSW4C.js +1385 -0
  7. package/dist/chunk-6YPV2AB5.js +1246 -0
  8. package/dist/chunk-BPVAB4P2.js +1126 -0
  9. package/dist/chunk-FL53T24A.js +257 -0
  10. package/dist/chunk-L6KCTHUW.js +1086 -0
  11. package/dist/chunk-MLKGABMK.js +7 -0
  12. package/dist/chunk-ROTPLW7T.js +265 -0
  13. package/dist/chunk-TSAGO3XP.js +1253 -0
  14. package/dist/chunk-UC656APA.js +1080 -0
  15. package/dist/chunk-W4UBLYFU.js +1219 -0
  16. package/dist/chunk-XST6X3HT.js +896 -0
  17. package/dist/chunk-XXYZLLHI.js +2227 -0
  18. package/dist/chunk-ZKL2VX2G.js +2215 -0
  19. package/dist/chunk-ZPQZEIXP.js +685 -0
  20. package/dist/code-QNrdLIR3.d.cts +327 -0
  21. package/dist/code-QNrdLIR3.d.ts +327 -0
  22. package/dist/color-tPwZCr9H.d.cts +229 -0
  23. package/dist/color-tPwZCr9H.d.ts +229 -0
  24. package/dist/css-Cf7AMGM-.d.cts +318 -0
  25. package/dist/css-Cf7AMGM-.d.ts +318 -0
  26. package/dist/data-rMjWNiOJ.d.cts +215 -0
  27. package/dist/data-rMjWNiOJ.d.ts +215 -0
  28. package/dist/encoding-7gmq-vkV.d.cts +108 -0
  29. package/dist/encoding-7gmq-vkV.d.ts +108 -0
  30. package/dist/generators-BGtRGpJZ.d.cts +118 -0
  31. package/dist/generators-BGtRGpJZ.d.ts +118 -0
  32. package/dist/hashing-CnetQFD_.d.cts +76 -0
  33. package/dist/hashing-CnetQFD_.d.ts +76 -0
  34. package/dist/index.cjs +15466 -0
  35. package/dist/index.d.cts +18 -0
  36. package/dist/index.d.ts +18 -0
  37. package/dist/index.js +20 -0
  38. package/dist/json-BjSoIS1h.d.cts +198 -0
  39. package/dist/json-BjSoIS1h.d.ts +198 -0
  40. package/dist/misc-DcVBManm.d.cts +201 -0
  41. package/dist/misc-DcVBManm.d.ts +201 -0
  42. package/dist/network-CNtmrDeN.d.cts +170 -0
  43. package/dist/network-CNtmrDeN.d.ts +170 -0
  44. package/dist/text-DqAjPtQ0.d.cts +319 -0
  45. package/dist/text-DqAjPtQ0.d.ts +319 -0
  46. package/dist/time-DbT8fjaF.d.cts +145 -0
  47. package/dist/time-DbT8fjaF.d.ts +145 -0
  48. package/dist/tools/api.cjs +1216 -0
  49. package/dist/tools/api.d.cts +1 -0
  50. package/dist/tools/api.d.ts +1 -0
  51. package/dist/tools/api.js +2 -0
  52. package/dist/tools/code.cjs +2212 -0
  53. package/dist/tools/code.d.cts +1 -0
  54. package/dist/tools/code.d.ts +1 -0
  55. package/dist/tools/code.js +2 -0
  56. package/dist/tools/color.cjs +1122 -0
  57. package/dist/tools/color.d.cts +1 -0
  58. package/dist/tools/color.d.ts +1 -0
  59. package/dist/tools/color.js +2 -0
  60. package/dist/tools/css.cjs +1242 -0
  61. package/dist/tools/css.d.cts +1 -0
  62. package/dist/tools/css.d.ts +1 -0
  63. package/dist/tools/css.js +2 -0
  64. package/dist/tools/data.cjs +1097 -0
  65. package/dist/tools/data.d.cts +1 -0
  66. package/dist/tools/data.d.ts +1 -0
  67. package/dist/tools/data.js +2 -0
  68. package/dist/tools/encoding.cjs +261 -0
  69. package/dist/tools/encoding.d.cts +1 -0
  70. package/dist/tools/encoding.d.ts +1 -0
  71. package/dist/tools/encoding.js +2 -0
  72. package/dist/tools/generators.cjs +521 -0
  73. package/dist/tools/generators.d.cts +1 -0
  74. package/dist/tools/generators.d.ts +1 -0
  75. package/dist/tools/generators.js +2 -0
  76. package/dist/tools/hashing.cjs +259 -0
  77. package/dist/tools/hashing.d.cts +1 -0
  78. package/dist/tools/hashing.d.ts +1 -0
  79. package/dist/tools/hashing.js +2 -0
  80. package/dist/tools/json.cjs +1270 -0
  81. package/dist/tools/json.d.cts +1 -0
  82. package/dist/tools/json.d.ts +1 -0
  83. package/dist/tools/json.js +2 -0
  84. package/dist/tools/misc.cjs +1082 -0
  85. package/dist/tools/misc.d.cts +1 -0
  86. package/dist/tools/misc.d.ts +1 -0
  87. package/dist/tools/misc.js +2 -0
  88. package/dist/tools/network.cjs +1381 -0
  89. package/dist/tools/network.d.cts +1 -0
  90. package/dist/tools/network.d.ts +1 -0
  91. package/dist/tools/network.js +2 -0
  92. package/dist/tools/text.cjs +2224 -0
  93. package/dist/tools/text.d.cts +1 -0
  94. package/dist/tools/text.d.ts +1 -0
  95. package/dist/tools/text.js +2 -0
  96. package/dist/tools/time.cjs +681 -0
  97. package/dist/tools/time.d.cts +1 -0
  98. package/dist/tools/time.d.ts +1 -0
  99. package/dist/tools/time.js +2 -0
  100. package/dist/tools/units.cjs +892 -0
  101. package/dist/tools/units.d.cts +1 -0
  102. package/dist/tools/units.d.ts +1 -0
  103. package/dist/tools/units.js +2 -0
  104. package/dist/units-6lwDYBvX.d.cts +302 -0
  105. package/dist/units-6lwDYBvX.d.ts +302 -0
  106. package/package.json +148 -0
@@ -0,0 +1,18 @@
1
+ export { j as json } from './json-BjSoIS1h.cjs';
2
+ export { e as encoding } from './encoding-7gmq-vkV.cjs';
3
+ export { h as hashing } from './hashing-CnetQFD_.cjs';
4
+ export { t as text } from './text-DqAjPtQ0.cjs';
5
+ export { d as data } from './data-rMjWNiOJ.cjs';
6
+ export { g as generators } from './generators-BGtRGpJZ.cjs';
7
+ export { t as time } from './time-DbT8fjaF.cjs';
8
+ export { u as units } from './units-6lwDYBvX.cjs';
9
+ export { n as network } from './network-CNtmrDeN.cjs';
10
+ export { a as api } from './api-8aZtWhSj.cjs';
11
+ export { c as code } from './code-QNrdLIR3.cjs';
12
+ export { c as color } from './color-tPwZCr9H.cjs';
13
+ export { c as css } from './css-Cf7AMGM-.cjs';
14
+ export { m as misc } from './misc-DcVBManm.cjs';
15
+
16
+ declare const version = "0.1.0";
17
+
18
+ export { version };
@@ -0,0 +1,18 @@
1
+ export { j as json } from './json-BjSoIS1h.js';
2
+ export { e as encoding } from './encoding-7gmq-vkV.js';
3
+ export { h as hashing } from './hashing-CnetQFD_.js';
4
+ export { t as text } from './text-DqAjPtQ0.js';
5
+ export { d as data } from './data-rMjWNiOJ.js';
6
+ export { g as generators } from './generators-BGtRGpJZ.js';
7
+ export { t as time } from './time-DbT8fjaF.js';
8
+ export { u as units } from './units-6lwDYBvX.js';
9
+ export { n as network } from './network-CNtmrDeN.js';
10
+ export { a as api } from './api-8aZtWhSj.js';
11
+ export { c as code } from './code-QNrdLIR3.js';
12
+ export { c as color } from './color-tPwZCr9H.js';
13
+ export { c as css } from './css-Cf7AMGM-.js';
14
+ export { m as misc } from './misc-DcVBManm.js';
15
+
16
+ declare const version = "0.1.0";
17
+
18
+ export { version };
package/dist/index.js ADDED
@@ -0,0 +1,20 @@
1
+ export { units_exports as units } from './chunk-XST6X3HT.js';
2
+ export { network_exports as network } from './chunk-3BAHSW4C.js';
3
+ export { api_exports as api } from './chunk-W4UBLYFU.js';
4
+ export { code_exports as code } from './chunk-ZKL2VX2G.js';
5
+ export { color_exports as color } from './chunk-BPVAB4P2.js';
6
+ export { css_exports as css } from './chunk-6YPV2AB5.js';
7
+ export { misc_exports as misc } from './chunk-L6KCTHUW.js';
8
+ export { json_exports as json } from './chunk-TSAGO3XP.js';
9
+ export { encoding_exports as encoding } from './chunk-ROTPLW7T.js';
10
+ export { hashing_exports as hashing } from './chunk-FL53T24A.js';
11
+ export { text_exports as text } from './chunk-XXYZLLHI.js';
12
+ export { data_exports as data } from './chunk-UC656APA.js';
13
+ export { generators_exports as generators } from './chunk-2CJSLYWI.js';
14
+ export { time_exports as time } from './chunk-ZPQZEIXP.js';
15
+ import './chunk-MLKGABMK.js';
16
+
17
+ // src/index.ts
18
+ var version = "0.1.0";
19
+
20
+ export { version };
@@ -0,0 +1,198 @@
1
+ /**
2
+ * @utilix/sdk — json module
3
+ *
4
+ * Tools covered:
5
+ * - json-formatter : parseJson, (re-exported formatJson/minifyJson from json-minifier)
6
+ * - json-minifier : minifyJson, formatJson, getJsonStats
7
+ * - json-diff : diffJson, formatDiffLine
8
+ * - json-to-csv : jsonToCsv, csvToJson
9
+ * - json-path : evaluateJsonPath, validateJsonPath
10
+ * - json-schema : validateJson, validateJsonString, generateExample
11
+ * - yaml-json : yamlToJson, jsonToYaml, detectFormat
12
+ * - json-to-typescript : jsonToTypescript, inferType
13
+ * - json-to-go : jsonToGo, parseStructs, toPascalCase, inferGoType
14
+ * - json-to-python : jsonToPython, toSnakeCase, inferPythonType
15
+ * - json-to-zod : jsonToZod
16
+ */
17
+ type ParseStatus = 'idle' | 'valid' | 'error';
18
+ interface JsonParseResult {
19
+ status: ParseStatus;
20
+ output: string;
21
+ error: string | null;
22
+ lines: number;
23
+ bytes: number;
24
+ }
25
+ declare function parseJson(input: string, indent: number | null): JsonParseResult;
26
+ declare function minifyJson(input: string): string | {
27
+ error: string;
28
+ };
29
+ declare function formatJson(input: string, indent?: number): string | {
30
+ error: string;
31
+ };
32
+ declare function getJsonStats(input: string): {
33
+ originalSize: number;
34
+ minifiedSize: number;
35
+ savingPercent: number;
36
+ } | {
37
+ error: string;
38
+ };
39
+ type DiffType = 'added' | 'removed' | 'changed' | 'unchanged';
40
+ interface DiffNode {
41
+ type: DiffType;
42
+ path: string;
43
+ leftValue?: unknown;
44
+ rightValue?: unknown;
45
+ children?: DiffNode[];
46
+ }
47
+ interface JsonDiffResult {
48
+ nodes: DiffNode[];
49
+ addedCount: number;
50
+ removedCount: number;
51
+ changedCount: number;
52
+ unchanged: boolean;
53
+ }
54
+ declare function diffJson(left: string, right: string): JsonDiffResult | {
55
+ error: string;
56
+ };
57
+ declare function formatDiffLine(node: DiffNode): string;
58
+ interface CsvOptions {
59
+ delimiter?: ',' | ';' | '\t';
60
+ includeHeaders?: boolean;
61
+ nullAs?: string;
62
+ }
63
+ declare function jsonToCsv(json: string, options?: CsvOptions): string | {
64
+ error: string;
65
+ };
66
+ declare function csvToJson(csv: string, delimiter?: ',' | ';' | '\t'): string | {
67
+ error: string;
68
+ };
69
+ interface JsonPathResult {
70
+ matches: unknown[];
71
+ count: number;
72
+ paths: string[];
73
+ error?: string;
74
+ }
75
+ declare function evaluateJsonPath(json: string, path: string): JsonPathResult;
76
+ declare function validateJsonPath(path: string): {
77
+ valid: boolean;
78
+ error?: string;
79
+ };
80
+ interface ValidationError {
81
+ path: string;
82
+ message: string;
83
+ }
84
+ interface ValidationResult {
85
+ valid: boolean;
86
+ errors: ValidationError[];
87
+ }
88
+ declare function validateJson(data: unknown, schema: object): ValidationResult;
89
+ declare function validateJsonString(dataStr: string, schemaStr: string): ValidationResult | {
90
+ parseError: string;
91
+ };
92
+ declare function generateExample(schema: object): unknown;
93
+ declare function yamlToJson(input: string, pretty?: boolean): string | {
94
+ error: string;
95
+ };
96
+ declare function jsonToYaml(input: string): string | {
97
+ error: string;
98
+ };
99
+ declare function detectFormat(input: string): 'json' | 'yaml' | 'unknown';
100
+ interface ConvertOptions {
101
+ rootName?: string;
102
+ useInterface?: boolean;
103
+ optionalFields?: boolean;
104
+ }
105
+ declare function inferType(value: unknown, name: string, interfaces: string[]): string;
106
+ declare function jsonToTypescript(json: string, options?: ConvertOptions): string | {
107
+ error: string;
108
+ };
109
+ interface GoField {
110
+ name: string;
111
+ jsonKey: string;
112
+ goType: string;
113
+ omitempty: boolean;
114
+ }
115
+ interface GoStruct {
116
+ name: string;
117
+ fields: GoField[];
118
+ }
119
+ declare function toPascalCase(key: string): string;
120
+ declare function inferGoType(value: unknown, fieldName?: string): string;
121
+ declare function parseStructs(json: string, rootName?: string): GoStruct[] | {
122
+ error: string;
123
+ };
124
+ declare function jsonToGo(json: string, rootTypeName?: string): string | {
125
+ error: string;
126
+ };
127
+ type PythonMode = 'typeddict' | 'dataclass' | 'pydantic';
128
+ interface PythonField {
129
+ name: string;
130
+ jsonKey: string;
131
+ pyType: string;
132
+ optional: boolean;
133
+ }
134
+ interface PythonClass {
135
+ name: string;
136
+ fields: PythonField[];
137
+ mode: PythonMode;
138
+ }
139
+ declare function toSnakeCase(key: string): string;
140
+ declare function inferPythonType(value: unknown, fieldName?: string): string;
141
+ declare function jsonToPython(json: string, rootName?: string, mode?: PythonMode): string | {
142
+ error: string;
143
+ };
144
+ interface ZodOptions {
145
+ rootName?: string;
146
+ coerce?: boolean;
147
+ }
148
+ declare function jsonToZod(json: string, options?: ZodOptions): string | {
149
+ error: string;
150
+ };
151
+
152
+ type json_ConvertOptions = ConvertOptions;
153
+ type json_CsvOptions = CsvOptions;
154
+ type json_DiffNode = DiffNode;
155
+ type json_DiffType = DiffType;
156
+ type json_GoField = GoField;
157
+ type json_GoStruct = GoStruct;
158
+ type json_JsonDiffResult = JsonDiffResult;
159
+ type json_JsonParseResult = JsonParseResult;
160
+ type json_JsonPathResult = JsonPathResult;
161
+ type json_ParseStatus = ParseStatus;
162
+ type json_PythonClass = PythonClass;
163
+ type json_PythonField = PythonField;
164
+ type json_PythonMode = PythonMode;
165
+ type json_ValidationError = ValidationError;
166
+ type json_ValidationResult = ValidationResult;
167
+ type json_ZodOptions = ZodOptions;
168
+ declare const json_csvToJson: typeof csvToJson;
169
+ declare const json_detectFormat: typeof detectFormat;
170
+ declare const json_diffJson: typeof diffJson;
171
+ declare const json_evaluateJsonPath: typeof evaluateJsonPath;
172
+ declare const json_formatDiffLine: typeof formatDiffLine;
173
+ declare const json_formatJson: typeof formatJson;
174
+ declare const json_generateExample: typeof generateExample;
175
+ declare const json_getJsonStats: typeof getJsonStats;
176
+ declare const json_inferGoType: typeof inferGoType;
177
+ declare const json_inferPythonType: typeof inferPythonType;
178
+ declare const json_inferType: typeof inferType;
179
+ declare const json_jsonToCsv: typeof jsonToCsv;
180
+ declare const json_jsonToGo: typeof jsonToGo;
181
+ declare const json_jsonToPython: typeof jsonToPython;
182
+ declare const json_jsonToTypescript: typeof jsonToTypescript;
183
+ declare const json_jsonToYaml: typeof jsonToYaml;
184
+ declare const json_jsonToZod: typeof jsonToZod;
185
+ declare const json_minifyJson: typeof minifyJson;
186
+ declare const json_parseJson: typeof parseJson;
187
+ declare const json_parseStructs: typeof parseStructs;
188
+ declare const json_toPascalCase: typeof toPascalCase;
189
+ declare const json_toSnakeCase: typeof toSnakeCase;
190
+ declare const json_validateJson: typeof validateJson;
191
+ declare const json_validateJsonPath: typeof validateJsonPath;
192
+ declare const json_validateJsonString: typeof validateJsonString;
193
+ declare const json_yamlToJson: typeof yamlToJson;
194
+ declare namespace json {
195
+ export { type json_ConvertOptions as ConvertOptions, type json_CsvOptions as CsvOptions, type json_DiffNode as DiffNode, type json_DiffType as DiffType, type json_GoField as GoField, type json_GoStruct as GoStruct, type json_JsonDiffResult as JsonDiffResult, type json_JsonParseResult as JsonParseResult, type json_JsonPathResult as JsonPathResult, type json_ParseStatus as ParseStatus, type json_PythonClass as PythonClass, type json_PythonField as PythonField, type json_PythonMode as PythonMode, type json_ValidationError as ValidationError, type json_ValidationResult as ValidationResult, type json_ZodOptions as ZodOptions, json_csvToJson as csvToJson, json_detectFormat as detectFormat, json_diffJson as diffJson, json_evaluateJsonPath as evaluateJsonPath, json_formatDiffLine as formatDiffLine, json_formatJson as formatJson, json_generateExample as generateExample, json_getJsonStats as getJsonStats, json_inferGoType as inferGoType, json_inferPythonType as inferPythonType, json_inferType as inferType, json_jsonToCsv as jsonToCsv, json_jsonToGo as jsonToGo, json_jsonToPython as jsonToPython, json_jsonToTypescript as jsonToTypescript, json_jsonToYaml as jsonToYaml, json_jsonToZod as jsonToZod, json_minifyJson as minifyJson, json_parseJson as parseJson, json_parseStructs as parseStructs, json_toPascalCase as toPascalCase, json_toSnakeCase as toSnakeCase, json_validateJson as validateJson, json_validateJsonPath as validateJsonPath, json_validateJsonString as validateJsonString, json_yamlToJson as yamlToJson };
196
+ }
197
+
198
+ export { jsonToZod as A, minifyJson as B, type ConvertOptions as C, type DiffNode as D, parseJson as E, parseStructs as F, type GoField as G, toPascalCase as H, toSnakeCase as I, type JsonDiffResult as J, validateJson as K, validateJsonPath as L, validateJsonString as M, yamlToJson as N, type ParseStatus as P, type ValidationError as V, type ZodOptions as Z, type CsvOptions as a, type DiffType as b, type GoStruct as c, type JsonParseResult as d, type JsonPathResult as e, type PythonClass as f, type PythonField as g, type PythonMode as h, type ValidationResult as i, json as j, csvToJson as k, detectFormat as l, diffJson as m, evaluateJsonPath as n, formatDiffLine as o, formatJson as p, generateExample as q, getJsonStats as r, inferGoType as s, inferPythonType as t, inferType as u, jsonToCsv as v, jsonToGo as w, jsonToPython as x, jsonToTypescript as y, jsonToYaml as z };
@@ -0,0 +1,198 @@
1
+ /**
2
+ * @utilix/sdk — json module
3
+ *
4
+ * Tools covered:
5
+ * - json-formatter : parseJson, (re-exported formatJson/minifyJson from json-minifier)
6
+ * - json-minifier : minifyJson, formatJson, getJsonStats
7
+ * - json-diff : diffJson, formatDiffLine
8
+ * - json-to-csv : jsonToCsv, csvToJson
9
+ * - json-path : evaluateJsonPath, validateJsonPath
10
+ * - json-schema : validateJson, validateJsonString, generateExample
11
+ * - yaml-json : yamlToJson, jsonToYaml, detectFormat
12
+ * - json-to-typescript : jsonToTypescript, inferType
13
+ * - json-to-go : jsonToGo, parseStructs, toPascalCase, inferGoType
14
+ * - json-to-python : jsonToPython, toSnakeCase, inferPythonType
15
+ * - json-to-zod : jsonToZod
16
+ */
17
+ type ParseStatus = 'idle' | 'valid' | 'error';
18
+ interface JsonParseResult {
19
+ status: ParseStatus;
20
+ output: string;
21
+ error: string | null;
22
+ lines: number;
23
+ bytes: number;
24
+ }
25
+ declare function parseJson(input: string, indent: number | null): JsonParseResult;
26
+ declare function minifyJson(input: string): string | {
27
+ error: string;
28
+ };
29
+ declare function formatJson(input: string, indent?: number): string | {
30
+ error: string;
31
+ };
32
+ declare function getJsonStats(input: string): {
33
+ originalSize: number;
34
+ minifiedSize: number;
35
+ savingPercent: number;
36
+ } | {
37
+ error: string;
38
+ };
39
+ type DiffType = 'added' | 'removed' | 'changed' | 'unchanged';
40
+ interface DiffNode {
41
+ type: DiffType;
42
+ path: string;
43
+ leftValue?: unknown;
44
+ rightValue?: unknown;
45
+ children?: DiffNode[];
46
+ }
47
+ interface JsonDiffResult {
48
+ nodes: DiffNode[];
49
+ addedCount: number;
50
+ removedCount: number;
51
+ changedCount: number;
52
+ unchanged: boolean;
53
+ }
54
+ declare function diffJson(left: string, right: string): JsonDiffResult | {
55
+ error: string;
56
+ };
57
+ declare function formatDiffLine(node: DiffNode): string;
58
+ interface CsvOptions {
59
+ delimiter?: ',' | ';' | '\t';
60
+ includeHeaders?: boolean;
61
+ nullAs?: string;
62
+ }
63
+ declare function jsonToCsv(json: string, options?: CsvOptions): string | {
64
+ error: string;
65
+ };
66
+ declare function csvToJson(csv: string, delimiter?: ',' | ';' | '\t'): string | {
67
+ error: string;
68
+ };
69
+ interface JsonPathResult {
70
+ matches: unknown[];
71
+ count: number;
72
+ paths: string[];
73
+ error?: string;
74
+ }
75
+ declare function evaluateJsonPath(json: string, path: string): JsonPathResult;
76
+ declare function validateJsonPath(path: string): {
77
+ valid: boolean;
78
+ error?: string;
79
+ };
80
+ interface ValidationError {
81
+ path: string;
82
+ message: string;
83
+ }
84
+ interface ValidationResult {
85
+ valid: boolean;
86
+ errors: ValidationError[];
87
+ }
88
+ declare function validateJson(data: unknown, schema: object): ValidationResult;
89
+ declare function validateJsonString(dataStr: string, schemaStr: string): ValidationResult | {
90
+ parseError: string;
91
+ };
92
+ declare function generateExample(schema: object): unknown;
93
+ declare function yamlToJson(input: string, pretty?: boolean): string | {
94
+ error: string;
95
+ };
96
+ declare function jsonToYaml(input: string): string | {
97
+ error: string;
98
+ };
99
+ declare function detectFormat(input: string): 'json' | 'yaml' | 'unknown';
100
+ interface ConvertOptions {
101
+ rootName?: string;
102
+ useInterface?: boolean;
103
+ optionalFields?: boolean;
104
+ }
105
+ declare function inferType(value: unknown, name: string, interfaces: string[]): string;
106
+ declare function jsonToTypescript(json: string, options?: ConvertOptions): string | {
107
+ error: string;
108
+ };
109
+ interface GoField {
110
+ name: string;
111
+ jsonKey: string;
112
+ goType: string;
113
+ omitempty: boolean;
114
+ }
115
+ interface GoStruct {
116
+ name: string;
117
+ fields: GoField[];
118
+ }
119
+ declare function toPascalCase(key: string): string;
120
+ declare function inferGoType(value: unknown, fieldName?: string): string;
121
+ declare function parseStructs(json: string, rootName?: string): GoStruct[] | {
122
+ error: string;
123
+ };
124
+ declare function jsonToGo(json: string, rootTypeName?: string): string | {
125
+ error: string;
126
+ };
127
+ type PythonMode = 'typeddict' | 'dataclass' | 'pydantic';
128
+ interface PythonField {
129
+ name: string;
130
+ jsonKey: string;
131
+ pyType: string;
132
+ optional: boolean;
133
+ }
134
+ interface PythonClass {
135
+ name: string;
136
+ fields: PythonField[];
137
+ mode: PythonMode;
138
+ }
139
+ declare function toSnakeCase(key: string): string;
140
+ declare function inferPythonType(value: unknown, fieldName?: string): string;
141
+ declare function jsonToPython(json: string, rootName?: string, mode?: PythonMode): string | {
142
+ error: string;
143
+ };
144
+ interface ZodOptions {
145
+ rootName?: string;
146
+ coerce?: boolean;
147
+ }
148
+ declare function jsonToZod(json: string, options?: ZodOptions): string | {
149
+ error: string;
150
+ };
151
+
152
+ type json_ConvertOptions = ConvertOptions;
153
+ type json_CsvOptions = CsvOptions;
154
+ type json_DiffNode = DiffNode;
155
+ type json_DiffType = DiffType;
156
+ type json_GoField = GoField;
157
+ type json_GoStruct = GoStruct;
158
+ type json_JsonDiffResult = JsonDiffResult;
159
+ type json_JsonParseResult = JsonParseResult;
160
+ type json_JsonPathResult = JsonPathResult;
161
+ type json_ParseStatus = ParseStatus;
162
+ type json_PythonClass = PythonClass;
163
+ type json_PythonField = PythonField;
164
+ type json_PythonMode = PythonMode;
165
+ type json_ValidationError = ValidationError;
166
+ type json_ValidationResult = ValidationResult;
167
+ type json_ZodOptions = ZodOptions;
168
+ declare const json_csvToJson: typeof csvToJson;
169
+ declare const json_detectFormat: typeof detectFormat;
170
+ declare const json_diffJson: typeof diffJson;
171
+ declare const json_evaluateJsonPath: typeof evaluateJsonPath;
172
+ declare const json_formatDiffLine: typeof formatDiffLine;
173
+ declare const json_formatJson: typeof formatJson;
174
+ declare const json_generateExample: typeof generateExample;
175
+ declare const json_getJsonStats: typeof getJsonStats;
176
+ declare const json_inferGoType: typeof inferGoType;
177
+ declare const json_inferPythonType: typeof inferPythonType;
178
+ declare const json_inferType: typeof inferType;
179
+ declare const json_jsonToCsv: typeof jsonToCsv;
180
+ declare const json_jsonToGo: typeof jsonToGo;
181
+ declare const json_jsonToPython: typeof jsonToPython;
182
+ declare const json_jsonToTypescript: typeof jsonToTypescript;
183
+ declare const json_jsonToYaml: typeof jsonToYaml;
184
+ declare const json_jsonToZod: typeof jsonToZod;
185
+ declare const json_minifyJson: typeof minifyJson;
186
+ declare const json_parseJson: typeof parseJson;
187
+ declare const json_parseStructs: typeof parseStructs;
188
+ declare const json_toPascalCase: typeof toPascalCase;
189
+ declare const json_toSnakeCase: typeof toSnakeCase;
190
+ declare const json_validateJson: typeof validateJson;
191
+ declare const json_validateJsonPath: typeof validateJsonPath;
192
+ declare const json_validateJsonString: typeof validateJsonString;
193
+ declare const json_yamlToJson: typeof yamlToJson;
194
+ declare namespace json {
195
+ export { type json_ConvertOptions as ConvertOptions, type json_CsvOptions as CsvOptions, type json_DiffNode as DiffNode, type json_DiffType as DiffType, type json_GoField as GoField, type json_GoStruct as GoStruct, type json_JsonDiffResult as JsonDiffResult, type json_JsonParseResult as JsonParseResult, type json_JsonPathResult as JsonPathResult, type json_ParseStatus as ParseStatus, type json_PythonClass as PythonClass, type json_PythonField as PythonField, type json_PythonMode as PythonMode, type json_ValidationError as ValidationError, type json_ValidationResult as ValidationResult, type json_ZodOptions as ZodOptions, json_csvToJson as csvToJson, json_detectFormat as detectFormat, json_diffJson as diffJson, json_evaluateJsonPath as evaluateJsonPath, json_formatDiffLine as formatDiffLine, json_formatJson as formatJson, json_generateExample as generateExample, json_getJsonStats as getJsonStats, json_inferGoType as inferGoType, json_inferPythonType as inferPythonType, json_inferType as inferType, json_jsonToCsv as jsonToCsv, json_jsonToGo as jsonToGo, json_jsonToPython as jsonToPython, json_jsonToTypescript as jsonToTypescript, json_jsonToYaml as jsonToYaml, json_jsonToZod as jsonToZod, json_minifyJson as minifyJson, json_parseJson as parseJson, json_parseStructs as parseStructs, json_toPascalCase as toPascalCase, json_toSnakeCase as toSnakeCase, json_validateJson as validateJson, json_validateJsonPath as validateJsonPath, json_validateJsonString as validateJsonString, json_yamlToJson as yamlToJson };
196
+ }
197
+
198
+ export { jsonToZod as A, minifyJson as B, type ConvertOptions as C, type DiffNode as D, parseJson as E, parseStructs as F, type GoField as G, toPascalCase as H, toSnakeCase as I, type JsonDiffResult as J, validateJson as K, validateJsonPath as L, validateJsonString as M, yamlToJson as N, type ParseStatus as P, type ValidationError as V, type ZodOptions as Z, type CsvOptions as a, type DiffType as b, type GoStruct as c, type JsonParseResult as d, type JsonPathResult as e, type PythonClass as f, type PythonField as g, type PythonMode as h, type ValidationResult as i, json as j, csvToJson as k, detectFormat as l, diffJson as m, evaluateJsonPath as n, formatDiffLine as o, formatJson as p, generateExample as q, getJsonStats as r, inferGoType as s, inferPythonType as t, inferType as u, jsonToCsv as v, jsonToGo as w, jsonToPython as x, jsonToTypescript as y, jsonToYaml as z };
@@ -0,0 +1,201 @@
1
+ /**
2
+ * @module misc
3
+ * Miscellaneous tools for the @utilix/sdk Node.js SDK.
4
+ *
5
+ * Tools covered:
6
+ * - unicode : analyzeString, toUnicodeEscape, fromUnicodeEscape, codePointToChar, charToCodePoint
7
+ * - favicon-gen : generateSvgFavicon, svgToDataUrl (Node-compatible), DEFAULT_CONFIG, COLOR_PRESETS
8
+ * - svg-viewer : analyzeSvg, sanitizeSvg, optimizeSvg, formatSvg, minifySvg
9
+ * - image-compressor : formatBytes, calcSavings, detectFormatFromDataUrl, detectFormatFromFilename,
10
+ * getDefaultQuality, getSupportedOutputFormats, formatLabel, calcResizeDimensions
11
+ * - image-converter : getConversionWarnings, getSupportedFormats, getDownloadFilename,
12
+ * FORMAT_EXTENSIONS, FORMAT_LABELS
13
+ * - number-words : numberToWords, numberToOrdinal, ordinalWords, numberToRoman, romanToNumber
14
+ * - random-data : generateSingle, generateData, DATA_TYPES
15
+ *
16
+ * NOTE: Canvas-based image compression/conversion is not supported in Node. The relevant
17
+ * functions (compressImage, convertImage) are intentionally omitted; use the REST API or
18
+ * the Python SDK instead. The pure-logic helpers from both modules ARE exported.
19
+ */
20
+ interface CodePoint {
21
+ char: string;
22
+ codePoint: number;
23
+ hex: string;
24
+ htmlEntity: string;
25
+ htmlHex: string;
26
+ utf8Bytes: string;
27
+ utf16: string;
28
+ name?: string;
29
+ category: string;
30
+ }
31
+ declare function analyzeString(input: string): CodePoint[];
32
+ declare function toUnicodeEscape(input: string): string;
33
+ declare function fromUnicodeEscape(input: string): string | {
34
+ error: string;
35
+ };
36
+ declare function codePointToChar(codePoint: number): string;
37
+ declare function charToCodePoint(char: string): number;
38
+ type Shape = 'square' | 'circle' | 'rounded';
39
+ interface FaviconConfig {
40
+ text: string;
41
+ bgColor: string;
42
+ textColor: string;
43
+ shape: Shape;
44
+ fontSize: number;
45
+ fontWeight: 'normal' | 'bold';
46
+ size: 32 | 48 | 64 | 128;
47
+ }
48
+ declare function generateSvgFavicon(config: FaviconConfig): string;
49
+ /** Convert an SVG string to a base64 data URL. Node-compatible (uses Buffer). */
50
+ declare function svgToDataUrl(svg: string): string;
51
+ declare const DEFAULT_CONFIG: FaviconConfig;
52
+ declare const COLOR_PRESETS: Array<{
53
+ name: string;
54
+ bg: string;
55
+ text: string;
56
+ }>;
57
+ interface SvgInfo {
58
+ width: string | null;
59
+ height: string | null;
60
+ viewBox: string | null;
61
+ elementCount: number;
62
+ hasAnimation: boolean;
63
+ hasScript: boolean;
64
+ hasExternalRef: boolean;
65
+ usedElements: string[];
66
+ }
67
+ declare function analyzeSvg(svg: string): SvgInfo | {
68
+ error: string;
69
+ };
70
+ declare function sanitizeSvg(svg: string): string;
71
+ declare function optimizeSvg(svg: string): string;
72
+ declare function formatSvg(svg: string): string;
73
+ declare function minifySvg(svg: string): string;
74
+ type ImageFormat = 'image/jpeg' | 'image/png' | 'image/webp' | 'image/gif';
75
+ interface CompressionOptions {
76
+ quality: number;
77
+ maxWidth?: number;
78
+ maxHeight?: number;
79
+ outputFormat: ImageFormat;
80
+ }
81
+ interface CompressionResult {
82
+ originalSize: number;
83
+ compressedSize: number;
84
+ savedBytes: number;
85
+ savedPercent: number;
86
+ width: number;
87
+ height: number;
88
+ format: ImageFormat;
89
+ dataUrl: string;
90
+ }
91
+ declare function formatBytes(bytes: number): string;
92
+ declare function calcSavings(originalBytes: number, compressedBytes: number): {
93
+ savedBytes: number;
94
+ savedPercent: number;
95
+ };
96
+ declare function detectFormatFromDataUrl(dataUrl: string): ImageFormat | null;
97
+ declare function detectFormatFromFilename(filename: string): ImageFormat | null;
98
+ declare function getDefaultQuality(format: ImageFormat): number;
99
+ declare function getSupportedOutputFormats(): ImageFormat[];
100
+ declare function formatLabel(format: ImageFormat): string;
101
+ declare function calcResizeDimensions(width: number, height: number, maxWidth?: number, maxHeight?: number): {
102
+ width: number;
103
+ height: number;
104
+ changed: boolean;
105
+ };
106
+ /** Narrower type used by image-converter (no gif output) */
107
+ type ConvertImageFormat = 'image/jpeg' | 'image/png' | 'image/webp';
108
+ interface ConversionOptions {
109
+ outputFormat: ConvertImageFormat;
110
+ quality?: number;
111
+ backgroundColor?: string;
112
+ }
113
+ declare const FORMAT_EXTENSIONS: Record<ConvertImageFormat, string>;
114
+ declare const FORMAT_LABELS: Record<ConvertImageFormat, string>;
115
+ declare function getConversionWarnings(from: ConvertImageFormat, to: ConvertImageFormat): string[];
116
+ declare function getSupportedFormats(): ConvertImageFormat[];
117
+ declare function getDownloadFilename(originalName: string, outputFormat: ConvertImageFormat): string;
118
+ declare function numberToWords(n: number): string | {
119
+ error: string;
120
+ };
121
+ declare function numberToOrdinal(n: number): string | {
122
+ error: string;
123
+ };
124
+ declare function ordinalWords(n: number): string | {
125
+ error: string;
126
+ };
127
+ declare function numberToRoman(n: number): string | {
128
+ error: string;
129
+ };
130
+ declare function romanToNumber(roman: string): number | {
131
+ error: string;
132
+ };
133
+ type DataType = 'name' | 'email' | 'uuid' | 'phone' | 'date' | 'number' | 'boolean' | 'color' | 'url' | 'ipv4' | 'sentence' | 'paragraph';
134
+ interface RandomConfig {
135
+ type: DataType;
136
+ count: number;
137
+ options?: {
138
+ min?: number;
139
+ max?: number;
140
+ dateFormat?: 'iso' | 'us' | 'eu';
141
+ };
142
+ }
143
+ declare const DATA_TYPES: {
144
+ value: DataType;
145
+ label: string;
146
+ example: string;
147
+ }[];
148
+ declare function generateSingle(type: DataType, options?: RandomConfig['options']): string;
149
+ declare function generateData(config: RandomConfig): string[];
150
+
151
+ declare const misc_COLOR_PRESETS: typeof COLOR_PRESETS;
152
+ type misc_CodePoint = CodePoint;
153
+ type misc_CompressionOptions = CompressionOptions;
154
+ type misc_CompressionResult = CompressionResult;
155
+ type misc_ConversionOptions = ConversionOptions;
156
+ type misc_ConvertImageFormat = ConvertImageFormat;
157
+ declare const misc_DATA_TYPES: typeof DATA_TYPES;
158
+ declare const misc_DEFAULT_CONFIG: typeof DEFAULT_CONFIG;
159
+ type misc_DataType = DataType;
160
+ declare const misc_FORMAT_EXTENSIONS: typeof FORMAT_EXTENSIONS;
161
+ declare const misc_FORMAT_LABELS: typeof FORMAT_LABELS;
162
+ type misc_FaviconConfig = FaviconConfig;
163
+ type misc_ImageFormat = ImageFormat;
164
+ type misc_RandomConfig = RandomConfig;
165
+ type misc_Shape = Shape;
166
+ type misc_SvgInfo = SvgInfo;
167
+ declare const misc_analyzeString: typeof analyzeString;
168
+ declare const misc_analyzeSvg: typeof analyzeSvg;
169
+ declare const misc_calcResizeDimensions: typeof calcResizeDimensions;
170
+ declare const misc_calcSavings: typeof calcSavings;
171
+ declare const misc_charToCodePoint: typeof charToCodePoint;
172
+ declare const misc_codePointToChar: typeof codePointToChar;
173
+ declare const misc_detectFormatFromDataUrl: typeof detectFormatFromDataUrl;
174
+ declare const misc_detectFormatFromFilename: typeof detectFormatFromFilename;
175
+ declare const misc_formatBytes: typeof formatBytes;
176
+ declare const misc_formatLabel: typeof formatLabel;
177
+ declare const misc_formatSvg: typeof formatSvg;
178
+ declare const misc_fromUnicodeEscape: typeof fromUnicodeEscape;
179
+ declare const misc_generateData: typeof generateData;
180
+ declare const misc_generateSingle: typeof generateSingle;
181
+ declare const misc_generateSvgFavicon: typeof generateSvgFavicon;
182
+ declare const misc_getConversionWarnings: typeof getConversionWarnings;
183
+ declare const misc_getDefaultQuality: typeof getDefaultQuality;
184
+ declare const misc_getDownloadFilename: typeof getDownloadFilename;
185
+ declare const misc_getSupportedFormats: typeof getSupportedFormats;
186
+ declare const misc_getSupportedOutputFormats: typeof getSupportedOutputFormats;
187
+ declare const misc_minifySvg: typeof minifySvg;
188
+ declare const misc_numberToOrdinal: typeof numberToOrdinal;
189
+ declare const misc_numberToRoman: typeof numberToRoman;
190
+ declare const misc_numberToWords: typeof numberToWords;
191
+ declare const misc_optimizeSvg: typeof optimizeSvg;
192
+ declare const misc_ordinalWords: typeof ordinalWords;
193
+ declare const misc_romanToNumber: typeof romanToNumber;
194
+ declare const misc_sanitizeSvg: typeof sanitizeSvg;
195
+ declare const misc_svgToDataUrl: typeof svgToDataUrl;
196
+ declare const misc_toUnicodeEscape: typeof toUnicodeEscape;
197
+ declare namespace misc {
198
+ export { misc_COLOR_PRESETS as COLOR_PRESETS, type misc_CodePoint as CodePoint, type misc_CompressionOptions as CompressionOptions, type misc_CompressionResult as CompressionResult, type misc_ConversionOptions as ConversionOptions, type misc_ConvertImageFormat as ConvertImageFormat, misc_DATA_TYPES as DATA_TYPES, misc_DEFAULT_CONFIG as DEFAULT_CONFIG, type misc_DataType as DataType, misc_FORMAT_EXTENSIONS as FORMAT_EXTENSIONS, misc_FORMAT_LABELS as FORMAT_LABELS, type misc_FaviconConfig as FaviconConfig, type misc_ImageFormat as ImageFormat, type misc_RandomConfig as RandomConfig, type misc_Shape as Shape, type misc_SvgInfo as SvgInfo, misc_analyzeString as analyzeString, misc_analyzeSvg as analyzeSvg, misc_calcResizeDimensions as calcResizeDimensions, misc_calcSavings as calcSavings, misc_charToCodePoint as charToCodePoint, misc_codePointToChar as codePointToChar, misc_detectFormatFromDataUrl as detectFormatFromDataUrl, misc_detectFormatFromFilename as detectFormatFromFilename, misc_formatBytes as formatBytes, misc_formatLabel as formatLabel, misc_formatSvg as formatSvg, misc_fromUnicodeEscape as fromUnicodeEscape, misc_generateData as generateData, misc_generateSingle as generateSingle, misc_generateSvgFavicon as generateSvgFavicon, misc_getConversionWarnings as getConversionWarnings, misc_getDefaultQuality as getDefaultQuality, misc_getDownloadFilename as getDownloadFilename, misc_getSupportedFormats as getSupportedFormats, misc_getSupportedOutputFormats as getSupportedOutputFormats, misc_minifySvg as minifySvg, misc_numberToOrdinal as numberToOrdinal, misc_numberToRoman as numberToRoman, misc_numberToWords as numberToWords, misc_optimizeSvg as optimizeSvg, misc_ordinalWords as ordinalWords, misc_romanToNumber as romanToNumber, misc_sanitizeSvg as sanitizeSvg, misc_svgToDataUrl as svgToDataUrl, misc_toUnicodeEscape as toUnicodeEscape };
199
+ }
200
+
201
+ export { getConversionWarnings as A, getDefaultQuality as B, COLOR_PRESETS as C, DATA_TYPES as D, getDownloadFilename as E, FORMAT_EXTENSIONS as F, getSupportedFormats as G, getSupportedOutputFormats as H, type ImageFormat as I, minifySvg as J, numberToOrdinal as K, numberToRoman as L, numberToWords as M, optimizeSvg as N, ordinalWords as O, romanToNumber as P, sanitizeSvg as Q, type RandomConfig as R, type Shape as S, svgToDataUrl as T, toUnicodeEscape as U, type CodePoint as a, type CompressionOptions as b, type CompressionResult as c, type ConversionOptions as d, type ConvertImageFormat as e, DEFAULT_CONFIG as f, type DataType as g, FORMAT_LABELS as h, type FaviconConfig as i, type SvgInfo as j, analyzeString as k, analyzeSvg as l, misc as m, calcResizeDimensions as n, calcSavings as o, charToCodePoint as p, codePointToChar as q, detectFormatFromDataUrl as r, detectFormatFromFilename as s, formatBytes as t, formatLabel as u, formatSvg as v, fromUnicodeEscape as w, generateData as x, generateSingle as y, generateSvgFavicon as z };