@utilix-tech/sdk 0.64.0 → 0.65.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 +4 -0
- package/README.md +3 -3
- package/dist/{chunk-QY2M2UHJ.js → chunk-HJVSH7FQ.js} +137 -1
- package/dist/{chunk-IANBS5Y3.js → chunk-KEZLVYR3.js} +84 -1
- package/dist/{data-vxXrBlWh.d.cts → data-26TALa9U.d.cts} +35 -2
- package/dist/{data-vxXrBlWh.d.ts → data-26TALa9U.d.ts} +35 -2
- package/dist/index.cjs +219 -0
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/{network-DZTfMAk0.d.cts → network-DT-OMHWV.d.cts} +43 -2
- package/dist/{network-DZTfMAk0.d.ts → network-DT-OMHWV.d.ts} +43 -2
- package/dist/tools/data.cjs +136 -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/network.cjs +83 -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/tools/data.cjs
CHANGED
|
@@ -1773,7 +1773,143 @@ function calculateMarkdownTaskListProgress(markdown) {
|
|
|
1773
1773
|
});
|
|
1774
1774
|
return { totalItems, completedItems, percentComplete, sections, items };
|
|
1775
1775
|
}
|
|
1776
|
+
function _splitMarkdownTableRow(line) {
|
|
1777
|
+
const raw = [];
|
|
1778
|
+
let current = "";
|
|
1779
|
+
for (let i = 0; i < line.length; i++) {
|
|
1780
|
+
const ch = line[i];
|
|
1781
|
+
if (ch === "\\" && line[i + 1] === "|") {
|
|
1782
|
+
current += "\\|";
|
|
1783
|
+
i++;
|
|
1784
|
+
continue;
|
|
1785
|
+
}
|
|
1786
|
+
if (ch === "|") {
|
|
1787
|
+
raw.push(current);
|
|
1788
|
+
current = "";
|
|
1789
|
+
continue;
|
|
1790
|
+
}
|
|
1791
|
+
current += ch;
|
|
1792
|
+
}
|
|
1793
|
+
raw.push(current);
|
|
1794
|
+
const cells = raw.map((c) => c.trim());
|
|
1795
|
+
if (cells.length > 1 && cells[0] === "") cells.shift();
|
|
1796
|
+
if (cells.length > 1 && cells[cells.length - 1] === "") cells.pop();
|
|
1797
|
+
return cells;
|
|
1798
|
+
}
|
|
1799
|
+
function _isMarkdownTableDelimiterRow(line) {
|
|
1800
|
+
const trimmed = line.trim();
|
|
1801
|
+
if (trimmed === "" || !trimmed.includes("-")) return false;
|
|
1802
|
+
const cells = _splitMarkdownTableRow(trimmed);
|
|
1803
|
+
if (cells.length === 0) return false;
|
|
1804
|
+
return cells.every((c) => /^:?-+:?$/.test(c));
|
|
1805
|
+
}
|
|
1806
|
+
function _markdownTableCellAlignment(delimCell) {
|
|
1807
|
+
const left = delimCell.startsWith(":");
|
|
1808
|
+
const right = delimCell.endsWith(":");
|
|
1809
|
+
if (left && right) return "center";
|
|
1810
|
+
if (right) return "right";
|
|
1811
|
+
if (left) return "left";
|
|
1812
|
+
return "none";
|
|
1813
|
+
}
|
|
1814
|
+
function _padMarkdownTableCell(text, width, alignment) {
|
|
1815
|
+
const len = [...text].length;
|
|
1816
|
+
const diff = Math.max(0, width - len);
|
|
1817
|
+
if (alignment === "right") return " ".repeat(diff) + text;
|
|
1818
|
+
if (alignment === "center") {
|
|
1819
|
+
const left = Math.floor(diff / 2);
|
|
1820
|
+
const right = diff - left;
|
|
1821
|
+
return " ".repeat(left) + text + " ".repeat(right);
|
|
1822
|
+
}
|
|
1823
|
+
return text + " ".repeat(diff);
|
|
1824
|
+
}
|
|
1825
|
+
function _markdownTableDelimiterCell(width, alignment) {
|
|
1826
|
+
switch (alignment) {
|
|
1827
|
+
case "left":
|
|
1828
|
+
return ":" + "-".repeat(Math.max(1, width - 1));
|
|
1829
|
+
case "right":
|
|
1830
|
+
return "-".repeat(Math.max(1, width - 1)) + ":";
|
|
1831
|
+
case "center":
|
|
1832
|
+
return ":" + "-".repeat(Math.max(1, width - 2)) + ":";
|
|
1833
|
+
default:
|
|
1834
|
+
return "-".repeat(width);
|
|
1835
|
+
}
|
|
1836
|
+
}
|
|
1837
|
+
function alignMarkdownTables(markdown) {
|
|
1838
|
+
if (typeof markdown !== "string") return { error: "markdown must be a string" };
|
|
1839
|
+
const lines = markdown.replace(/\r\n/g, "\n").split("\n");
|
|
1840
|
+
const outputLines = [...lines];
|
|
1841
|
+
const tables = [];
|
|
1842
|
+
const warnings = [];
|
|
1843
|
+
let inFence = false;
|
|
1844
|
+
let fenceMarker = "";
|
|
1845
|
+
let i = 0;
|
|
1846
|
+
while (i < lines.length) {
|
|
1847
|
+
const line = lines[i];
|
|
1848
|
+
const fenceMatch = line.match(/^\s*(```+|~~~+)/);
|
|
1849
|
+
if (fenceMatch) {
|
|
1850
|
+
if (!inFence) {
|
|
1851
|
+
inFence = true;
|
|
1852
|
+
fenceMarker = fenceMatch[1][0];
|
|
1853
|
+
} else if (fenceMatch[1][0] === fenceMarker) {
|
|
1854
|
+
inFence = false;
|
|
1855
|
+
}
|
|
1856
|
+
i++;
|
|
1857
|
+
continue;
|
|
1858
|
+
}
|
|
1859
|
+
if (inFence) {
|
|
1860
|
+
i++;
|
|
1861
|
+
continue;
|
|
1862
|
+
}
|
|
1863
|
+
const nextLine = lines[i + 1];
|
|
1864
|
+
if (line.includes("|") && nextLine !== void 0 && _isMarkdownTableDelimiterRow(nextLine)) {
|
|
1865
|
+
const headerCells = _splitMarkdownTableRow(line);
|
|
1866
|
+
const delimCells = _splitMarkdownTableRow(nextLine);
|
|
1867
|
+
if (headerCells.length > 0 && headerCells.length === delimCells.length) {
|
|
1868
|
+
const columnCount = headerCells.length;
|
|
1869
|
+
const alignments = delimCells.map(_markdownTableCellAlignment);
|
|
1870
|
+
let j = i + 2;
|
|
1871
|
+
const bodyRows = [];
|
|
1872
|
+
while (j < lines.length && lines[j].trim() !== "" && lines[j].includes("|")) {
|
|
1873
|
+
bodyRows.push(_splitMarkdownTableRow(lines[j]));
|
|
1874
|
+
j++;
|
|
1875
|
+
}
|
|
1876
|
+
const normalizedBody = [];
|
|
1877
|
+
for (const row of bodyRows) {
|
|
1878
|
+
if (row.length !== columnCount) {
|
|
1879
|
+
warnings.push(`Table at line ${i + 1}: a row has ${row.length} cell(s) but the header has ${columnCount}; it was padded/truncated to match.`);
|
|
1880
|
+
}
|
|
1881
|
+
normalizedBody.push(Array.from({ length: columnCount }, (_, c) => row[c] ?? ""));
|
|
1882
|
+
}
|
|
1883
|
+
const allRows = [headerCells, ...normalizedBody];
|
|
1884
|
+
const widths = Array.from(
|
|
1885
|
+
{ length: columnCount },
|
|
1886
|
+
(_, c) => Math.max(3, ...allRows.map((r) => [...r[c] ?? ""].length))
|
|
1887
|
+
);
|
|
1888
|
+
const formattedHeader = "| " + headerCells.map((c, idx) => _padMarkdownTableCell(c, widths[idx], alignments[idx])).join(" | ") + " |";
|
|
1889
|
+
const formattedDelim = "| " + widths.map((w, idx) => _markdownTableDelimiterCell(w, alignments[idx])).join(" | ") + " |";
|
|
1890
|
+
const formattedBody = normalizedBody.map((row) => "| " + row.map((c, idx) => _padMarkdownTableCell(c, widths[idx], alignments[idx])).join(" | ") + " |");
|
|
1891
|
+
const formattedLines = [formattedHeader, formattedDelim, ...formattedBody];
|
|
1892
|
+
for (let k = 0; k < formattedLines.length; k++) {
|
|
1893
|
+
outputLines[i + k] = formattedLines[k];
|
|
1894
|
+
}
|
|
1895
|
+
tables.push({
|
|
1896
|
+
startLine: i + 1,
|
|
1897
|
+
endLine: i + formattedLines.length,
|
|
1898
|
+
columnCount,
|
|
1899
|
+
rowCount: normalizedBody.length,
|
|
1900
|
+
alignments
|
|
1901
|
+
});
|
|
1902
|
+
i = j;
|
|
1903
|
+
continue;
|
|
1904
|
+
}
|
|
1905
|
+
}
|
|
1906
|
+
i++;
|
|
1907
|
+
}
|
|
1908
|
+
if (tables.length === 0) return { error: "No Markdown tables found" };
|
|
1909
|
+
return { output: outputLines.join("\n"), tables, warnings };
|
|
1910
|
+
}
|
|
1776
1911
|
|
|
1912
|
+
exports.alignMarkdownTables = alignMarkdownTables;
|
|
1777
1913
|
exports.analyzeCaptionSpeed = analyzeCaptionSpeed;
|
|
1778
1914
|
exports.calculateMarkdownTaskListProgress = calculateMarkdownTaskListProgress;
|
|
1779
1915
|
exports.convertSubtitles = convertSubtitles;
|
package/dist/tools/data.d.cts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { C as CaptionSpeedCue, a as CaptionSpeedResult, b as ConvertedSubtitles, c as CsvColumnType, e as CsvColumnTypeInfo, f as CsvColumnTypeOptions, g as CsvColumnTypeResult, h as CsvDuplicateGroup, i as CsvDuplicateOptions, j as CsvDuplicateResult, k as CsvParseResult, l as CsvToSqlOptions, m as CsvToSqlResult, E as EnvDiffError, n as EnvDiffResult, o as EnvEntry, p as EnvParseResult, F as FrontMatterError, q as FrontMatterResult, I as IniSection, M as
|
|
1
|
+
export { C as CaptionSpeedCue, a as CaptionSpeedResult, b as ConvertedSubtitles, c as CsvColumnType, e as CsvColumnTypeInfo, f as CsvColumnTypeOptions, g as CsvColumnTypeResult, h as CsvDuplicateGroup, i as CsvDuplicateOptions, j as CsvDuplicateResult, k as CsvParseResult, l as CsvToSqlOptions, m as CsvToSqlResult, E as EnvDiffError, n as EnvDiffResult, o as EnvEntry, p as EnvParseResult, F as FrontMatterError, q as FrontMatterResult, I as IniSection, M as MarkdownTableAlignResult, r as MarkdownTableColumnAlignment, s as MarkdownTableInfo, t as MarkdownTaskListItem, u as MarkdownTaskListProgressResult, v as MarkdownTaskListSectionSummary, w as MarkdownTocEntry, x as MarkdownTocOptions, y as MarkdownTocResult, N as NdjsonDedupeResult, z as NdjsonLineResult, A as NdjsonValidateResult, P as ParseOptions, B as ParsedIni, D as ParsedSubtitles, S as SubtitleCue, G as SubtitleFormat, T as TomlFormatResult, V as ValidationResult, X as XmlFormatResult, H as XmlToJsonOptions, Y as YamlAnchorInfo, J as YamlAnchorResolveError, K as YamlAnchorResolveResult, L as alignMarkdownTables, O as analyzeCaptionSpeed, Q as calculateMarkdownTaskListProgress, R as convertSubtitles, U as csvToJson, W as csvToSqlInsert, Z as dedupeNdjson, _ as detectDelimiter, $ as detectSubtitleFormat, a0 as diffEnvExample, a1 as envToExport, a2 as envToJson, a3 as findCsvDuplicateRows, a4 as formatNdjson, a5 as formatSubtitleTimestamp, a6 as formatToml, a7 as formatXml, a8 as generateMarkdownToc, a9 as getSection, aa as getSectionNames, ab as getTomlStats, ac as getXmlStats, ad as getYamlStats, ae as inferCsvColumnTypes, af as iniToJson, ag as jsonArrayToNdjson, ah as jsonToIni, ai as jsonToToml, aj as jsonToXml, ak as minifyNdjson, al as minifyToml, am as minifyXml, an as ndjsonToJsonArray, ao as parseCsv, ap as parseEnv, aq as parseFrontMatter, ar as parseIni, as as parseSubtitleTimestamp, at as parseSubtitles, au as parseXmlToObject, av as resolveYamlAnchors, aw as serializeSubtitles, ax as shiftSubtitles, ay as stringifyIni, az 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-26TALa9U.cjs';
|
package/dist/tools/data.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { C as CaptionSpeedCue, a as CaptionSpeedResult, b as ConvertedSubtitles, c as CsvColumnType, e as CsvColumnTypeInfo, f as CsvColumnTypeOptions, g as CsvColumnTypeResult, h as CsvDuplicateGroup, i as CsvDuplicateOptions, j as CsvDuplicateResult, k as CsvParseResult, l as CsvToSqlOptions, m as CsvToSqlResult, E as EnvDiffError, n as EnvDiffResult, o as EnvEntry, p as EnvParseResult, F as FrontMatterError, q as FrontMatterResult, I as IniSection, M as
|
|
1
|
+
export { C as CaptionSpeedCue, a as CaptionSpeedResult, b as ConvertedSubtitles, c as CsvColumnType, e as CsvColumnTypeInfo, f as CsvColumnTypeOptions, g as CsvColumnTypeResult, h as CsvDuplicateGroup, i as CsvDuplicateOptions, j as CsvDuplicateResult, k as CsvParseResult, l as CsvToSqlOptions, m as CsvToSqlResult, E as EnvDiffError, n as EnvDiffResult, o as EnvEntry, p as EnvParseResult, F as FrontMatterError, q as FrontMatterResult, I as IniSection, M as MarkdownTableAlignResult, r as MarkdownTableColumnAlignment, s as MarkdownTableInfo, t as MarkdownTaskListItem, u as MarkdownTaskListProgressResult, v as MarkdownTaskListSectionSummary, w as MarkdownTocEntry, x as MarkdownTocOptions, y as MarkdownTocResult, N as NdjsonDedupeResult, z as NdjsonLineResult, A as NdjsonValidateResult, P as ParseOptions, B as ParsedIni, D as ParsedSubtitles, S as SubtitleCue, G as SubtitleFormat, T as TomlFormatResult, V as ValidationResult, X as XmlFormatResult, H as XmlToJsonOptions, Y as YamlAnchorInfo, J as YamlAnchorResolveError, K as YamlAnchorResolveResult, L as alignMarkdownTables, O as analyzeCaptionSpeed, Q as calculateMarkdownTaskListProgress, R as convertSubtitles, U as csvToJson, W as csvToSqlInsert, Z as dedupeNdjson, _ as detectDelimiter, $ as detectSubtitleFormat, a0 as diffEnvExample, a1 as envToExport, a2 as envToJson, a3 as findCsvDuplicateRows, a4 as formatNdjson, a5 as formatSubtitleTimestamp, a6 as formatToml, a7 as formatXml, a8 as generateMarkdownToc, a9 as getSection, aa as getSectionNames, ab as getTomlStats, ac as getXmlStats, ad as getYamlStats, ae as inferCsvColumnTypes, af as iniToJson, ag as jsonArrayToNdjson, ah as jsonToIni, ai as jsonToToml, aj as jsonToXml, ak as minifyNdjson, al as minifyToml, am as minifyXml, an as ndjsonToJsonArray, ao as parseCsv, ap as parseEnv, aq as parseFrontMatter, ar as parseIni, as as parseSubtitleTimestamp, at as parseSubtitles, au as parseXmlToObject, av as resolveYamlAnchors, aw as serializeSubtitles, ax as shiftSubtitles, ay as stringifyIni, az 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-26TALa9U.js';
|
package/dist/tools/data.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { analyzeCaptionSpeed, calculateMarkdownTaskListProgress, convertSubtitles, csvToJson, csvToSqlInsert, dedupeNdjson, detectDelimiter, detectSubtitleFormat, diffEnvExample, envToExport, envToJson, findCsvDuplicateRows, formatNdjson, formatSubtitleTimestamp, formatToml, formatXml, generateMarkdownToc, getSection, getSectionNames, getTomlStats, getXmlStats, getYamlStats, inferCsvColumnTypes, iniToJson, jsonArrayToNdjson, jsonToIni, jsonToToml, jsonToXml, minifyNdjson, minifyToml, minifyXml, ndjsonToJsonArray, parseCsv, parseEnv, parseFrontMatter, parseIni, parseSubtitleTimestamp, parseSubtitles, parseXmlToObject, resolveYamlAnchors, serializeSubtitles, shiftSubtitles, stringifyIni, toCsvString, tomlToJson, validateEnvKey, validateIni, validateNdjson, validateToml, validateXml, validateYaml, xmlToJson } from '../chunk-
|
|
1
|
+
export { alignMarkdownTables, analyzeCaptionSpeed, calculateMarkdownTaskListProgress, convertSubtitles, csvToJson, csvToSqlInsert, dedupeNdjson, detectDelimiter, detectSubtitleFormat, diffEnvExample, envToExport, envToJson, findCsvDuplicateRows, formatNdjson, formatSubtitleTimestamp, formatToml, formatXml, generateMarkdownToc, getSection, getSectionNames, getTomlStats, getXmlStats, getYamlStats, inferCsvColumnTypes, iniToJson, jsonArrayToNdjson, jsonToIni, jsonToToml, jsonToXml, minifyNdjson, minifyToml, minifyXml, ndjsonToJsonArray, parseCsv, parseEnv, parseFrontMatter, parseIni, parseSubtitleTimestamp, parseSubtitles, parseXmlToObject, resolveYamlAnchors, serializeSubtitles, shiftSubtitles, stringifyIni, toCsvString, tomlToJson, validateEnvKey, validateIni, validateNdjson, validateToml, validateXml, validateYaml, xmlToJson } from '../chunk-HJVSH7FQ.js';
|
|
2
2
|
import '../chunk-MLKGABMK.js';
|
package/dist/tools/network.cjs
CHANGED
|
@@ -3090,6 +3090,87 @@ function parseMultipartFormData(body, boundary) {
|
|
|
3090
3090
|
}
|
|
3091
3091
|
return { boundary, parts };
|
|
3092
3092
|
}
|
|
3093
|
+
var HSTS_ONE_YEAR_SECONDS = 31536e3;
|
|
3094
|
+
function _humanizeHstsMaxAge(seconds) {
|
|
3095
|
+
if (seconds === 0) return "0 seconds (clears HSTS)";
|
|
3096
|
+
if (seconds % HSTS_ONE_YEAR_SECONDS === 0) {
|
|
3097
|
+
const years = seconds / HSTS_ONE_YEAR_SECONDS;
|
|
3098
|
+
return `${years} year${years === 1 ? "" : "s"}`;
|
|
3099
|
+
}
|
|
3100
|
+
if (seconds % 86400 === 0) {
|
|
3101
|
+
const days = seconds / 86400;
|
|
3102
|
+
return `${days} day${days === 1 ? "" : "s"}`;
|
|
3103
|
+
}
|
|
3104
|
+
if (seconds % 3600 === 0) {
|
|
3105
|
+
const hours = seconds / 3600;
|
|
3106
|
+
return `${hours} hour${hours === 1 ? "" : "s"}`;
|
|
3107
|
+
}
|
|
3108
|
+
return `${seconds} second${seconds === 1 ? "" : "s"}`;
|
|
3109
|
+
}
|
|
3110
|
+
function buildHsts(options) {
|
|
3111
|
+
if (!options || typeof options !== "object") return { error: "maxAge is required" };
|
|
3112
|
+
const { maxAge, includeSubDomains = false, preload = false } = options;
|
|
3113
|
+
if (typeof maxAge !== "number" || !Number.isFinite(maxAge) || !Number.isInteger(maxAge) || maxAge < 0) {
|
|
3114
|
+
return { error: "maxAge must be a non-negative integer number of seconds" };
|
|
3115
|
+
}
|
|
3116
|
+
const warnings = [];
|
|
3117
|
+
const preloadEligible = maxAge >= HSTS_ONE_YEAR_SECONDS && includeSubDomains && preload;
|
|
3118
|
+
if (preload && !includeSubDomains) {
|
|
3119
|
+
warnings.push("Browser HSTS preload lists require includeSubDomains whenever preload is set; this header will not qualify for preloading as configured.");
|
|
3120
|
+
}
|
|
3121
|
+
if (preload && maxAge < HSTS_ONE_YEAR_SECONDS) {
|
|
3122
|
+
warnings.push(`Browser HSTS preload lists require max-age of at least ${HSTS_ONE_YEAR_SECONDS} (1 year); ${maxAge} is too low to qualify.`);
|
|
3123
|
+
}
|
|
3124
|
+
if (maxAge === 0) {
|
|
3125
|
+
warnings.push("max-age=0 tells the browser to forget this host supports HSTS immediately, this clears HSTS rather than enabling it.");
|
|
3126
|
+
} else if (maxAge < 86400) {
|
|
3127
|
+
warnings.push("A max-age under a day gives very little protection; most real deployments use at least 15552000 (180 days) once confident HTTPS is fully working.");
|
|
3128
|
+
}
|
|
3129
|
+
const parts = [`max-age=${maxAge}`];
|
|
3130
|
+
if (includeSubDomains) parts.push("includeSubDomains");
|
|
3131
|
+
if (preload) parts.push("preload");
|
|
3132
|
+
const header = parts.join("; ");
|
|
3133
|
+
return {
|
|
3134
|
+
header,
|
|
3135
|
+
headerName: "Strict-Transport-Security",
|
|
3136
|
+
snippet: `Strict-Transport-Security: ${header}`,
|
|
3137
|
+
maxAge,
|
|
3138
|
+
maxAgeHuman: _humanizeHstsMaxAge(maxAge),
|
|
3139
|
+
includeSubDomains,
|
|
3140
|
+
preload,
|
|
3141
|
+
preloadEligible,
|
|
3142
|
+
warnings
|
|
3143
|
+
};
|
|
3144
|
+
}
|
|
3145
|
+
function parseHsts(raw) {
|
|
3146
|
+
if (!raw || raw.trim() === "") return { error: "Input is empty" };
|
|
3147
|
+
const withoutLabel = raw.trim().replace(/^strict-transport-security:\s*/i, "");
|
|
3148
|
+
const tokens = withoutLabel.split(";").map((t) => t.trim()).filter((t) => t !== "");
|
|
3149
|
+
if (tokens.length === 0) return { error: "No directives found" };
|
|
3150
|
+
let maxAge = null;
|
|
3151
|
+
let includeSubDomains = false;
|
|
3152
|
+
let preload = false;
|
|
3153
|
+
for (const token of tokens) {
|
|
3154
|
+
const eq = token.indexOf("=");
|
|
3155
|
+
const name = (eq === -1 ? token : token.slice(0, eq)).trim().toLowerCase();
|
|
3156
|
+
if (name === "max-age") {
|
|
3157
|
+
const rawValue = eq === -1 ? "" : token.slice(eq + 1).trim();
|
|
3158
|
+
const n = Number(rawValue);
|
|
3159
|
+
if (rawValue === "" || !Number.isFinite(n) || !Number.isInteger(n) || n < 0) {
|
|
3160
|
+
return { error: `max-age value "${rawValue}" is not a valid non-negative integer` };
|
|
3161
|
+
}
|
|
3162
|
+
maxAge = n;
|
|
3163
|
+
} else if (name === "includesubdomains") {
|
|
3164
|
+
includeSubDomains = true;
|
|
3165
|
+
} else if (name === "preload") {
|
|
3166
|
+
preload = true;
|
|
3167
|
+
} else {
|
|
3168
|
+
return { error: `Unrecognized directive "${token}"` };
|
|
3169
|
+
}
|
|
3170
|
+
}
|
|
3171
|
+
if (maxAge === null) return { error: "max-age directive is required" };
|
|
3172
|
+
return buildHsts({ maxAge, includeSubDomains, preload });
|
|
3173
|
+
}
|
|
3093
3174
|
|
|
3094
3175
|
exports.CLIENT_HINTS = CLIENT_HINTS;
|
|
3095
3176
|
exports.DNS_RECORD_TYPES = DNS_RECORD_TYPES;
|
|
@@ -3107,6 +3188,7 @@ exports.buildClientHints = buildClientHints;
|
|
|
3107
3188
|
exports.buildContentDisposition = buildContentDisposition;
|
|
3108
3189
|
exports.buildDnsQueryUrl = buildDnsQueryUrl;
|
|
3109
3190
|
exports.buildGeoUrl = buildGeoUrl;
|
|
3191
|
+
exports.buildHsts = buildHsts;
|
|
3110
3192
|
exports.buildLinkHeader = buildLinkHeader;
|
|
3111
3193
|
exports.buildMapUrl = buildMapUrl;
|
|
3112
3194
|
exports.buildPermissionsPolicy = buildPermissionsPolicy;
|
|
@@ -3142,6 +3224,7 @@ exports.parseContentRangeHeader = parseContentRangeHeader;
|
|
|
3142
3224
|
exports.parseDnsResponse = parseDnsResponse;
|
|
3143
3225
|
exports.parseGeoResponse = parseGeoResponse;
|
|
3144
3226
|
exports.parseHar = parseHar;
|
|
3227
|
+
exports.parseHsts = parseHsts;
|
|
3145
3228
|
exports.parseIpv6Address = parseIpv6Address;
|
|
3146
3229
|
exports.parseMultipartFormData = parseMultipartFormData;
|
|
3147
3230
|
exports.parsePermissionsPolicy = parsePermissionsPolicy;
|
package/dist/tools/network.d.cts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { A as AcceptLanguageEntry, a as AcceptLanguageResult, b as AuthResultEntry, B as BuildRangeHeaderOptions, C as CLIENT_HINTS, c as CacheControlDirective, d as CacheControlOptions, e as CacheControlResult, f as ClientHintDef, g as ClientHintValueType, h as ClientHintsBuildResult, i as ClientHintsParseResult, j as CloseCodeInfo, k as CloseCodeRange, l as ContentDispositionBuildOptions, m as ContentDispositionBuildResult, o as ContentDispositionParseResult, p as ContentRangeResult, q as ContentTypeRiskResult, r as ContentTypeSniffRisk, s as CookieAttributes, t as CookieCheckResult, D as DNS_RECORD_TYPES, u as DnsRecord, v as DnsRecordType, w as DnsResponse, E as EmailHeaderAnalysis, x as EmailHeaderField, G as GeoResult, H as HTTP_HEADERS, y as HarEntry, z as HarParseResult, F as HarSummary, I as HeaderCategory, J as
|
|
1
|
+
export { A as AcceptLanguageEntry, a as AcceptLanguageResult, b as AuthResultEntry, B as BuildRangeHeaderOptions, C as CLIENT_HINTS, c as CacheControlDirective, d as CacheControlOptions, e as CacheControlResult, f as ClientHintDef, g as ClientHintValueType, h as ClientHintsBuildResult, i as ClientHintsParseResult, j as CloseCodeInfo, k as CloseCodeRange, l as ContentDispositionBuildOptions, m as ContentDispositionBuildResult, o as ContentDispositionParseResult, p as ContentRangeResult, q as ContentTypeRiskResult, r as ContentTypeSniffRisk, s as CookieAttributes, t as CookieCheckResult, D as DNS_RECORD_TYPES, u as DnsRecord, v as DnsRecordType, w as DnsResponse, E as EmailHeaderAnalysis, x as EmailHeaderField, G as GeoResult, H as HTTP_HEADERS, y as HarEntry, z as HarParseResult, F as HarSummary, I as HeaderCategory, J as HstsOptions, K as HstsResult, L as HttpHeader, M as Ipv6AddressType, N as Ipv6ParseResult, O as LINK_REL_VALUES, P as LinkHeaderEntry, Q as LinkHeaderEntryInput, R as LinkHeaderResult, S as LinkRel, T as ManifestIconInfo, U as ManifestIssue, V as ManifestValidationResult, W as MultipartParseResult, X as MultipartPart, Y as PERMISSIONS_POLICY_FEATURES, Z as ParsedClientHint, _ as ParsedDnsResult, $ as ParsedGeoResult, a0 as PermissionsPolicyDirective, a1 as PermissionsPolicyFeatureInput, a2 as PermissionsPolicyResult, a3 as PreferParameter, a4 as PreferPreference, a5 as PreferResult, a6 as PriorityResult, a7 as REFERRER_POLICY_VALUES, a8 as RangeEntry, a9 as RangeEntryInput, aa as RangeHeaderResult, ab as ReceivedHop, ac as ReferrerPolicyEntry, ad as ReferrerPolicyResult, ae as ReferrerPolicyValue, af as RetryAfterDateResult, ag as RetryAfterResult, ah as RetryAfterSecondsResult, ai as RobotsGroup, aj as RobotsIssue, ak as RobotsRule, al as RobotsValidationResult, am as STATUS_CODES, an as SameSiteValue, ao as SitemapIndexEntry, ap as SitemapIssue, aq as SitemapSplitFile, ar as SitemapUrlEntry, as as SitemapValidationResult, at as SplitSitemapOptions, au as SplitSitemapResult, av as StatusCode, aw as UaDeviceType, ax as UserAgentInfo, ay as VaryHeaderEntry, az as VaryHeaderResult, aA as XContentTypeOptionsHeader, aB as XContentTypeOptionsParseResult, aC as X_CONTENT_TYPE_OPTIONS_HEADER, aD as analyzeEmailHeaders, aE as assessContentTypeRisk, aF as buildAcceptLanguage, aG as buildCacheControl, aH as buildClientHints, aI as buildContentDisposition, aJ as buildDnsQueryUrl, aK as buildGeoUrl, aL as buildHsts, aM as buildLinkHeader, aN as buildMapUrl, aO as buildPermissionsPolicy, aP as buildPreferHeader, aQ as buildPriorityHeader, aR as buildRangeHeader, aS as buildReferrerPolicy, aT as buildRetryAfterHeader, aU as buildVaryHeader, aV as buildXContentTypeOptionsHeader, aW as checkSetCookieHeader, aX as countryCodeToFlag, aY as extractMultipartBoundary, aZ as formatCoordinates, a_ as formatTtl, a$ as getByCategory, b0 as getHeader, b1 as getHeadersByCategory, b2 as getStatusByCategory, b3 as getStatusCode, b4 as isClientError, b5 as isServerError, b6 as isSuccess, b7 as isValidIp, b8 as isValidIpv4, b9 as isValidIpv6, ba as listCloseCodes, bb as lookupCloseCode, bc as parseAcceptLanguage, bd as parseClientHintHeaders, be as parseContentDisposition, bf as parseContentRangeHeader, bg as parseDnsResponse, bh as parseGeoResponse, bi as parseHar, bj as parseHsts, bk as parseIpv6Address, bl as parseMultipartFormData, bm as parsePermissionsPolicy, bn as parsePreferHeader, bo as parsePriorityHeader, bp as parseRetryAfterHeader, bq as parseUserAgent, br as parseVaryHeader, bs as parseXContentTypeOptionsHeader, bt as searchHeaders, bu as searchStatusCodes, bv as splitSitemap, bw as statusCodeToText, bx as typeNumberToLabel, by as validateDomain, bz as validateHeaderName, bA as validateHeaderValue, bB as validateManifest, bC as validateRobotsTxt, bD as validateSitemap } from '../network-DT-OMHWV.cjs';
|
package/dist/tools/network.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { A as AcceptLanguageEntry, a as AcceptLanguageResult, b as AuthResultEntry, B as BuildRangeHeaderOptions, C as CLIENT_HINTS, c as CacheControlDirective, d as CacheControlOptions, e as CacheControlResult, f as ClientHintDef, g as ClientHintValueType, h as ClientHintsBuildResult, i as ClientHintsParseResult, j as CloseCodeInfo, k as CloseCodeRange, l as ContentDispositionBuildOptions, m as ContentDispositionBuildResult, o as ContentDispositionParseResult, p as ContentRangeResult, q as ContentTypeRiskResult, r as ContentTypeSniffRisk, s as CookieAttributes, t as CookieCheckResult, D as DNS_RECORD_TYPES, u as DnsRecord, v as DnsRecordType, w as DnsResponse, E as EmailHeaderAnalysis, x as EmailHeaderField, G as GeoResult, H as HTTP_HEADERS, y as HarEntry, z as HarParseResult, F as HarSummary, I as HeaderCategory, J as
|
|
1
|
+
export { A as AcceptLanguageEntry, a as AcceptLanguageResult, b as AuthResultEntry, B as BuildRangeHeaderOptions, C as CLIENT_HINTS, c as CacheControlDirective, d as CacheControlOptions, e as CacheControlResult, f as ClientHintDef, g as ClientHintValueType, h as ClientHintsBuildResult, i as ClientHintsParseResult, j as CloseCodeInfo, k as CloseCodeRange, l as ContentDispositionBuildOptions, m as ContentDispositionBuildResult, o as ContentDispositionParseResult, p as ContentRangeResult, q as ContentTypeRiskResult, r as ContentTypeSniffRisk, s as CookieAttributes, t as CookieCheckResult, D as DNS_RECORD_TYPES, u as DnsRecord, v as DnsRecordType, w as DnsResponse, E as EmailHeaderAnalysis, x as EmailHeaderField, G as GeoResult, H as HTTP_HEADERS, y as HarEntry, z as HarParseResult, F as HarSummary, I as HeaderCategory, J as HstsOptions, K as HstsResult, L as HttpHeader, M as Ipv6AddressType, N as Ipv6ParseResult, O as LINK_REL_VALUES, P as LinkHeaderEntry, Q as LinkHeaderEntryInput, R as LinkHeaderResult, S as LinkRel, T as ManifestIconInfo, U as ManifestIssue, V as ManifestValidationResult, W as MultipartParseResult, X as MultipartPart, Y as PERMISSIONS_POLICY_FEATURES, Z as ParsedClientHint, _ as ParsedDnsResult, $ as ParsedGeoResult, a0 as PermissionsPolicyDirective, a1 as PermissionsPolicyFeatureInput, a2 as PermissionsPolicyResult, a3 as PreferParameter, a4 as PreferPreference, a5 as PreferResult, a6 as PriorityResult, a7 as REFERRER_POLICY_VALUES, a8 as RangeEntry, a9 as RangeEntryInput, aa as RangeHeaderResult, ab as ReceivedHop, ac as ReferrerPolicyEntry, ad as ReferrerPolicyResult, ae as ReferrerPolicyValue, af as RetryAfterDateResult, ag as RetryAfterResult, ah as RetryAfterSecondsResult, ai as RobotsGroup, aj as RobotsIssue, ak as RobotsRule, al as RobotsValidationResult, am as STATUS_CODES, an as SameSiteValue, ao as SitemapIndexEntry, ap as SitemapIssue, aq as SitemapSplitFile, ar as SitemapUrlEntry, as as SitemapValidationResult, at as SplitSitemapOptions, au as SplitSitemapResult, av as StatusCode, aw as UaDeviceType, ax as UserAgentInfo, ay as VaryHeaderEntry, az as VaryHeaderResult, aA as XContentTypeOptionsHeader, aB as XContentTypeOptionsParseResult, aC as X_CONTENT_TYPE_OPTIONS_HEADER, aD as analyzeEmailHeaders, aE as assessContentTypeRisk, aF as buildAcceptLanguage, aG as buildCacheControl, aH as buildClientHints, aI as buildContentDisposition, aJ as buildDnsQueryUrl, aK as buildGeoUrl, aL as buildHsts, aM as buildLinkHeader, aN as buildMapUrl, aO as buildPermissionsPolicy, aP as buildPreferHeader, aQ as buildPriorityHeader, aR as buildRangeHeader, aS as buildReferrerPolicy, aT as buildRetryAfterHeader, aU as buildVaryHeader, aV as buildXContentTypeOptionsHeader, aW as checkSetCookieHeader, aX as countryCodeToFlag, aY as extractMultipartBoundary, aZ as formatCoordinates, a_ as formatTtl, a$ as getByCategory, b0 as getHeader, b1 as getHeadersByCategory, b2 as getStatusByCategory, b3 as getStatusCode, b4 as isClientError, b5 as isServerError, b6 as isSuccess, b7 as isValidIp, b8 as isValidIpv4, b9 as isValidIpv6, ba as listCloseCodes, bb as lookupCloseCode, bc as parseAcceptLanguage, bd as parseClientHintHeaders, be as parseContentDisposition, bf as parseContentRangeHeader, bg as parseDnsResponse, bh as parseGeoResponse, bi as parseHar, bj as parseHsts, bk as parseIpv6Address, bl as parseMultipartFormData, bm as parsePermissionsPolicy, bn as parsePreferHeader, bo as parsePriorityHeader, bp as parseRetryAfterHeader, bq as parseUserAgent, br as parseVaryHeader, bs as parseXContentTypeOptionsHeader, bt as searchHeaders, bu as searchStatusCodes, bv as splitSitemap, bw as statusCodeToText, bx as typeNumberToLabel, by as validateDomain, bz as validateHeaderName, bA as validateHeaderValue, bB as validateManifest, bC as validateRobotsTxt, bD as validateSitemap } from '../network-DT-OMHWV.js';
|
package/dist/tools/network.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { CLIENT_HINTS, DNS_RECORD_TYPES, HTTP_HEADERS, LINK_REL_VALUES, PERMISSIONS_POLICY_FEATURES, REFERRER_POLICY_VALUES, STATUS_CODES, X_CONTENT_TYPE_OPTIONS_HEADER, analyzeEmailHeaders, assessContentTypeRisk, buildAcceptLanguage, buildCacheControl, buildClientHints, buildContentDisposition, buildDnsQueryUrl, buildGeoUrl, buildLinkHeader, buildMapUrl, buildPermissionsPolicy, buildPreferHeader, buildPriorityHeader, buildRangeHeader, buildReferrerPolicy, buildRetryAfterHeader, buildVaryHeader, buildXContentTypeOptionsHeader, checkSetCookieHeader, countryCodeToFlag, extractMultipartBoundary, formatCoordinates, formatTtl, getByCategory, getHeader, getHeadersByCategory, getStatusByCategory, getStatusCode, isClientError, isServerError, isSuccess, isValidIp, isValidIpv4, isValidIpv6, listCloseCodes, lookupCloseCode, parseAcceptLanguage, parseClientHintHeaders, parseContentDisposition, parseContentRangeHeader, parseDnsResponse, parseGeoResponse, parseHar, parseIpv6Address, parseMultipartFormData, parsePermissionsPolicy, parsePreferHeader, parsePriorityHeader, parseRetryAfterHeader, parseUserAgent, parseVaryHeader, parseXContentTypeOptionsHeader, searchHeaders, searchStatusCodes, splitSitemap, statusCodeToText, typeNumberToLabel, validateDomain, validateHeaderName, validateHeaderValue, validateManifest, validateRobotsTxt, validateSitemap } from '../chunk-
|
|
1
|
+
export { CLIENT_HINTS, DNS_RECORD_TYPES, HTTP_HEADERS, LINK_REL_VALUES, PERMISSIONS_POLICY_FEATURES, REFERRER_POLICY_VALUES, STATUS_CODES, X_CONTENT_TYPE_OPTIONS_HEADER, analyzeEmailHeaders, assessContentTypeRisk, buildAcceptLanguage, buildCacheControl, buildClientHints, buildContentDisposition, buildDnsQueryUrl, buildGeoUrl, buildHsts, buildLinkHeader, buildMapUrl, buildPermissionsPolicy, buildPreferHeader, buildPriorityHeader, buildRangeHeader, buildReferrerPolicy, buildRetryAfterHeader, buildVaryHeader, buildXContentTypeOptionsHeader, checkSetCookieHeader, countryCodeToFlag, extractMultipartBoundary, formatCoordinates, formatTtl, getByCategory, getHeader, getHeadersByCategory, getStatusByCategory, getStatusCode, isClientError, isServerError, isSuccess, isValidIp, isValidIpv4, isValidIpv6, listCloseCodes, lookupCloseCode, parseAcceptLanguage, parseClientHintHeaders, parseContentDisposition, parseContentRangeHeader, parseDnsResponse, parseGeoResponse, parseHar, parseHsts, parseIpv6Address, parseMultipartFormData, parsePermissionsPolicy, parsePreferHeader, parsePriorityHeader, parseRetryAfterHeader, parseUserAgent, parseVaryHeader, parseXContentTypeOptionsHeader, searchHeaders, searchStatusCodes, splitSitemap, statusCodeToText, typeNumberToLabel, validateDomain, validateHeaderName, validateHeaderValue, validateManifest, validateRobotsTxt, validateSitemap } from '../chunk-KEZLVYR3.js';
|
|
2
2
|
import '../chunk-MLKGABMK.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@utilix-tech/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.65.0",
|
|
4
4
|
"description": "154+ developer utility tools for Node.js: JSON, encoding, hashing, color, CSS, network and more. Runs locally, no API key required.",
|
|
5
5
|
"author": "Utilix <hello@utilix.tech>",
|
|
6
6
|
"license": "MIT",
|