@utilix-tech/sdk 0.37.0 → 0.39.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/CHANGELOG.md +8 -0
- package/README.md +21 -5
- package/dist/{chunk-7AJRK57W.js → chunk-47RI5V3B.js} +31 -1
- package/dist/{chunk-YEXQDI3J.js → chunk-RZUNTYEH.js} +40 -1
- package/dist/{chunk-GEFVMGZR.js → chunk-VEVNIGJ6.js} +26 -1
- package/dist/{chunk-DBNTO3YO.js → chunk-Y4BVU76A.js} +80 -1
- package/dist/{data-CFeS9kes.d.cts → data-BCf3dm-E.d.cts} +28 -2
- package/dist/{data-CFeS9kes.d.ts → data-BCf3dm-E.d.ts} +28 -2
- package/dist/{hashing-CnetQFD_.d.cts → hashing-Dnj0IAZf.d.cts} +27 -2
- package/dist/{hashing-CnetQFD_.d.ts → hashing-Dnj0IAZf.d.ts} +27 -2
- package/dist/index.cjs +173 -0
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +4 -4
- package/dist/{network-CnKUQT4g.d.cts → network-CKPoesdD.d.cts} +52 -2
- package/dist/{network-CnKUQT4g.d.ts → network-CKPoesdD.d.ts} +52 -2
- package/dist/tools/data.cjs +39 -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/hashing.cjs +25 -0
- package/dist/tools/hashing.d.cts +1 -1
- package/dist/tools/hashing.d.ts +1 -1
- package/dist/tools/hashing.js +1 -1
- package/dist/tools/network.cjs +79 -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/dist/tools/units.cjs +30 -0
- package/dist/tools/units.d.cts +1 -1
- package/dist/tools/units.d.ts +1 -1
- package/dist/tools/units.js +1 -1
- package/dist/{units-c90DW-OZ.d.cts → units-HQrMCiNM.d.cts} +34 -2
- package/dist/{units-c90DW-OZ.d.ts → units-HQrMCiNM.d.ts} +34 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1769,12 +1769,15 @@ __export(hashing_exports, {
|
|
|
1769
1769
|
HASH_ALGORITHMS: () => HASH_ALGORITHMS,
|
|
1770
1770
|
HASH_BITS: () => HASH_BITS,
|
|
1771
1771
|
ROUND_OPTIONS: () => ROUND_OPTIONS,
|
|
1772
|
+
SRI_ALGORITHMS: () => SRI_ALGORITHMS,
|
|
1772
1773
|
createEntry: () => createEntry,
|
|
1773
1774
|
generateBcryptHash: () => generateBcryptHash,
|
|
1774
1775
|
generateHtpasswdFile: () => generateHtpasswdFile,
|
|
1775
1776
|
generateMd5Hash: () => generateMd5Hash,
|
|
1776
1777
|
generatePlain: () => generatePlain,
|
|
1777
1778
|
generateSha1Hash: () => generateSha1Hash,
|
|
1779
|
+
generateSri: () => generateSri,
|
|
1780
|
+
generateSriAll: () => generateSriAll,
|
|
1778
1781
|
hashAll: () => hashAll,
|
|
1779
1782
|
hashOne: () => hashOne,
|
|
1780
1783
|
hashPassword: () => hashPassword,
|
|
@@ -2007,6 +2010,28 @@ function generateHtpasswdFile(entries) {
|
|
|
2007
2010
|
function validateUsername(username) {
|
|
2008
2011
|
return /^[^\s:]{1,255}$/.test(username);
|
|
2009
2012
|
}
|
|
2013
|
+
var SRI_ALGORITHMS = ["SHA-256", "SHA-384", "SHA-512"];
|
|
2014
|
+
var SRI_NODE_ALG_MAP = {
|
|
2015
|
+
"SHA-256": "sha256",
|
|
2016
|
+
"SHA-384": "sha384",
|
|
2017
|
+
"SHA-512": "sha512"
|
|
2018
|
+
};
|
|
2019
|
+
function generateSri(content, algorithm = "SHA-384") {
|
|
2020
|
+
if (typeof content !== "string" || content.length === 0) {
|
|
2021
|
+
return { error: "Content is required" };
|
|
2022
|
+
}
|
|
2023
|
+
if (!SRI_ALGORITHMS.includes(algorithm)) {
|
|
2024
|
+
return { error: `Unknown algorithm: ${algorithm}. Must be one of ${SRI_ALGORITHMS.join(", ")}` };
|
|
2025
|
+
}
|
|
2026
|
+
const base64 = crypto.createHash(SRI_NODE_ALG_MAP[algorithm]).update(content, "utf8").digest("base64");
|
|
2027
|
+
return { algorithm, base64, integrity: `${SRI_NODE_ALG_MAP[algorithm]}-${base64}` };
|
|
2028
|
+
}
|
|
2029
|
+
function generateSriAll(content) {
|
|
2030
|
+
if (typeof content !== "string" || content.length === 0) {
|
|
2031
|
+
return { error: "Content is required" };
|
|
2032
|
+
}
|
|
2033
|
+
return SRI_ALGORITHMS.map((alg) => generateSri(content, alg));
|
|
2034
|
+
}
|
|
2010
2035
|
|
|
2011
2036
|
// src/tools/text.ts
|
|
2012
2037
|
var text_exports = {};
|
|
@@ -4982,6 +5007,7 @@ var data_exports = {};
|
|
|
4982
5007
|
__export(data_exports, {
|
|
4983
5008
|
convertSubtitles: () => convertSubtitles,
|
|
4984
5009
|
csvToJson: () => csvToJson2,
|
|
5010
|
+
csvToSqlInsert: () => csvToSqlInsert,
|
|
4985
5011
|
detectDelimiter: () => detectDelimiter2,
|
|
4986
5012
|
detectSubtitleFormat: () => detectSubtitleFormat,
|
|
4987
5013
|
diffEnvExample: () => diffEnvExample,
|
|
@@ -6436,6 +6462,44 @@ function generateMarkdownToc(markdown, options = {}) {
|
|
|
6436
6462
|
});
|
|
6437
6463
|
return { toc: tocLines.join("\n"), entries };
|
|
6438
6464
|
}
|
|
6465
|
+
function quoteSqlIdentifier(name, dialect) {
|
|
6466
|
+
if (dialect === "mysql") return "`" + name.replace(/`/g, "``") + "`";
|
|
6467
|
+
return '"' + name.replace(/"/g, '""') + '"';
|
|
6468
|
+
}
|
|
6469
|
+
function formatSqlValue(raw) {
|
|
6470
|
+
const trimmed = raw.trim();
|
|
6471
|
+
if (trimmed === "") return "NULL";
|
|
6472
|
+
if (/^-?\d+(\.\d+)?$/.test(trimmed)) return trimmed;
|
|
6473
|
+
if (/^(true|false)$/i.test(trimmed)) return trimmed.toLowerCase();
|
|
6474
|
+
return "'" + trimmed.replace(/'/g, "''") + "'";
|
|
6475
|
+
}
|
|
6476
|
+
function csvToSqlInsert(input, options) {
|
|
6477
|
+
const parsed = parseCsv(input);
|
|
6478
|
+
if ("error" in parsed) return parsed;
|
|
6479
|
+
const tableName = options?.tableName?.trim() || "my_table";
|
|
6480
|
+
if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(tableName)) {
|
|
6481
|
+
return { error: "tableName must start with a letter or underscore and contain only letters, digits, and underscores" };
|
|
6482
|
+
}
|
|
6483
|
+
const dialect = options?.dialect === "mysql" ? "mysql" : "ansi";
|
|
6484
|
+
const batchSize = options?.batchSize !== void 0 && Number.isFinite(options.batchSize) && options.batchSize > 0 ? Math.floor(options.batchSize) : 1;
|
|
6485
|
+
const columns = parsed.headers.map((h) => h.trim());
|
|
6486
|
+
const quotedTable = quoteSqlIdentifier(tableName, dialect);
|
|
6487
|
+
const quotedColumns = columns.map((c) => quoteSqlIdentifier(c, dialect)).join(", ");
|
|
6488
|
+
const statements = [];
|
|
6489
|
+
for (let i = 0; i < parsed.rows.length; i += batchSize) {
|
|
6490
|
+
const batch = parsed.rows.slice(i, i + batchSize);
|
|
6491
|
+
const tuples = batch.map(
|
|
6492
|
+
(row) => "(" + columns.map((_, idx) => formatSqlValue(row[idx] ?? "")).join(", ") + ")"
|
|
6493
|
+
);
|
|
6494
|
+
statements.push(`INSERT INTO ${quotedTable} (${quotedColumns}) VALUES ${tuples.join(", ")};`);
|
|
6495
|
+
}
|
|
6496
|
+
return {
|
|
6497
|
+
sql: statements.join("\n"),
|
|
6498
|
+
rowCount: parsed.rows.length,
|
|
6499
|
+
columnCount: columns.length,
|
|
6500
|
+
columns
|
|
6501
|
+
};
|
|
6502
|
+
}
|
|
6439
6503
|
|
|
6440
6504
|
// src/tools/generators.ts
|
|
6441
6505
|
var generators_exports = {};
|
|
@@ -7868,6 +7932,7 @@ __export(units_exports, {
|
|
|
7868
7932
|
calculateTipSplit: () => calculateTipSplit,
|
|
7869
7933
|
calculateVideoBitrate: () => calculateVideoBitrate,
|
|
7870
7934
|
compareSemver: () => compareSemver,
|
|
7935
|
+
compareUnitPrices: () => compareUnitPrices,
|
|
7871
7936
|
convert: () => convert,
|
|
7872
7937
|
convertAprApy: () => convertAprApy,
|
|
7873
7938
|
convertBytes: () => convertBytes,
|
|
@@ -9670,6 +9735,35 @@ function calculateRoi(input) {
|
|
|
9670
9735
|
}
|
|
9671
9736
|
return result;
|
|
9672
9737
|
}
|
|
9738
|
+
function compareUnitPrices(items) {
|
|
9739
|
+
if (!Array.isArray(items) || items.length < 2) {
|
|
9740
|
+
return { error: "At least 2 items are required to compare" };
|
|
9741
|
+
}
|
|
9742
|
+
for (const item of items) {
|
|
9743
|
+
if (!item.label || typeof item.label !== "string") {
|
|
9744
|
+
return { error: "Each item must have a non-empty label" };
|
|
9745
|
+
}
|
|
9746
|
+
if (!Number.isFinite(item.price) || item.price <= 0) {
|
|
9747
|
+
return { error: `Item "${item.label}" must have a price greater than zero` };
|
|
9748
|
+
}
|
|
9749
|
+
if (!Number.isFinite(item.quantity) || item.quantity <= 0) {
|
|
9750
|
+
return { error: `Item "${item.label}" must have a quantity greater than zero` };
|
|
9751
|
+
}
|
|
9752
|
+
}
|
|
9753
|
+
const round4 = (n) => Math.round(n * 1e4) / 1e4;
|
|
9754
|
+
const unitPrices = items.map((item) => item.price / item.quantity);
|
|
9755
|
+
const bestUnitPrice = Math.min(...unitPrices);
|
|
9756
|
+
const results = items.map((item, i) => ({
|
|
9757
|
+
label: item.label,
|
|
9758
|
+
price: round4(item.price),
|
|
9759
|
+
quantity: round4(item.quantity),
|
|
9760
|
+
unitPrice: round4(unitPrices[i]),
|
|
9761
|
+
isBest: unitPrices[i] === bestUnitPrice,
|
|
9762
|
+
percentMoreThanBest: round4((unitPrices[i] - bestUnitPrice) / bestUnitPrice * 100)
|
|
9763
|
+
}));
|
|
9764
|
+
const bestLabel = results.find((r) => r.isBest).label;
|
|
9765
|
+
return { items: results, bestLabel };
|
|
9766
|
+
}
|
|
9673
9767
|
|
|
9674
9768
|
// src/tools/network.ts
|
|
9675
9769
|
var network_exports = {};
|
|
@@ -9679,6 +9773,7 @@ __export(network_exports, {
|
|
|
9679
9773
|
LINK_REL_VALUES: () => LINK_REL_VALUES,
|
|
9680
9774
|
REFERRER_POLICY_VALUES: () => REFERRER_POLICY_VALUES,
|
|
9681
9775
|
STATUS_CODES: () => STATUS_CODES,
|
|
9776
|
+
analyzeEmailHeaders: () => analyzeEmailHeaders,
|
|
9682
9777
|
buildCacheControl: () => buildCacheControl,
|
|
9683
9778
|
buildDnsQueryUrl: () => buildDnsQueryUrl,
|
|
9684
9779
|
buildGeoUrl: () => buildGeoUrl,
|
|
@@ -11801,6 +11896,84 @@ function checkSetCookieHeader(header) {
|
|
|
11801
11896
|
}
|
|
11802
11897
|
return { cookie, issues, warnings, valid: issues.length === 0 };
|
|
11803
11898
|
}
|
|
11899
|
+
function analyzeEmailHeaders(raw) {
|
|
11900
|
+
if (typeof raw !== "string" || !raw.trim()) {
|
|
11901
|
+
return { error: "Raw email header text is required" };
|
|
11902
|
+
}
|
|
11903
|
+
const normalized = raw.replace(/\r\n/g, "\n");
|
|
11904
|
+
const blockEnd = normalized.indexOf("\n\n");
|
|
11905
|
+
const headerBlock = blockEnd === -1 ? normalized : normalized.slice(0, blockEnd);
|
|
11906
|
+
const rawLines = headerBlock.split("\n");
|
|
11907
|
+
const unfolded = [];
|
|
11908
|
+
for (const line of rawLines) {
|
|
11909
|
+
if (/^[ \t]/.test(line) && unfolded.length > 0) {
|
|
11910
|
+
unfolded[unfolded.length - 1] += " " + line.trim();
|
|
11911
|
+
} else if (line.trim() !== "") {
|
|
11912
|
+
unfolded.push(line);
|
|
11913
|
+
}
|
|
11914
|
+
}
|
|
11915
|
+
const headers = [];
|
|
11916
|
+
for (const line of unfolded) {
|
|
11917
|
+
const colonIdx = line.indexOf(":");
|
|
11918
|
+
if (colonIdx === -1) continue;
|
|
11919
|
+
const name = line.slice(0, colonIdx).trim();
|
|
11920
|
+
const value = line.slice(colonIdx + 1).trim();
|
|
11921
|
+
if (!name) continue;
|
|
11922
|
+
headers.push({ name, value });
|
|
11923
|
+
}
|
|
11924
|
+
if (headers.length === 0) {
|
|
11925
|
+
return { error: 'No parseable headers found \u2014 expected lines like "From: ..." or "Received: ..."' };
|
|
11926
|
+
}
|
|
11927
|
+
const findFirst = (name) => headers.find((h) => h.name.toLowerCase() === name.toLowerCase())?.value ?? null;
|
|
11928
|
+
const findAll = (name) => headers.filter((h) => h.name.toLowerCase() === name.toLowerCase());
|
|
11929
|
+
const receivedHops = findAll("received").map((h, i) => {
|
|
11930
|
+
const fromMatch = h.value.match(/from\s+([^\s;]+(?:\s*\([^)]*\))?)/i);
|
|
11931
|
+
const byMatch = h.value.match(/\bby\s+([^\s;]+)/i);
|
|
11932
|
+
const segments = h.value.split(";");
|
|
11933
|
+
const date = segments.length > 1 ? segments[segments.length - 1].trim() : null;
|
|
11934
|
+
return {
|
|
11935
|
+
index: i + 1,
|
|
11936
|
+
raw: h.value,
|
|
11937
|
+
from: fromMatch ? fromMatch[1].trim() : null,
|
|
11938
|
+
by: byMatch ? byMatch[1].trim() : null,
|
|
11939
|
+
date: date || null
|
|
11940
|
+
};
|
|
11941
|
+
});
|
|
11942
|
+
const authResultsHeader = findFirst("authentication-results");
|
|
11943
|
+
const authResults = [];
|
|
11944
|
+
if (authResultsHeader) {
|
|
11945
|
+
const re = /\b(spf|dkim|dmarc)=(\w+)/gi;
|
|
11946
|
+
let m;
|
|
11947
|
+
while ((m = re.exec(authResultsHeader)) !== null) {
|
|
11948
|
+
authResults.push({ mechanism: m[1].toLowerCase(), result: m[2].toLowerCase() });
|
|
11949
|
+
}
|
|
11950
|
+
}
|
|
11951
|
+
const findAuth = (mechanism) => authResults.find((a) => a.mechanism === mechanism)?.result ?? null;
|
|
11952
|
+
const warnings = [];
|
|
11953
|
+
if (receivedHops.length === 0) {
|
|
11954
|
+
warnings.push("No Received headers found \u2014 this may be a partial header block rather than a full raw source.");
|
|
11955
|
+
}
|
|
11956
|
+
if (!authResultsHeader) {
|
|
11957
|
+
warnings.push("No Authentication-Results header found \u2014 SPF/DKIM/DMARC cannot be determined from this header block alone.");
|
|
11958
|
+
}
|
|
11959
|
+
return {
|
|
11960
|
+
headers,
|
|
11961
|
+
from: findFirst("from"),
|
|
11962
|
+
to: findFirst("to"),
|
|
11963
|
+
subject: findFirst("subject"),
|
|
11964
|
+
date: findFirst("date"),
|
|
11965
|
+
messageId: findFirst("message-id"),
|
|
11966
|
+
returnPath: findFirst("return-path"),
|
|
11967
|
+
replyTo: findFirst("reply-to"),
|
|
11968
|
+
receivedHops,
|
|
11969
|
+
hopCount: receivedHops.length,
|
|
11970
|
+
authResults,
|
|
11971
|
+
spf: findAuth("spf"),
|
|
11972
|
+
dkim: findAuth("dkim"),
|
|
11973
|
+
dmarc: findAuth("dmarc"),
|
|
11974
|
+
warnings
|
|
11975
|
+
};
|
|
11976
|
+
}
|
|
11804
11977
|
|
|
11805
11978
|
// src/tools/api.ts
|
|
11806
11979
|
var api_exports = {};
|
package/dist/index.d.cts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export { j as json } from './json-Ta9JykSB.cjs';
|
|
2
2
|
export { e as encoding } from './encoding-Dk3wpmb3.cjs';
|
|
3
|
-
export { h as hashing } from './hashing-
|
|
3
|
+
export { h as hashing } from './hashing-Dnj0IAZf.cjs';
|
|
4
4
|
export { t as text } from './text-kHkT9VtT.cjs';
|
|
5
|
-
export { d as data } from './data-
|
|
5
|
+
export { d as data } from './data-BCf3dm-E.cjs';
|
|
6
6
|
export { g as generators } from './generators-Du8cBesn.cjs';
|
|
7
7
|
export { t as time } from './time-KqJjdqII.cjs';
|
|
8
|
-
export { u as units } from './units-
|
|
9
|
-
export { n as network } from './network-
|
|
8
|
+
export { u as units } from './units-HQrMCiNM.cjs';
|
|
9
|
+
export { n as network } from './network-CKPoesdD.cjs';
|
|
10
10
|
export { a as api } from './api-DmTNE4c1.cjs';
|
|
11
11
|
export { c as code } from './code-KXoRsHtl.cjs';
|
|
12
12
|
export { c as color } from './color-tPwZCr9H.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export { j as json } from './json-Ta9JykSB.js';
|
|
2
2
|
export { e as encoding } from './encoding-Dk3wpmb3.js';
|
|
3
|
-
export { h as hashing } from './hashing-
|
|
3
|
+
export { h as hashing } from './hashing-Dnj0IAZf.js';
|
|
4
4
|
export { t as text } from './text-kHkT9VtT.js';
|
|
5
|
-
export { d as data } from './data-
|
|
5
|
+
export { d as data } from './data-BCf3dm-E.js';
|
|
6
6
|
export { g as generators } from './generators-Du8cBesn.js';
|
|
7
7
|
export { t as time } from './time-KqJjdqII.js';
|
|
8
|
-
export { u as units } from './units-
|
|
9
|
-
export { n as network } from './network-
|
|
8
|
+
export { u as units } from './units-HQrMCiNM.js';
|
|
9
|
+
export { n as network } from './network-CKPoesdD.js';
|
|
10
10
|
export { a as api } from './api-DmTNE4c1.js';
|
|
11
11
|
export { c as code } from './code-KXoRsHtl.js';
|
|
12
12
|
export { c as color } from './color-tPwZCr9H.js';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { media_exports as media } from './chunk-L6V4W4SU.js';
|
|
2
|
-
export { units_exports as units } from './chunk-
|
|
3
|
-
export { network_exports as network } from './chunk-
|
|
2
|
+
export { units_exports as units } from './chunk-47RI5V3B.js';
|
|
3
|
+
export { network_exports as network } from './chunk-Y4BVU76A.js';
|
|
4
4
|
export { api_exports as api } from './chunk-52ZDKSIX.js';
|
|
5
5
|
export { code_exports as code } from './chunk-JL7YTXRB.js';
|
|
6
6
|
export { color_exports as color } from './chunk-BPVAB4P2.js';
|
|
@@ -9,9 +9,9 @@ export { misc_exports as misc } from './chunk-GX7H6TAX.js';
|
|
|
9
9
|
export { ai_agent_exports as ai_agent } from './chunk-W3J7GZVQ.js';
|
|
10
10
|
export { json_exports as json } from './chunk-WVEKRKGU.js';
|
|
11
11
|
export { encoding_exports as encoding } from './chunk-DOWQZUTP.js';
|
|
12
|
-
export { hashing_exports as hashing } from './chunk-
|
|
12
|
+
export { hashing_exports as hashing } from './chunk-VEVNIGJ6.js';
|
|
13
13
|
export { text_exports as text } from './chunk-F2CEN226.js';
|
|
14
|
-
export { data_exports as data } from './chunk-
|
|
14
|
+
export { data_exports as data } from './chunk-RZUNTYEH.js';
|
|
15
15
|
export { generators_exports as generators } from './chunk-3TYWIX3B.js';
|
|
16
16
|
export { time_exports as time } from './chunk-IEPWZERQ.js';
|
|
17
17
|
import './chunk-MLKGABMK.js';
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
* - ipv6-compressor: parseIpv6Address
|
|
17
17
|
* - link-header-builder: buildLinkHeader
|
|
18
18
|
* - same-site-cookie-checker: checkSetCookieHeader
|
|
19
|
+
* - email-header-analyzer: analyzeEmailHeaders
|
|
19
20
|
*/
|
|
20
21
|
declare const DNS_RECORD_TYPES: readonly ["A", "AAAA", "CNAME", "MX", "TXT", "NS", "SOA", "PTR", "SRV", "CAA"];
|
|
21
22
|
type DnsRecordType = typeof DNS_RECORD_TYPES[number];
|
|
@@ -402,7 +403,52 @@ interface CookieCheckResult {
|
|
|
402
403
|
declare function checkSetCookieHeader(header: string): CookieCheckResult | {
|
|
403
404
|
error: string;
|
|
404
405
|
};
|
|
406
|
+
interface EmailHeaderField {
|
|
407
|
+
name: string;
|
|
408
|
+
value: string;
|
|
409
|
+
}
|
|
410
|
+
interface ReceivedHop {
|
|
411
|
+
index: number;
|
|
412
|
+
raw: string;
|
|
413
|
+
from: string | null;
|
|
414
|
+
by: string | null;
|
|
415
|
+
date: string | null;
|
|
416
|
+
}
|
|
417
|
+
interface AuthResultEntry {
|
|
418
|
+
mechanism: string;
|
|
419
|
+
result: string;
|
|
420
|
+
}
|
|
421
|
+
interface EmailHeaderAnalysis {
|
|
422
|
+
headers: EmailHeaderField[];
|
|
423
|
+
from: string | null;
|
|
424
|
+
to: string | null;
|
|
425
|
+
subject: string | null;
|
|
426
|
+
date: string | null;
|
|
427
|
+
messageId: string | null;
|
|
428
|
+
returnPath: string | null;
|
|
429
|
+
replyTo: string | null;
|
|
430
|
+
receivedHops: ReceivedHop[];
|
|
431
|
+
hopCount: number;
|
|
432
|
+
authResults: AuthResultEntry[];
|
|
433
|
+
spf: string | null;
|
|
434
|
+
dkim: string | null;
|
|
435
|
+
dmarc: string | null;
|
|
436
|
+
warnings: string[];
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* Parse a raw email header block (e.g. Gmail's "Show original", or the
|
|
440
|
+
* headers from a .eml file) into structured fields, the Received hop chain
|
|
441
|
+
* in the order they appear (top = most recently added, i.e. closest to the
|
|
442
|
+
* final destination), and any SPF/DKIM/DMARC verdicts found in an
|
|
443
|
+
* Authentication-Results header. Header folding (continuation lines starting
|
|
444
|
+
* with whitespace) is unfolded before parsing. This never performs a live
|
|
445
|
+
* DNS/SPF/DKIM check — it only reports what the headers already claim.
|
|
446
|
+
*/
|
|
447
|
+
declare function analyzeEmailHeaders(raw: string): EmailHeaderAnalysis | {
|
|
448
|
+
error: string;
|
|
449
|
+
};
|
|
405
450
|
|
|
451
|
+
type network_AuthResultEntry = AuthResultEntry;
|
|
406
452
|
type network_CacheControlDirective = CacheControlDirective;
|
|
407
453
|
type network_CacheControlOptions = CacheControlOptions;
|
|
408
454
|
type network_CacheControlResult = CacheControlResult;
|
|
@@ -412,6 +458,8 @@ declare const network_DNS_RECORD_TYPES: typeof DNS_RECORD_TYPES;
|
|
|
412
458
|
type network_DnsRecord = DnsRecord;
|
|
413
459
|
type network_DnsRecordType = DnsRecordType;
|
|
414
460
|
type network_DnsResponse = DnsResponse;
|
|
461
|
+
type network_EmailHeaderAnalysis = EmailHeaderAnalysis;
|
|
462
|
+
type network_EmailHeaderField = EmailHeaderField;
|
|
415
463
|
type network_GeoResult = GeoResult;
|
|
416
464
|
declare const network_HTTP_HEADERS: typeof HTTP_HEADERS;
|
|
417
465
|
type network_HarEntry = HarEntry;
|
|
@@ -429,6 +477,7 @@ type network_LinkRel = LinkRel;
|
|
|
429
477
|
type network_ParsedDnsResult = ParsedDnsResult;
|
|
430
478
|
type network_ParsedGeoResult = ParsedGeoResult;
|
|
431
479
|
declare const network_REFERRER_POLICY_VALUES: typeof REFERRER_POLICY_VALUES;
|
|
480
|
+
type network_ReceivedHop = ReceivedHop;
|
|
432
481
|
type network_ReferrerPolicyEntry = ReferrerPolicyEntry;
|
|
433
482
|
type network_ReferrerPolicyResult = ReferrerPolicyResult;
|
|
434
483
|
type network_ReferrerPolicyValue = ReferrerPolicyValue;
|
|
@@ -445,6 +494,7 @@ type network_SitemapValidationResult = SitemapValidationResult;
|
|
|
445
494
|
type network_StatusCode = StatusCode;
|
|
446
495
|
type network_UaDeviceType = UaDeviceType;
|
|
447
496
|
type network_UserAgentInfo = UserAgentInfo;
|
|
497
|
+
declare const network_analyzeEmailHeaders: typeof analyzeEmailHeaders;
|
|
448
498
|
declare const network_buildCacheControl: typeof buildCacheControl;
|
|
449
499
|
declare const network_buildDnsQueryUrl: typeof buildDnsQueryUrl;
|
|
450
500
|
declare const network_buildGeoUrl: typeof buildGeoUrl;
|
|
@@ -481,7 +531,7 @@ declare const network_validateHeaderValue: typeof validateHeaderValue;
|
|
|
481
531
|
declare const network_validateRobotsTxt: typeof validateRobotsTxt;
|
|
482
532
|
declare const network_validateSitemap: typeof validateSitemap;
|
|
483
533
|
declare namespace network {
|
|
484
|
-
export { type network_CacheControlDirective as CacheControlDirective, type network_CacheControlOptions as CacheControlOptions, type network_CacheControlResult as CacheControlResult, type network_CookieAttributes as CookieAttributes, type network_CookieCheckResult as CookieCheckResult, network_DNS_RECORD_TYPES as DNS_RECORD_TYPES, type network_DnsRecord as DnsRecord, type network_DnsRecordType as DnsRecordType, type network_DnsResponse as DnsResponse, type network_GeoResult as GeoResult, network_HTTP_HEADERS as HTTP_HEADERS, type network_HarEntry as HarEntry, type network_HarParseResult as HarParseResult, type network_HarSummary as HarSummary, type network_HeaderCategory as HeaderCategory, type network_HttpHeader as HttpHeader, type network_Ipv6AddressType as Ipv6AddressType, type network_Ipv6ParseResult as Ipv6ParseResult, network_LINK_REL_VALUES as LINK_REL_VALUES, type network_LinkHeaderEntry as LinkHeaderEntry, type network_LinkHeaderEntryInput as LinkHeaderEntryInput, type network_LinkHeaderResult as LinkHeaderResult, type network_LinkRel as LinkRel, type network_ParsedDnsResult as ParsedDnsResult, type network_ParsedGeoResult as ParsedGeoResult, network_REFERRER_POLICY_VALUES as REFERRER_POLICY_VALUES, type network_ReferrerPolicyEntry as ReferrerPolicyEntry, type network_ReferrerPolicyResult as ReferrerPolicyResult, type network_ReferrerPolicyValue as ReferrerPolicyValue, type network_RobotsGroup as RobotsGroup, type network_RobotsIssue as RobotsIssue, type network_RobotsRule as RobotsRule, type network_RobotsValidationResult as RobotsValidationResult, network_STATUS_CODES as STATUS_CODES, type network_SameSiteValue as SameSiteValue, type network_SitemapIndexEntry as SitemapIndexEntry, type network_SitemapIssue as SitemapIssue, type network_SitemapUrlEntry as SitemapUrlEntry, type network_SitemapValidationResult as SitemapValidationResult, type network_StatusCode as StatusCode, type network_UaDeviceType as UaDeviceType, type network_UserAgentInfo as UserAgentInfo, network_buildCacheControl as buildCacheControl, network_buildDnsQueryUrl as buildDnsQueryUrl, network_buildGeoUrl as buildGeoUrl, network_buildLinkHeader as buildLinkHeader, network_buildMapUrl as buildMapUrl, network_buildReferrerPolicy as buildReferrerPolicy, network_checkSetCookieHeader as checkSetCookieHeader, network_countryCodeToFlag as countryCodeToFlag, network_formatCoordinates as formatCoordinates, network_formatTtl as formatTtl, network_getByCategory as getByCategory, network_getHeader as getHeader, network_getHeadersByCategory as getHeadersByCategory, network_getStatusByCategory as getStatusByCategory, network_getStatusCode as getStatusCode, network_isClientError as isClientError, network_isServerError as isServerError, network_isSuccess as isSuccess, network_isValidIp as isValidIp, network_isValidIpv4 as isValidIpv4, network_isValidIpv6 as isValidIpv6, network_parseDnsResponse as parseDnsResponse, network_parseGeoResponse as parseGeoResponse, network_parseHar as parseHar, network_parseIpv6Address as parseIpv6Address, network_parseUserAgent as parseUserAgent, network_searchHeaders as searchHeaders, network_searchStatusCodes as searchStatusCodes, network_statusCodeToText as statusCodeToText, network_typeNumberToLabel as typeNumberToLabel, network_validateDomain as validateDomain, network_validateHeaderName as validateHeaderName, network_validateHeaderValue as validateHeaderValue, network_validateRobotsTxt as validateRobotsTxt, network_validateSitemap as validateSitemap };
|
|
534
|
+
export { type network_AuthResultEntry as AuthResultEntry, type network_CacheControlDirective as CacheControlDirective, type network_CacheControlOptions as CacheControlOptions, type network_CacheControlResult as CacheControlResult, type network_CookieAttributes as CookieAttributes, type network_CookieCheckResult as CookieCheckResult, network_DNS_RECORD_TYPES as DNS_RECORD_TYPES, type network_DnsRecord as DnsRecord, type network_DnsRecordType as DnsRecordType, type network_DnsResponse as DnsResponse, type network_EmailHeaderAnalysis as EmailHeaderAnalysis, type network_EmailHeaderField as EmailHeaderField, type network_GeoResult as GeoResult, network_HTTP_HEADERS as HTTP_HEADERS, type network_HarEntry as HarEntry, type network_HarParseResult as HarParseResult, type network_HarSummary as HarSummary, type network_HeaderCategory as HeaderCategory, type network_HttpHeader as HttpHeader, type network_Ipv6AddressType as Ipv6AddressType, type network_Ipv6ParseResult as Ipv6ParseResult, network_LINK_REL_VALUES as LINK_REL_VALUES, type network_LinkHeaderEntry as LinkHeaderEntry, type network_LinkHeaderEntryInput as LinkHeaderEntryInput, type network_LinkHeaderResult as LinkHeaderResult, type network_LinkRel as LinkRel, type network_ParsedDnsResult as ParsedDnsResult, type network_ParsedGeoResult as ParsedGeoResult, network_REFERRER_POLICY_VALUES as REFERRER_POLICY_VALUES, type network_ReceivedHop as ReceivedHop, type network_ReferrerPolicyEntry as ReferrerPolicyEntry, type network_ReferrerPolicyResult as ReferrerPolicyResult, type network_ReferrerPolicyValue as ReferrerPolicyValue, type network_RobotsGroup as RobotsGroup, type network_RobotsIssue as RobotsIssue, type network_RobotsRule as RobotsRule, type network_RobotsValidationResult as RobotsValidationResult, network_STATUS_CODES as STATUS_CODES, type network_SameSiteValue as SameSiteValue, type network_SitemapIndexEntry as SitemapIndexEntry, type network_SitemapIssue as SitemapIssue, type network_SitemapUrlEntry as SitemapUrlEntry, type network_SitemapValidationResult as SitemapValidationResult, type network_StatusCode as StatusCode, type network_UaDeviceType as UaDeviceType, type network_UserAgentInfo as UserAgentInfo, network_analyzeEmailHeaders as analyzeEmailHeaders, network_buildCacheControl as buildCacheControl, network_buildDnsQueryUrl as buildDnsQueryUrl, network_buildGeoUrl as buildGeoUrl, network_buildLinkHeader as buildLinkHeader, network_buildMapUrl as buildMapUrl, network_buildReferrerPolicy as buildReferrerPolicy, network_checkSetCookieHeader as checkSetCookieHeader, network_countryCodeToFlag as countryCodeToFlag, network_formatCoordinates as formatCoordinates, network_formatTtl as formatTtl, network_getByCategory as getByCategory, network_getHeader as getHeader, network_getHeadersByCategory as getHeadersByCategory, network_getStatusByCategory as getStatusByCategory, network_getStatusCode as getStatusCode, network_isClientError as isClientError, network_isServerError as isServerError, network_isSuccess as isSuccess, network_isValidIp as isValidIp, network_isValidIpv4 as isValidIpv4, network_isValidIpv6 as isValidIpv6, network_parseDnsResponse as parseDnsResponse, network_parseGeoResponse as parseGeoResponse, network_parseHar as parseHar, network_parseIpv6Address as parseIpv6Address, network_parseUserAgent as parseUserAgent, network_searchHeaders as searchHeaders, network_searchStatusCodes as searchStatusCodes, network_statusCodeToText as statusCodeToText, network_typeNumberToLabel as typeNumberToLabel, network_validateDomain as validateDomain, network_validateHeaderName as validateHeaderName, network_validateHeaderValue as validateHeaderValue, network_validateRobotsTxt as validateRobotsTxt, network_validateSitemap as validateSitemap };
|
|
485
535
|
}
|
|
486
536
|
|
|
487
|
-
export {
|
|
537
|
+
export { buildReferrerPolicy as $, type AuthResultEntry as A, type RobotsRule as B, type CacheControlDirective as C, DNS_RECORD_TYPES as D, type EmailHeaderAnalysis as E, type RobotsValidationResult as F, type GeoResult as G, HTTP_HEADERS as H, type Ipv6AddressType as I, type SameSiteValue as J, type SitemapIndexEntry as K, LINK_REL_VALUES as L, type SitemapIssue as M, type SitemapUrlEntry as N, type SitemapValidationResult as O, type ParsedDnsResult as P, type StatusCode as Q, REFERRER_POLICY_VALUES as R, STATUS_CODES as S, type UserAgentInfo as T, type UaDeviceType as U, analyzeEmailHeaders as V, buildCacheControl as W, buildDnsQueryUrl as X, buildGeoUrl as Y, buildLinkHeader as Z, buildMapUrl as _, type CacheControlOptions as a, checkSetCookieHeader as a0, countryCodeToFlag as a1, formatCoordinates as a2, formatTtl as a3, getByCategory as a4, getHeader as a5, getHeadersByCategory as a6, getStatusByCategory as a7, getStatusCode as a8, isClientError as a9, isServerError as aa, isSuccess as ab, isValidIp as ac, isValidIpv4 as ad, isValidIpv6 as ae, parseDnsResponse as af, parseGeoResponse as ag, parseHar as ah, parseIpv6Address as ai, parseUserAgent as aj, searchHeaders as ak, searchStatusCodes as al, statusCodeToText as am, typeNumberToLabel as an, validateDomain as ao, validateHeaderName as ap, validateHeaderValue as aq, validateRobotsTxt as ar, validateSitemap as as, type CacheControlResult as b, type CookieAttributes as c, type CookieCheckResult as d, type DnsRecord as e, type DnsRecordType as f, type DnsResponse as g, type EmailHeaderField as h, type HarEntry as i, type HarParseResult as j, type HarSummary as k, type HeaderCategory as l, type HttpHeader as m, network as n, type Ipv6ParseResult as o, type LinkHeaderEntry as p, type LinkHeaderEntryInput as q, type LinkHeaderResult as r, type LinkRel as s, type ParsedGeoResult as t, type ReceivedHop as u, type ReferrerPolicyEntry as v, type ReferrerPolicyResult as w, type ReferrerPolicyValue as x, type RobotsGroup as y, type RobotsIssue as z };
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
* - ipv6-compressor: parseIpv6Address
|
|
17
17
|
* - link-header-builder: buildLinkHeader
|
|
18
18
|
* - same-site-cookie-checker: checkSetCookieHeader
|
|
19
|
+
* - email-header-analyzer: analyzeEmailHeaders
|
|
19
20
|
*/
|
|
20
21
|
declare const DNS_RECORD_TYPES: readonly ["A", "AAAA", "CNAME", "MX", "TXT", "NS", "SOA", "PTR", "SRV", "CAA"];
|
|
21
22
|
type DnsRecordType = typeof DNS_RECORD_TYPES[number];
|
|
@@ -402,7 +403,52 @@ interface CookieCheckResult {
|
|
|
402
403
|
declare function checkSetCookieHeader(header: string): CookieCheckResult | {
|
|
403
404
|
error: string;
|
|
404
405
|
};
|
|
406
|
+
interface EmailHeaderField {
|
|
407
|
+
name: string;
|
|
408
|
+
value: string;
|
|
409
|
+
}
|
|
410
|
+
interface ReceivedHop {
|
|
411
|
+
index: number;
|
|
412
|
+
raw: string;
|
|
413
|
+
from: string | null;
|
|
414
|
+
by: string | null;
|
|
415
|
+
date: string | null;
|
|
416
|
+
}
|
|
417
|
+
interface AuthResultEntry {
|
|
418
|
+
mechanism: string;
|
|
419
|
+
result: string;
|
|
420
|
+
}
|
|
421
|
+
interface EmailHeaderAnalysis {
|
|
422
|
+
headers: EmailHeaderField[];
|
|
423
|
+
from: string | null;
|
|
424
|
+
to: string | null;
|
|
425
|
+
subject: string | null;
|
|
426
|
+
date: string | null;
|
|
427
|
+
messageId: string | null;
|
|
428
|
+
returnPath: string | null;
|
|
429
|
+
replyTo: string | null;
|
|
430
|
+
receivedHops: ReceivedHop[];
|
|
431
|
+
hopCount: number;
|
|
432
|
+
authResults: AuthResultEntry[];
|
|
433
|
+
spf: string | null;
|
|
434
|
+
dkim: string | null;
|
|
435
|
+
dmarc: string | null;
|
|
436
|
+
warnings: string[];
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* Parse a raw email header block (e.g. Gmail's "Show original", or the
|
|
440
|
+
* headers from a .eml file) into structured fields, the Received hop chain
|
|
441
|
+
* in the order they appear (top = most recently added, i.e. closest to the
|
|
442
|
+
* final destination), and any SPF/DKIM/DMARC verdicts found in an
|
|
443
|
+
* Authentication-Results header. Header folding (continuation lines starting
|
|
444
|
+
* with whitespace) is unfolded before parsing. This never performs a live
|
|
445
|
+
* DNS/SPF/DKIM check — it only reports what the headers already claim.
|
|
446
|
+
*/
|
|
447
|
+
declare function analyzeEmailHeaders(raw: string): EmailHeaderAnalysis | {
|
|
448
|
+
error: string;
|
|
449
|
+
};
|
|
405
450
|
|
|
451
|
+
type network_AuthResultEntry = AuthResultEntry;
|
|
406
452
|
type network_CacheControlDirective = CacheControlDirective;
|
|
407
453
|
type network_CacheControlOptions = CacheControlOptions;
|
|
408
454
|
type network_CacheControlResult = CacheControlResult;
|
|
@@ -412,6 +458,8 @@ declare const network_DNS_RECORD_TYPES: typeof DNS_RECORD_TYPES;
|
|
|
412
458
|
type network_DnsRecord = DnsRecord;
|
|
413
459
|
type network_DnsRecordType = DnsRecordType;
|
|
414
460
|
type network_DnsResponse = DnsResponse;
|
|
461
|
+
type network_EmailHeaderAnalysis = EmailHeaderAnalysis;
|
|
462
|
+
type network_EmailHeaderField = EmailHeaderField;
|
|
415
463
|
type network_GeoResult = GeoResult;
|
|
416
464
|
declare const network_HTTP_HEADERS: typeof HTTP_HEADERS;
|
|
417
465
|
type network_HarEntry = HarEntry;
|
|
@@ -429,6 +477,7 @@ type network_LinkRel = LinkRel;
|
|
|
429
477
|
type network_ParsedDnsResult = ParsedDnsResult;
|
|
430
478
|
type network_ParsedGeoResult = ParsedGeoResult;
|
|
431
479
|
declare const network_REFERRER_POLICY_VALUES: typeof REFERRER_POLICY_VALUES;
|
|
480
|
+
type network_ReceivedHop = ReceivedHop;
|
|
432
481
|
type network_ReferrerPolicyEntry = ReferrerPolicyEntry;
|
|
433
482
|
type network_ReferrerPolicyResult = ReferrerPolicyResult;
|
|
434
483
|
type network_ReferrerPolicyValue = ReferrerPolicyValue;
|
|
@@ -445,6 +494,7 @@ type network_SitemapValidationResult = SitemapValidationResult;
|
|
|
445
494
|
type network_StatusCode = StatusCode;
|
|
446
495
|
type network_UaDeviceType = UaDeviceType;
|
|
447
496
|
type network_UserAgentInfo = UserAgentInfo;
|
|
497
|
+
declare const network_analyzeEmailHeaders: typeof analyzeEmailHeaders;
|
|
448
498
|
declare const network_buildCacheControl: typeof buildCacheControl;
|
|
449
499
|
declare const network_buildDnsQueryUrl: typeof buildDnsQueryUrl;
|
|
450
500
|
declare const network_buildGeoUrl: typeof buildGeoUrl;
|
|
@@ -481,7 +531,7 @@ declare const network_validateHeaderValue: typeof validateHeaderValue;
|
|
|
481
531
|
declare const network_validateRobotsTxt: typeof validateRobotsTxt;
|
|
482
532
|
declare const network_validateSitemap: typeof validateSitemap;
|
|
483
533
|
declare namespace network {
|
|
484
|
-
export { type network_CacheControlDirective as CacheControlDirective, type network_CacheControlOptions as CacheControlOptions, type network_CacheControlResult as CacheControlResult, type network_CookieAttributes as CookieAttributes, type network_CookieCheckResult as CookieCheckResult, network_DNS_RECORD_TYPES as DNS_RECORD_TYPES, type network_DnsRecord as DnsRecord, type network_DnsRecordType as DnsRecordType, type network_DnsResponse as DnsResponse, type network_GeoResult as GeoResult, network_HTTP_HEADERS as HTTP_HEADERS, type network_HarEntry as HarEntry, type network_HarParseResult as HarParseResult, type network_HarSummary as HarSummary, type network_HeaderCategory as HeaderCategory, type network_HttpHeader as HttpHeader, type network_Ipv6AddressType as Ipv6AddressType, type network_Ipv6ParseResult as Ipv6ParseResult, network_LINK_REL_VALUES as LINK_REL_VALUES, type network_LinkHeaderEntry as LinkHeaderEntry, type network_LinkHeaderEntryInput as LinkHeaderEntryInput, type network_LinkHeaderResult as LinkHeaderResult, type network_LinkRel as LinkRel, type network_ParsedDnsResult as ParsedDnsResult, type network_ParsedGeoResult as ParsedGeoResult, network_REFERRER_POLICY_VALUES as REFERRER_POLICY_VALUES, type network_ReferrerPolicyEntry as ReferrerPolicyEntry, type network_ReferrerPolicyResult as ReferrerPolicyResult, type network_ReferrerPolicyValue as ReferrerPolicyValue, type network_RobotsGroup as RobotsGroup, type network_RobotsIssue as RobotsIssue, type network_RobotsRule as RobotsRule, type network_RobotsValidationResult as RobotsValidationResult, network_STATUS_CODES as STATUS_CODES, type network_SameSiteValue as SameSiteValue, type network_SitemapIndexEntry as SitemapIndexEntry, type network_SitemapIssue as SitemapIssue, type network_SitemapUrlEntry as SitemapUrlEntry, type network_SitemapValidationResult as SitemapValidationResult, type network_StatusCode as StatusCode, type network_UaDeviceType as UaDeviceType, type network_UserAgentInfo as UserAgentInfo, network_buildCacheControl as buildCacheControl, network_buildDnsQueryUrl as buildDnsQueryUrl, network_buildGeoUrl as buildGeoUrl, network_buildLinkHeader as buildLinkHeader, network_buildMapUrl as buildMapUrl, network_buildReferrerPolicy as buildReferrerPolicy, network_checkSetCookieHeader as checkSetCookieHeader, network_countryCodeToFlag as countryCodeToFlag, network_formatCoordinates as formatCoordinates, network_formatTtl as formatTtl, network_getByCategory as getByCategory, network_getHeader as getHeader, network_getHeadersByCategory as getHeadersByCategory, network_getStatusByCategory as getStatusByCategory, network_getStatusCode as getStatusCode, network_isClientError as isClientError, network_isServerError as isServerError, network_isSuccess as isSuccess, network_isValidIp as isValidIp, network_isValidIpv4 as isValidIpv4, network_isValidIpv6 as isValidIpv6, network_parseDnsResponse as parseDnsResponse, network_parseGeoResponse as parseGeoResponse, network_parseHar as parseHar, network_parseIpv6Address as parseIpv6Address, network_parseUserAgent as parseUserAgent, network_searchHeaders as searchHeaders, network_searchStatusCodes as searchStatusCodes, network_statusCodeToText as statusCodeToText, network_typeNumberToLabel as typeNumberToLabel, network_validateDomain as validateDomain, network_validateHeaderName as validateHeaderName, network_validateHeaderValue as validateHeaderValue, network_validateRobotsTxt as validateRobotsTxt, network_validateSitemap as validateSitemap };
|
|
534
|
+
export { type network_AuthResultEntry as AuthResultEntry, type network_CacheControlDirective as CacheControlDirective, type network_CacheControlOptions as CacheControlOptions, type network_CacheControlResult as CacheControlResult, type network_CookieAttributes as CookieAttributes, type network_CookieCheckResult as CookieCheckResult, network_DNS_RECORD_TYPES as DNS_RECORD_TYPES, type network_DnsRecord as DnsRecord, type network_DnsRecordType as DnsRecordType, type network_DnsResponse as DnsResponse, type network_EmailHeaderAnalysis as EmailHeaderAnalysis, type network_EmailHeaderField as EmailHeaderField, type network_GeoResult as GeoResult, network_HTTP_HEADERS as HTTP_HEADERS, type network_HarEntry as HarEntry, type network_HarParseResult as HarParseResult, type network_HarSummary as HarSummary, type network_HeaderCategory as HeaderCategory, type network_HttpHeader as HttpHeader, type network_Ipv6AddressType as Ipv6AddressType, type network_Ipv6ParseResult as Ipv6ParseResult, network_LINK_REL_VALUES as LINK_REL_VALUES, type network_LinkHeaderEntry as LinkHeaderEntry, type network_LinkHeaderEntryInput as LinkHeaderEntryInput, type network_LinkHeaderResult as LinkHeaderResult, type network_LinkRel as LinkRel, type network_ParsedDnsResult as ParsedDnsResult, type network_ParsedGeoResult as ParsedGeoResult, network_REFERRER_POLICY_VALUES as REFERRER_POLICY_VALUES, type network_ReceivedHop as ReceivedHop, type network_ReferrerPolicyEntry as ReferrerPolicyEntry, type network_ReferrerPolicyResult as ReferrerPolicyResult, type network_ReferrerPolicyValue as ReferrerPolicyValue, type network_RobotsGroup as RobotsGroup, type network_RobotsIssue as RobotsIssue, type network_RobotsRule as RobotsRule, type network_RobotsValidationResult as RobotsValidationResult, network_STATUS_CODES as STATUS_CODES, type network_SameSiteValue as SameSiteValue, type network_SitemapIndexEntry as SitemapIndexEntry, type network_SitemapIssue as SitemapIssue, type network_SitemapUrlEntry as SitemapUrlEntry, type network_SitemapValidationResult as SitemapValidationResult, type network_StatusCode as StatusCode, type network_UaDeviceType as UaDeviceType, type network_UserAgentInfo as UserAgentInfo, network_analyzeEmailHeaders as analyzeEmailHeaders, network_buildCacheControl as buildCacheControl, network_buildDnsQueryUrl as buildDnsQueryUrl, network_buildGeoUrl as buildGeoUrl, network_buildLinkHeader as buildLinkHeader, network_buildMapUrl as buildMapUrl, network_buildReferrerPolicy as buildReferrerPolicy, network_checkSetCookieHeader as checkSetCookieHeader, network_countryCodeToFlag as countryCodeToFlag, network_formatCoordinates as formatCoordinates, network_formatTtl as formatTtl, network_getByCategory as getByCategory, network_getHeader as getHeader, network_getHeadersByCategory as getHeadersByCategory, network_getStatusByCategory as getStatusByCategory, network_getStatusCode as getStatusCode, network_isClientError as isClientError, network_isServerError as isServerError, network_isSuccess as isSuccess, network_isValidIp as isValidIp, network_isValidIpv4 as isValidIpv4, network_isValidIpv6 as isValidIpv6, network_parseDnsResponse as parseDnsResponse, network_parseGeoResponse as parseGeoResponse, network_parseHar as parseHar, network_parseIpv6Address as parseIpv6Address, network_parseUserAgent as parseUserAgent, network_searchHeaders as searchHeaders, network_searchStatusCodes as searchStatusCodes, network_statusCodeToText as statusCodeToText, network_typeNumberToLabel as typeNumberToLabel, network_validateDomain as validateDomain, network_validateHeaderName as validateHeaderName, network_validateHeaderValue as validateHeaderValue, network_validateRobotsTxt as validateRobotsTxt, network_validateSitemap as validateSitemap };
|
|
485
535
|
}
|
|
486
536
|
|
|
487
|
-
export {
|
|
537
|
+
export { buildReferrerPolicy as $, type AuthResultEntry as A, type RobotsRule as B, type CacheControlDirective as C, DNS_RECORD_TYPES as D, type EmailHeaderAnalysis as E, type RobotsValidationResult as F, type GeoResult as G, HTTP_HEADERS as H, type Ipv6AddressType as I, type SameSiteValue as J, type SitemapIndexEntry as K, LINK_REL_VALUES as L, type SitemapIssue as M, type SitemapUrlEntry as N, type SitemapValidationResult as O, type ParsedDnsResult as P, type StatusCode as Q, REFERRER_POLICY_VALUES as R, STATUS_CODES as S, type UserAgentInfo as T, type UaDeviceType as U, analyzeEmailHeaders as V, buildCacheControl as W, buildDnsQueryUrl as X, buildGeoUrl as Y, buildLinkHeader as Z, buildMapUrl as _, type CacheControlOptions as a, checkSetCookieHeader as a0, countryCodeToFlag as a1, formatCoordinates as a2, formatTtl as a3, getByCategory as a4, getHeader as a5, getHeadersByCategory as a6, getStatusByCategory as a7, getStatusCode as a8, isClientError as a9, isServerError as aa, isSuccess as ab, isValidIp as ac, isValidIpv4 as ad, isValidIpv6 as ae, parseDnsResponse as af, parseGeoResponse as ag, parseHar as ah, parseIpv6Address as ai, parseUserAgent as aj, searchHeaders as ak, searchStatusCodes as al, statusCodeToText as am, typeNumberToLabel as an, validateDomain as ao, validateHeaderName as ap, validateHeaderValue as aq, validateRobotsTxt as ar, validateSitemap as as, type CacheControlResult as b, type CookieAttributes as c, type CookieCheckResult as d, type DnsRecord as e, type DnsRecordType as f, type DnsResponse as g, type EmailHeaderField as h, type HarEntry as i, type HarParseResult as j, type HarSummary as k, type HeaderCategory as l, type HttpHeader as m, network as n, type Ipv6ParseResult as o, type LinkHeaderEntry as p, type LinkHeaderEntryInput as q, type LinkHeaderResult as r, type LinkRel as s, type ParsedGeoResult as t, type ReceivedHop as u, type ReferrerPolicyEntry as v, type ReferrerPolicyResult as w, type ReferrerPolicyValue as x, type RobotsGroup as y, type RobotsIssue as z };
|
package/dist/tools/data.cjs
CHANGED
|
@@ -1434,9 +1434,48 @@ function generateMarkdownToc(markdown, options = {}) {
|
|
|
1434
1434
|
});
|
|
1435
1435
|
return { toc: tocLines.join("\n"), entries };
|
|
1436
1436
|
}
|
|
1437
|
+
function quoteSqlIdentifier(name, dialect) {
|
|
1438
|
+
if (dialect === "mysql") return "`" + name.replace(/`/g, "``") + "`";
|
|
1439
|
+
return '"' + name.replace(/"/g, '""') + '"';
|
|
1440
|
+
}
|
|
1441
|
+
function formatSqlValue(raw) {
|
|
1442
|
+
const trimmed = raw.trim();
|
|
1443
|
+
if (trimmed === "") return "NULL";
|
|
1444
|
+
if (/^-?\d+(\.\d+)?$/.test(trimmed)) return trimmed;
|
|
1445
|
+
if (/^(true|false)$/i.test(trimmed)) return trimmed.toLowerCase();
|
|
1446
|
+
return "'" + trimmed.replace(/'/g, "''") + "'";
|
|
1447
|
+
}
|
|
1448
|
+
function csvToSqlInsert(input, options) {
|
|
1449
|
+
const parsed = parseCsv(input);
|
|
1450
|
+
if ("error" in parsed) return parsed;
|
|
1451
|
+
const tableName = options?.tableName?.trim() || "my_table";
|
|
1452
|
+
if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(tableName)) {
|
|
1453
|
+
return { error: "tableName must start with a letter or underscore and contain only letters, digits, and underscores" };
|
|
1454
|
+
}
|
|
1455
|
+
const dialect = options?.dialect === "mysql" ? "mysql" : "ansi";
|
|
1456
|
+
const batchSize = options?.batchSize !== void 0 && Number.isFinite(options.batchSize) && options.batchSize > 0 ? Math.floor(options.batchSize) : 1;
|
|
1457
|
+
const columns = parsed.headers.map((h) => h.trim());
|
|
1458
|
+
const quotedTable = quoteSqlIdentifier(tableName, dialect);
|
|
1459
|
+
const quotedColumns = columns.map((c) => quoteSqlIdentifier(c, dialect)).join(", ");
|
|
1460
|
+
const statements = [];
|
|
1461
|
+
for (let i = 0; i < parsed.rows.length; i += batchSize) {
|
|
1462
|
+
const batch = parsed.rows.slice(i, i + batchSize);
|
|
1463
|
+
const tuples = batch.map(
|
|
1464
|
+
(row) => "(" + columns.map((_, idx) => formatSqlValue(row[idx] ?? "")).join(", ") + ")"
|
|
1465
|
+
);
|
|
1466
|
+
statements.push(`INSERT INTO ${quotedTable} (${quotedColumns}) VALUES ${tuples.join(", ")};`);
|
|
1467
|
+
}
|
|
1468
|
+
return {
|
|
1469
|
+
sql: statements.join("\n"),
|
|
1470
|
+
rowCount: parsed.rows.length,
|
|
1471
|
+
columnCount: columns.length,
|
|
1472
|
+
columns
|
|
1473
|
+
};
|
|
1474
|
+
}
|
|
1437
1475
|
|
|
1438
1476
|
exports.convertSubtitles = convertSubtitles;
|
|
1439
1477
|
exports.csvToJson = csvToJson;
|
|
1478
|
+
exports.csvToSqlInsert = csvToSqlInsert;
|
|
1440
1479
|
exports.detectDelimiter = detectDelimiter;
|
|
1441
1480
|
exports.detectSubtitleFormat = detectSubtitleFormat;
|
|
1442
1481
|
exports.diffEnvExample = diffEnvExample;
|
package/dist/tools/data.d.cts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { C as ConvertedSubtitles, a as CsvParseResult, E as EnvDiffError,
|
|
1
|
+
export { C as ConvertedSubtitles, a as CsvParseResult, b as CsvToSqlOptions, c as CsvToSqlResult, E as EnvDiffError, e as EnvDiffResult, f as EnvEntry, g as EnvParseResult, F as FrontMatterError, h as FrontMatterResult, I as IniSection, M as MarkdownTocEntry, i as MarkdownTocOptions, j as MarkdownTocResult, N as NdjsonLineResult, k as NdjsonValidateResult, P as ParseOptions, l as ParsedIni, m as ParsedSubtitles, S as SubtitleCue, n as SubtitleFormat, T as TomlFormatResult, V as ValidationResult, X as XmlFormatResult, o as XmlToJsonOptions, p as convertSubtitles, q as csvToJson, r as csvToSqlInsert, s as detectDelimiter, t as detectSubtitleFormat, u as diffEnvExample, v as envToExport, w as envToJson, x as formatNdjson, y as formatSubtitleTimestamp, z as formatToml, A as formatXml, B as generateMarkdownToc, D as getSection, G as getSectionNames, H as getTomlStats, J as getXmlStats, K as getYamlStats, L as iniToJson, O as jsonArrayToNdjson, Q as jsonToIni, R as jsonToToml, U as jsonToXml, W as minifyNdjson, Y as minifyToml, Z as minifyXml, _ as ndjsonToJsonArray, $ as parseCsv, a0 as parseEnv, a1 as parseFrontMatter, a2 as parseIni, a3 as parseSubtitleTimestamp, a4 as parseSubtitles, a5 as parseXmlToObject, a6 as serializeSubtitles, a7 as shiftSubtitles, a8 as stringifyIni, a9 as toCsvString, aa as tomlToJson, ab as validateEnvKey, ac as validateIni, ad as validateNdjson, ae as validateToml, af as validateXml, ag as validateYaml, ah as xmlToJson } from '../data-BCf3dm-E.cjs';
|
package/dist/tools/data.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { C as ConvertedSubtitles, a as CsvParseResult, E as EnvDiffError,
|
|
1
|
+
export { C as ConvertedSubtitles, a as CsvParseResult, b as CsvToSqlOptions, c as CsvToSqlResult, E as EnvDiffError, e as EnvDiffResult, f as EnvEntry, g as EnvParseResult, F as FrontMatterError, h as FrontMatterResult, I as IniSection, M as MarkdownTocEntry, i as MarkdownTocOptions, j as MarkdownTocResult, N as NdjsonLineResult, k as NdjsonValidateResult, P as ParseOptions, l as ParsedIni, m as ParsedSubtitles, S as SubtitleCue, n as SubtitleFormat, T as TomlFormatResult, V as ValidationResult, X as XmlFormatResult, o as XmlToJsonOptions, p as convertSubtitles, q as csvToJson, r as csvToSqlInsert, s as detectDelimiter, t as detectSubtitleFormat, u as diffEnvExample, v as envToExport, w as envToJson, x as formatNdjson, y as formatSubtitleTimestamp, z as formatToml, A as formatXml, B as generateMarkdownToc, D as getSection, G as getSectionNames, H as getTomlStats, J as getXmlStats, K as getYamlStats, L as iniToJson, O as jsonArrayToNdjson, Q as jsonToIni, R as jsonToToml, U as jsonToXml, W as minifyNdjson, Y as minifyToml, Z as minifyXml, _ as ndjsonToJsonArray, $ as parseCsv, a0 as parseEnv, a1 as parseFrontMatter, a2 as parseIni, a3 as parseSubtitleTimestamp, a4 as parseSubtitles, a5 as parseXmlToObject, a6 as serializeSubtitles, a7 as shiftSubtitles, a8 as stringifyIni, a9 as toCsvString, aa as tomlToJson, ab as validateEnvKey, ac as validateIni, ad as validateNdjson, ae as validateToml, af as validateXml, ag as validateYaml, ah as xmlToJson } from '../data-BCf3dm-E.js';
|
package/dist/tools/data.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { convertSubtitles, csvToJson, detectDelimiter, detectSubtitleFormat, diffEnvExample, envToExport, envToJson, formatNdjson, formatSubtitleTimestamp, formatToml, formatXml, generateMarkdownToc, getSection, getSectionNames, getTomlStats, getXmlStats, getYamlStats, iniToJson, jsonArrayToNdjson, jsonToIni, jsonToToml, jsonToXml, minifyNdjson, minifyToml, minifyXml, ndjsonToJsonArray, parseCsv, parseEnv, parseFrontMatter, parseIni, parseSubtitleTimestamp, parseSubtitles, parseXmlToObject, serializeSubtitles, shiftSubtitles, stringifyIni, toCsvString, tomlToJson, validateEnvKey, validateIni, validateNdjson, validateToml, validateXml, validateYaml, xmlToJson } from '../chunk-
|
|
1
|
+
export { convertSubtitles, csvToJson, csvToSqlInsert, detectDelimiter, detectSubtitleFormat, diffEnvExample, envToExport, envToJson, formatNdjson, formatSubtitleTimestamp, formatToml, formatXml, generateMarkdownToc, getSection, getSectionNames, getTomlStats, getXmlStats, getYamlStats, iniToJson, jsonArrayToNdjson, jsonToIni, jsonToToml, jsonToXml, minifyNdjson, minifyToml, minifyXml, ndjsonToJsonArray, parseCsv, parseEnv, parseFrontMatter, parseIni, parseSubtitleTimestamp, parseSubtitles, parseXmlToObject, serializeSubtitles, shiftSubtitles, stringifyIni, toCsvString, tomlToJson, validateEnvKey, validateIni, validateNdjson, validateToml, validateXml, validateYaml, xmlToJson } from '../chunk-RZUNTYEH.js';
|
|
2
2
|
import '../chunk-MLKGABMK.js';
|
package/dist/tools/hashing.cjs
CHANGED
|
@@ -233,16 +233,41 @@ function generateHtpasswdFile(entries) {
|
|
|
233
233
|
function validateUsername(username) {
|
|
234
234
|
return /^[^\s:]{1,255}$/.test(username);
|
|
235
235
|
}
|
|
236
|
+
var SRI_ALGORITHMS = ["SHA-256", "SHA-384", "SHA-512"];
|
|
237
|
+
var SRI_NODE_ALG_MAP = {
|
|
238
|
+
"SHA-256": "sha256",
|
|
239
|
+
"SHA-384": "sha384",
|
|
240
|
+
"SHA-512": "sha512"
|
|
241
|
+
};
|
|
242
|
+
function generateSri(content, algorithm = "SHA-384") {
|
|
243
|
+
if (typeof content !== "string" || content.length === 0) {
|
|
244
|
+
return { error: "Content is required" };
|
|
245
|
+
}
|
|
246
|
+
if (!SRI_ALGORITHMS.includes(algorithm)) {
|
|
247
|
+
return { error: `Unknown algorithm: ${algorithm}. Must be one of ${SRI_ALGORITHMS.join(", ")}` };
|
|
248
|
+
}
|
|
249
|
+
const base64 = crypto.createHash(SRI_NODE_ALG_MAP[algorithm]).update(content, "utf8").digest("base64");
|
|
250
|
+
return { algorithm, base64, integrity: `${SRI_NODE_ALG_MAP[algorithm]}-${base64}` };
|
|
251
|
+
}
|
|
252
|
+
function generateSriAll(content) {
|
|
253
|
+
if (typeof content !== "string" || content.length === 0) {
|
|
254
|
+
return { error: "Content is required" };
|
|
255
|
+
}
|
|
256
|
+
return SRI_ALGORITHMS.map((alg) => generateSri(content, alg));
|
|
257
|
+
}
|
|
236
258
|
|
|
237
259
|
exports.HASH_ALGORITHMS = HASH_ALGORITHMS;
|
|
238
260
|
exports.HASH_BITS = HASH_BITS;
|
|
239
261
|
exports.ROUND_OPTIONS = ROUND_OPTIONS;
|
|
262
|
+
exports.SRI_ALGORITHMS = SRI_ALGORITHMS;
|
|
240
263
|
exports.createEntry = createEntry;
|
|
241
264
|
exports.generateBcryptHash = generateBcryptHash;
|
|
242
265
|
exports.generateHtpasswdFile = generateHtpasswdFile;
|
|
243
266
|
exports.generateMd5Hash = generateMd5Hash;
|
|
244
267
|
exports.generatePlain = generatePlain;
|
|
245
268
|
exports.generateSha1Hash = generateSha1Hash;
|
|
269
|
+
exports.generateSri = generateSri;
|
|
270
|
+
exports.generateSriAll = generateSriAll;
|
|
246
271
|
exports.hashAll = hashAll;
|
|
247
272
|
exports.hashOne = hashOne;
|
|
248
273
|
exports.hashPassword = hashPassword;
|