@utilix-tech/sdk 0.41.0 → 0.42.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 +3 -0
- package/README.md +10 -2
- package/dist/{chunk-7WSFJTYP.js → chunk-UD45LBG7.js} +41 -1
- package/dist/index.cjs +40 -0
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{network-BC8McQOh.d.cts → network-oAs83Ztn.d.cts} +33 -2
- package/dist/{network-BC8McQOh.d.ts → network-oAs83Ztn.d.ts} +33 -2
- package/dist/tools/network.cjs +40 -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/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Full release notes for all Utilix surfaces (browser tools, REST API, SDKs, MCP server) live at [utilix.tech/changelog](https://utilix.tech/changelog). This file tracks just this package.
|
|
4
4
|
|
|
5
|
+
## 0.42.0
|
|
6
|
+
- Add `buildVaryHeader`, `parseVaryHeader` (vary-header-builder): build a `Vary` response header from request-header names with a plain-English caching note per header, or parse an existing Vary header into the same shape.
|
|
7
|
+
|
|
5
8
|
## 0.41.0
|
|
6
9
|
- Add `buildRangeHeader`, `parseContentRangeHeader` (http-range-header-builder): build an HTTP `Range` request header from explicit, open-ended, or suffix ("last N bytes") byte ranges, and parse a server's `Content-Range` response to verify what it actually sent back.
|
|
7
10
|
- Add `findCsvDuplicateRows` (csv-duplicate-row-finder): group CSV/TSV rows that share the same value across a chosen set of key columns, or the entire row, and report each duplicate group's occurrence count and data row numbers.
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @utilix-tech/sdk
|
|
2
2
|
|
|
3
|
-
**
|
|
3
|
+
**620 developer utility functions for Node.js: runs locally, no API key required.**
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@utilix-tech/sdk)
|
|
6
6
|
[](https://www.npmjs.com/package/@utilix-tech/sdk)
|
|
@@ -433,7 +433,7 @@ import { getStatusCode, isValidIp, isValidIpv4, isValidIpv6,
|
|
|
433
433
|
searchStatusCodes, buildGeoUrl, countryCodeToFlag,
|
|
434
434
|
parseHar, validateSitemap, validateRobotsTxt,
|
|
435
435
|
parseUserAgent, buildCacheControl, buildReferrerPolicy, parseIpv6Address, buildLinkHeader, checkSetCookieHeader, analyzeEmailHeaders,
|
|
436
|
-
buildRangeHeader, parseContentRangeHeader } from "@utilix-tech/sdk/network";
|
|
436
|
+
buildRangeHeader, parseContentRangeHeader, buildVaryHeader, parseVaryHeader } from "@utilix-tech/sdk/network";
|
|
437
437
|
|
|
438
438
|
getStatusCode(404);
|
|
439
439
|
// { code: 404, text: "Not Found", description: "...", category: "Client Error" }
|
|
@@ -496,6 +496,14 @@ buildRangeHeader([{ start: 0, end: 1023 }], { totalSize: 146515 });
|
|
|
496
496
|
// Parse a Content-Range response header to verify what a server actually sent back
|
|
497
497
|
parseContentRangeHeader("bytes 200-1000/67589");
|
|
498
498
|
// { unit: "bytes", start: 200, end: 1000, total: 67589, byteLength: 801, isUnsatisfiable: false }
|
|
499
|
+
|
|
500
|
+
// Build a Vary response header from request-header names, with a plain-English caching note per header
|
|
501
|
+
buildVaryHeader(["Accept-Encoding", "Accept-Language"]);
|
|
502
|
+
// { header: "Vary: Accept-Encoding, Accept-Language", entries: [...], warnings: [] }
|
|
503
|
+
|
|
504
|
+
// Parse an existing Vary header value into the same shape
|
|
505
|
+
parseVaryHeader("Vary: Accept-Encoding, Accept-Language");
|
|
506
|
+
// { header: "Vary: Accept-Encoding, Accept-Language", entries: [...], warnings: [] }
|
|
499
507
|
```
|
|
500
508
|
|
|
501
509
|
---
|
|
@@ -16,6 +16,7 @@ __export(network_exports, {
|
|
|
16
16
|
buildMapUrl: () => buildMapUrl,
|
|
17
17
|
buildRangeHeader: () => buildRangeHeader,
|
|
18
18
|
buildReferrerPolicy: () => buildReferrerPolicy,
|
|
19
|
+
buildVaryHeader: () => buildVaryHeader,
|
|
19
20
|
checkSetCookieHeader: () => checkSetCookieHeader,
|
|
20
21
|
countryCodeToFlag: () => countryCodeToFlag,
|
|
21
22
|
formatCoordinates: () => formatCoordinates,
|
|
@@ -37,6 +38,7 @@ __export(network_exports, {
|
|
|
37
38
|
parseHar: () => parseHar,
|
|
38
39
|
parseIpv6Address: () => parseIpv6Address,
|
|
39
40
|
parseUserAgent: () => parseUserAgent,
|
|
41
|
+
parseVaryHeader: () => parseVaryHeader,
|
|
40
42
|
searchHeaders: () => searchHeaders,
|
|
41
43
|
searchStatusCodes: () => searchStatusCodes,
|
|
42
44
|
statusCodeToText: () => statusCodeToText,
|
|
@@ -2324,5 +2326,43 @@ function parseContentRangeHeader(header) {
|
|
|
2324
2326
|
}
|
|
2325
2327
|
return { unit, start, end, total, isUnsatisfiable, isTotalUnknown, byteLength: end - start + 1 };
|
|
2326
2328
|
}
|
|
2329
|
+
var VARY_HEADER_NOTES = {
|
|
2330
|
+
"accept-encoding": "Caches must store a separate response per compression scheme (gzip, br, etc.) the client accepts.",
|
|
2331
|
+
"accept-language": "Caches must store a separate response per requested language, which can fragment a shared cache badly if Accept-Language values are highly varied.",
|
|
2332
|
+
"accept": "Caches must store a separate response per requested content type (e.g. JSON vs HTML).",
|
|
2333
|
+
"user-agent": "Caches must store a separate response per distinct User-Agent string, which is often unique enough to make caching nearly ineffective.",
|
|
2334
|
+
"authorization": "Signals the response is user-specific; most shared caches will refuse to cache it at all rather than key on this header.",
|
|
2335
|
+
"cookie": "Same effect as Authorization: shared caches typically treat the response as private and skip caching rather than key on cookie values.",
|
|
2336
|
+
"origin": "Caches must store a separate response per requesting Origin, needed whenever a response includes CORS headers that differ by origin.",
|
|
2337
|
+
"x-requested-with": "Caches must store a separate response depending on whether the request was made via an XHR/fetch client hint.",
|
|
2338
|
+
"x-forwarded-proto": "Caches must store a separate response for HTTP vs HTTPS requests, relevant behind a proxy or load balancer that terminates TLS."
|
|
2339
|
+
};
|
|
2340
|
+
function buildVaryHeader(headers) {
|
|
2341
|
+
if (!Array.isArray(headers) || headers.length === 0) return { error: "At least one header is required" };
|
|
2342
|
+
const trimmed = headers.map((h) => typeof h === "string" ? h.trim() : "").filter((h) => h.length > 0);
|
|
2343
|
+
if (trimmed.length === 0) return { error: "At least one header is required" };
|
|
2344
|
+
const warnings = [];
|
|
2345
|
+
if (trimmed.some((h) => h === "*") && trimmed.length > 1) {
|
|
2346
|
+
warnings.push('"*" makes every request effectively uncacheable; combining it with other header names is redundant, most caches will just skip caching entirely');
|
|
2347
|
+
}
|
|
2348
|
+
const seen = /* @__PURE__ */ new Map();
|
|
2349
|
+
for (const h of trimmed) {
|
|
2350
|
+
const key = h.toLowerCase();
|
|
2351
|
+
if (!seen.has(key)) seen.set(key, h);
|
|
2352
|
+
}
|
|
2353
|
+
if (seen.size < trimmed.length) warnings.push("duplicate header names were removed");
|
|
2354
|
+
const entries = Array.from(seen.values()).map((h) => ({
|
|
2355
|
+
header: h,
|
|
2356
|
+
note: h === "*" ? "Every response is considered unique; most caches will not store it at all." : VARY_HEADER_NOTES[h.toLowerCase()] ?? `Caches must store a separate response per distinct ${h} value.`
|
|
2357
|
+
}));
|
|
2358
|
+
const headerValue = entries.map((e) => e.header).join(", ");
|
|
2359
|
+
return { header: `Vary: ${headerValue}`, headerValue, entries, warnings };
|
|
2360
|
+
}
|
|
2361
|
+
function parseVaryHeader(raw) {
|
|
2362
|
+
if (!raw || raw.trim() === "") return { error: "Input is empty" };
|
|
2363
|
+
const withoutLabel = raw.trim().replace(/^vary:\s*/i, "");
|
|
2364
|
+
const headers = withoutLabel.split(",").map((h) => h.trim()).filter((h) => h.length > 0);
|
|
2365
|
+
return buildVaryHeader(headers);
|
|
2366
|
+
}
|
|
2327
2367
|
|
|
2328
|
-
export { DNS_RECORD_TYPES, HTTP_HEADERS, LINK_REL_VALUES, REFERRER_POLICY_VALUES, STATUS_CODES, analyzeEmailHeaders, buildCacheControl, buildDnsQueryUrl, buildGeoUrl, buildLinkHeader, buildMapUrl, buildRangeHeader, buildReferrerPolicy, checkSetCookieHeader, countryCodeToFlag, formatCoordinates, formatTtl, getByCategory, getHeader, getHeadersByCategory, getStatusByCategory, getStatusCode, isClientError, isServerError, isSuccess, isValidIp, isValidIpv4, isValidIpv6, network_exports, parseContentRangeHeader, parseDnsResponse, parseGeoResponse, parseHar, parseIpv6Address, parseUserAgent, searchHeaders, searchStatusCodes, statusCodeToText, typeNumberToLabel, validateDomain, validateHeaderName, validateHeaderValue, validateRobotsTxt, validateSitemap };
|
|
2368
|
+
export { DNS_RECORD_TYPES, HTTP_HEADERS, LINK_REL_VALUES, REFERRER_POLICY_VALUES, STATUS_CODES, analyzeEmailHeaders, buildCacheControl, buildDnsQueryUrl, buildGeoUrl, buildLinkHeader, buildMapUrl, buildRangeHeader, buildReferrerPolicy, buildVaryHeader, checkSetCookieHeader, countryCodeToFlag, formatCoordinates, formatTtl, getByCategory, getHeader, getHeadersByCategory, getStatusByCategory, getStatusCode, isClientError, isServerError, isSuccess, isValidIp, isValidIpv4, isValidIpv6, network_exports, parseContentRangeHeader, parseDnsResponse, parseGeoResponse, parseHar, parseIpv6Address, parseUserAgent, parseVaryHeader, searchHeaders, searchStatusCodes, statusCodeToText, typeNumberToLabel, validateDomain, validateHeaderName, validateHeaderValue, validateRobotsTxt, validateSitemap };
|
package/dist/index.cjs
CHANGED
|
@@ -9922,6 +9922,7 @@ __export(network_exports, {
|
|
|
9922
9922
|
buildMapUrl: () => buildMapUrl,
|
|
9923
9923
|
buildRangeHeader: () => buildRangeHeader,
|
|
9924
9924
|
buildReferrerPolicy: () => buildReferrerPolicy,
|
|
9925
|
+
buildVaryHeader: () => buildVaryHeader,
|
|
9925
9926
|
checkSetCookieHeader: () => checkSetCookieHeader,
|
|
9926
9927
|
countryCodeToFlag: () => countryCodeToFlag,
|
|
9927
9928
|
formatCoordinates: () => formatCoordinates,
|
|
@@ -9943,6 +9944,7 @@ __export(network_exports, {
|
|
|
9943
9944
|
parseHar: () => parseHar,
|
|
9944
9945
|
parseIpv6Address: () => parseIpv6Address,
|
|
9945
9946
|
parseUserAgent: () => parseUserAgent,
|
|
9947
|
+
parseVaryHeader: () => parseVaryHeader,
|
|
9946
9948
|
searchHeaders: () => searchHeaders,
|
|
9947
9949
|
searchStatusCodes: () => searchStatusCodes,
|
|
9948
9950
|
statusCodeToText: () => statusCodeToText,
|
|
@@ -12230,6 +12232,44 @@ function parseContentRangeHeader(header) {
|
|
|
12230
12232
|
}
|
|
12231
12233
|
return { unit, start, end, total, isUnsatisfiable, isTotalUnknown, byteLength: end - start + 1 };
|
|
12232
12234
|
}
|
|
12235
|
+
var VARY_HEADER_NOTES = {
|
|
12236
|
+
"accept-encoding": "Caches must store a separate response per compression scheme (gzip, br, etc.) the client accepts.",
|
|
12237
|
+
"accept-language": "Caches must store a separate response per requested language, which can fragment a shared cache badly if Accept-Language values are highly varied.",
|
|
12238
|
+
"accept": "Caches must store a separate response per requested content type (e.g. JSON vs HTML).",
|
|
12239
|
+
"user-agent": "Caches must store a separate response per distinct User-Agent string, which is often unique enough to make caching nearly ineffective.",
|
|
12240
|
+
"authorization": "Signals the response is user-specific; most shared caches will refuse to cache it at all rather than key on this header.",
|
|
12241
|
+
"cookie": "Same effect as Authorization: shared caches typically treat the response as private and skip caching rather than key on cookie values.",
|
|
12242
|
+
"origin": "Caches must store a separate response per requesting Origin, needed whenever a response includes CORS headers that differ by origin.",
|
|
12243
|
+
"x-requested-with": "Caches must store a separate response depending on whether the request was made via an XHR/fetch client hint.",
|
|
12244
|
+
"x-forwarded-proto": "Caches must store a separate response for HTTP vs HTTPS requests, relevant behind a proxy or load balancer that terminates TLS."
|
|
12245
|
+
};
|
|
12246
|
+
function buildVaryHeader(headers) {
|
|
12247
|
+
if (!Array.isArray(headers) || headers.length === 0) return { error: "At least one header is required" };
|
|
12248
|
+
const trimmed = headers.map((h) => typeof h === "string" ? h.trim() : "").filter((h) => h.length > 0);
|
|
12249
|
+
if (trimmed.length === 0) return { error: "At least one header is required" };
|
|
12250
|
+
const warnings = [];
|
|
12251
|
+
if (trimmed.some((h) => h === "*") && trimmed.length > 1) {
|
|
12252
|
+
warnings.push('"*" makes every request effectively uncacheable; combining it with other header names is redundant, most caches will just skip caching entirely');
|
|
12253
|
+
}
|
|
12254
|
+
const seen = /* @__PURE__ */ new Map();
|
|
12255
|
+
for (const h of trimmed) {
|
|
12256
|
+
const key = h.toLowerCase();
|
|
12257
|
+
if (!seen.has(key)) seen.set(key, h);
|
|
12258
|
+
}
|
|
12259
|
+
if (seen.size < trimmed.length) warnings.push("duplicate header names were removed");
|
|
12260
|
+
const entries = Array.from(seen.values()).map((h) => ({
|
|
12261
|
+
header: h,
|
|
12262
|
+
note: h === "*" ? "Every response is considered unique; most caches will not store it at all." : VARY_HEADER_NOTES[h.toLowerCase()] ?? `Caches must store a separate response per distinct ${h} value.`
|
|
12263
|
+
}));
|
|
12264
|
+
const headerValue = entries.map((e) => e.header).join(", ");
|
|
12265
|
+
return { header: `Vary: ${headerValue}`, headerValue, entries, warnings };
|
|
12266
|
+
}
|
|
12267
|
+
function parseVaryHeader(raw) {
|
|
12268
|
+
if (!raw || raw.trim() === "") return { error: "Input is empty" };
|
|
12269
|
+
const withoutLabel = raw.trim().replace(/^vary:\s*/i, "");
|
|
12270
|
+
const headers = withoutLabel.split(",").map((h) => h.trim()).filter((h) => h.length > 0);
|
|
12271
|
+
return buildVaryHeader(headers);
|
|
12272
|
+
}
|
|
12233
12273
|
|
|
12234
12274
|
// src/tools/api.ts
|
|
12235
12275
|
var api_exports = {};
|
package/dist/index.d.cts
CHANGED
|
@@ -6,7 +6,7 @@ export { d as data } from './data-BKpEOcOX.cjs';
|
|
|
6
6
|
export { g as generators } from './generators-Du8cBesn.cjs';
|
|
7
7
|
export { t as time } from './time-KqJjdqII.cjs';
|
|
8
8
|
export { u as units } from './units-CzPwRC03.cjs';
|
|
9
|
-
export { n as network } from './network-
|
|
9
|
+
export { n as network } from './network-oAs83Ztn.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
|
@@ -6,7 +6,7 @@ export { d as data } from './data-BKpEOcOX.js';
|
|
|
6
6
|
export { g as generators } from './generators-Du8cBesn.js';
|
|
7
7
|
export { t as time } from './time-KqJjdqII.js';
|
|
8
8
|
export { u as units } from './units-CzPwRC03.js';
|
|
9
|
-
export { n as network } from './network-
|
|
9
|
+
export { n as network } from './network-oAs83Ztn.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
2
|
export { units_exports as units } from './chunk-2MTHD2LG.js';
|
|
3
|
-
export { network_exports as network } from './chunk-
|
|
3
|
+
export { network_exports as network } from './chunk-UD45LBG7.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';
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
* - same-site-cookie-checker: checkSetCookieHeader
|
|
19
19
|
* - email-header-analyzer: analyzeEmailHeaders
|
|
20
20
|
* - http-range-header-builder: buildRangeHeader, parseContentRangeHeader
|
|
21
|
+
* - vary-header-builder: buildVaryHeader, parseVaryHeader
|
|
21
22
|
*/
|
|
22
23
|
declare const DNS_RECORD_TYPES: readonly ["A", "AAAA", "CNAME", "MX", "TXT", "NS", "SOA", "PTR", "SRV", "CAA"];
|
|
23
24
|
type DnsRecordType = typeof DNS_RECORD_TYPES[number];
|
|
@@ -498,6 +499,32 @@ interface ContentRangeResult {
|
|
|
498
499
|
declare function parseContentRangeHeader(header: string): ContentRangeResult | {
|
|
499
500
|
error: string;
|
|
500
501
|
};
|
|
502
|
+
interface VaryHeaderEntry {
|
|
503
|
+
header: string;
|
|
504
|
+
note: string;
|
|
505
|
+
}
|
|
506
|
+
interface VaryHeaderResult {
|
|
507
|
+
header: string;
|
|
508
|
+
headerValue: string;
|
|
509
|
+
entries: VaryHeaderEntry[];
|
|
510
|
+
warnings: string[];
|
|
511
|
+
}
|
|
512
|
+
/**
|
|
513
|
+
* Build a `Vary` response-header value from a list of request-header names,
|
|
514
|
+
* de-duplicating case-insensitively and attaching a plain-English caching
|
|
515
|
+
* note for each well-known header (Accept-Encoding, Authorization, etc.).
|
|
516
|
+
*/
|
|
517
|
+
declare function buildVaryHeader(headers: string[]): VaryHeaderResult | {
|
|
518
|
+
error: string;
|
|
519
|
+
};
|
|
520
|
+
/**
|
|
521
|
+
* Parse an existing `Vary` header value (with or without a leading `Vary:`
|
|
522
|
+
* label) into the same shape `buildVaryHeader` returns, for explaining a
|
|
523
|
+
* header you found on a real response rather than building one from scratch.
|
|
524
|
+
*/
|
|
525
|
+
declare function parseVaryHeader(raw: string): VaryHeaderResult | {
|
|
526
|
+
error: string;
|
|
527
|
+
};
|
|
501
528
|
|
|
502
529
|
type network_AuthResultEntry = AuthResultEntry;
|
|
503
530
|
type network_BuildRangeHeaderOptions = BuildRangeHeaderOptions;
|
|
@@ -550,6 +577,8 @@ type network_SitemapValidationResult = SitemapValidationResult;
|
|
|
550
577
|
type network_StatusCode = StatusCode;
|
|
551
578
|
type network_UaDeviceType = UaDeviceType;
|
|
552
579
|
type network_UserAgentInfo = UserAgentInfo;
|
|
580
|
+
type network_VaryHeaderEntry = VaryHeaderEntry;
|
|
581
|
+
type network_VaryHeaderResult = VaryHeaderResult;
|
|
553
582
|
declare const network_analyzeEmailHeaders: typeof analyzeEmailHeaders;
|
|
554
583
|
declare const network_buildCacheControl: typeof buildCacheControl;
|
|
555
584
|
declare const network_buildDnsQueryUrl: typeof buildDnsQueryUrl;
|
|
@@ -558,6 +587,7 @@ declare const network_buildLinkHeader: typeof buildLinkHeader;
|
|
|
558
587
|
declare const network_buildMapUrl: typeof buildMapUrl;
|
|
559
588
|
declare const network_buildRangeHeader: typeof buildRangeHeader;
|
|
560
589
|
declare const network_buildReferrerPolicy: typeof buildReferrerPolicy;
|
|
590
|
+
declare const network_buildVaryHeader: typeof buildVaryHeader;
|
|
561
591
|
declare const network_checkSetCookieHeader: typeof checkSetCookieHeader;
|
|
562
592
|
declare const network_countryCodeToFlag: typeof countryCodeToFlag;
|
|
563
593
|
declare const network_formatCoordinates: typeof formatCoordinates;
|
|
@@ -579,6 +609,7 @@ declare const network_parseGeoResponse: typeof parseGeoResponse;
|
|
|
579
609
|
declare const network_parseHar: typeof parseHar;
|
|
580
610
|
declare const network_parseIpv6Address: typeof parseIpv6Address;
|
|
581
611
|
declare const network_parseUserAgent: typeof parseUserAgent;
|
|
612
|
+
declare const network_parseVaryHeader: typeof parseVaryHeader;
|
|
582
613
|
declare const network_searchHeaders: typeof searchHeaders;
|
|
583
614
|
declare const network_searchStatusCodes: typeof searchStatusCodes;
|
|
584
615
|
declare const network_statusCodeToText: typeof statusCodeToText;
|
|
@@ -589,7 +620,7 @@ declare const network_validateHeaderValue: typeof validateHeaderValue;
|
|
|
589
620
|
declare const network_validateRobotsTxt: typeof validateRobotsTxt;
|
|
590
621
|
declare const network_validateSitemap: typeof validateSitemap;
|
|
591
622
|
declare namespace network {
|
|
592
|
-
export { type network_AuthResultEntry as AuthResultEntry, type network_BuildRangeHeaderOptions as BuildRangeHeaderOptions, type network_CacheControlDirective as CacheControlDirective, type network_CacheControlOptions as CacheControlOptions, type network_CacheControlResult as CacheControlResult, type network_ContentRangeResult as ContentRangeResult, 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_RangeEntry as RangeEntry, type network_RangeEntryInput as RangeEntryInput, type network_RangeHeaderResult as RangeHeaderResult, 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_buildRangeHeader as buildRangeHeader, 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_parseContentRangeHeader as parseContentRangeHeader, 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 };
|
|
623
|
+
export { type network_AuthResultEntry as AuthResultEntry, type network_BuildRangeHeaderOptions as BuildRangeHeaderOptions, type network_CacheControlDirective as CacheControlDirective, type network_CacheControlOptions as CacheControlOptions, type network_CacheControlResult as CacheControlResult, type network_ContentRangeResult as ContentRangeResult, 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_RangeEntry as RangeEntry, type network_RangeEntryInput as RangeEntryInput, type network_RangeHeaderResult as RangeHeaderResult, 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, type network_VaryHeaderEntry as VaryHeaderEntry, type network_VaryHeaderResult as VaryHeaderResult, 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_buildRangeHeader as buildRangeHeader, network_buildReferrerPolicy as buildReferrerPolicy, network_buildVaryHeader as buildVaryHeader, 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_parseContentRangeHeader as parseContentRangeHeader, network_parseDnsResponse as parseDnsResponse, network_parseGeoResponse as parseGeoResponse, network_parseHar as parseHar, network_parseIpv6Address as parseIpv6Address, network_parseUserAgent as parseUserAgent, network_parseVaryHeader as parseVaryHeader, 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 };
|
|
593
624
|
}
|
|
594
625
|
|
|
595
|
-
export {
|
|
626
|
+
export { type VaryHeaderResult as $, type AuthResultEntry as A, type BuildRangeHeaderOptions as B, type CacheControlDirective as C, DNS_RECORD_TYPES as D, type EmailHeaderAnalysis as E, type ReferrerPolicyResult as F, type GeoResult as G, HTTP_HEADERS as H, type Ipv6AddressType as I, type ReferrerPolicyValue as J, type RobotsGroup as K, LINK_REL_VALUES as L, type RobotsIssue as M, type RobotsRule as N, type RobotsValidationResult as O, type ParsedDnsResult as P, type SameSiteValue as Q, REFERRER_POLICY_VALUES as R, STATUS_CODES as S, type SitemapIndexEntry as T, type SitemapIssue as U, type SitemapUrlEntry as V, type SitemapValidationResult as W, type StatusCode as X, type UaDeviceType as Y, type UserAgentInfo as Z, type VaryHeaderEntry as _, type CacheControlOptions as a, analyzeEmailHeaders as a0, buildCacheControl as a1, buildDnsQueryUrl as a2, buildGeoUrl as a3, buildLinkHeader as a4, buildMapUrl as a5, buildRangeHeader as a6, buildReferrerPolicy as a7, buildVaryHeader as a8, checkSetCookieHeader as a9, validateHeaderName as aA, validateHeaderValue as aB, validateRobotsTxt as aC, validateSitemap as aD, countryCodeToFlag as aa, formatCoordinates as ab, formatTtl as ac, getByCategory as ad, getHeader as ae, getHeadersByCategory as af, getStatusByCategory as ag, getStatusCode as ah, isClientError as ai, isServerError as aj, isSuccess as ak, isValidIp as al, isValidIpv4 as am, isValidIpv6 as an, parseContentRangeHeader as ao, parseDnsResponse as ap, parseGeoResponse as aq, parseHar as ar, parseIpv6Address as as, parseUserAgent as at, parseVaryHeader as au, searchHeaders as av, searchStatusCodes as aw, statusCodeToText as ax, typeNumberToLabel as ay, validateDomain as az, type CacheControlResult as b, type ContentRangeResult as c, type CookieAttributes as d, type CookieCheckResult as e, type DnsRecord as f, type DnsRecordType as g, type DnsResponse as h, type EmailHeaderField as i, type HarEntry as j, type HarParseResult as k, type HarSummary as l, type HeaderCategory as m, network as n, type HttpHeader as o, type Ipv6ParseResult as p, type LinkHeaderEntry as q, type LinkHeaderEntryInput as r, type LinkHeaderResult as s, type LinkRel as t, type ParsedGeoResult as u, type RangeEntry as v, type RangeEntryInput as w, type RangeHeaderResult as x, type ReceivedHop as y, type ReferrerPolicyEntry as z };
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
* - same-site-cookie-checker: checkSetCookieHeader
|
|
19
19
|
* - email-header-analyzer: analyzeEmailHeaders
|
|
20
20
|
* - http-range-header-builder: buildRangeHeader, parseContentRangeHeader
|
|
21
|
+
* - vary-header-builder: buildVaryHeader, parseVaryHeader
|
|
21
22
|
*/
|
|
22
23
|
declare const DNS_RECORD_TYPES: readonly ["A", "AAAA", "CNAME", "MX", "TXT", "NS", "SOA", "PTR", "SRV", "CAA"];
|
|
23
24
|
type DnsRecordType = typeof DNS_RECORD_TYPES[number];
|
|
@@ -498,6 +499,32 @@ interface ContentRangeResult {
|
|
|
498
499
|
declare function parseContentRangeHeader(header: string): ContentRangeResult | {
|
|
499
500
|
error: string;
|
|
500
501
|
};
|
|
502
|
+
interface VaryHeaderEntry {
|
|
503
|
+
header: string;
|
|
504
|
+
note: string;
|
|
505
|
+
}
|
|
506
|
+
interface VaryHeaderResult {
|
|
507
|
+
header: string;
|
|
508
|
+
headerValue: string;
|
|
509
|
+
entries: VaryHeaderEntry[];
|
|
510
|
+
warnings: string[];
|
|
511
|
+
}
|
|
512
|
+
/**
|
|
513
|
+
* Build a `Vary` response-header value from a list of request-header names,
|
|
514
|
+
* de-duplicating case-insensitively and attaching a plain-English caching
|
|
515
|
+
* note for each well-known header (Accept-Encoding, Authorization, etc.).
|
|
516
|
+
*/
|
|
517
|
+
declare function buildVaryHeader(headers: string[]): VaryHeaderResult | {
|
|
518
|
+
error: string;
|
|
519
|
+
};
|
|
520
|
+
/**
|
|
521
|
+
* Parse an existing `Vary` header value (with or without a leading `Vary:`
|
|
522
|
+
* label) into the same shape `buildVaryHeader` returns, for explaining a
|
|
523
|
+
* header you found on a real response rather than building one from scratch.
|
|
524
|
+
*/
|
|
525
|
+
declare function parseVaryHeader(raw: string): VaryHeaderResult | {
|
|
526
|
+
error: string;
|
|
527
|
+
};
|
|
501
528
|
|
|
502
529
|
type network_AuthResultEntry = AuthResultEntry;
|
|
503
530
|
type network_BuildRangeHeaderOptions = BuildRangeHeaderOptions;
|
|
@@ -550,6 +577,8 @@ type network_SitemapValidationResult = SitemapValidationResult;
|
|
|
550
577
|
type network_StatusCode = StatusCode;
|
|
551
578
|
type network_UaDeviceType = UaDeviceType;
|
|
552
579
|
type network_UserAgentInfo = UserAgentInfo;
|
|
580
|
+
type network_VaryHeaderEntry = VaryHeaderEntry;
|
|
581
|
+
type network_VaryHeaderResult = VaryHeaderResult;
|
|
553
582
|
declare const network_analyzeEmailHeaders: typeof analyzeEmailHeaders;
|
|
554
583
|
declare const network_buildCacheControl: typeof buildCacheControl;
|
|
555
584
|
declare const network_buildDnsQueryUrl: typeof buildDnsQueryUrl;
|
|
@@ -558,6 +587,7 @@ declare const network_buildLinkHeader: typeof buildLinkHeader;
|
|
|
558
587
|
declare const network_buildMapUrl: typeof buildMapUrl;
|
|
559
588
|
declare const network_buildRangeHeader: typeof buildRangeHeader;
|
|
560
589
|
declare const network_buildReferrerPolicy: typeof buildReferrerPolicy;
|
|
590
|
+
declare const network_buildVaryHeader: typeof buildVaryHeader;
|
|
561
591
|
declare const network_checkSetCookieHeader: typeof checkSetCookieHeader;
|
|
562
592
|
declare const network_countryCodeToFlag: typeof countryCodeToFlag;
|
|
563
593
|
declare const network_formatCoordinates: typeof formatCoordinates;
|
|
@@ -579,6 +609,7 @@ declare const network_parseGeoResponse: typeof parseGeoResponse;
|
|
|
579
609
|
declare const network_parseHar: typeof parseHar;
|
|
580
610
|
declare const network_parseIpv6Address: typeof parseIpv6Address;
|
|
581
611
|
declare const network_parseUserAgent: typeof parseUserAgent;
|
|
612
|
+
declare const network_parseVaryHeader: typeof parseVaryHeader;
|
|
582
613
|
declare const network_searchHeaders: typeof searchHeaders;
|
|
583
614
|
declare const network_searchStatusCodes: typeof searchStatusCodes;
|
|
584
615
|
declare const network_statusCodeToText: typeof statusCodeToText;
|
|
@@ -589,7 +620,7 @@ declare const network_validateHeaderValue: typeof validateHeaderValue;
|
|
|
589
620
|
declare const network_validateRobotsTxt: typeof validateRobotsTxt;
|
|
590
621
|
declare const network_validateSitemap: typeof validateSitemap;
|
|
591
622
|
declare namespace network {
|
|
592
|
-
export { type network_AuthResultEntry as AuthResultEntry, type network_BuildRangeHeaderOptions as BuildRangeHeaderOptions, type network_CacheControlDirective as CacheControlDirective, type network_CacheControlOptions as CacheControlOptions, type network_CacheControlResult as CacheControlResult, type network_ContentRangeResult as ContentRangeResult, 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_RangeEntry as RangeEntry, type network_RangeEntryInput as RangeEntryInput, type network_RangeHeaderResult as RangeHeaderResult, 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_buildRangeHeader as buildRangeHeader, 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_parseContentRangeHeader as parseContentRangeHeader, 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 };
|
|
623
|
+
export { type network_AuthResultEntry as AuthResultEntry, type network_BuildRangeHeaderOptions as BuildRangeHeaderOptions, type network_CacheControlDirective as CacheControlDirective, type network_CacheControlOptions as CacheControlOptions, type network_CacheControlResult as CacheControlResult, type network_ContentRangeResult as ContentRangeResult, 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_RangeEntry as RangeEntry, type network_RangeEntryInput as RangeEntryInput, type network_RangeHeaderResult as RangeHeaderResult, 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, type network_VaryHeaderEntry as VaryHeaderEntry, type network_VaryHeaderResult as VaryHeaderResult, 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_buildRangeHeader as buildRangeHeader, network_buildReferrerPolicy as buildReferrerPolicy, network_buildVaryHeader as buildVaryHeader, 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_parseContentRangeHeader as parseContentRangeHeader, network_parseDnsResponse as parseDnsResponse, network_parseGeoResponse as parseGeoResponse, network_parseHar as parseHar, network_parseIpv6Address as parseIpv6Address, network_parseUserAgent as parseUserAgent, network_parseVaryHeader as parseVaryHeader, 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 };
|
|
593
624
|
}
|
|
594
625
|
|
|
595
|
-
export {
|
|
626
|
+
export { type VaryHeaderResult as $, type AuthResultEntry as A, type BuildRangeHeaderOptions as B, type CacheControlDirective as C, DNS_RECORD_TYPES as D, type EmailHeaderAnalysis as E, type ReferrerPolicyResult as F, type GeoResult as G, HTTP_HEADERS as H, type Ipv6AddressType as I, type ReferrerPolicyValue as J, type RobotsGroup as K, LINK_REL_VALUES as L, type RobotsIssue as M, type RobotsRule as N, type RobotsValidationResult as O, type ParsedDnsResult as P, type SameSiteValue as Q, REFERRER_POLICY_VALUES as R, STATUS_CODES as S, type SitemapIndexEntry as T, type SitemapIssue as U, type SitemapUrlEntry as V, type SitemapValidationResult as W, type StatusCode as X, type UaDeviceType as Y, type UserAgentInfo as Z, type VaryHeaderEntry as _, type CacheControlOptions as a, analyzeEmailHeaders as a0, buildCacheControl as a1, buildDnsQueryUrl as a2, buildGeoUrl as a3, buildLinkHeader as a4, buildMapUrl as a5, buildRangeHeader as a6, buildReferrerPolicy as a7, buildVaryHeader as a8, checkSetCookieHeader as a9, validateHeaderName as aA, validateHeaderValue as aB, validateRobotsTxt as aC, validateSitemap as aD, countryCodeToFlag as aa, formatCoordinates as ab, formatTtl as ac, getByCategory as ad, getHeader as ae, getHeadersByCategory as af, getStatusByCategory as ag, getStatusCode as ah, isClientError as ai, isServerError as aj, isSuccess as ak, isValidIp as al, isValidIpv4 as am, isValidIpv6 as an, parseContentRangeHeader as ao, parseDnsResponse as ap, parseGeoResponse as aq, parseHar as ar, parseIpv6Address as as, parseUserAgent as at, parseVaryHeader as au, searchHeaders as av, searchStatusCodes as aw, statusCodeToText as ax, typeNumberToLabel as ay, validateDomain as az, type CacheControlResult as b, type ContentRangeResult as c, type CookieAttributes as d, type CookieCheckResult as e, type DnsRecord as f, type DnsRecordType as g, type DnsResponse as h, type EmailHeaderField as i, type HarEntry as j, type HarParseResult as k, type HarSummary as l, type HeaderCategory as m, network as n, type HttpHeader as o, type Ipv6ParseResult as p, type LinkHeaderEntry as q, type LinkHeaderEntryInput as r, type LinkHeaderResult as s, type LinkRel as t, type ParsedGeoResult as u, type RangeEntry as v, type RangeEntryInput as w, type RangeHeaderResult as x, type ReceivedHop as y, type ReferrerPolicyEntry as z };
|
package/dist/tools/network.cjs
CHANGED
|
@@ -2278,6 +2278,44 @@ function parseContentRangeHeader(header) {
|
|
|
2278
2278
|
}
|
|
2279
2279
|
return { unit, start, end, total, isUnsatisfiable, isTotalUnknown, byteLength: end - start + 1 };
|
|
2280
2280
|
}
|
|
2281
|
+
var VARY_HEADER_NOTES = {
|
|
2282
|
+
"accept-encoding": "Caches must store a separate response per compression scheme (gzip, br, etc.) the client accepts.",
|
|
2283
|
+
"accept-language": "Caches must store a separate response per requested language, which can fragment a shared cache badly if Accept-Language values are highly varied.",
|
|
2284
|
+
"accept": "Caches must store a separate response per requested content type (e.g. JSON vs HTML).",
|
|
2285
|
+
"user-agent": "Caches must store a separate response per distinct User-Agent string, which is often unique enough to make caching nearly ineffective.",
|
|
2286
|
+
"authorization": "Signals the response is user-specific; most shared caches will refuse to cache it at all rather than key on this header.",
|
|
2287
|
+
"cookie": "Same effect as Authorization: shared caches typically treat the response as private and skip caching rather than key on cookie values.",
|
|
2288
|
+
"origin": "Caches must store a separate response per requesting Origin, needed whenever a response includes CORS headers that differ by origin.",
|
|
2289
|
+
"x-requested-with": "Caches must store a separate response depending on whether the request was made via an XHR/fetch client hint.",
|
|
2290
|
+
"x-forwarded-proto": "Caches must store a separate response for HTTP vs HTTPS requests, relevant behind a proxy or load balancer that terminates TLS."
|
|
2291
|
+
};
|
|
2292
|
+
function buildVaryHeader(headers) {
|
|
2293
|
+
if (!Array.isArray(headers) || headers.length === 0) return { error: "At least one header is required" };
|
|
2294
|
+
const trimmed = headers.map((h) => typeof h === "string" ? h.trim() : "").filter((h) => h.length > 0);
|
|
2295
|
+
if (trimmed.length === 0) return { error: "At least one header is required" };
|
|
2296
|
+
const warnings = [];
|
|
2297
|
+
if (trimmed.some((h) => h === "*") && trimmed.length > 1) {
|
|
2298
|
+
warnings.push('"*" makes every request effectively uncacheable; combining it with other header names is redundant, most caches will just skip caching entirely');
|
|
2299
|
+
}
|
|
2300
|
+
const seen = /* @__PURE__ */ new Map();
|
|
2301
|
+
for (const h of trimmed) {
|
|
2302
|
+
const key = h.toLowerCase();
|
|
2303
|
+
if (!seen.has(key)) seen.set(key, h);
|
|
2304
|
+
}
|
|
2305
|
+
if (seen.size < trimmed.length) warnings.push("duplicate header names were removed");
|
|
2306
|
+
const entries = Array.from(seen.values()).map((h) => ({
|
|
2307
|
+
header: h,
|
|
2308
|
+
note: h === "*" ? "Every response is considered unique; most caches will not store it at all." : VARY_HEADER_NOTES[h.toLowerCase()] ?? `Caches must store a separate response per distinct ${h} value.`
|
|
2309
|
+
}));
|
|
2310
|
+
const headerValue = entries.map((e) => e.header).join(", ");
|
|
2311
|
+
return { header: `Vary: ${headerValue}`, headerValue, entries, warnings };
|
|
2312
|
+
}
|
|
2313
|
+
function parseVaryHeader(raw) {
|
|
2314
|
+
if (!raw || raw.trim() === "") return { error: "Input is empty" };
|
|
2315
|
+
const withoutLabel = raw.trim().replace(/^vary:\s*/i, "");
|
|
2316
|
+
const headers = withoutLabel.split(",").map((h) => h.trim()).filter((h) => h.length > 0);
|
|
2317
|
+
return buildVaryHeader(headers);
|
|
2318
|
+
}
|
|
2281
2319
|
|
|
2282
2320
|
exports.DNS_RECORD_TYPES = DNS_RECORD_TYPES;
|
|
2283
2321
|
exports.HTTP_HEADERS = HTTP_HEADERS;
|
|
@@ -2292,6 +2330,7 @@ exports.buildLinkHeader = buildLinkHeader;
|
|
|
2292
2330
|
exports.buildMapUrl = buildMapUrl;
|
|
2293
2331
|
exports.buildRangeHeader = buildRangeHeader;
|
|
2294
2332
|
exports.buildReferrerPolicy = buildReferrerPolicy;
|
|
2333
|
+
exports.buildVaryHeader = buildVaryHeader;
|
|
2295
2334
|
exports.checkSetCookieHeader = checkSetCookieHeader;
|
|
2296
2335
|
exports.countryCodeToFlag = countryCodeToFlag;
|
|
2297
2336
|
exports.formatCoordinates = formatCoordinates;
|
|
@@ -2313,6 +2352,7 @@ exports.parseGeoResponse = parseGeoResponse;
|
|
|
2313
2352
|
exports.parseHar = parseHar;
|
|
2314
2353
|
exports.parseIpv6Address = parseIpv6Address;
|
|
2315
2354
|
exports.parseUserAgent = parseUserAgent;
|
|
2355
|
+
exports.parseVaryHeader = parseVaryHeader;
|
|
2316
2356
|
exports.searchHeaders = searchHeaders;
|
|
2317
2357
|
exports.searchStatusCodes = searchStatusCodes;
|
|
2318
2358
|
exports.statusCodeToText = statusCodeToText;
|
package/dist/tools/network.d.cts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { A as AuthResultEntry, B as BuildRangeHeaderOptions, C as CacheControlDirective, a as CacheControlOptions, b as CacheControlResult, c as ContentRangeResult, d as CookieAttributes, e as CookieCheckResult, D as DNS_RECORD_TYPES, f as DnsRecord, g as DnsRecordType, h as DnsResponse, E as EmailHeaderAnalysis, i as EmailHeaderField, G as GeoResult, H as HTTP_HEADERS, j as HarEntry, k as HarParseResult, l as HarSummary, m as HeaderCategory, o as HttpHeader, I as Ipv6AddressType, p as Ipv6ParseResult, L as LINK_REL_VALUES, q as LinkHeaderEntry, r as LinkHeaderEntryInput, s as LinkHeaderResult, t as LinkRel, P as ParsedDnsResult, u as ParsedGeoResult, R as REFERRER_POLICY_VALUES, v as RangeEntry, w as RangeEntryInput, x as RangeHeaderResult, y as ReceivedHop, z as ReferrerPolicyEntry, F as ReferrerPolicyResult, J as ReferrerPolicyValue, K as RobotsGroup, M as RobotsIssue, N as RobotsRule, O as RobotsValidationResult, S as STATUS_CODES, Q as SameSiteValue, T as SitemapIndexEntry, U as SitemapIssue, V as SitemapUrlEntry, W as SitemapValidationResult, X as StatusCode, Y as UaDeviceType, Z as UserAgentInfo, _ as
|
|
1
|
+
export { A as AuthResultEntry, B as BuildRangeHeaderOptions, C as CacheControlDirective, a as CacheControlOptions, b as CacheControlResult, c as ContentRangeResult, d as CookieAttributes, e as CookieCheckResult, D as DNS_RECORD_TYPES, f as DnsRecord, g as DnsRecordType, h as DnsResponse, E as EmailHeaderAnalysis, i as EmailHeaderField, G as GeoResult, H as HTTP_HEADERS, j as HarEntry, k as HarParseResult, l as HarSummary, m as HeaderCategory, o as HttpHeader, I as Ipv6AddressType, p as Ipv6ParseResult, L as LINK_REL_VALUES, q as LinkHeaderEntry, r as LinkHeaderEntryInput, s as LinkHeaderResult, t as LinkRel, P as ParsedDnsResult, u as ParsedGeoResult, R as REFERRER_POLICY_VALUES, v as RangeEntry, w as RangeEntryInput, x as RangeHeaderResult, y as ReceivedHop, z as ReferrerPolicyEntry, F as ReferrerPolicyResult, J as ReferrerPolicyValue, K as RobotsGroup, M as RobotsIssue, N as RobotsRule, O as RobotsValidationResult, S as STATUS_CODES, Q as SameSiteValue, T as SitemapIndexEntry, U as SitemapIssue, V as SitemapUrlEntry, W as SitemapValidationResult, X as StatusCode, Y as UaDeviceType, Z as UserAgentInfo, _ as VaryHeaderEntry, $ as VaryHeaderResult, a0 as analyzeEmailHeaders, a1 as buildCacheControl, a2 as buildDnsQueryUrl, a3 as buildGeoUrl, a4 as buildLinkHeader, a5 as buildMapUrl, a6 as buildRangeHeader, a7 as buildReferrerPolicy, a8 as buildVaryHeader, a9 as checkSetCookieHeader, aa as countryCodeToFlag, ab as formatCoordinates, ac as formatTtl, ad as getByCategory, ae as getHeader, af as getHeadersByCategory, ag as getStatusByCategory, ah as getStatusCode, ai as isClientError, aj as isServerError, ak as isSuccess, al as isValidIp, am as isValidIpv4, an as isValidIpv6, ao as parseContentRangeHeader, ap as parseDnsResponse, aq as parseGeoResponse, ar as parseHar, as as parseIpv6Address, at as parseUserAgent, au as parseVaryHeader, av as searchHeaders, aw as searchStatusCodes, ax as statusCodeToText, ay as typeNumberToLabel, az as validateDomain, aA as validateHeaderName, aB as validateHeaderValue, aC as validateRobotsTxt, aD as validateSitemap } from '../network-oAs83Ztn.cjs';
|
package/dist/tools/network.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { A as AuthResultEntry, B as BuildRangeHeaderOptions, C as CacheControlDirective, a as CacheControlOptions, b as CacheControlResult, c as ContentRangeResult, d as CookieAttributes, e as CookieCheckResult, D as DNS_RECORD_TYPES, f as DnsRecord, g as DnsRecordType, h as DnsResponse, E as EmailHeaderAnalysis, i as EmailHeaderField, G as GeoResult, H as HTTP_HEADERS, j as HarEntry, k as HarParseResult, l as HarSummary, m as HeaderCategory, o as HttpHeader, I as Ipv6AddressType, p as Ipv6ParseResult, L as LINK_REL_VALUES, q as LinkHeaderEntry, r as LinkHeaderEntryInput, s as LinkHeaderResult, t as LinkRel, P as ParsedDnsResult, u as ParsedGeoResult, R as REFERRER_POLICY_VALUES, v as RangeEntry, w as RangeEntryInput, x as RangeHeaderResult, y as ReceivedHop, z as ReferrerPolicyEntry, F as ReferrerPolicyResult, J as ReferrerPolicyValue, K as RobotsGroup, M as RobotsIssue, N as RobotsRule, O as RobotsValidationResult, S as STATUS_CODES, Q as SameSiteValue, T as SitemapIndexEntry, U as SitemapIssue, V as SitemapUrlEntry, W as SitemapValidationResult, X as StatusCode, Y as UaDeviceType, Z as UserAgentInfo, _ as
|
|
1
|
+
export { A as AuthResultEntry, B as BuildRangeHeaderOptions, C as CacheControlDirective, a as CacheControlOptions, b as CacheControlResult, c as ContentRangeResult, d as CookieAttributes, e as CookieCheckResult, D as DNS_RECORD_TYPES, f as DnsRecord, g as DnsRecordType, h as DnsResponse, E as EmailHeaderAnalysis, i as EmailHeaderField, G as GeoResult, H as HTTP_HEADERS, j as HarEntry, k as HarParseResult, l as HarSummary, m as HeaderCategory, o as HttpHeader, I as Ipv6AddressType, p as Ipv6ParseResult, L as LINK_REL_VALUES, q as LinkHeaderEntry, r as LinkHeaderEntryInput, s as LinkHeaderResult, t as LinkRel, P as ParsedDnsResult, u as ParsedGeoResult, R as REFERRER_POLICY_VALUES, v as RangeEntry, w as RangeEntryInput, x as RangeHeaderResult, y as ReceivedHop, z as ReferrerPolicyEntry, F as ReferrerPolicyResult, J as ReferrerPolicyValue, K as RobotsGroup, M as RobotsIssue, N as RobotsRule, O as RobotsValidationResult, S as STATUS_CODES, Q as SameSiteValue, T as SitemapIndexEntry, U as SitemapIssue, V as SitemapUrlEntry, W as SitemapValidationResult, X as StatusCode, Y as UaDeviceType, Z as UserAgentInfo, _ as VaryHeaderEntry, $ as VaryHeaderResult, a0 as analyzeEmailHeaders, a1 as buildCacheControl, a2 as buildDnsQueryUrl, a3 as buildGeoUrl, a4 as buildLinkHeader, a5 as buildMapUrl, a6 as buildRangeHeader, a7 as buildReferrerPolicy, a8 as buildVaryHeader, a9 as checkSetCookieHeader, aa as countryCodeToFlag, ab as formatCoordinates, ac as formatTtl, ad as getByCategory, ae as getHeader, af as getHeadersByCategory, ag as getStatusByCategory, ah as getStatusCode, ai as isClientError, aj as isServerError, ak as isSuccess, al as isValidIp, am as isValidIpv4, an as isValidIpv6, ao as parseContentRangeHeader, ap as parseDnsResponse, aq as parseGeoResponse, ar as parseHar, as as parseIpv6Address, at as parseUserAgent, au as parseVaryHeader, av as searchHeaders, aw as searchStatusCodes, ax as statusCodeToText, ay as typeNumberToLabel, az as validateDomain, aA as validateHeaderName, aB as validateHeaderValue, aC as validateRobotsTxt, aD as validateSitemap } from '../network-oAs83Ztn.js';
|
package/dist/tools/network.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { DNS_RECORD_TYPES, HTTP_HEADERS, LINK_REL_VALUES, REFERRER_POLICY_VALUES, STATUS_CODES, analyzeEmailHeaders, buildCacheControl, buildDnsQueryUrl, buildGeoUrl, buildLinkHeader, buildMapUrl, buildRangeHeader, buildReferrerPolicy, checkSetCookieHeader, countryCodeToFlag, formatCoordinates, formatTtl, getByCategory, getHeader, getHeadersByCategory, getStatusByCategory, getStatusCode, isClientError, isServerError, isSuccess, isValidIp, isValidIpv4, isValidIpv6, parseContentRangeHeader, 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, analyzeEmailHeaders, buildCacheControl, buildDnsQueryUrl, buildGeoUrl, buildLinkHeader, buildMapUrl, buildRangeHeader, buildReferrerPolicy, buildVaryHeader, checkSetCookieHeader, countryCodeToFlag, formatCoordinates, formatTtl, getByCategory, getHeader, getHeadersByCategory, getStatusByCategory, getStatusCode, isClientError, isServerError, isSuccess, isValidIp, isValidIpv4, isValidIpv6, parseContentRangeHeader, parseDnsResponse, parseGeoResponse, parseHar, parseIpv6Address, parseUserAgent, parseVaryHeader, searchHeaders, searchStatusCodes, statusCodeToText, typeNumberToLabel, validateDomain, validateHeaderName, validateHeaderValue, validateRobotsTxt, validateSitemap } from '../chunk-UD45LBG7.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.42.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",
|