@utilix-tech/sdk 0.35.0 → 0.37.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 +7 -0
- package/README.md +15 -3
- package/dist/{chunk-3YUKLV5N.js → chunk-DBNTO3YO.js} +148 -1
- package/dist/{chunk-UUT5HNST.js → chunk-JL7YTXRB.js} +81 -1
- package/dist/{code-BK-x8hVx.d.cts → code-KXoRsHtl.d.cts} +21 -2
- package/dist/{code-BK-x8hVx.d.ts → code-KXoRsHtl.d.ts} +21 -2
- package/dist/index.cjs +227 -0
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/{network-DfY5Ikvr.d.cts → network-CnKUQT4g.d.cts} +78 -2
- package/dist/{network-DfY5Ikvr.d.ts → network-CnKUQT4g.d.ts} +78 -2
- package/dist/tools/code.cjs +80 -0
- package/dist/tools/code.d.cts +1 -1
- package/dist/tools/code.d.ts +1 -1
- package/dist/tools/code.js +1 -1
- package/dist/tools/network.cjs +147 -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/code.cjs
CHANGED
|
@@ -2807,6 +2807,85 @@ function lintConventionalCommit(message, options = {}) {
|
|
|
2807
2807
|
const valid = !findings.some((f) => f.severity === "error");
|
|
2808
2808
|
return { message, valid, parsed, findings };
|
|
2809
2809
|
}
|
|
2810
|
+
function globSegmentToRegexSource(segment) {
|
|
2811
|
+
let out = "";
|
|
2812
|
+
for (let i = 0; i < segment.length; i++) {
|
|
2813
|
+
const c = segment[i];
|
|
2814
|
+
if (c === "*") {
|
|
2815
|
+
out += "[^/]*";
|
|
2816
|
+
} else if (c === "?") {
|
|
2817
|
+
out += "[^/]";
|
|
2818
|
+
} else if (c === "[") {
|
|
2819
|
+
const close = segment.indexOf("]", i + 1);
|
|
2820
|
+
if (close === -1) {
|
|
2821
|
+
out += "\\[";
|
|
2822
|
+
} else {
|
|
2823
|
+
let cls = segment.slice(i + 1, close);
|
|
2824
|
+
if (cls.startsWith("!")) cls = "^" + cls.slice(1);
|
|
2825
|
+
out += `[${cls}]`;
|
|
2826
|
+
i = close;
|
|
2827
|
+
}
|
|
2828
|
+
} else {
|
|
2829
|
+
out += c.replace(/[.+^${}()|\\]/g, "\\$&");
|
|
2830
|
+
}
|
|
2831
|
+
}
|
|
2832
|
+
return out;
|
|
2833
|
+
}
|
|
2834
|
+
function compileGitignorePattern(raw, line) {
|
|
2835
|
+
let pattern = raw.replace(/\s+$/, "");
|
|
2836
|
+
if (!pattern || pattern.startsWith("#")) return null;
|
|
2837
|
+
let negate = false;
|
|
2838
|
+
if (pattern.startsWith("!")) {
|
|
2839
|
+
negate = true;
|
|
2840
|
+
pattern = pattern.slice(1);
|
|
2841
|
+
}
|
|
2842
|
+
pattern = pattern.replace(/\\(.)/g, "$1");
|
|
2843
|
+
if (!pattern) return null;
|
|
2844
|
+
const dirOnly = pattern.endsWith("/") && !pattern.endsWith("\\/");
|
|
2845
|
+
if (dirOnly) pattern = pattern.slice(0, -1);
|
|
2846
|
+
const hasLeadingSlash = pattern.startsWith("/");
|
|
2847
|
+
if (hasLeadingSlash) pattern = pattern.slice(1);
|
|
2848
|
+
const anchored = hasLeadingSlash || pattern.includes("/");
|
|
2849
|
+
const segments = pattern.split("/");
|
|
2850
|
+
const regexParts = segments.map((seg) => {
|
|
2851
|
+
if (seg === "**") return "(?:.*)";
|
|
2852
|
+
return globSegmentToRegexSource(seg);
|
|
2853
|
+
});
|
|
2854
|
+
let body = regexParts.join("/");
|
|
2855
|
+
body = body.replace(/\(\?:\.\*\)\//g, "(?:.*/)?").replace(/\/\(\?:\.\*\)/g, "(?:/.*)?");
|
|
2856
|
+
const prefix = anchored ? "^" : "^(?:.*/)?";
|
|
2857
|
+
const suffix = "(?:/.*)?$";
|
|
2858
|
+
const regex = new RegExp(prefix + body + suffix);
|
|
2859
|
+
return { raw, line, negate, regex };
|
|
2860
|
+
}
|
|
2861
|
+
function testGitignorePatterns(gitignoreContent, paths) {
|
|
2862
|
+
if (typeof gitignoreContent !== "string" || !gitignoreContent.trim()) {
|
|
2863
|
+
return { error: "gitignore content is required" };
|
|
2864
|
+
}
|
|
2865
|
+
if (!Array.isArray(paths) || paths.length === 0) {
|
|
2866
|
+
return { error: "At least one path is required" };
|
|
2867
|
+
}
|
|
2868
|
+
const lines = gitignoreContent.split("\n");
|
|
2869
|
+
const patterns = [];
|
|
2870
|
+
lines.forEach((line, idx) => {
|
|
2871
|
+
const compiled = compileGitignorePattern(line, idx + 1);
|
|
2872
|
+
if (compiled) patterns.push(compiled);
|
|
2873
|
+
});
|
|
2874
|
+
return paths.map((rawPath) => {
|
|
2875
|
+
const path = rawPath.trim().replace(/^\.\//, "");
|
|
2876
|
+
let ignored = false;
|
|
2877
|
+
let matchedPattern = null;
|
|
2878
|
+
let matchedLine = null;
|
|
2879
|
+
for (const p of patterns) {
|
|
2880
|
+
if (p.regex.test(path)) {
|
|
2881
|
+
ignored = !p.negate;
|
|
2882
|
+
matchedPattern = p.raw.trim();
|
|
2883
|
+
matchedLine = p.line;
|
|
2884
|
+
}
|
|
2885
|
+
}
|
|
2886
|
+
return { path, ignored, matchedPattern, matchedLine };
|
|
2887
|
+
});
|
|
2888
|
+
}
|
|
2810
2889
|
|
|
2811
2890
|
exports.ALL_FLAGS = ALL_FLAGS;
|
|
2812
2891
|
exports.CHEATSHEET = CHEATSHEET;
|
|
@@ -2856,6 +2935,7 @@ exports.removeRedundantAttributes = removeRedundantAttributes;
|
|
|
2856
2935
|
exports.searchCheatsheet = searchCheatsheet;
|
|
2857
2936
|
exports.searchEndpoints = searchEndpoints;
|
|
2858
2937
|
exports.splitStatements = splitStatements;
|
|
2938
|
+
exports.testGitignorePatterns = testGitignorePatterns;
|
|
2859
2939
|
exports.testPattern = testPattern;
|
|
2860
2940
|
exports.testRegex = testRegex;
|
|
2861
2941
|
exports.validateEnvKey = validateEnvKey;
|
package/dist/tools/code.d.cts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { A as ALL_FLAGS, a as ApiEndpoint, b as ApiInfo, C as CHEATSHEET, d as CheatsheetEntry, e as ConventionalCommitFinding, f as ConventionalCommitFooter, g as ConventionalCommitOptions, h as ConventionalCommitParsed, i as ConventionalCommitResult, j as ConventionalCommitSeverity, k as CssResult, D as DEFAULT_COMMIT_TYPES, l as DockerImageRef, E as EnvEntry, m as EnvParseResult, G as GitCommandConfig, n as GitCommandResult, o as GitOperation, p as GithubUrlInfo, q as GithubUrlType, r as GqlFormatResult, H as HtmlFormatResult,
|
|
1
|
+
export { A as ALL_FLAGS, a as ApiEndpoint, b as ApiInfo, C as CHEATSHEET, d as CheatsheetEntry, e as ConventionalCommitFinding, f as ConventionalCommitFooter, g as ConventionalCommitOptions, h as ConventionalCommitParsed, i as ConventionalCommitResult, j as ConventionalCommitSeverity, k as CssResult, D as DEFAULT_COMMIT_TYPES, l as DockerImageRef, E as EnvEntry, m as EnvParseResult, G as GitCommandConfig, n as GitCommandResult, o as GitOperation, p as GithubUrlInfo, q as GithubUrlType, r as GitignoreTestResult, s as GqlFormatResult, H as HtmlFormatResult, t as HtmlMinifyOptions, u as HtmlMinifyResult, J as JsMinifyOptions, v as JsMinifyResult, M as MIME_TABLE, w as MatchResult, x as MimeEntry, y as MimeLookupResult, O as OPERATIONS, P as ParsedSpec, R as RedosFinding, z as RedosResult, B as RedosSeverity, F as RegexError, I as RegexFlag, K as RegexMatch, L as RegexResult, N as RegexSuccess, S as SQL_DEFAULT_OPTIONS, Q as Segment, T as SpecVersion, U as SqlDialect, V as SqlFormatOptions, W as TestPatternResult, X as buildDockerPull, Y as buildDockerRun, Z as buildGitCommand, _ as collapseHtmlWhitespace, $ as collapseJsWhitespace, a0 as countProperties, a1 as countRules, a2 as detectDialect, a3 as detectOperationType, a4 as detectRedos, a5 as envToExport, a6 as envToJson, a7 as formatCss, a8 as formatGql, a9 as formatHtml, aa as formatSql, ab as getEndpointsByTag, ac as getHtmlStats, ad as getJsStats, ae as getMethodColor, af as isValidTag, ag as lintConventionalCommit, ah as lookupMime, ai as minifyCss, aj as minifyGql, ak as minifyHtml, al as minifyJs, am as minifySql, an as normalizeRef, ao as parseDockerImage, ap as parseEnv, aq as parseGitCommand, ar as parseGithubUrl, as as parseSpec, at as removeConsoleCalls, au as removeEmptyAttributes, av as removeHtmlComments, aw as removeJsComments, ax as removeRedundantAttributes, ay as searchCheatsheet, az as searchEndpoints, aA as splitStatements, aB as testGitignorePatterns, aC as testPattern, aD as testRegex, aE as validateEnvKey } from '../code-KXoRsHtl.cjs';
|
package/dist/tools/code.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { A as ALL_FLAGS, a as ApiEndpoint, b as ApiInfo, C as CHEATSHEET, d as CheatsheetEntry, e as ConventionalCommitFinding, f as ConventionalCommitFooter, g as ConventionalCommitOptions, h as ConventionalCommitParsed, i as ConventionalCommitResult, j as ConventionalCommitSeverity, k as CssResult, D as DEFAULT_COMMIT_TYPES, l as DockerImageRef, E as EnvEntry, m as EnvParseResult, G as GitCommandConfig, n as GitCommandResult, o as GitOperation, p as GithubUrlInfo, q as GithubUrlType, r as GqlFormatResult, H as HtmlFormatResult,
|
|
1
|
+
export { A as ALL_FLAGS, a as ApiEndpoint, b as ApiInfo, C as CHEATSHEET, d as CheatsheetEntry, e as ConventionalCommitFinding, f as ConventionalCommitFooter, g as ConventionalCommitOptions, h as ConventionalCommitParsed, i as ConventionalCommitResult, j as ConventionalCommitSeverity, k as CssResult, D as DEFAULT_COMMIT_TYPES, l as DockerImageRef, E as EnvEntry, m as EnvParseResult, G as GitCommandConfig, n as GitCommandResult, o as GitOperation, p as GithubUrlInfo, q as GithubUrlType, r as GitignoreTestResult, s as GqlFormatResult, H as HtmlFormatResult, t as HtmlMinifyOptions, u as HtmlMinifyResult, J as JsMinifyOptions, v as JsMinifyResult, M as MIME_TABLE, w as MatchResult, x as MimeEntry, y as MimeLookupResult, O as OPERATIONS, P as ParsedSpec, R as RedosFinding, z as RedosResult, B as RedosSeverity, F as RegexError, I as RegexFlag, K as RegexMatch, L as RegexResult, N as RegexSuccess, S as SQL_DEFAULT_OPTIONS, Q as Segment, T as SpecVersion, U as SqlDialect, V as SqlFormatOptions, W as TestPatternResult, X as buildDockerPull, Y as buildDockerRun, Z as buildGitCommand, _ as collapseHtmlWhitespace, $ as collapseJsWhitespace, a0 as countProperties, a1 as countRules, a2 as detectDialect, a3 as detectOperationType, a4 as detectRedos, a5 as envToExport, a6 as envToJson, a7 as formatCss, a8 as formatGql, a9 as formatHtml, aa as formatSql, ab as getEndpointsByTag, ac as getHtmlStats, ad as getJsStats, ae as getMethodColor, af as isValidTag, ag as lintConventionalCommit, ah as lookupMime, ai as minifyCss, aj as minifyGql, ak as minifyHtml, al as minifyJs, am as minifySql, an as normalizeRef, ao as parseDockerImage, ap as parseEnv, aq as parseGitCommand, ar as parseGithubUrl, as as parseSpec, at as removeConsoleCalls, au as removeEmptyAttributes, av as removeHtmlComments, aw as removeJsComments, ax as removeRedundantAttributes, ay as searchCheatsheet, az as searchEndpoints, aA as splitStatements, aB as testGitignorePatterns, aC as testPattern, aD as testRegex, aE as validateEnvKey } from '../code-KXoRsHtl.js';
|
package/dist/tools/code.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { ALL_FLAGS, CHEATSHEET, DEFAULT_COMMIT_TYPES, MIME_TABLE, OPERATIONS, SQL_DEFAULT_OPTIONS, buildDockerPull, buildDockerRun, buildGitCommand, collapseHtmlWhitespace, collapseJsWhitespace, countProperties, countRules, detectDialect, detectOperationType, detectRedos, envToExport, envToJson, formatCss, formatGql, formatHtml, formatSql, getEndpointsByTag, getHtmlStats, getJsStats, getMethodColor, isValidTag, lintConventionalCommit, lookupMime, minifyCss, minifyGql, minifyHtml, minifyJs, minifySql, normalizeRef, parseDockerImage, parseEnv, parseGitCommand, parseGithubUrl, parseSpec, removeConsoleCalls, removeEmptyAttributes, removeHtmlComments, removeJsComments, removeRedundantAttributes, searchCheatsheet, searchEndpoints, splitStatements, testPattern, testRegex, validateEnvKey } from '../chunk-
|
|
1
|
+
export { ALL_FLAGS, CHEATSHEET, DEFAULT_COMMIT_TYPES, MIME_TABLE, OPERATIONS, SQL_DEFAULT_OPTIONS, buildDockerPull, buildDockerRun, buildGitCommand, collapseHtmlWhitespace, collapseJsWhitespace, countProperties, countRules, detectDialect, detectOperationType, detectRedos, envToExport, envToJson, formatCss, formatGql, formatHtml, formatSql, getEndpointsByTag, getHtmlStats, getJsStats, getMethodColor, isValidTag, lintConventionalCommit, lookupMime, minifyCss, minifyGql, minifyHtml, minifyJs, minifySql, normalizeRef, parseDockerImage, parseEnv, parseGitCommand, parseGithubUrl, parseSpec, removeConsoleCalls, removeEmptyAttributes, removeHtmlComments, removeJsComments, removeRedundantAttributes, searchCheatsheet, searchEndpoints, splitStatements, testGitignorePatterns, testPattern, testRegex, validateEnvKey } from '../chunk-JL7YTXRB.js';
|
|
2
2
|
import '../chunk-MLKGABMK.js';
|
package/dist/tools/network.cjs
CHANGED
|
@@ -1855,6 +1855,73 @@ function buildReferrerPolicy(policies) {
|
|
|
1855
1855
|
const metaTag = `<meta name="referrer" content="${last.value}">`;
|
|
1856
1856
|
return { header, headerName: "Referrer-Policy", snippet, metaTag, policies: entries, warnings };
|
|
1857
1857
|
}
|
|
1858
|
+
var LINK_REL_VALUES = [
|
|
1859
|
+
"preload",
|
|
1860
|
+
"preconnect",
|
|
1861
|
+
"prefetch",
|
|
1862
|
+
"prerender",
|
|
1863
|
+
"dns-prefetch",
|
|
1864
|
+
"canonical",
|
|
1865
|
+
"next",
|
|
1866
|
+
"prev",
|
|
1867
|
+
"alternate",
|
|
1868
|
+
"stylesheet",
|
|
1869
|
+
"icon",
|
|
1870
|
+
"modulepreload"
|
|
1871
|
+
];
|
|
1872
|
+
var _LINK_REL_INFO = {
|
|
1873
|
+
preload: "Tells the browser to fetch this resource early, before the parser would otherwise discover it, without blocking rendering. Requires an `as` attribute so the browser applies the right request priority and Content-Security-Policy check; omitting it commonly causes the resource to be fetched twice.",
|
|
1874
|
+
preconnect: "Tells the browser to start the connection handshake (DNS, TCP, TLS) to this origin early, before any real request to it is made, so the first actual request lands faster.",
|
|
1875
|
+
prefetch: "Tells the browser to fetch this resource at low priority for a likely future navigation and cache it. Unlike preload, it does not affect the current page load.",
|
|
1876
|
+
prerender: "Tells the browser to fetch and render this page in the background so navigating to it feels instant, at a real bandwidth and CPU cost if the user never navigates there.",
|
|
1877
|
+
"dns-prefetch": "Tells the browser to resolve this origin's DNS early, a lighter-weight version of preconnect that skips the TCP/TLS handshake.",
|
|
1878
|
+
canonical: "Tells search engines which URL is the authoritative version of this page, used to consolidate duplicate-content signals across query-string or protocol variants.",
|
|
1879
|
+
next: "Marks the next page in a paginated sequence, a hint search engines and some browsers use for pagination.",
|
|
1880
|
+
prev: "Marks the previous page in a paginated sequence.",
|
|
1881
|
+
alternate: "Points to an alternate version of this resource, such as a different language or an RSS feed.",
|
|
1882
|
+
stylesheet: 'Loads an external stylesheet, the same effect as a `<link rel="stylesheet">` tag but delivered as a response header instead.',
|
|
1883
|
+
icon: 'Points to this resource\'s favicon, the same effect as a `<link rel="icon">` tag but delivered as a response header instead.',
|
|
1884
|
+
modulepreload: "Tells the browser to fetch and parse this JavaScript module early, ahead of when the module graph would otherwise discover it."
|
|
1885
|
+
};
|
|
1886
|
+
function buildLinkHeader(links) {
|
|
1887
|
+
if (!Array.isArray(links) || links.length === 0) {
|
|
1888
|
+
return { error: "At least one link entry is required" };
|
|
1889
|
+
}
|
|
1890
|
+
const entries = [];
|
|
1891
|
+
for (const link of links) {
|
|
1892
|
+
const url = typeof link.url === "string" ? link.url.trim() : "";
|
|
1893
|
+
const rel = typeof link.rel === "string" ? link.rel.trim() : "";
|
|
1894
|
+
if (!url) return { error: "Each link entry requires a non-empty url" };
|
|
1895
|
+
if (!rel) return { error: "Each link entry requires a non-empty rel" };
|
|
1896
|
+
if (!LINK_REL_VALUES.includes(rel)) {
|
|
1897
|
+
return { error: `'${rel}' is not a supported rel value. Supported values: ${LINK_REL_VALUES.join(", ")}` };
|
|
1898
|
+
}
|
|
1899
|
+
const as = link.as?.trim() || void 0;
|
|
1900
|
+
const type = link.type?.trim() || void 0;
|
|
1901
|
+
const crossorigin = link.crossorigin === true;
|
|
1902
|
+
let value = `<${url}>; rel="${rel}"`;
|
|
1903
|
+
if (as) value += `; as="${as}"`;
|
|
1904
|
+
if (type) value += `; type="${type}"`;
|
|
1905
|
+
if (crossorigin) value += "; crossorigin";
|
|
1906
|
+
entries.push({ url, rel, as, type, crossorigin: crossorigin || void 0, value, explanation: _LINK_REL_INFO[rel] });
|
|
1907
|
+
}
|
|
1908
|
+
const warnings = [];
|
|
1909
|
+
for (const entry of entries) {
|
|
1910
|
+
if (entry.rel === "preload" && !entry.as) {
|
|
1911
|
+
warnings.push(`preload link for "${entry.url}" is missing an \`as\` attribute \u2014 the browser may fetch it twice or apply the wrong request priority.`);
|
|
1912
|
+
}
|
|
1913
|
+
if ((entry.rel === "preconnect" || entry.rel === "dns-prefetch") && (entry.as || entry.type)) {
|
|
1914
|
+
warnings.push(`${entry.rel} link for "${entry.url}" sets \`as\`/\`type\`, which it ignores since no specific resource is being fetched yet.`);
|
|
1915
|
+
}
|
|
1916
|
+
}
|
|
1917
|
+
const canonicalCount = entries.filter((e) => e.rel === "canonical").length;
|
|
1918
|
+
if (canonicalCount > 1) {
|
|
1919
|
+
warnings.push(`${canonicalCount} canonical links present \u2014 only one canonical URL should be declared per page.`);
|
|
1920
|
+
}
|
|
1921
|
+
const header = entries.map((e) => e.value).join(", ");
|
|
1922
|
+
const snippet = `Link: ${header}`;
|
|
1923
|
+
return { header, headerName: "Link", snippet, links: entries, warnings };
|
|
1924
|
+
}
|
|
1858
1925
|
function isValidIpv6HexGroup(g) {
|
|
1859
1926
|
return /^[0-9a-fA-F]{1,4}$/.test(g);
|
|
1860
1927
|
}
|
|
@@ -1943,16 +2010,96 @@ function parseIpv6Address(input) {
|
|
|
1943
2010
|
addressType: classifyIpv6(expandedGroups)
|
|
1944
2011
|
};
|
|
1945
2012
|
}
|
|
2013
|
+
var MAX_COOKIE_AGE_SECONDS = 400 * 24 * 60 * 60;
|
|
2014
|
+
function checkSetCookieHeader(header) {
|
|
2015
|
+
if (typeof header !== "string" || !header.trim()) {
|
|
2016
|
+
return { error: "A Set-Cookie header value is required" };
|
|
2017
|
+
}
|
|
2018
|
+
const parts = header.split(";").map((p) => p.trim()).filter(Boolean);
|
|
2019
|
+
const [nameValue, ...attrParts] = parts;
|
|
2020
|
+
const eqIdx = nameValue.indexOf("=");
|
|
2021
|
+
if (eqIdx === -1) return { error: "Missing name=value pair" };
|
|
2022
|
+
const name = nameValue.slice(0, eqIdx).trim();
|
|
2023
|
+
const value = nameValue.slice(eqIdx + 1).trim();
|
|
2024
|
+
if (!name) return { error: "Cookie name cannot be empty" };
|
|
2025
|
+
const cookie = {
|
|
2026
|
+
name,
|
|
2027
|
+
value,
|
|
2028
|
+
domain: null,
|
|
2029
|
+
path: null,
|
|
2030
|
+
expires: null,
|
|
2031
|
+
maxAge: null,
|
|
2032
|
+
secure: false,
|
|
2033
|
+
httpOnly: false,
|
|
2034
|
+
sameSite: null
|
|
2035
|
+
};
|
|
2036
|
+
for (const attr of attrParts) {
|
|
2037
|
+
const idx = attr.indexOf("=");
|
|
2038
|
+
const key = (idx === -1 ? attr : attr.slice(0, idx)).trim().toLowerCase();
|
|
2039
|
+
const val = idx === -1 ? "" : attr.slice(idx + 1).trim();
|
|
2040
|
+
switch (key) {
|
|
2041
|
+
case "domain":
|
|
2042
|
+
cookie.domain = val || null;
|
|
2043
|
+
break;
|
|
2044
|
+
case "path":
|
|
2045
|
+
cookie.path = val || null;
|
|
2046
|
+
break;
|
|
2047
|
+
case "expires":
|
|
2048
|
+
cookie.expires = val || null;
|
|
2049
|
+
break;
|
|
2050
|
+
case "max-age": {
|
|
2051
|
+
const n = Number(val);
|
|
2052
|
+
cookie.maxAge = Number.isFinite(n) ? n : null;
|
|
2053
|
+
break;
|
|
2054
|
+
}
|
|
2055
|
+
case "secure":
|
|
2056
|
+
cookie.secure = true;
|
|
2057
|
+
break;
|
|
2058
|
+
case "httponly":
|
|
2059
|
+
cookie.httpOnly = true;
|
|
2060
|
+
break;
|
|
2061
|
+
case "samesite": {
|
|
2062
|
+
const normalized = val.toLowerCase();
|
|
2063
|
+
if (normalized === "strict") cookie.sameSite = "Strict";
|
|
2064
|
+
else if (normalized === "lax") cookie.sameSite = "Lax";
|
|
2065
|
+
else if (normalized === "none") cookie.sameSite = "None";
|
|
2066
|
+
break;
|
|
2067
|
+
}
|
|
2068
|
+
}
|
|
2069
|
+
}
|
|
2070
|
+
const issues = [];
|
|
2071
|
+
const warnings = [];
|
|
2072
|
+
if (cookie.sameSite === "None" && !cookie.secure) {
|
|
2073
|
+
issues.push("SameSite=None requires the Secure attribute \u2014 modern browsers reject this cookie without it.");
|
|
2074
|
+
}
|
|
2075
|
+
if (name.startsWith("__Host-")) {
|
|
2076
|
+
if (!cookie.secure) issues.push("__Host- prefixed cookies require the Secure attribute.");
|
|
2077
|
+
if (cookie.domain) issues.push("__Host- prefixed cookies must not set a Domain attribute.");
|
|
2078
|
+
if (cookie.path !== "/") issues.push("__Host- prefixed cookies must set Path=/.");
|
|
2079
|
+
} else if (name.startsWith("__Secure-")) {
|
|
2080
|
+
if (!cookie.secure) issues.push("__Secure- prefixed cookies require the Secure attribute.");
|
|
2081
|
+
}
|
|
2082
|
+
if (!cookie.secure) {
|
|
2083
|
+
warnings.push("Missing Secure attribute \u2014 the cookie can be sent over a plain HTTP connection.");
|
|
2084
|
+
}
|
|
2085
|
+
if (cookie.maxAge !== null && cookie.maxAge > MAX_COOKIE_AGE_SECONDS) {
|
|
2086
|
+
warnings.push(`Max-Age (${cookie.maxAge}s) exceeds 400 days \u2014 Chromium-based browsers clamp cookie expiry to 400 days from when it's set, so this will be shortened.`);
|
|
2087
|
+
}
|
|
2088
|
+
return { cookie, issues, warnings, valid: issues.length === 0 };
|
|
2089
|
+
}
|
|
1946
2090
|
|
|
1947
2091
|
exports.DNS_RECORD_TYPES = DNS_RECORD_TYPES;
|
|
1948
2092
|
exports.HTTP_HEADERS = HTTP_HEADERS;
|
|
2093
|
+
exports.LINK_REL_VALUES = LINK_REL_VALUES;
|
|
1949
2094
|
exports.REFERRER_POLICY_VALUES = REFERRER_POLICY_VALUES;
|
|
1950
2095
|
exports.STATUS_CODES = STATUS_CODES;
|
|
1951
2096
|
exports.buildCacheControl = buildCacheControl;
|
|
1952
2097
|
exports.buildDnsQueryUrl = buildDnsQueryUrl;
|
|
1953
2098
|
exports.buildGeoUrl = buildGeoUrl;
|
|
2099
|
+
exports.buildLinkHeader = buildLinkHeader;
|
|
1954
2100
|
exports.buildMapUrl = buildMapUrl;
|
|
1955
2101
|
exports.buildReferrerPolicy = buildReferrerPolicy;
|
|
2102
|
+
exports.checkSetCookieHeader = checkSetCookieHeader;
|
|
1956
2103
|
exports.countryCodeToFlag = countryCodeToFlag;
|
|
1957
2104
|
exports.formatCoordinates = formatCoordinates;
|
|
1958
2105
|
exports.formatTtl = formatTtl;
|
package/dist/tools/network.d.cts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { C as CacheControlDirective, a as CacheControlOptions, b as CacheControlResult, D as DNS_RECORD_TYPES,
|
|
1
|
+
export { C as CacheControlDirective, a as CacheControlOptions, b as CacheControlResult, c as CookieAttributes, d as CookieCheckResult, D as DNS_RECORD_TYPES, e as DnsRecord, f as DnsRecordType, g as DnsResponse, G as GeoResult, H as HTTP_HEADERS, h as HarEntry, i as HarParseResult, j as HarSummary, k as HeaderCategory, l as HttpHeader, I as Ipv6AddressType, m as Ipv6ParseResult, L as LINK_REL_VALUES, o as LinkHeaderEntry, p as LinkHeaderEntryInput, q as LinkHeaderResult, r as LinkRel, P as ParsedDnsResult, s as ParsedGeoResult, R as REFERRER_POLICY_VALUES, t as ReferrerPolicyEntry, u as ReferrerPolicyResult, v as ReferrerPolicyValue, w as RobotsGroup, x as RobotsIssue, y as RobotsRule, z as RobotsValidationResult, S as STATUS_CODES, A as SameSiteValue, B as SitemapIndexEntry, E as SitemapIssue, F as SitemapUrlEntry, J as SitemapValidationResult, K as StatusCode, U as UaDeviceType, M as UserAgentInfo, N as buildCacheControl, O as buildDnsQueryUrl, Q as buildGeoUrl, T as buildLinkHeader, V as buildMapUrl, W as buildReferrerPolicy, X as checkSetCookieHeader, Y as countryCodeToFlag, Z as formatCoordinates, _ as formatTtl, $ as getByCategory, a0 as getHeader, a1 as getHeadersByCategory, a2 as getStatusByCategory, a3 as getStatusCode, a4 as isClientError, a5 as isServerError, a6 as isSuccess, a7 as isValidIp, a8 as isValidIpv4, a9 as isValidIpv6, aa as parseDnsResponse, ab as parseGeoResponse, ac as parseHar, ad as parseIpv6Address, ae as parseUserAgent, af as searchHeaders, ag as searchStatusCodes, ah as statusCodeToText, ai as typeNumberToLabel, aj as validateDomain, ak as validateHeaderName, al as validateHeaderValue, am as validateRobotsTxt, an as validateSitemap } from '../network-CnKUQT4g.cjs';
|
package/dist/tools/network.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { C as CacheControlDirective, a as CacheControlOptions, b as CacheControlResult, D as DNS_RECORD_TYPES,
|
|
1
|
+
export { C as CacheControlDirective, a as CacheControlOptions, b as CacheControlResult, c as CookieAttributes, d as CookieCheckResult, D as DNS_RECORD_TYPES, e as DnsRecord, f as DnsRecordType, g as DnsResponse, G as GeoResult, H as HTTP_HEADERS, h as HarEntry, i as HarParseResult, j as HarSummary, k as HeaderCategory, l as HttpHeader, I as Ipv6AddressType, m as Ipv6ParseResult, L as LINK_REL_VALUES, o as LinkHeaderEntry, p as LinkHeaderEntryInput, q as LinkHeaderResult, r as LinkRel, P as ParsedDnsResult, s as ParsedGeoResult, R as REFERRER_POLICY_VALUES, t as ReferrerPolicyEntry, u as ReferrerPolicyResult, v as ReferrerPolicyValue, w as RobotsGroup, x as RobotsIssue, y as RobotsRule, z as RobotsValidationResult, S as STATUS_CODES, A as SameSiteValue, B as SitemapIndexEntry, E as SitemapIssue, F as SitemapUrlEntry, J as SitemapValidationResult, K as StatusCode, U as UaDeviceType, M as UserAgentInfo, N as buildCacheControl, O as buildDnsQueryUrl, Q as buildGeoUrl, T as buildLinkHeader, V as buildMapUrl, W as buildReferrerPolicy, X as checkSetCookieHeader, Y as countryCodeToFlag, Z as formatCoordinates, _ as formatTtl, $ as getByCategory, a0 as getHeader, a1 as getHeadersByCategory, a2 as getStatusByCategory, a3 as getStatusCode, a4 as isClientError, a5 as isServerError, a6 as isSuccess, a7 as isValidIp, a8 as isValidIpv4, a9 as isValidIpv6, aa as parseDnsResponse, ab as parseGeoResponse, ac as parseHar, ad as parseIpv6Address, ae as parseUserAgent, af as searchHeaders, ag as searchStatusCodes, ah as statusCodeToText, ai as typeNumberToLabel, aj as validateDomain, ak as validateHeaderName, al as validateHeaderValue, am as validateRobotsTxt, an as validateSitemap } from '../network-CnKUQT4g.js';
|
package/dist/tools/network.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { DNS_RECORD_TYPES, HTTP_HEADERS, REFERRER_POLICY_VALUES, STATUS_CODES, buildCacheControl, buildDnsQueryUrl, buildGeoUrl, buildMapUrl, buildReferrerPolicy, countryCodeToFlag, formatCoordinates, formatTtl, getByCategory, getHeader, getHeadersByCategory, getStatusByCategory, getStatusCode, isClientError, isServerError, isSuccess, isValidIp, isValidIpv4, isValidIpv6, parseDnsResponse, parseGeoResponse, parseHar, parseIpv6Address, parseUserAgent, searchHeaders, searchStatusCodes, statusCodeToText, typeNumberToLabel, validateDomain, validateHeaderName, validateHeaderValue, validateRobotsTxt, validateSitemap } from '../chunk-
|
|
1
|
+
export { DNS_RECORD_TYPES, HTTP_HEADERS, LINK_REL_VALUES, REFERRER_POLICY_VALUES, STATUS_CODES, buildCacheControl, buildDnsQueryUrl, buildGeoUrl, buildLinkHeader, buildMapUrl, buildReferrerPolicy, checkSetCookieHeader, countryCodeToFlag, formatCoordinates, formatTtl, getByCategory, getHeader, getHeadersByCategory, getStatusByCategory, getStatusCode, isClientError, isServerError, isSuccess, isValidIp, isValidIpv4, isValidIpv6, parseDnsResponse, parseGeoResponse, parseHar, parseIpv6Address, parseUserAgent, searchHeaders, searchStatusCodes, statusCodeToText, typeNumberToLabel, validateDomain, validateHeaderName, validateHeaderValue, validateRobotsTxt, validateSitemap } from '../chunk-DBNTO3YO.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.37.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",
|