@utilix-tech/sdk 0.3.1 → 0.5.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.
- package/README.md +34 -12
- package/dist/{api-8aZtWhSj.d.cts → api-Xl7OzIgq.d.cts} +35 -2
- package/dist/{api-8aZtWhSj.d.ts → api-Xl7OzIgq.d.ts} +35 -2
- package/dist/{chunk-UC656APA.js → chunk-DNCOIO5N.js} +64 -1
- package/dist/{chunk-HFRTZE7T.js → chunk-Q3B3YWOA.js} +51 -1
- package/dist/{chunk-3BAHSW4C.js → chunk-V5JKVDBA.js} +60 -1
- package/dist/chunk-WWKPLYEP.js +277 -0
- package/dist/{data-rMjWNiOJ.d.cts → data-CakDxAcT.d.cts} +36 -2
- package/dist/{data-rMjWNiOJ.d.ts → data-CakDxAcT.d.ts} +36 -2
- package/dist/index.cjs +316 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +4 -4
- package/dist/media-D-K5aZnq.d.cts +53 -0
- package/dist/media-D-K5aZnq.d.ts +53 -0
- package/dist/{network-CNtmrDeN.d.cts → network-DwyAjwJS.d.cts} +39 -2
- package/dist/{network-CNtmrDeN.d.ts → network-DwyAjwJS.d.ts} +39 -2
- package/dist/tools/api.cjs +50 -0
- package/dist/tools/api.d.cts +1 -1
- package/dist/tools/api.d.ts +1 -1
- package/dist/tools/api.js +1 -1
- package/dist/tools/data.cjs +63 -0
- package/dist/tools/data.d.cts +1 -1
- package/dist/tools/data.d.ts +1 -1
- package/dist/tools/data.js +1 -1
- package/dist/tools/media.cjs +143 -0
- package/dist/tools/media.d.cts +1 -1
- package/dist/tools/media.d.ts +1 -1
- package/dist/tools/media.js +1 -1
- package/dist/tools/network.cjs +59 -0
- package/dist/tools/network.d.cts +1 -1
- package/dist/tools/network.d.ts +1 -1
- package/dist/tools/network.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-N7C52YGL.js +0 -134
- package/dist/media-DF2cx3pK.d.cts +0 -28
- package/dist/media-DF2cx3pK.d.ts +0 -28
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
import { __export } from './chunk-MLKGABMK.js';
|
|
2
|
+
|
|
3
|
+
// src/tools/media.ts
|
|
4
|
+
var media_exports = {};
|
|
5
|
+
__export(media_exports, {
|
|
6
|
+
readImageInfo: () => readImageInfo,
|
|
7
|
+
readPdfMetadata: () => readPdfMetadata
|
|
8
|
+
});
|
|
9
|
+
function readU32BE(bytes, offset) {
|
|
10
|
+
return (bytes[offset] << 24 | bytes[offset + 1] << 16 | bytes[offset + 2] << 8 | bytes[offset + 3]) >>> 0;
|
|
11
|
+
}
|
|
12
|
+
function readI32LE(bytes, offset) {
|
|
13
|
+
return bytes[offset] | bytes[offset + 1] << 8 | bytes[offset + 2] << 16 | bytes[offset + 3] << 24;
|
|
14
|
+
}
|
|
15
|
+
var PNG_COLOR_TYPES = {
|
|
16
|
+
0: "grayscale",
|
|
17
|
+
2: "rgb",
|
|
18
|
+
3: "palette",
|
|
19
|
+
4: "grayscale+alpha",
|
|
20
|
+
6: "rgba"
|
|
21
|
+
};
|
|
22
|
+
function readPng(bytes) {
|
|
23
|
+
if (bytes.length < 33) return { error: "Truncated PNG file" };
|
|
24
|
+
const width = readU32BE(bytes, 16);
|
|
25
|
+
const height = readU32BE(bytes, 20);
|
|
26
|
+
const bitDepth = bytes[24];
|
|
27
|
+
const colorTypeNum = bytes[25];
|
|
28
|
+
const colorType = PNG_COLOR_TYPES[colorTypeNum] ?? "unknown";
|
|
29
|
+
const hasAlpha = colorTypeNum === 4 || colorTypeNum === 6;
|
|
30
|
+
return { format: "png", width, height, bitDepth, colorType, hasAlpha };
|
|
31
|
+
}
|
|
32
|
+
function readGif(bytes) {
|
|
33
|
+
if (bytes.length < 10) return { error: "Truncated GIF file" };
|
|
34
|
+
const width = bytes[6] | bytes[7] << 8;
|
|
35
|
+
const height = bytes[8] | bytes[9] << 8;
|
|
36
|
+
return { format: "gif", width, height };
|
|
37
|
+
}
|
|
38
|
+
function readBmp(bytes) {
|
|
39
|
+
if (bytes.length < 30) return { error: "Truncated BMP file" };
|
|
40
|
+
const width = readI32LE(bytes, 18);
|
|
41
|
+
const heightRaw = readI32LE(bytes, 22);
|
|
42
|
+
const bitDepth = bytes[28] | bytes[29] << 8;
|
|
43
|
+
return { format: "bmp", width: Math.abs(width), height: Math.abs(heightRaw), bitDepth };
|
|
44
|
+
}
|
|
45
|
+
function readWebp(bytes) {
|
|
46
|
+
if (bytes.length < 16) return { error: "Truncated WebP file" };
|
|
47
|
+
const fourCC = String.fromCharCode(bytes[12], bytes[13], bytes[14], bytes[15]);
|
|
48
|
+
if (fourCC === "VP8 ") {
|
|
49
|
+
if (bytes.length < 30) return { error: "Truncated WebP file" };
|
|
50
|
+
const width = (bytes[26] | bytes[27] << 8) & 16383;
|
|
51
|
+
const height = (bytes[28] | bytes[29] << 8) & 16383;
|
|
52
|
+
return { format: "webp", width, height };
|
|
53
|
+
}
|
|
54
|
+
if (fourCC === "VP8L") {
|
|
55
|
+
if (bytes.length < 25) return { error: "Truncated WebP file" };
|
|
56
|
+
const bits = bytes[21] | bytes[22] << 8 | bytes[23] << 16 | bytes[24] << 24;
|
|
57
|
+
const width = (bits & 16383) + 1;
|
|
58
|
+
const height = (bits >>> 14 & 16383) + 1;
|
|
59
|
+
const hasAlpha = !!(bits >>> 28 & 1);
|
|
60
|
+
return { format: "webp", width, height, hasAlpha };
|
|
61
|
+
}
|
|
62
|
+
if (fourCC === "VP8X") {
|
|
63
|
+
if (bytes.length < 30) return { error: "Truncated WebP file" };
|
|
64
|
+
const flags = bytes[20];
|
|
65
|
+
const hasAlpha = !!(flags & 16);
|
|
66
|
+
const width = (bytes[24] | bytes[25] << 8 | bytes[26] << 16) + 1;
|
|
67
|
+
const height = (bytes[27] | bytes[28] << 8 | bytes[29] << 16) + 1;
|
|
68
|
+
return { format: "webp", width, height, hasAlpha };
|
|
69
|
+
}
|
|
70
|
+
return { error: "Unrecognized WebP chunk format" };
|
|
71
|
+
}
|
|
72
|
+
var JPEG_SOF_MARKERS = /* @__PURE__ */ new Set([
|
|
73
|
+
192,
|
|
74
|
+
193,
|
|
75
|
+
194,
|
|
76
|
+
195,
|
|
77
|
+
197,
|
|
78
|
+
198,
|
|
79
|
+
199,
|
|
80
|
+
201,
|
|
81
|
+
202,
|
|
82
|
+
203,
|
|
83
|
+
205,
|
|
84
|
+
206,
|
|
85
|
+
207
|
|
86
|
+
]);
|
|
87
|
+
function readJpeg(bytes) {
|
|
88
|
+
let offset = 2;
|
|
89
|
+
while (offset < bytes.length - 1) {
|
|
90
|
+
if (bytes[offset] !== 255) {
|
|
91
|
+
offset++;
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
const marker = bytes[offset + 1];
|
|
95
|
+
if (marker === 216 || marker === 1 || marker >= 208 && marker <= 215) {
|
|
96
|
+
offset += 2;
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
if (marker === 217) break;
|
|
100
|
+
if (offset + 3 >= bytes.length) break;
|
|
101
|
+
const segmentLength = bytes[offset + 2] << 8 | bytes[offset + 3];
|
|
102
|
+
if (JPEG_SOF_MARKERS.has(marker)) {
|
|
103
|
+
if (offset + 9 >= bytes.length) return { error: "Truncated JPEG SOF segment" };
|
|
104
|
+
const bitDepth = bytes[offset + 4];
|
|
105
|
+
const height = bytes[offset + 5] << 8 | bytes[offset + 6];
|
|
106
|
+
const width = bytes[offset + 7] << 8 | bytes[offset + 8];
|
|
107
|
+
const components = bytes[offset + 9];
|
|
108
|
+
const colorType = components === 1 ? "grayscale" : components === 3 ? "rgb" : components === 4 ? "cmyk" : "unknown";
|
|
109
|
+
return { format: "jpeg", width, height, bitDepth, colorType };
|
|
110
|
+
}
|
|
111
|
+
offset += 2 + segmentLength;
|
|
112
|
+
}
|
|
113
|
+
return { error: "No SOF marker found in JPEG (file may be corrupt)" };
|
|
114
|
+
}
|
|
115
|
+
function readImageInfo(bytes) {
|
|
116
|
+
if (bytes.length < 10) return { error: "File too small to determine format" };
|
|
117
|
+
if (bytes[0] === 137 && bytes[1] === 80 && bytes[2] === 78 && bytes[3] === 71 && bytes[4] === 13 && bytes[5] === 10 && bytes[6] === 26 && bytes[7] === 10) {
|
|
118
|
+
return readPng(bytes);
|
|
119
|
+
}
|
|
120
|
+
if (bytes[0] === 71 && bytes[1] === 73 && bytes[2] === 70) {
|
|
121
|
+
return readGif(bytes);
|
|
122
|
+
}
|
|
123
|
+
if (bytes[0] === 66 && bytes[1] === 77) {
|
|
124
|
+
return readBmp(bytes);
|
|
125
|
+
}
|
|
126
|
+
if (bytes[0] === 82 && bytes[1] === 73 && bytes[2] === 70 && bytes[3] === 70 && bytes[8] === 87 && bytes[9] === 69 && bytes[10] === 66 && bytes[11] === 80) {
|
|
127
|
+
return readWebp(bytes);
|
|
128
|
+
}
|
|
129
|
+
if (bytes[0] === 255 && bytes[1] === 216) {
|
|
130
|
+
return readJpeg(bytes);
|
|
131
|
+
}
|
|
132
|
+
return { error: "Unrecognized image format. Supported formats: PNG, JPEG, GIF, WebP, BMP" };
|
|
133
|
+
}
|
|
134
|
+
function bytesToLatin1(bytes) {
|
|
135
|
+
let out = "";
|
|
136
|
+
const CHUNK = 32768;
|
|
137
|
+
for (let i = 0; i < bytes.length; i += CHUNK) {
|
|
138
|
+
out += String.fromCharCode(...bytes.subarray(i, i + CHUNK));
|
|
139
|
+
}
|
|
140
|
+
return out;
|
|
141
|
+
}
|
|
142
|
+
function decodePdfString(raw, isHex) {
|
|
143
|
+
const bytes = [];
|
|
144
|
+
if (isHex) {
|
|
145
|
+
const hex = raw.replace(/\s+/g, "");
|
|
146
|
+
const padded = hex.length % 2 === 0 ? hex : hex + "0";
|
|
147
|
+
for (let i = 0; i < padded.length; i += 2) bytes.push(parseInt(padded.slice(i, i + 2), 16));
|
|
148
|
+
} else {
|
|
149
|
+
const s = raw.replace(/\\\r\n|\\\r|\\\n/g, "");
|
|
150
|
+
for (let i = 0; i < s.length; i++) {
|
|
151
|
+
const ch = s[i];
|
|
152
|
+
if (ch === "\\" && i + 1 < s.length) {
|
|
153
|
+
const next = s[i + 1];
|
|
154
|
+
if (next === "n") {
|
|
155
|
+
bytes.push(10);
|
|
156
|
+
i++;
|
|
157
|
+
} else if (next === "r") {
|
|
158
|
+
bytes.push(13);
|
|
159
|
+
i++;
|
|
160
|
+
} else if (next === "t") {
|
|
161
|
+
bytes.push(9);
|
|
162
|
+
i++;
|
|
163
|
+
} else if (next === "b") {
|
|
164
|
+
bytes.push(8);
|
|
165
|
+
i++;
|
|
166
|
+
} else if (next === "f") {
|
|
167
|
+
bytes.push(12);
|
|
168
|
+
i++;
|
|
169
|
+
} else if (next === "(" || next === ")" || next === "\\") {
|
|
170
|
+
bytes.push(next.charCodeAt(0));
|
|
171
|
+
i++;
|
|
172
|
+
} else if (/[0-7]/.test(next)) {
|
|
173
|
+
let oct = next;
|
|
174
|
+
i++;
|
|
175
|
+
for (let k = 0; k < 2 && i + 1 < s.length && /[0-7]/.test(s[i + 1]); k++) {
|
|
176
|
+
i++;
|
|
177
|
+
oct += s[i];
|
|
178
|
+
}
|
|
179
|
+
bytes.push(parseInt(oct, 8) & 255);
|
|
180
|
+
} else {
|
|
181
|
+
bytes.push(next.charCodeAt(0));
|
|
182
|
+
i++;
|
|
183
|
+
}
|
|
184
|
+
} else {
|
|
185
|
+
bytes.push(ch.charCodeAt(0) & 255);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
if (bytes.length >= 2 && bytes[0] === 254 && bytes[1] === 255) {
|
|
190
|
+
let out = "";
|
|
191
|
+
for (let i = 2; i + 1 < bytes.length; i += 2) out += String.fromCharCode(bytes[i] << 8 | bytes[i + 1]);
|
|
192
|
+
return out;
|
|
193
|
+
}
|
|
194
|
+
return bytes.map((b) => String.fromCharCode(b)).join("");
|
|
195
|
+
}
|
|
196
|
+
function extractDictField(dict, key) {
|
|
197
|
+
const litMatch = dict.match(new RegExp(`/${key}\\s*\\(((?:\\\\.|[^\\\\()])*)\\)`));
|
|
198
|
+
if (litMatch) return decodePdfString(litMatch[1], false);
|
|
199
|
+
const hexMatch = dict.match(new RegExp(`/${key}\\s*<([0-9A-Fa-f\\s]*)>`));
|
|
200
|
+
if (hexMatch) return decodePdfString(hexMatch[1], true);
|
|
201
|
+
return null;
|
|
202
|
+
}
|
|
203
|
+
function findObject(text, objNum, gen) {
|
|
204
|
+
const m = text.match(new RegExp(`(?:^|[^0-9])${objNum}\\s+${gen}\\s+obj([\\s\\S]*?)endobj`));
|
|
205
|
+
return m ? m[1] : null;
|
|
206
|
+
}
|
|
207
|
+
function parsePdfDate(raw) {
|
|
208
|
+
const m = raw.match(/^D:(\d{4})(\d{2})?(\d{2})?(\d{2})?(\d{2})?(\d{2})?([Z+-])?(\d{2})?'?(\d{2})?'?/);
|
|
209
|
+
if (!m) return null;
|
|
210
|
+
const [, y, mo = "01", d = "01", h = "00", mi = "00", s = "00", tz, tzh, tzm] = m;
|
|
211
|
+
let iso = `${y}-${mo}-${d}T${h}:${mi}:${s}`;
|
|
212
|
+
if (tz === "Z") iso += "Z";
|
|
213
|
+
else if (tz === "+" || tz === "-") iso += `${tz}${tzh ?? "00"}:${tzm ?? "00"}`;
|
|
214
|
+
return iso;
|
|
215
|
+
}
|
|
216
|
+
function readPdfMetadata(bytes) {
|
|
217
|
+
if (bytes.length < 8) return { error: "File too small to be a PDF" };
|
|
218
|
+
const header = bytesToLatin1(bytes.subarray(0, 16));
|
|
219
|
+
const versionMatch = header.match(/%PDF-(\d\.\d)/);
|
|
220
|
+
if (!versionMatch) return { error: "Not a valid PDF file (missing %PDF header)" };
|
|
221
|
+
const version = versionMatch[1];
|
|
222
|
+
const text = bytesToLatin1(bytes);
|
|
223
|
+
const trailerMatches = [...text.matchAll(/trailer\s*<<([\s\S]*?)>>/g)];
|
|
224
|
+
let infoDict = null;
|
|
225
|
+
let encrypted = false;
|
|
226
|
+
if (trailerMatches.length > 0) {
|
|
227
|
+
const trailer = trailerMatches[trailerMatches.length - 1][1];
|
|
228
|
+
encrypted = /\/Encrypt\s+\d+\s+\d+\s+R/.test(trailer);
|
|
229
|
+
const infoRef = trailer.match(/\/Info\s+(\d+)\s+(\d+)\s+R/);
|
|
230
|
+
if (infoRef) infoDict = findObject(text, Number(infoRef[1]), Number(infoRef[2]));
|
|
231
|
+
}
|
|
232
|
+
const objBlocks = [...text.matchAll(/(\d+)\s+(\d+)\s+obj([\s\S]*?)endobj/g)];
|
|
233
|
+
if (!infoDict) {
|
|
234
|
+
for (const b of objBlocks) {
|
|
235
|
+
if (/\/(Title|Author|Producer|Creator|CreationDate)\b/.test(b[3]) && !/\/Type\s*\/(Page|Pages|Catalog|Font)\b/.test(b[3])) {
|
|
236
|
+
infoDict = b[3];
|
|
237
|
+
break;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
const title = infoDict ? extractDictField(infoDict, "Title") : null;
|
|
242
|
+
const author = infoDict ? extractDictField(infoDict, "Author") : null;
|
|
243
|
+
const subject = infoDict ? extractDictField(infoDict, "Subject") : null;
|
|
244
|
+
const keywords = infoDict ? extractDictField(infoDict, "Keywords") : null;
|
|
245
|
+
const creator = infoDict ? extractDictField(infoDict, "Creator") : null;
|
|
246
|
+
const producer = infoDict ? extractDictField(infoDict, "Producer") : null;
|
|
247
|
+
const creationDateRaw = infoDict ? extractDictField(infoDict, "CreationDate") : null;
|
|
248
|
+
const modDateRaw = infoDict ? extractDictField(infoDict, "ModDate") : null;
|
|
249
|
+
let pageCount = null;
|
|
250
|
+
for (const b of objBlocks) {
|
|
251
|
+
if (!/\/Type\s*\/Pages\b/.test(b[3])) continue;
|
|
252
|
+
const countMatch = b[3].match(/\/Count\s+(\d+)/);
|
|
253
|
+
if (countMatch) {
|
|
254
|
+
const c = Number(countMatch[1]);
|
|
255
|
+
if (pageCount === null || c > pageCount) pageCount = c;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
if (pageCount === null) {
|
|
259
|
+
const pageMatches = text.match(/\/Type\s*\/Page(?!s)\b/g);
|
|
260
|
+
if (pageMatches) pageCount = pageMatches.length;
|
|
261
|
+
}
|
|
262
|
+
return {
|
|
263
|
+
version,
|
|
264
|
+
pageCount,
|
|
265
|
+
title,
|
|
266
|
+
author,
|
|
267
|
+
subject,
|
|
268
|
+
keywords,
|
|
269
|
+
creator,
|
|
270
|
+
producer,
|
|
271
|
+
creationDate: creationDateRaw ? parsePdfDate(creationDateRaw) ?? creationDateRaw : null,
|
|
272
|
+
modDate: modDateRaw ? parsePdfDate(modDateRaw) ?? modDateRaw : null,
|
|
273
|
+
encrypted
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
export { media_exports, readImageInfo, readPdfMetadata };
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* - csv-viewer : detectDelimiter, parseCsv, csvToJson, toCsvString
|
|
11
11
|
* - ini-parser : parseIni, stringifyIni, iniToJson, jsonToIni, getSection, getSectionNames, validateIni
|
|
12
12
|
* - env-parser : parseEnv, envToJson, envToExport, validateEnvKey
|
|
13
|
+
* - ndjson-formatter: validateNdjson, minifyNdjson, formatNdjson, ndjsonToJsonArray, jsonArrayToNdjson
|
|
13
14
|
*/
|
|
14
15
|
interface ValidationResult {
|
|
15
16
|
valid: boolean;
|
|
@@ -167,11 +168,39 @@ declare function envToJson(input: string): string | {
|
|
|
167
168
|
};
|
|
168
169
|
declare function envToExport(input: string): string;
|
|
169
170
|
declare function validateEnvKey(key: string): boolean;
|
|
171
|
+
interface NdjsonLineResult {
|
|
172
|
+
line: number;
|
|
173
|
+
raw: string;
|
|
174
|
+
valid: boolean;
|
|
175
|
+
error?: string;
|
|
176
|
+
}
|
|
177
|
+
interface NdjsonValidateResult {
|
|
178
|
+
valid: boolean;
|
|
179
|
+
totalLines: number;
|
|
180
|
+
validLines: number;
|
|
181
|
+
invalidLines: number;
|
|
182
|
+
lines: NdjsonLineResult[];
|
|
183
|
+
}
|
|
184
|
+
declare function validateNdjson(input: string): NdjsonValidateResult;
|
|
185
|
+
declare function minifyNdjson(input: string): string | {
|
|
186
|
+
error: string;
|
|
187
|
+
};
|
|
188
|
+
declare function formatNdjson(input: string, indent?: number): string | {
|
|
189
|
+
error: string;
|
|
190
|
+
};
|
|
191
|
+
declare function ndjsonToJsonArray(input: string): string | {
|
|
192
|
+
error: string;
|
|
193
|
+
};
|
|
194
|
+
declare function jsonArrayToNdjson(input: string): string | {
|
|
195
|
+
error: string;
|
|
196
|
+
};
|
|
170
197
|
|
|
171
198
|
type data_CsvParseResult = CsvParseResult;
|
|
172
199
|
type data_EnvEntry = EnvEntry;
|
|
173
200
|
type data_EnvParseResult = EnvParseResult;
|
|
174
201
|
type data_IniSection = IniSection;
|
|
202
|
+
type data_NdjsonLineResult = NdjsonLineResult;
|
|
203
|
+
type data_NdjsonValidateResult = NdjsonValidateResult;
|
|
175
204
|
type data_ParseOptions = ParseOptions;
|
|
176
205
|
type data_ParsedIni = ParsedIni;
|
|
177
206
|
type data_TomlFormatResult = TomlFormatResult;
|
|
@@ -182,6 +211,7 @@ declare const data_csvToJson: typeof csvToJson;
|
|
|
182
211
|
declare const data_detectDelimiter: typeof detectDelimiter;
|
|
183
212
|
declare const data_envToExport: typeof envToExport;
|
|
184
213
|
declare const data_envToJson: typeof envToJson;
|
|
214
|
+
declare const data_formatNdjson: typeof formatNdjson;
|
|
185
215
|
declare const data_formatToml: typeof formatToml;
|
|
186
216
|
declare const data_formatXml: typeof formatXml;
|
|
187
217
|
declare const data_getSection: typeof getSection;
|
|
@@ -190,11 +220,14 @@ declare const data_getTomlStats: typeof getTomlStats;
|
|
|
190
220
|
declare const data_getXmlStats: typeof getXmlStats;
|
|
191
221
|
declare const data_getYamlStats: typeof getYamlStats;
|
|
192
222
|
declare const data_iniToJson: typeof iniToJson;
|
|
223
|
+
declare const data_jsonArrayToNdjson: typeof jsonArrayToNdjson;
|
|
193
224
|
declare const data_jsonToIni: typeof jsonToIni;
|
|
194
225
|
declare const data_jsonToToml: typeof jsonToToml;
|
|
195
226
|
declare const data_jsonToXml: typeof jsonToXml;
|
|
227
|
+
declare const data_minifyNdjson: typeof minifyNdjson;
|
|
196
228
|
declare const data_minifyToml: typeof minifyToml;
|
|
197
229
|
declare const data_minifyXml: typeof minifyXml;
|
|
230
|
+
declare const data_ndjsonToJsonArray: typeof ndjsonToJsonArray;
|
|
198
231
|
declare const data_parseCsv: typeof parseCsv;
|
|
199
232
|
declare const data_parseEnv: typeof parseEnv;
|
|
200
233
|
declare const data_parseIni: typeof parseIni;
|
|
@@ -204,12 +237,13 @@ declare const data_toCsvString: typeof toCsvString;
|
|
|
204
237
|
declare const data_tomlToJson: typeof tomlToJson;
|
|
205
238
|
declare const data_validateEnvKey: typeof validateEnvKey;
|
|
206
239
|
declare const data_validateIni: typeof validateIni;
|
|
240
|
+
declare const data_validateNdjson: typeof validateNdjson;
|
|
207
241
|
declare const data_validateToml: typeof validateToml;
|
|
208
242
|
declare const data_validateXml: typeof validateXml;
|
|
209
243
|
declare const data_validateYaml: typeof validateYaml;
|
|
210
244
|
declare const data_xmlToJson: typeof xmlToJson;
|
|
211
245
|
declare namespace data {
|
|
212
|
-
export { type data_CsvParseResult as CsvParseResult, type data_EnvEntry as EnvEntry, type data_EnvParseResult as EnvParseResult, type data_IniSection as IniSection, type data_ParseOptions as ParseOptions, type data_ParsedIni as ParsedIni, type data_TomlFormatResult as TomlFormatResult, type data_ValidationResult as ValidationResult, type data_XmlFormatResult as XmlFormatResult, type data_XmlToJsonOptions as XmlToJsonOptions, data_csvToJson as csvToJson, data_detectDelimiter as detectDelimiter, data_envToExport as envToExport, data_envToJson as envToJson, data_formatToml as formatToml, data_formatXml as formatXml, data_getSection as getSection, data_getSectionNames as getSectionNames, data_getTomlStats as getTomlStats, data_getXmlStats as getXmlStats, data_getYamlStats as getYamlStats, data_iniToJson as iniToJson, data_jsonToIni as jsonToIni, data_jsonToToml as jsonToToml, data_jsonToXml as jsonToXml, data_minifyToml as minifyToml, data_minifyXml as minifyXml, data_parseCsv as parseCsv, data_parseEnv as parseEnv, data_parseIni as parseIni, data_parseXmlToObject as parseXmlToObject, data_stringifyIni as stringifyIni, data_toCsvString as toCsvString, data_tomlToJson as tomlToJson, data_validateEnvKey as validateEnvKey, data_validateIni as validateIni, data_validateToml as validateToml, data_validateXml as validateXml, data_validateYaml as validateYaml, data_xmlToJson as xmlToJson };
|
|
246
|
+
export { type data_CsvParseResult as CsvParseResult, type data_EnvEntry as EnvEntry, type data_EnvParseResult as EnvParseResult, type data_IniSection as IniSection, type data_NdjsonLineResult as NdjsonLineResult, type data_NdjsonValidateResult as NdjsonValidateResult, type data_ParseOptions as ParseOptions, type data_ParsedIni as ParsedIni, type data_TomlFormatResult as TomlFormatResult, type data_ValidationResult as ValidationResult, type data_XmlFormatResult as XmlFormatResult, type data_XmlToJsonOptions as XmlToJsonOptions, data_csvToJson as csvToJson, data_detectDelimiter as detectDelimiter, data_envToExport as envToExport, data_envToJson as envToJson, data_formatNdjson as formatNdjson, data_formatToml as formatToml, data_formatXml as formatXml, data_getSection as getSection, data_getSectionNames as getSectionNames, data_getTomlStats as getTomlStats, data_getXmlStats as getXmlStats, data_getYamlStats as getYamlStats, data_iniToJson as iniToJson, data_jsonArrayToNdjson as jsonArrayToNdjson, data_jsonToIni as jsonToIni, data_jsonToToml as jsonToToml, data_jsonToXml as jsonToXml, data_minifyNdjson as minifyNdjson, data_minifyToml as minifyToml, data_minifyXml as minifyXml, data_ndjsonToJsonArray as ndjsonToJsonArray, data_parseCsv as parseCsv, data_parseEnv as parseEnv, data_parseIni as parseIni, data_parseXmlToObject as parseXmlToObject, data_stringifyIni as stringifyIni, data_toCsvString as toCsvString, data_tomlToJson as tomlToJson, data_validateEnvKey as validateEnvKey, data_validateIni as validateIni, data_validateNdjson as validateNdjson, data_validateToml as validateToml, data_validateXml as validateXml, data_validateYaml as validateYaml, data_xmlToJson as xmlToJson };
|
|
213
247
|
}
|
|
214
248
|
|
|
215
|
-
export {
|
|
249
|
+
export { parseCsv as A, parseEnv as B, type CsvParseResult as C, parseIni as D, type EnvEntry as E, parseXmlToObject as F, stringifyIni as G, toCsvString as H, type IniSection as I, tomlToJson as J, validateEnvKey as K, validateIni as L, validateNdjson as M, type NdjsonLineResult as N, validateToml as O, type ParseOptions as P, validateXml as Q, validateYaml as R, xmlToJson as S, type TomlFormatResult as T, type ValidationResult as V, type XmlFormatResult as X, type EnvParseResult as a, type NdjsonValidateResult as b, type ParsedIni as c, data as d, type XmlToJsonOptions as e, csvToJson as f, detectDelimiter as g, envToExport as h, envToJson as i, formatNdjson as j, formatToml as k, formatXml as l, getSection as m, getSectionNames as n, getTomlStats as o, getXmlStats as p, getYamlStats as q, iniToJson as r, jsonArrayToNdjson as s, jsonToIni as t, jsonToToml as u, jsonToXml as v, minifyNdjson as w, minifyToml as x, minifyXml as y, ndjsonToJsonArray as z };
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* - csv-viewer : detectDelimiter, parseCsv, csvToJson, toCsvString
|
|
11
11
|
* - ini-parser : parseIni, stringifyIni, iniToJson, jsonToIni, getSection, getSectionNames, validateIni
|
|
12
12
|
* - env-parser : parseEnv, envToJson, envToExport, validateEnvKey
|
|
13
|
+
* - ndjson-formatter: validateNdjson, minifyNdjson, formatNdjson, ndjsonToJsonArray, jsonArrayToNdjson
|
|
13
14
|
*/
|
|
14
15
|
interface ValidationResult {
|
|
15
16
|
valid: boolean;
|
|
@@ -167,11 +168,39 @@ declare function envToJson(input: string): string | {
|
|
|
167
168
|
};
|
|
168
169
|
declare function envToExport(input: string): string;
|
|
169
170
|
declare function validateEnvKey(key: string): boolean;
|
|
171
|
+
interface NdjsonLineResult {
|
|
172
|
+
line: number;
|
|
173
|
+
raw: string;
|
|
174
|
+
valid: boolean;
|
|
175
|
+
error?: string;
|
|
176
|
+
}
|
|
177
|
+
interface NdjsonValidateResult {
|
|
178
|
+
valid: boolean;
|
|
179
|
+
totalLines: number;
|
|
180
|
+
validLines: number;
|
|
181
|
+
invalidLines: number;
|
|
182
|
+
lines: NdjsonLineResult[];
|
|
183
|
+
}
|
|
184
|
+
declare function validateNdjson(input: string): NdjsonValidateResult;
|
|
185
|
+
declare function minifyNdjson(input: string): string | {
|
|
186
|
+
error: string;
|
|
187
|
+
};
|
|
188
|
+
declare function formatNdjson(input: string, indent?: number): string | {
|
|
189
|
+
error: string;
|
|
190
|
+
};
|
|
191
|
+
declare function ndjsonToJsonArray(input: string): string | {
|
|
192
|
+
error: string;
|
|
193
|
+
};
|
|
194
|
+
declare function jsonArrayToNdjson(input: string): string | {
|
|
195
|
+
error: string;
|
|
196
|
+
};
|
|
170
197
|
|
|
171
198
|
type data_CsvParseResult = CsvParseResult;
|
|
172
199
|
type data_EnvEntry = EnvEntry;
|
|
173
200
|
type data_EnvParseResult = EnvParseResult;
|
|
174
201
|
type data_IniSection = IniSection;
|
|
202
|
+
type data_NdjsonLineResult = NdjsonLineResult;
|
|
203
|
+
type data_NdjsonValidateResult = NdjsonValidateResult;
|
|
175
204
|
type data_ParseOptions = ParseOptions;
|
|
176
205
|
type data_ParsedIni = ParsedIni;
|
|
177
206
|
type data_TomlFormatResult = TomlFormatResult;
|
|
@@ -182,6 +211,7 @@ declare const data_csvToJson: typeof csvToJson;
|
|
|
182
211
|
declare const data_detectDelimiter: typeof detectDelimiter;
|
|
183
212
|
declare const data_envToExport: typeof envToExport;
|
|
184
213
|
declare const data_envToJson: typeof envToJson;
|
|
214
|
+
declare const data_formatNdjson: typeof formatNdjson;
|
|
185
215
|
declare const data_formatToml: typeof formatToml;
|
|
186
216
|
declare const data_formatXml: typeof formatXml;
|
|
187
217
|
declare const data_getSection: typeof getSection;
|
|
@@ -190,11 +220,14 @@ declare const data_getTomlStats: typeof getTomlStats;
|
|
|
190
220
|
declare const data_getXmlStats: typeof getXmlStats;
|
|
191
221
|
declare const data_getYamlStats: typeof getYamlStats;
|
|
192
222
|
declare const data_iniToJson: typeof iniToJson;
|
|
223
|
+
declare const data_jsonArrayToNdjson: typeof jsonArrayToNdjson;
|
|
193
224
|
declare const data_jsonToIni: typeof jsonToIni;
|
|
194
225
|
declare const data_jsonToToml: typeof jsonToToml;
|
|
195
226
|
declare const data_jsonToXml: typeof jsonToXml;
|
|
227
|
+
declare const data_minifyNdjson: typeof minifyNdjson;
|
|
196
228
|
declare const data_minifyToml: typeof minifyToml;
|
|
197
229
|
declare const data_minifyXml: typeof minifyXml;
|
|
230
|
+
declare const data_ndjsonToJsonArray: typeof ndjsonToJsonArray;
|
|
198
231
|
declare const data_parseCsv: typeof parseCsv;
|
|
199
232
|
declare const data_parseEnv: typeof parseEnv;
|
|
200
233
|
declare const data_parseIni: typeof parseIni;
|
|
@@ -204,12 +237,13 @@ declare const data_toCsvString: typeof toCsvString;
|
|
|
204
237
|
declare const data_tomlToJson: typeof tomlToJson;
|
|
205
238
|
declare const data_validateEnvKey: typeof validateEnvKey;
|
|
206
239
|
declare const data_validateIni: typeof validateIni;
|
|
240
|
+
declare const data_validateNdjson: typeof validateNdjson;
|
|
207
241
|
declare const data_validateToml: typeof validateToml;
|
|
208
242
|
declare const data_validateXml: typeof validateXml;
|
|
209
243
|
declare const data_validateYaml: typeof validateYaml;
|
|
210
244
|
declare const data_xmlToJson: typeof xmlToJson;
|
|
211
245
|
declare namespace data {
|
|
212
|
-
export { type data_CsvParseResult as CsvParseResult, type data_EnvEntry as EnvEntry, type data_EnvParseResult as EnvParseResult, type data_IniSection as IniSection, type data_ParseOptions as ParseOptions, type data_ParsedIni as ParsedIni, type data_TomlFormatResult as TomlFormatResult, type data_ValidationResult as ValidationResult, type data_XmlFormatResult as XmlFormatResult, type data_XmlToJsonOptions as XmlToJsonOptions, data_csvToJson as csvToJson, data_detectDelimiter as detectDelimiter, data_envToExport as envToExport, data_envToJson as envToJson, data_formatToml as formatToml, data_formatXml as formatXml, data_getSection as getSection, data_getSectionNames as getSectionNames, data_getTomlStats as getTomlStats, data_getXmlStats as getXmlStats, data_getYamlStats as getYamlStats, data_iniToJson as iniToJson, data_jsonToIni as jsonToIni, data_jsonToToml as jsonToToml, data_jsonToXml as jsonToXml, data_minifyToml as minifyToml, data_minifyXml as minifyXml, data_parseCsv as parseCsv, data_parseEnv as parseEnv, data_parseIni as parseIni, data_parseXmlToObject as parseXmlToObject, data_stringifyIni as stringifyIni, data_toCsvString as toCsvString, data_tomlToJson as tomlToJson, data_validateEnvKey as validateEnvKey, data_validateIni as validateIni, data_validateToml as validateToml, data_validateXml as validateXml, data_validateYaml as validateYaml, data_xmlToJson as xmlToJson };
|
|
246
|
+
export { type data_CsvParseResult as CsvParseResult, type data_EnvEntry as EnvEntry, type data_EnvParseResult as EnvParseResult, type data_IniSection as IniSection, type data_NdjsonLineResult as NdjsonLineResult, type data_NdjsonValidateResult as NdjsonValidateResult, type data_ParseOptions as ParseOptions, type data_ParsedIni as ParsedIni, type data_TomlFormatResult as TomlFormatResult, type data_ValidationResult as ValidationResult, type data_XmlFormatResult as XmlFormatResult, type data_XmlToJsonOptions as XmlToJsonOptions, data_csvToJson as csvToJson, data_detectDelimiter as detectDelimiter, data_envToExport as envToExport, data_envToJson as envToJson, data_formatNdjson as formatNdjson, data_formatToml as formatToml, data_formatXml as formatXml, data_getSection as getSection, data_getSectionNames as getSectionNames, data_getTomlStats as getTomlStats, data_getXmlStats as getXmlStats, data_getYamlStats as getYamlStats, data_iniToJson as iniToJson, data_jsonArrayToNdjson as jsonArrayToNdjson, data_jsonToIni as jsonToIni, data_jsonToToml as jsonToToml, data_jsonToXml as jsonToXml, data_minifyNdjson as minifyNdjson, data_minifyToml as minifyToml, data_minifyXml as minifyXml, data_ndjsonToJsonArray as ndjsonToJsonArray, data_parseCsv as parseCsv, data_parseEnv as parseEnv, data_parseIni as parseIni, data_parseXmlToObject as parseXmlToObject, data_stringifyIni as stringifyIni, data_toCsvString as toCsvString, data_tomlToJson as tomlToJson, data_validateEnvKey as validateEnvKey, data_validateIni as validateIni, data_validateNdjson as validateNdjson, data_validateToml as validateToml, data_validateXml as validateXml, data_validateYaml as validateYaml, data_xmlToJson as xmlToJson };
|
|
213
247
|
}
|
|
214
248
|
|
|
215
|
-
export {
|
|
249
|
+
export { parseCsv as A, parseEnv as B, type CsvParseResult as C, parseIni as D, type EnvEntry as E, parseXmlToObject as F, stringifyIni as G, toCsvString as H, type IniSection as I, tomlToJson as J, validateEnvKey as K, validateIni as L, validateNdjson as M, type NdjsonLineResult as N, validateToml as O, type ParseOptions as P, validateXml as Q, validateYaml as R, xmlToJson as S, type TomlFormatResult as T, type ValidationResult as V, type XmlFormatResult as X, type EnvParseResult as a, type NdjsonValidateResult as b, type ParsedIni as c, data as d, type XmlToJsonOptions as e, csvToJson as f, detectDelimiter as g, envToExport as h, envToJson as i, formatNdjson as j, formatToml as k, formatXml as l, getSection as m, getSectionNames as n, getTomlStats as o, getXmlStats as p, getYamlStats as q, iniToJson as r, jsonArrayToNdjson as s, jsonToIni as t, jsonToToml as u, jsonToXml as v, minifyNdjson as w, minifyToml as x, minifyXml as y, ndjsonToJsonArray as z };
|