@utilix-tech/sdk 0.61.0 → 0.62.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 +18 -2
- package/dist/{chunk-2WT347WO.js → chunk-43L7H3L2.js} +96 -1
- package/dist/index.cjs +95 -0
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{network-CXt69chQ.d.cts → network-DewFJy4E.d.cts} +62 -2
- package/dist/{network-CXt69chQ.d.ts → network-DewFJy4E.d.ts} +62 -2
- package/dist/tools/network.cjs +95 -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,10 @@
|
|
|
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.62.0
|
|
6
|
+
- Add `buildPriorityHeader`, `parsePriorityHeader` (priority-header): build an HTTP Priority request/response-header value from an urgency (0-7) and/or an incremental flag per RFC 9218, or parse an existing one into the same shape.
|
|
7
|
+
- Add `lookupCloseCode`, `listCloseCodes` (websocket-close-codes): look up what a WebSocket close code means per RFC 6455 and the IANA reserved ranges, or list every well-known code.
|
|
8
|
+
|
|
5
9
|
## 0.61.0
|
|
6
10
|
- Add `calculateExtraPaymentPayoff` (extra-payment-mortgage-calculator): compute how much faster a fixed-rate loan pays off, and how much interest is saved, when a fixed extra amount is added to every monthly payment.
|
|
7
11
|
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @utilix-tech/sdk
|
|
2
2
|
|
|
3
|
-
**
|
|
3
|
+
**670 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)
|
|
@@ -643,6 +643,22 @@ buildRetryAfterHeader({ seconds: 120 });
|
|
|
643
643
|
// Parse an existing Retry-After header value into the same shape
|
|
644
644
|
parseRetryAfterHeader("Retry-After: 120");
|
|
645
645
|
// { header: "Retry-After: 120", headerValue: "120", type: "seconds", seconds: 120 }
|
|
646
|
+
|
|
647
|
+
// Build a Priority request/response header from urgency (0-7) and/or incremental, per RFC 9218
|
|
648
|
+
buildPriorityHeader({ urgency: 1, incremental: true });
|
|
649
|
+
// { header: "Priority: u=1, i", headerValue: "u=1, i", urgency: 1, incremental: true }
|
|
650
|
+
|
|
651
|
+
// Parse an existing Priority header value into the same shape, with spec defaults applied
|
|
652
|
+
parsePriorityHeader("u=2");
|
|
653
|
+
// { header: "Priority: u=2, i=?0", headerValue: "u=2, i=?0", urgency: 2, incremental: false }
|
|
654
|
+
|
|
655
|
+
// Look up what a WebSocket close code means, per RFC 6455 and the IANA reserved ranges
|
|
656
|
+
lookupCloseCode(1006);
|
|
657
|
+
// { code: 1006, name: "Abnormal Closure", description: "...", range: "standard", sentOnWire: false }
|
|
658
|
+
|
|
659
|
+
// List every well-known WebSocket close code (1000-1015)
|
|
660
|
+
listCloseCodes();
|
|
661
|
+
// [{ code: 1000, name: "Normal Closure", ... }, ...]
|
|
646
662
|
```
|
|
647
663
|
|
|
648
664
|
---
|
|
@@ -902,7 +918,7 @@ inspectGifFrames(new Uint8Array(gifBytes));
|
|
|
902
918
|
| `@utilix-tech/sdk/generators` | UUID v4/v7, ULID, passwords, strength check, entropy estimator, fake data, CSP nonce generator |
|
|
903
919
|
| `@utilix-tech/sdk/time` | Date diff, timezone convert, cron parse, relative time |
|
|
904
920
|
| `@utilix-tech/sdk/units` | Bytes, CSS px/rem, number bases, currency format, credit card/IBAN/barcode/ISBN validation, loan calculator, EMI calculator, compound/simple interest calculators, VAT/sales tax calculator, tip/bill split calculator, break-even point calculator, Rule of 72 calculator, savings goal calculator, ROI calculator, cash denomination/till calculator, payback period calculator, CD maturity calculator, debt-to-income ratio calculator, freelancer hourly rate calculator |
|
|
905
|
-
| `@utilix-tech/sdk/network` | HTTP status codes, IP validation, country flags, geolocation URLs, HAR file parsing, User-Agent parsing, IPv6 address compress/expand, Permissions-Policy header builder, Client Hints header builder/parser, Content-Disposition header builder/parser, X-Content-Type-Options header builder/risk assessor, sitemap.xml validator, sitemap index splitter, Prefer header builder/parser (RFC 7240), Retry-After header builder/parser (RFC 9110) |
|
|
921
|
+
| `@utilix-tech/sdk/network` | HTTP status codes, IP validation, country flags, geolocation URLs, HAR file parsing, User-Agent parsing, IPv6 address compress/expand, Permissions-Policy header builder, Client Hints header builder/parser, Content-Disposition header builder/parser, X-Content-Type-Options header builder/risk assessor, sitemap.xml validator, sitemap index splitter, Prefer header builder/parser (RFC 7240), Retry-After header builder/parser (RFC 9110), Priority header builder/parser (RFC 9218), WebSocket close code reference/lookup |
|
|
906
922
|
| `@utilix-tech/sdk/api` | cURL build/parse, JWT decode/sign, JWKS parse, CORS headers, CSP header |
|
|
907
923
|
| `@utilix-tech/sdk/code` | SQL format/minify, HTML format/minify, regex tester, GraphQL format, MIME type lookup, GitHub URL parsing, regex ReDoS detector, Conventional Commits linter, package.json exports field validator |
|
|
908
924
|
| `@utilix-tech/sdk/color` | Hex/RGB/HSL/HSV/CMYK convert, palette generation, contrast check |
|
|
@@ -23,6 +23,7 @@ __export(network_exports, {
|
|
|
23
23
|
buildMapUrl: () => buildMapUrl,
|
|
24
24
|
buildPermissionsPolicy: () => buildPermissionsPolicy,
|
|
25
25
|
buildPreferHeader: () => buildPreferHeader,
|
|
26
|
+
buildPriorityHeader: () => buildPriorityHeader,
|
|
26
27
|
buildRangeHeader: () => buildRangeHeader,
|
|
27
28
|
buildReferrerPolicy: () => buildReferrerPolicy,
|
|
28
29
|
buildRetryAfterHeader: () => buildRetryAfterHeader,
|
|
@@ -43,6 +44,8 @@ __export(network_exports, {
|
|
|
43
44
|
isValidIp: () => isValidIp,
|
|
44
45
|
isValidIpv4: () => isValidIpv4,
|
|
45
46
|
isValidIpv6: () => isValidIpv6,
|
|
47
|
+
listCloseCodes: () => listCloseCodes,
|
|
48
|
+
lookupCloseCode: () => lookupCloseCode,
|
|
46
49
|
parseAcceptLanguage: () => parseAcceptLanguage,
|
|
47
50
|
parseClientHintHeaders: () => parseClientHintHeaders,
|
|
48
51
|
parseContentDisposition: () => parseContentDisposition,
|
|
@@ -53,6 +56,7 @@ __export(network_exports, {
|
|
|
53
56
|
parseIpv6Address: () => parseIpv6Address,
|
|
54
57
|
parsePermissionsPolicy: () => parsePermissionsPolicy,
|
|
55
58
|
parsePreferHeader: () => parsePreferHeader,
|
|
59
|
+
parsePriorityHeader: () => parsePriorityHeader,
|
|
56
60
|
parseRetryAfterHeader: () => parseRetryAfterHeader,
|
|
57
61
|
parseUserAgent: () => parseUserAgent,
|
|
58
62
|
parseVaryHeader: () => parseVaryHeader,
|
|
@@ -3019,5 +3023,96 @@ function parseRetryAfterHeader(raw) {
|
|
|
3019
3023
|
const httpDate = parsed.toUTCString();
|
|
3020
3024
|
return { header: `Retry-After: ${httpDate}`, headerValue: httpDate, type: "http-date", httpDate, iso: parsed.toISOString() };
|
|
3021
3025
|
}
|
|
3026
|
+
function isValidUrgency(n) {
|
|
3027
|
+
return typeof n === "number" && Number.isInteger(n) && n >= 0 && n <= 7;
|
|
3028
|
+
}
|
|
3029
|
+
function buildPriorityHeader(input) {
|
|
3030
|
+
const { urgency, incremental } = input ?? {};
|
|
3031
|
+
if (urgency === void 0 && incremental === void 0) {
|
|
3032
|
+
return { error: "Provide at least one of urgency or incremental" };
|
|
3033
|
+
}
|
|
3034
|
+
if (urgency !== void 0 && !isValidUrgency(urgency)) {
|
|
3035
|
+
return { error: "urgency must be an integer between 0 and 7" };
|
|
3036
|
+
}
|
|
3037
|
+
const parts = [];
|
|
3038
|
+
if (urgency !== void 0) parts.push(`u=${urgency}`);
|
|
3039
|
+
if (incremental === true) parts.push("i");
|
|
3040
|
+
else if (incremental === false) parts.push("i=?0");
|
|
3041
|
+
const headerValue = parts.join(", ");
|
|
3042
|
+
return {
|
|
3043
|
+
header: `Priority: ${headerValue}`,
|
|
3044
|
+
headerValue,
|
|
3045
|
+
urgency: urgency ?? 3,
|
|
3046
|
+
incremental: incremental ?? false
|
|
3047
|
+
};
|
|
3048
|
+
}
|
|
3049
|
+
function parsePriorityHeader(raw) {
|
|
3050
|
+
if (!raw || raw.trim() === "") return { error: "Input is empty" };
|
|
3051
|
+
const withoutLabel = raw.trim().replace(/^priority:\s*/i, "");
|
|
3052
|
+
const parts = withoutLabel.split(",").map((p) => p.trim()).filter((p) => p.length > 0);
|
|
3053
|
+
if (parts.length === 0) return { error: "Input is empty" };
|
|
3054
|
+
let urgency = 3;
|
|
3055
|
+
let incremental = false;
|
|
3056
|
+
for (const part of parts) {
|
|
3057
|
+
const eq = part.indexOf("=");
|
|
3058
|
+
const key = (eq === -1 ? part : part.slice(0, eq)).trim();
|
|
3059
|
+
const rawValue = eq === -1 ? void 0 : part.slice(eq + 1).trim();
|
|
3060
|
+
if (key === "u") {
|
|
3061
|
+
if (rawValue === void 0 || !/^\d+$/.test(rawValue)) return { error: `Invalid urgency value in "${part}"` };
|
|
3062
|
+
const n = Number(rawValue);
|
|
3063
|
+
if (n < 0 || n > 7) return { error: `urgency must be between 0 and 7, got ${n}` };
|
|
3064
|
+
urgency = n;
|
|
3065
|
+
} else if (key === "i") {
|
|
3066
|
+
if (rawValue === void 0 || rawValue === "?1") incremental = true;
|
|
3067
|
+
else if (rawValue === "?0") incremental = false;
|
|
3068
|
+
else return { error: `Invalid incremental value in "${part}"` };
|
|
3069
|
+
}
|
|
3070
|
+
}
|
|
3071
|
+
const headerValue = incremental ? `u=${urgency}, i` : `u=${urgency}, i=?0`;
|
|
3072
|
+
return { header: `Priority: ${headerValue}`, headerValue, urgency, incremental };
|
|
3073
|
+
}
|
|
3074
|
+
var WELL_KNOWN_CLOSE_CODES = {
|
|
3075
|
+
1e3: { name: "Normal Closure", description: "The connection successfully completed the purpose for which it was created.", sentOnWire: true },
|
|
3076
|
+
1001: { name: "Going Away", description: "An endpoint is going away, such as a server shutting down or a browser navigating away from the page.", sentOnWire: true },
|
|
3077
|
+
1002: { name: "Protocol Error", description: "An endpoint is terminating the connection due to a protocol error.", sentOnWire: true },
|
|
3078
|
+
1003: { name: "Unsupported Data", description: "An endpoint received a data type it cannot accept, such as a binary-only endpoint receiving a text message.", sentOnWire: true },
|
|
3079
|
+
1004: { name: "Reserved", description: "Reserved. A meaning might be defined in the future.", sentOnWire: true },
|
|
3080
|
+
1005: { name: "No Status Received", description: "A reserved value used internally by libraries to indicate no status code was actually present in the close frame. Must not be sent on the wire.", sentOnWire: false },
|
|
3081
|
+
1006: { name: "Abnormal Closure", description: "A reserved value used internally by libraries to indicate the connection closed without a close frame, e.g. the TCP connection dropped. Must not be sent on the wire.", sentOnWire: false },
|
|
3082
|
+
1007: { name: "Invalid frame payload data", description: "An endpoint is terminating the connection because it received data inconsistent with the message type, such as non-UTF-8 data in a text message.", sentOnWire: true },
|
|
3083
|
+
1008: { name: "Policy Violation", description: "A generic status code used when no other code fits and the endpoint does not want to reveal further details, or a message violated its policy.", sentOnWire: true },
|
|
3084
|
+
1009: { name: "Message Too Big", description: "An endpoint is terminating the connection because it received a message too large to process.", sentOnWire: true },
|
|
3085
|
+
1010: { name: "Mandatory Extension", description: "A client is terminating the connection because the server did not negotiate one or more extensions the client required.", sentOnWire: true },
|
|
3086
|
+
1011: { name: "Internal Error", description: "A server is terminating the connection because it encountered an unexpected condition that prevented it from fulfilling the request.", sentOnWire: true },
|
|
3087
|
+
1012: { name: "Service Restart", description: "The server is terminating the connection because it is restarting.", sentOnWire: true },
|
|
3088
|
+
1013: { name: "Try Again Later", description: "The server is terminating the connection due to a temporary condition, such as being overloaded, and the client should reconnect later.", sentOnWire: true },
|
|
3089
|
+
1014: { name: "Bad Gateway", description: "The server, acting as a gateway or proxy, received an invalid response from an upstream server it connected to while processing the request.", sentOnWire: true },
|
|
3090
|
+
1015: { name: "TLS Handshake", description: "A reserved value used internally by libraries to indicate the TLS handshake failed. Must not be sent on the wire.", sentOnWire: false }
|
|
3091
|
+
};
|
|
3092
|
+
function listCloseCodes() {
|
|
3093
|
+
return Object.entries(WELL_KNOWN_CLOSE_CODES).map(([code, info]) => ({ code: Number(code), name: info.name, description: info.description, range: "standard", sentOnWire: info.sentOnWire })).sort((a, b) => a.code - b.code);
|
|
3094
|
+
}
|
|
3095
|
+
function lookupCloseCode(code) {
|
|
3096
|
+
if (typeof code !== "number" || !Number.isInteger(code) || code < 0 || code > 65535) {
|
|
3097
|
+
return { error: "code must be an integer between 0 and 65535" };
|
|
3098
|
+
}
|
|
3099
|
+
const known = WELL_KNOWN_CLOSE_CODES[code];
|
|
3100
|
+
if (known) {
|
|
3101
|
+
return { code, name: known.name, description: known.description, range: "standard", sentOnWire: known.sentOnWire };
|
|
3102
|
+
}
|
|
3103
|
+
if (code < 1e3) {
|
|
3104
|
+
return { error: `${code} is not a valid WebSocket close code; codes below 1000 are not permitted on the wire` };
|
|
3105
|
+
}
|
|
3106
|
+
if (code <= 2999) {
|
|
3107
|
+
return { code, name: "Unassigned", description: "Reserved for future use by the WebSocket protocol specification. No meaning is defined yet.", range: "reserved-future", sentOnWire: true };
|
|
3108
|
+
}
|
|
3109
|
+
if (code <= 3999) {
|
|
3110
|
+
return { code, name: "Library/Framework Use", description: "Reserved for use by libraries, frameworks, and applications. Codes in this range are meant to be registered directly with IANA in the WebSocket Close Code Number Registry, so their meaning depends on which library or application defined them.", range: "library-framework", sentOnWire: true };
|
|
3111
|
+
}
|
|
3112
|
+
if (code <= 4999) {
|
|
3113
|
+
return { code, name: "Private Use", description: "Reserved for private use between a specific client and server implementation. These codes cannot be registered with IANA, so their meaning is defined entirely by the application using them.", range: "private-use", sentOnWire: true };
|
|
3114
|
+
}
|
|
3115
|
+
return { error: `${code} is outside the defined close code ranges (0-4999); codes 5000 and above have no assigned meaning` };
|
|
3116
|
+
}
|
|
3022
3117
|
|
|
3023
|
-
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, buildRangeHeader, buildReferrerPolicy, buildRetryAfterHeader, buildVaryHeader, buildXContentTypeOptionsHeader, checkSetCookieHeader, countryCodeToFlag, formatCoordinates, formatTtl, getByCategory, getHeader, getHeadersByCategory, getStatusByCategory, getStatusCode, isClientError, isServerError, isSuccess, isValidIp, isValidIpv4, isValidIpv6, network_exports, parseAcceptLanguage, parseClientHintHeaders, parseContentDisposition, parseContentRangeHeader, parseDnsResponse, parseGeoResponse, parseHar, parseIpv6Address, parsePermissionsPolicy, parsePreferHeader, parseRetryAfterHeader, parseUserAgent, parseVaryHeader, parseXContentTypeOptionsHeader, searchHeaders, searchStatusCodes, splitSitemap, statusCodeToText, typeNumberToLabel, validateDomain, validateHeaderName, validateHeaderValue, validateManifest, validateRobotsTxt, validateSitemap };
|
|
3118
|
+
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, formatCoordinates, formatTtl, getByCategory, getHeader, getHeadersByCategory, getStatusByCategory, getStatusCode, isClientError, isServerError, isSuccess, isValidIp, isValidIpv4, isValidIpv6, listCloseCodes, lookupCloseCode, network_exports, parseAcceptLanguage, parseClientHintHeaders, parseContentDisposition, parseContentRangeHeader, parseDnsResponse, parseGeoResponse, parseHar, parseIpv6Address, parsePermissionsPolicy, parsePreferHeader, parsePriorityHeader, parseRetryAfterHeader, parseUserAgent, parseVaryHeader, parseXContentTypeOptionsHeader, searchHeaders, searchStatusCodes, splitSitemap, statusCodeToText, typeNumberToLabel, validateDomain, validateHeaderName, validateHeaderValue, validateManifest, validateRobotsTxt, validateSitemap };
|
package/dist/index.cjs
CHANGED
|
@@ -10803,6 +10803,7 @@ __export(network_exports, {
|
|
|
10803
10803
|
buildMapUrl: () => buildMapUrl,
|
|
10804
10804
|
buildPermissionsPolicy: () => buildPermissionsPolicy,
|
|
10805
10805
|
buildPreferHeader: () => buildPreferHeader,
|
|
10806
|
+
buildPriorityHeader: () => buildPriorityHeader,
|
|
10806
10807
|
buildRangeHeader: () => buildRangeHeader,
|
|
10807
10808
|
buildReferrerPolicy: () => buildReferrerPolicy,
|
|
10808
10809
|
buildRetryAfterHeader: () => buildRetryAfterHeader,
|
|
@@ -10823,6 +10824,8 @@ __export(network_exports, {
|
|
|
10823
10824
|
isValidIp: () => isValidIp2,
|
|
10824
10825
|
isValidIpv4: () => isValidIpv42,
|
|
10825
10826
|
isValidIpv6: () => isValidIpv6,
|
|
10827
|
+
listCloseCodes: () => listCloseCodes,
|
|
10828
|
+
lookupCloseCode: () => lookupCloseCode,
|
|
10826
10829
|
parseAcceptLanguage: () => parseAcceptLanguage,
|
|
10827
10830
|
parseClientHintHeaders: () => parseClientHintHeaders,
|
|
10828
10831
|
parseContentDisposition: () => parseContentDisposition,
|
|
@@ -10833,6 +10836,7 @@ __export(network_exports, {
|
|
|
10833
10836
|
parseIpv6Address: () => parseIpv6Address,
|
|
10834
10837
|
parsePermissionsPolicy: () => parsePermissionsPolicy,
|
|
10835
10838
|
parsePreferHeader: () => parsePreferHeader,
|
|
10839
|
+
parsePriorityHeader: () => parsePriorityHeader,
|
|
10836
10840
|
parseRetryAfterHeader: () => parseRetryAfterHeader,
|
|
10837
10841
|
parseUserAgent: () => parseUserAgent,
|
|
10838
10842
|
parseVaryHeader: () => parseVaryHeader,
|
|
@@ -13799,6 +13803,97 @@ function parseRetryAfterHeader(raw) {
|
|
|
13799
13803
|
const httpDate = parsed.toUTCString();
|
|
13800
13804
|
return { header: `Retry-After: ${httpDate}`, headerValue: httpDate, type: "http-date", httpDate, iso: parsed.toISOString() };
|
|
13801
13805
|
}
|
|
13806
|
+
function isValidUrgency(n) {
|
|
13807
|
+
return typeof n === "number" && Number.isInteger(n) && n >= 0 && n <= 7;
|
|
13808
|
+
}
|
|
13809
|
+
function buildPriorityHeader(input) {
|
|
13810
|
+
const { urgency, incremental } = input ?? {};
|
|
13811
|
+
if (urgency === void 0 && incremental === void 0) {
|
|
13812
|
+
return { error: "Provide at least one of urgency or incremental" };
|
|
13813
|
+
}
|
|
13814
|
+
if (urgency !== void 0 && !isValidUrgency(urgency)) {
|
|
13815
|
+
return { error: "urgency must be an integer between 0 and 7" };
|
|
13816
|
+
}
|
|
13817
|
+
const parts = [];
|
|
13818
|
+
if (urgency !== void 0) parts.push(`u=${urgency}`);
|
|
13819
|
+
if (incremental === true) parts.push("i");
|
|
13820
|
+
else if (incremental === false) parts.push("i=?0");
|
|
13821
|
+
const headerValue = parts.join(", ");
|
|
13822
|
+
return {
|
|
13823
|
+
header: `Priority: ${headerValue}`,
|
|
13824
|
+
headerValue,
|
|
13825
|
+
urgency: urgency ?? 3,
|
|
13826
|
+
incremental: incremental ?? false
|
|
13827
|
+
};
|
|
13828
|
+
}
|
|
13829
|
+
function parsePriorityHeader(raw) {
|
|
13830
|
+
if (!raw || raw.trim() === "") return { error: "Input is empty" };
|
|
13831
|
+
const withoutLabel = raw.trim().replace(/^priority:\s*/i, "");
|
|
13832
|
+
const parts = withoutLabel.split(",").map((p) => p.trim()).filter((p) => p.length > 0);
|
|
13833
|
+
if (parts.length === 0) return { error: "Input is empty" };
|
|
13834
|
+
let urgency = 3;
|
|
13835
|
+
let incremental = false;
|
|
13836
|
+
for (const part of parts) {
|
|
13837
|
+
const eq = part.indexOf("=");
|
|
13838
|
+
const key = (eq === -1 ? part : part.slice(0, eq)).trim();
|
|
13839
|
+
const rawValue = eq === -1 ? void 0 : part.slice(eq + 1).trim();
|
|
13840
|
+
if (key === "u") {
|
|
13841
|
+
if (rawValue === void 0 || !/^\d+$/.test(rawValue)) return { error: `Invalid urgency value in "${part}"` };
|
|
13842
|
+
const n = Number(rawValue);
|
|
13843
|
+
if (n < 0 || n > 7) return { error: `urgency must be between 0 and 7, got ${n}` };
|
|
13844
|
+
urgency = n;
|
|
13845
|
+
} else if (key === "i") {
|
|
13846
|
+
if (rawValue === void 0 || rawValue === "?1") incremental = true;
|
|
13847
|
+
else if (rawValue === "?0") incremental = false;
|
|
13848
|
+
else return { error: `Invalid incremental value in "${part}"` };
|
|
13849
|
+
}
|
|
13850
|
+
}
|
|
13851
|
+
const headerValue = incremental ? `u=${urgency}, i` : `u=${urgency}, i=?0`;
|
|
13852
|
+
return { header: `Priority: ${headerValue}`, headerValue, urgency, incremental };
|
|
13853
|
+
}
|
|
13854
|
+
var WELL_KNOWN_CLOSE_CODES = {
|
|
13855
|
+
1e3: { name: "Normal Closure", description: "The connection successfully completed the purpose for which it was created.", sentOnWire: true },
|
|
13856
|
+
1001: { name: "Going Away", description: "An endpoint is going away, such as a server shutting down or a browser navigating away from the page.", sentOnWire: true },
|
|
13857
|
+
1002: { name: "Protocol Error", description: "An endpoint is terminating the connection due to a protocol error.", sentOnWire: true },
|
|
13858
|
+
1003: { name: "Unsupported Data", description: "An endpoint received a data type it cannot accept, such as a binary-only endpoint receiving a text message.", sentOnWire: true },
|
|
13859
|
+
1004: { name: "Reserved", description: "Reserved. A meaning might be defined in the future.", sentOnWire: true },
|
|
13860
|
+
1005: { name: "No Status Received", description: "A reserved value used internally by libraries to indicate no status code was actually present in the close frame. Must not be sent on the wire.", sentOnWire: false },
|
|
13861
|
+
1006: { name: "Abnormal Closure", description: "A reserved value used internally by libraries to indicate the connection closed without a close frame, e.g. the TCP connection dropped. Must not be sent on the wire.", sentOnWire: false },
|
|
13862
|
+
1007: { name: "Invalid frame payload data", description: "An endpoint is terminating the connection because it received data inconsistent with the message type, such as non-UTF-8 data in a text message.", sentOnWire: true },
|
|
13863
|
+
1008: { name: "Policy Violation", description: "A generic status code used when no other code fits and the endpoint does not want to reveal further details, or a message violated its policy.", sentOnWire: true },
|
|
13864
|
+
1009: { name: "Message Too Big", description: "An endpoint is terminating the connection because it received a message too large to process.", sentOnWire: true },
|
|
13865
|
+
1010: { name: "Mandatory Extension", description: "A client is terminating the connection because the server did not negotiate one or more extensions the client required.", sentOnWire: true },
|
|
13866
|
+
1011: { name: "Internal Error", description: "A server is terminating the connection because it encountered an unexpected condition that prevented it from fulfilling the request.", sentOnWire: true },
|
|
13867
|
+
1012: { name: "Service Restart", description: "The server is terminating the connection because it is restarting.", sentOnWire: true },
|
|
13868
|
+
1013: { name: "Try Again Later", description: "The server is terminating the connection due to a temporary condition, such as being overloaded, and the client should reconnect later.", sentOnWire: true },
|
|
13869
|
+
1014: { name: "Bad Gateway", description: "The server, acting as a gateway or proxy, received an invalid response from an upstream server it connected to while processing the request.", sentOnWire: true },
|
|
13870
|
+
1015: { name: "TLS Handshake", description: "A reserved value used internally by libraries to indicate the TLS handshake failed. Must not be sent on the wire.", sentOnWire: false }
|
|
13871
|
+
};
|
|
13872
|
+
function listCloseCodes() {
|
|
13873
|
+
return Object.entries(WELL_KNOWN_CLOSE_CODES).map(([code, info]) => ({ code: Number(code), name: info.name, description: info.description, range: "standard", sentOnWire: info.sentOnWire })).sort((a, b) => a.code - b.code);
|
|
13874
|
+
}
|
|
13875
|
+
function lookupCloseCode(code) {
|
|
13876
|
+
if (typeof code !== "number" || !Number.isInteger(code) || code < 0 || code > 65535) {
|
|
13877
|
+
return { error: "code must be an integer between 0 and 65535" };
|
|
13878
|
+
}
|
|
13879
|
+
const known = WELL_KNOWN_CLOSE_CODES[code];
|
|
13880
|
+
if (known) {
|
|
13881
|
+
return { code, name: known.name, description: known.description, range: "standard", sentOnWire: known.sentOnWire };
|
|
13882
|
+
}
|
|
13883
|
+
if (code < 1e3) {
|
|
13884
|
+
return { error: `${code} is not a valid WebSocket close code; codes below 1000 are not permitted on the wire` };
|
|
13885
|
+
}
|
|
13886
|
+
if (code <= 2999) {
|
|
13887
|
+
return { code, name: "Unassigned", description: "Reserved for future use by the WebSocket protocol specification. No meaning is defined yet.", range: "reserved-future", sentOnWire: true };
|
|
13888
|
+
}
|
|
13889
|
+
if (code <= 3999) {
|
|
13890
|
+
return { code, name: "Library/Framework Use", description: "Reserved for use by libraries, frameworks, and applications. Codes in this range are meant to be registered directly with IANA in the WebSocket Close Code Number Registry, so their meaning depends on which library or application defined them.", range: "library-framework", sentOnWire: true };
|
|
13891
|
+
}
|
|
13892
|
+
if (code <= 4999) {
|
|
13893
|
+
return { code, name: "Private Use", description: "Reserved for private use between a specific client and server implementation. These codes cannot be registered with IANA, so their meaning is defined entirely by the application using them.", range: "private-use", sentOnWire: true };
|
|
13894
|
+
}
|
|
13895
|
+
return { error: `${code} is outside the defined close code ranges (0-4999); codes 5000 and above have no assigned meaning` };
|
|
13896
|
+
}
|
|
13802
13897
|
|
|
13803
13898
|
// src/tools/api.ts
|
|
13804
13899
|
var api_exports = {};
|
package/dist/index.d.cts
CHANGED
|
@@ -6,7 +6,7 @@ export { d as data } from './data-vxXrBlWh.cjs';
|
|
|
6
6
|
export { g as generators } from './generators-DAXXrMvG.cjs';
|
|
7
7
|
export { t as time } from './time-KqJjdqII.cjs';
|
|
8
8
|
export { u as units } from './units-izyUpUAb.cjs';
|
|
9
|
-
export { n as network } from './network-
|
|
9
|
+
export { n as network } from './network-DewFJy4E.cjs';
|
|
10
10
|
export { a as api } from './api-DmTNE4c1.cjs';
|
|
11
11
|
export { c as code } from './code-rxidGgvB.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-vxXrBlWh.js';
|
|
|
6
6
|
export { g as generators } from './generators-DAXXrMvG.js';
|
|
7
7
|
export { t as time } from './time-KqJjdqII.js';
|
|
8
8
|
export { u as units } from './units-izyUpUAb.js';
|
|
9
|
-
export { n as network } from './network-
|
|
9
|
+
export { n as network } from './network-DewFJy4E.js';
|
|
10
10
|
export { a as api } from './api-DmTNE4c1.js';
|
|
11
11
|
export { c as code } from './code-rxidGgvB.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-226EH3ZI.js';
|
|
2
2
|
export { units_exports as units } from './chunk-43WFN3CW.js';
|
|
3
|
-
export { network_exports as network } from './chunk-
|
|
3
|
+
export { network_exports as network } from './chunk-43L7H3L2.js';
|
|
4
4
|
export { api_exports as api } from './chunk-52ZDKSIX.js';
|
|
5
5
|
export { code_exports as code } from './chunk-JW4NG2GN.js';
|
|
6
6
|
export { color_exports as color } from './chunk-BPVAB4P2.js';
|
|
@@ -25,6 +25,8 @@
|
|
|
25
25
|
* - accept-language-parser: parseAcceptLanguage, buildAcceptLanguage
|
|
26
26
|
* - prefer-header: buildPreferHeader, parsePreferHeader
|
|
27
27
|
* - retry-after-builder: buildRetryAfterHeader, parseRetryAfterHeader
|
|
28
|
+
* - priority-header: buildPriorityHeader, parsePriorityHeader
|
|
29
|
+
* - websocket-close-codes: lookupCloseCode, listCloseCodes
|
|
28
30
|
*/
|
|
29
31
|
declare const DNS_RECORD_TYPES: readonly ["A", "AAAA", "CNAME", "MX", "TXT", "NS", "SOA", "PTR", "SRV", "CAA"];
|
|
30
32
|
type DnsRecordType = typeof DNS_RECORD_TYPES[number];
|
|
@@ -847,6 +849,57 @@ declare function buildRetryAfterHeader(input: {
|
|
|
847
849
|
declare function parseRetryAfterHeader(raw: string): RetryAfterResult | {
|
|
848
850
|
error: string;
|
|
849
851
|
};
|
|
852
|
+
interface PriorityResult {
|
|
853
|
+
header: string;
|
|
854
|
+
headerValue: string;
|
|
855
|
+
urgency: number;
|
|
856
|
+
incremental: boolean;
|
|
857
|
+
}
|
|
858
|
+
/**
|
|
859
|
+
* Build a `Priority` request/response-header value from an urgency (0-7,
|
|
860
|
+
* default 3) and/or an incremental flag, per RFC 9218. At least one of the
|
|
861
|
+
* two must be given; the omitted one falls back to its spec default.
|
|
862
|
+
*/
|
|
863
|
+
declare function buildPriorityHeader(input: {
|
|
864
|
+
urgency?: number;
|
|
865
|
+
incremental?: boolean;
|
|
866
|
+
}): PriorityResult | {
|
|
867
|
+
error: string;
|
|
868
|
+
};
|
|
869
|
+
/**
|
|
870
|
+
* Parse an existing `Priority` header value (with or without a leading
|
|
871
|
+
* `Priority:` label) into its urgency and incremental fields, per RFC 9218.
|
|
872
|
+
* Any field not present in the input falls back to its spec default (u=3,
|
|
873
|
+
* i=false). Unrecognized dictionary members are ignored for forward
|
|
874
|
+
* compatibility, as the spec requires.
|
|
875
|
+
*/
|
|
876
|
+
declare function parsePriorityHeader(raw: string): PriorityResult | {
|
|
877
|
+
error: string;
|
|
878
|
+
};
|
|
879
|
+
type CloseCodeRange = 'standard' | 'reserved-future' | 'library-framework' | 'private-use';
|
|
880
|
+
interface CloseCodeInfo {
|
|
881
|
+
code: number;
|
|
882
|
+
name: string;
|
|
883
|
+
description: string;
|
|
884
|
+
range: CloseCodeRange;
|
|
885
|
+
sentOnWire: boolean;
|
|
886
|
+
}
|
|
887
|
+
/**
|
|
888
|
+
* List every well-known WebSocket close code (1000-1015) defined directly
|
|
889
|
+
* by RFC 6455, in ascending order.
|
|
890
|
+
*/
|
|
891
|
+
declare function listCloseCodes(): CloseCodeInfo[];
|
|
892
|
+
/**
|
|
893
|
+
* Look up what a WebSocket close code means, per the RFC 6455 close code
|
|
894
|
+
* definitions and the IANA WebSocket Close Code Number Registry's reserved
|
|
895
|
+
* ranges. Codes 1000-1015 return their specific well-known meaning; codes
|
|
896
|
+
* 3000-3999 and 4000-4999 return the meaning of their reserved range, since
|
|
897
|
+
* those ranges are allocated to individual libraries/applications rather
|
|
898
|
+
* than having a single fixed meaning.
|
|
899
|
+
*/
|
|
900
|
+
declare function lookupCloseCode(code: number): CloseCodeInfo | {
|
|
901
|
+
error: string;
|
|
902
|
+
};
|
|
850
903
|
|
|
851
904
|
type network_AcceptLanguageEntry = AcceptLanguageEntry;
|
|
852
905
|
type network_AcceptLanguageResult = AcceptLanguageResult;
|
|
@@ -860,6 +913,8 @@ type network_ClientHintDef = ClientHintDef;
|
|
|
860
913
|
type network_ClientHintValueType = ClientHintValueType;
|
|
861
914
|
type network_ClientHintsBuildResult = ClientHintsBuildResult;
|
|
862
915
|
type network_ClientHintsParseResult = ClientHintsParseResult;
|
|
916
|
+
type network_CloseCodeInfo = CloseCodeInfo;
|
|
917
|
+
type network_CloseCodeRange = CloseCodeRange;
|
|
863
918
|
type network_ContentDispositionBuildOptions = ContentDispositionBuildOptions;
|
|
864
919
|
type network_ContentDispositionBuildResult = ContentDispositionBuildResult;
|
|
865
920
|
type network_ContentDispositionParseResult = ContentDispositionParseResult;
|
|
@@ -901,6 +956,7 @@ type network_PermissionsPolicyResult = PermissionsPolicyResult;
|
|
|
901
956
|
type network_PreferParameter = PreferParameter;
|
|
902
957
|
type network_PreferPreference = PreferPreference;
|
|
903
958
|
type network_PreferResult = PreferResult;
|
|
959
|
+
type network_PriorityResult = PriorityResult;
|
|
904
960
|
declare const network_REFERRER_POLICY_VALUES: typeof REFERRER_POLICY_VALUES;
|
|
905
961
|
type network_RangeEntry = RangeEntry;
|
|
906
962
|
type network_RangeEntryInput = RangeEntryInput;
|
|
@@ -945,6 +1001,7 @@ declare const network_buildLinkHeader: typeof buildLinkHeader;
|
|
|
945
1001
|
declare const network_buildMapUrl: typeof buildMapUrl;
|
|
946
1002
|
declare const network_buildPermissionsPolicy: typeof buildPermissionsPolicy;
|
|
947
1003
|
declare const network_buildPreferHeader: typeof buildPreferHeader;
|
|
1004
|
+
declare const network_buildPriorityHeader: typeof buildPriorityHeader;
|
|
948
1005
|
declare const network_buildRangeHeader: typeof buildRangeHeader;
|
|
949
1006
|
declare const network_buildReferrerPolicy: typeof buildReferrerPolicy;
|
|
950
1007
|
declare const network_buildRetryAfterHeader: typeof buildRetryAfterHeader;
|
|
@@ -965,6 +1022,8 @@ declare const network_isSuccess: typeof isSuccess;
|
|
|
965
1022
|
declare const network_isValidIp: typeof isValidIp;
|
|
966
1023
|
declare const network_isValidIpv4: typeof isValidIpv4;
|
|
967
1024
|
declare const network_isValidIpv6: typeof isValidIpv6;
|
|
1025
|
+
declare const network_listCloseCodes: typeof listCloseCodes;
|
|
1026
|
+
declare const network_lookupCloseCode: typeof lookupCloseCode;
|
|
968
1027
|
declare const network_parseAcceptLanguage: typeof parseAcceptLanguage;
|
|
969
1028
|
declare const network_parseClientHintHeaders: typeof parseClientHintHeaders;
|
|
970
1029
|
declare const network_parseContentDisposition: typeof parseContentDisposition;
|
|
@@ -975,6 +1034,7 @@ declare const network_parseHar: typeof parseHar;
|
|
|
975
1034
|
declare const network_parseIpv6Address: typeof parseIpv6Address;
|
|
976
1035
|
declare const network_parsePermissionsPolicy: typeof parsePermissionsPolicy;
|
|
977
1036
|
declare const network_parsePreferHeader: typeof parsePreferHeader;
|
|
1037
|
+
declare const network_parsePriorityHeader: typeof parsePriorityHeader;
|
|
978
1038
|
declare const network_parseRetryAfterHeader: typeof parseRetryAfterHeader;
|
|
979
1039
|
declare const network_parseUserAgent: typeof parseUserAgent;
|
|
980
1040
|
declare const network_parseVaryHeader: typeof parseVaryHeader;
|
|
@@ -991,7 +1051,7 @@ declare const network_validateManifest: typeof validateManifest;
|
|
|
991
1051
|
declare const network_validateRobotsTxt: typeof validateRobotsTxt;
|
|
992
1052
|
declare const network_validateSitemap: typeof validateSitemap;
|
|
993
1053
|
declare namespace network {
|
|
994
|
-
export { type network_AcceptLanguageEntry as AcceptLanguageEntry, type network_AcceptLanguageResult as AcceptLanguageResult, type network_AuthResultEntry as AuthResultEntry, type network_BuildRangeHeaderOptions as BuildRangeHeaderOptions, network_CLIENT_HINTS as CLIENT_HINTS, type network_CacheControlDirective as CacheControlDirective, type network_CacheControlOptions as CacheControlOptions, type network_CacheControlResult as CacheControlResult, type network_ClientHintDef as ClientHintDef, type network_ClientHintValueType as ClientHintValueType, type network_ClientHintsBuildResult as ClientHintsBuildResult, type network_ClientHintsParseResult as ClientHintsParseResult, type network_ContentDispositionBuildOptions as ContentDispositionBuildOptions, type network_ContentDispositionBuildResult as ContentDispositionBuildResult, type network_ContentDispositionParseResult as ContentDispositionParseResult, type network_ContentRangeResult as ContentRangeResult, type network_ContentTypeRiskResult as ContentTypeRiskResult, type network_ContentTypeSniffRisk as ContentTypeSniffRisk, 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_ManifestIconInfo as ManifestIconInfo, type network_ManifestIssue as ManifestIssue, type network_ManifestValidationResult as ManifestValidationResult, network_PERMISSIONS_POLICY_FEATURES as PERMISSIONS_POLICY_FEATURES, type network_ParsedClientHint as ParsedClientHint, type network_ParsedDnsResult as ParsedDnsResult, type network_ParsedGeoResult as ParsedGeoResult, type network_PermissionsPolicyDirective as PermissionsPolicyDirective, type network_PermissionsPolicyFeatureInput as PermissionsPolicyFeatureInput, type network_PermissionsPolicyResult as PermissionsPolicyResult, type network_PreferParameter as PreferParameter, type network_PreferPreference as PreferPreference, type network_PreferResult as PreferResult, 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_RetryAfterDateResult as RetryAfterDateResult, type network_RetryAfterResult as RetryAfterResult, type network_RetryAfterSecondsResult as RetryAfterSecondsResult, 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_SitemapSplitFile as SitemapSplitFile, type network_SitemapUrlEntry as SitemapUrlEntry, type network_SitemapValidationResult as SitemapValidationResult, type network_SplitSitemapOptions as SplitSitemapOptions, type network_SplitSitemapResult as SplitSitemapResult, 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, type network_XContentTypeOptionsHeader as XContentTypeOptionsHeader, type network_XContentTypeOptionsParseResult as XContentTypeOptionsParseResult, network_X_CONTENT_TYPE_OPTIONS_HEADER as X_CONTENT_TYPE_OPTIONS_HEADER, network_analyzeEmailHeaders as analyzeEmailHeaders, network_assessContentTypeRisk as assessContentTypeRisk, network_buildAcceptLanguage as buildAcceptLanguage, network_buildCacheControl as buildCacheControl, network_buildClientHints as buildClientHints, network_buildContentDisposition as buildContentDisposition, network_buildDnsQueryUrl as buildDnsQueryUrl, network_buildGeoUrl as buildGeoUrl, network_buildLinkHeader as buildLinkHeader, network_buildMapUrl as buildMapUrl, network_buildPermissionsPolicy as buildPermissionsPolicy, network_buildPreferHeader as buildPreferHeader, network_buildRangeHeader as buildRangeHeader, network_buildReferrerPolicy as buildReferrerPolicy, network_buildRetryAfterHeader as buildRetryAfterHeader, network_buildVaryHeader as buildVaryHeader, network_buildXContentTypeOptionsHeader as buildXContentTypeOptionsHeader, 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_parseAcceptLanguage as parseAcceptLanguage, network_parseClientHintHeaders as parseClientHintHeaders, network_parseContentDisposition as parseContentDisposition, network_parseContentRangeHeader as parseContentRangeHeader, network_parseDnsResponse as parseDnsResponse, network_parseGeoResponse as parseGeoResponse, network_parseHar as parseHar, network_parseIpv6Address as parseIpv6Address, network_parsePermissionsPolicy as parsePermissionsPolicy, network_parsePreferHeader as parsePreferHeader, network_parseRetryAfterHeader as parseRetryAfterHeader, network_parseUserAgent as parseUserAgent, network_parseVaryHeader as parseVaryHeader, network_parseXContentTypeOptionsHeader as parseXContentTypeOptionsHeader, network_searchHeaders as searchHeaders, network_searchStatusCodes as searchStatusCodes, network_splitSitemap as splitSitemap, network_statusCodeToText as statusCodeToText, network_typeNumberToLabel as typeNumberToLabel, network_validateDomain as validateDomain, network_validateHeaderName as validateHeaderName, network_validateHeaderValue as validateHeaderValue, network_validateManifest as validateManifest, network_validateRobotsTxt as validateRobotsTxt, network_validateSitemap as validateSitemap };
|
|
1054
|
+
export { type network_AcceptLanguageEntry as AcceptLanguageEntry, type network_AcceptLanguageResult as AcceptLanguageResult, type network_AuthResultEntry as AuthResultEntry, type network_BuildRangeHeaderOptions as BuildRangeHeaderOptions, network_CLIENT_HINTS as CLIENT_HINTS, type network_CacheControlDirective as CacheControlDirective, type network_CacheControlOptions as CacheControlOptions, type network_CacheControlResult as CacheControlResult, type network_ClientHintDef as ClientHintDef, type network_ClientHintValueType as ClientHintValueType, type network_ClientHintsBuildResult as ClientHintsBuildResult, type network_ClientHintsParseResult as ClientHintsParseResult, type network_CloseCodeInfo as CloseCodeInfo, type network_CloseCodeRange as CloseCodeRange, type network_ContentDispositionBuildOptions as ContentDispositionBuildOptions, type network_ContentDispositionBuildResult as ContentDispositionBuildResult, type network_ContentDispositionParseResult as ContentDispositionParseResult, type network_ContentRangeResult as ContentRangeResult, type network_ContentTypeRiskResult as ContentTypeRiskResult, type network_ContentTypeSniffRisk as ContentTypeSniffRisk, 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_ManifestIconInfo as ManifestIconInfo, type network_ManifestIssue as ManifestIssue, type network_ManifestValidationResult as ManifestValidationResult, network_PERMISSIONS_POLICY_FEATURES as PERMISSIONS_POLICY_FEATURES, type network_ParsedClientHint as ParsedClientHint, type network_ParsedDnsResult as ParsedDnsResult, type network_ParsedGeoResult as ParsedGeoResult, type network_PermissionsPolicyDirective as PermissionsPolicyDirective, type network_PermissionsPolicyFeatureInput as PermissionsPolicyFeatureInput, type network_PermissionsPolicyResult as PermissionsPolicyResult, type network_PreferParameter as PreferParameter, type network_PreferPreference as PreferPreference, type network_PreferResult as PreferResult, type network_PriorityResult as PriorityResult, 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_RetryAfterDateResult as RetryAfterDateResult, type network_RetryAfterResult as RetryAfterResult, type network_RetryAfterSecondsResult as RetryAfterSecondsResult, 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_SitemapSplitFile as SitemapSplitFile, type network_SitemapUrlEntry as SitemapUrlEntry, type network_SitemapValidationResult as SitemapValidationResult, type network_SplitSitemapOptions as SplitSitemapOptions, type network_SplitSitemapResult as SplitSitemapResult, 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, type network_XContentTypeOptionsHeader as XContentTypeOptionsHeader, type network_XContentTypeOptionsParseResult as XContentTypeOptionsParseResult, network_X_CONTENT_TYPE_OPTIONS_HEADER as X_CONTENT_TYPE_OPTIONS_HEADER, network_analyzeEmailHeaders as analyzeEmailHeaders, network_assessContentTypeRisk as assessContentTypeRisk, network_buildAcceptLanguage as buildAcceptLanguage, network_buildCacheControl as buildCacheControl, network_buildClientHints as buildClientHints, network_buildContentDisposition as buildContentDisposition, network_buildDnsQueryUrl as buildDnsQueryUrl, network_buildGeoUrl as buildGeoUrl, network_buildLinkHeader as buildLinkHeader, network_buildMapUrl as buildMapUrl, network_buildPermissionsPolicy as buildPermissionsPolicy, network_buildPreferHeader as buildPreferHeader, network_buildPriorityHeader as buildPriorityHeader, network_buildRangeHeader as buildRangeHeader, network_buildReferrerPolicy as buildReferrerPolicy, network_buildRetryAfterHeader as buildRetryAfterHeader, network_buildVaryHeader as buildVaryHeader, network_buildXContentTypeOptionsHeader as buildXContentTypeOptionsHeader, 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_listCloseCodes as listCloseCodes, network_lookupCloseCode as lookupCloseCode, network_parseAcceptLanguage as parseAcceptLanguage, network_parseClientHintHeaders as parseClientHintHeaders, network_parseContentDisposition as parseContentDisposition, network_parseContentRangeHeader as parseContentRangeHeader, network_parseDnsResponse as parseDnsResponse, network_parseGeoResponse as parseGeoResponse, network_parseHar as parseHar, network_parseIpv6Address as parseIpv6Address, network_parsePermissionsPolicy as parsePermissionsPolicy, network_parsePreferHeader as parsePreferHeader, network_parsePriorityHeader as parsePriorityHeader, network_parseRetryAfterHeader as parseRetryAfterHeader, network_parseUserAgent as parseUserAgent, network_parseVaryHeader as parseVaryHeader, network_parseXContentTypeOptionsHeader as parseXContentTypeOptionsHeader, network_searchHeaders as searchHeaders, network_searchStatusCodes as searchStatusCodes, network_splitSitemap as splitSitemap, network_statusCodeToText as statusCodeToText, network_typeNumberToLabel as typeNumberToLabel, network_validateDomain as validateDomain, network_validateHeaderName as validateHeaderName, network_validateHeaderValue as validateHeaderValue, network_validateManifest as validateManifest, network_validateRobotsTxt as validateRobotsTxt, network_validateSitemap as validateSitemap };
|
|
995
1055
|
}
|
|
996
1056
|
|
|
997
|
-
export { type
|
|
1057
|
+
export { type PreferParameter as $, type AcceptLanguageEntry as A, type BuildRangeHeaderOptions as B, CLIENT_HINTS as C, DNS_RECORD_TYPES as D, type EmailHeaderAnalysis as E, type HarSummary as F, type GeoResult as G, HTTP_HEADERS as H, type HeaderCategory as I, type HttpHeader as J, type Ipv6AddressType as K, type Ipv6ParseResult as L, LINK_REL_VALUES as M, type LinkHeaderEntry as N, type LinkHeaderEntryInput as O, type LinkHeaderResult as P, type LinkRel as Q, type ManifestIconInfo as R, type ManifestIssue as S, type ManifestValidationResult as T, PERMISSIONS_POLICY_FEATURES as U, type ParsedClientHint as V, type ParsedDnsResult as W, type ParsedGeoResult as X, type PermissionsPolicyDirective as Y, type PermissionsPolicyFeatureInput as Z, type PermissionsPolicyResult as _, type AcceptLanguageResult as a, isServerError as a$, type PreferPreference as a0, type PreferResult as a1, type PriorityResult as a2, REFERRER_POLICY_VALUES as a3, type RangeEntry as a4, type RangeEntryInput as a5, type RangeHeaderResult as a6, type ReceivedHop as a7, type ReferrerPolicyEntry as a8, type ReferrerPolicyResult as a9, assessContentTypeRisk as aA, buildAcceptLanguage as aB, buildCacheControl as aC, buildClientHints as aD, buildContentDisposition as aE, buildDnsQueryUrl as aF, buildGeoUrl as aG, buildLinkHeader as aH, buildMapUrl as aI, buildPermissionsPolicy as aJ, buildPreferHeader as aK, buildPriorityHeader as aL, buildRangeHeader as aM, buildReferrerPolicy as aN, buildRetryAfterHeader as aO, buildVaryHeader as aP, buildXContentTypeOptionsHeader as aQ, checkSetCookieHeader as aR, countryCodeToFlag as aS, formatCoordinates as aT, formatTtl as aU, getByCategory as aV, getHeader as aW, getHeadersByCategory as aX, getStatusByCategory as aY, getStatusCode as aZ, isClientError as a_, type ReferrerPolicyValue as aa, type RetryAfterDateResult as ab, type RetryAfterResult as ac, type RetryAfterSecondsResult as ad, type RobotsGroup as ae, type RobotsIssue as af, type RobotsRule as ag, type RobotsValidationResult as ah, STATUS_CODES as ai, type SameSiteValue as aj, type SitemapIndexEntry as ak, type SitemapIssue as al, type SitemapSplitFile as am, type SitemapUrlEntry as an, type SitemapValidationResult as ao, type SplitSitemapOptions as ap, type SplitSitemapResult as aq, type StatusCode as ar, type UaDeviceType as as, type UserAgentInfo as at, type VaryHeaderEntry as au, type VaryHeaderResult as av, type XContentTypeOptionsHeader as aw, type XContentTypeOptionsParseResult as ax, X_CONTENT_TYPE_OPTIONS_HEADER as ay, analyzeEmailHeaders as az, type AuthResultEntry as b, isSuccess as b0, isValidIp as b1, isValidIpv4 as b2, isValidIpv6 as b3, listCloseCodes as b4, lookupCloseCode as b5, parseAcceptLanguage as b6, parseClientHintHeaders as b7, parseContentDisposition as b8, parseContentRangeHeader as b9, parseDnsResponse as ba, parseGeoResponse as bb, parseHar as bc, parseIpv6Address as bd, parsePermissionsPolicy as be, parsePreferHeader as bf, parsePriorityHeader as bg, parseRetryAfterHeader as bh, parseUserAgent as bi, parseVaryHeader as bj, parseXContentTypeOptionsHeader as bk, searchHeaders as bl, searchStatusCodes as bm, splitSitemap as bn, statusCodeToText as bo, typeNumberToLabel as bp, validateDomain as bq, validateHeaderName as br, validateHeaderValue as bs, validateManifest as bt, validateRobotsTxt as bu, validateSitemap as bv, type CacheControlDirective as c, type CacheControlOptions as d, type CacheControlResult as e, type ClientHintDef as f, type ClientHintValueType as g, type ClientHintsBuildResult as h, type ClientHintsParseResult as i, type CloseCodeInfo as j, type CloseCodeRange as k, type ContentDispositionBuildOptions as l, type ContentDispositionBuildResult as m, network as n, type ContentDispositionParseResult as o, type ContentRangeResult as p, type ContentTypeRiskResult as q, type ContentTypeSniffRisk as r, type CookieAttributes as s, type CookieCheckResult as t, type DnsRecord as u, type DnsRecordType as v, type DnsResponse as w, type EmailHeaderField as x, type HarEntry as y, type HarParseResult as z };
|
|
@@ -25,6 +25,8 @@
|
|
|
25
25
|
* - accept-language-parser: parseAcceptLanguage, buildAcceptLanguage
|
|
26
26
|
* - prefer-header: buildPreferHeader, parsePreferHeader
|
|
27
27
|
* - retry-after-builder: buildRetryAfterHeader, parseRetryAfterHeader
|
|
28
|
+
* - priority-header: buildPriorityHeader, parsePriorityHeader
|
|
29
|
+
* - websocket-close-codes: lookupCloseCode, listCloseCodes
|
|
28
30
|
*/
|
|
29
31
|
declare const DNS_RECORD_TYPES: readonly ["A", "AAAA", "CNAME", "MX", "TXT", "NS", "SOA", "PTR", "SRV", "CAA"];
|
|
30
32
|
type DnsRecordType = typeof DNS_RECORD_TYPES[number];
|
|
@@ -847,6 +849,57 @@ declare function buildRetryAfterHeader(input: {
|
|
|
847
849
|
declare function parseRetryAfterHeader(raw: string): RetryAfterResult | {
|
|
848
850
|
error: string;
|
|
849
851
|
};
|
|
852
|
+
interface PriorityResult {
|
|
853
|
+
header: string;
|
|
854
|
+
headerValue: string;
|
|
855
|
+
urgency: number;
|
|
856
|
+
incremental: boolean;
|
|
857
|
+
}
|
|
858
|
+
/**
|
|
859
|
+
* Build a `Priority` request/response-header value from an urgency (0-7,
|
|
860
|
+
* default 3) and/or an incremental flag, per RFC 9218. At least one of the
|
|
861
|
+
* two must be given; the omitted one falls back to its spec default.
|
|
862
|
+
*/
|
|
863
|
+
declare function buildPriorityHeader(input: {
|
|
864
|
+
urgency?: number;
|
|
865
|
+
incremental?: boolean;
|
|
866
|
+
}): PriorityResult | {
|
|
867
|
+
error: string;
|
|
868
|
+
};
|
|
869
|
+
/**
|
|
870
|
+
* Parse an existing `Priority` header value (with or without a leading
|
|
871
|
+
* `Priority:` label) into its urgency and incremental fields, per RFC 9218.
|
|
872
|
+
* Any field not present in the input falls back to its spec default (u=3,
|
|
873
|
+
* i=false). Unrecognized dictionary members are ignored for forward
|
|
874
|
+
* compatibility, as the spec requires.
|
|
875
|
+
*/
|
|
876
|
+
declare function parsePriorityHeader(raw: string): PriorityResult | {
|
|
877
|
+
error: string;
|
|
878
|
+
};
|
|
879
|
+
type CloseCodeRange = 'standard' | 'reserved-future' | 'library-framework' | 'private-use';
|
|
880
|
+
interface CloseCodeInfo {
|
|
881
|
+
code: number;
|
|
882
|
+
name: string;
|
|
883
|
+
description: string;
|
|
884
|
+
range: CloseCodeRange;
|
|
885
|
+
sentOnWire: boolean;
|
|
886
|
+
}
|
|
887
|
+
/**
|
|
888
|
+
* List every well-known WebSocket close code (1000-1015) defined directly
|
|
889
|
+
* by RFC 6455, in ascending order.
|
|
890
|
+
*/
|
|
891
|
+
declare function listCloseCodes(): CloseCodeInfo[];
|
|
892
|
+
/**
|
|
893
|
+
* Look up what a WebSocket close code means, per the RFC 6455 close code
|
|
894
|
+
* definitions and the IANA WebSocket Close Code Number Registry's reserved
|
|
895
|
+
* ranges. Codes 1000-1015 return their specific well-known meaning; codes
|
|
896
|
+
* 3000-3999 and 4000-4999 return the meaning of their reserved range, since
|
|
897
|
+
* those ranges are allocated to individual libraries/applications rather
|
|
898
|
+
* than having a single fixed meaning.
|
|
899
|
+
*/
|
|
900
|
+
declare function lookupCloseCode(code: number): CloseCodeInfo | {
|
|
901
|
+
error: string;
|
|
902
|
+
};
|
|
850
903
|
|
|
851
904
|
type network_AcceptLanguageEntry = AcceptLanguageEntry;
|
|
852
905
|
type network_AcceptLanguageResult = AcceptLanguageResult;
|
|
@@ -860,6 +913,8 @@ type network_ClientHintDef = ClientHintDef;
|
|
|
860
913
|
type network_ClientHintValueType = ClientHintValueType;
|
|
861
914
|
type network_ClientHintsBuildResult = ClientHintsBuildResult;
|
|
862
915
|
type network_ClientHintsParseResult = ClientHintsParseResult;
|
|
916
|
+
type network_CloseCodeInfo = CloseCodeInfo;
|
|
917
|
+
type network_CloseCodeRange = CloseCodeRange;
|
|
863
918
|
type network_ContentDispositionBuildOptions = ContentDispositionBuildOptions;
|
|
864
919
|
type network_ContentDispositionBuildResult = ContentDispositionBuildResult;
|
|
865
920
|
type network_ContentDispositionParseResult = ContentDispositionParseResult;
|
|
@@ -901,6 +956,7 @@ type network_PermissionsPolicyResult = PermissionsPolicyResult;
|
|
|
901
956
|
type network_PreferParameter = PreferParameter;
|
|
902
957
|
type network_PreferPreference = PreferPreference;
|
|
903
958
|
type network_PreferResult = PreferResult;
|
|
959
|
+
type network_PriorityResult = PriorityResult;
|
|
904
960
|
declare const network_REFERRER_POLICY_VALUES: typeof REFERRER_POLICY_VALUES;
|
|
905
961
|
type network_RangeEntry = RangeEntry;
|
|
906
962
|
type network_RangeEntryInput = RangeEntryInput;
|
|
@@ -945,6 +1001,7 @@ declare const network_buildLinkHeader: typeof buildLinkHeader;
|
|
|
945
1001
|
declare const network_buildMapUrl: typeof buildMapUrl;
|
|
946
1002
|
declare const network_buildPermissionsPolicy: typeof buildPermissionsPolicy;
|
|
947
1003
|
declare const network_buildPreferHeader: typeof buildPreferHeader;
|
|
1004
|
+
declare const network_buildPriorityHeader: typeof buildPriorityHeader;
|
|
948
1005
|
declare const network_buildRangeHeader: typeof buildRangeHeader;
|
|
949
1006
|
declare const network_buildReferrerPolicy: typeof buildReferrerPolicy;
|
|
950
1007
|
declare const network_buildRetryAfterHeader: typeof buildRetryAfterHeader;
|
|
@@ -965,6 +1022,8 @@ declare const network_isSuccess: typeof isSuccess;
|
|
|
965
1022
|
declare const network_isValidIp: typeof isValidIp;
|
|
966
1023
|
declare const network_isValidIpv4: typeof isValidIpv4;
|
|
967
1024
|
declare const network_isValidIpv6: typeof isValidIpv6;
|
|
1025
|
+
declare const network_listCloseCodes: typeof listCloseCodes;
|
|
1026
|
+
declare const network_lookupCloseCode: typeof lookupCloseCode;
|
|
968
1027
|
declare const network_parseAcceptLanguage: typeof parseAcceptLanguage;
|
|
969
1028
|
declare const network_parseClientHintHeaders: typeof parseClientHintHeaders;
|
|
970
1029
|
declare const network_parseContentDisposition: typeof parseContentDisposition;
|
|
@@ -975,6 +1034,7 @@ declare const network_parseHar: typeof parseHar;
|
|
|
975
1034
|
declare const network_parseIpv6Address: typeof parseIpv6Address;
|
|
976
1035
|
declare const network_parsePermissionsPolicy: typeof parsePermissionsPolicy;
|
|
977
1036
|
declare const network_parsePreferHeader: typeof parsePreferHeader;
|
|
1037
|
+
declare const network_parsePriorityHeader: typeof parsePriorityHeader;
|
|
978
1038
|
declare const network_parseRetryAfterHeader: typeof parseRetryAfterHeader;
|
|
979
1039
|
declare const network_parseUserAgent: typeof parseUserAgent;
|
|
980
1040
|
declare const network_parseVaryHeader: typeof parseVaryHeader;
|
|
@@ -991,7 +1051,7 @@ declare const network_validateManifest: typeof validateManifest;
|
|
|
991
1051
|
declare const network_validateRobotsTxt: typeof validateRobotsTxt;
|
|
992
1052
|
declare const network_validateSitemap: typeof validateSitemap;
|
|
993
1053
|
declare namespace network {
|
|
994
|
-
export { type network_AcceptLanguageEntry as AcceptLanguageEntry, type network_AcceptLanguageResult as AcceptLanguageResult, type network_AuthResultEntry as AuthResultEntry, type network_BuildRangeHeaderOptions as BuildRangeHeaderOptions, network_CLIENT_HINTS as CLIENT_HINTS, type network_CacheControlDirective as CacheControlDirective, type network_CacheControlOptions as CacheControlOptions, type network_CacheControlResult as CacheControlResult, type network_ClientHintDef as ClientHintDef, type network_ClientHintValueType as ClientHintValueType, type network_ClientHintsBuildResult as ClientHintsBuildResult, type network_ClientHintsParseResult as ClientHintsParseResult, type network_ContentDispositionBuildOptions as ContentDispositionBuildOptions, type network_ContentDispositionBuildResult as ContentDispositionBuildResult, type network_ContentDispositionParseResult as ContentDispositionParseResult, type network_ContentRangeResult as ContentRangeResult, type network_ContentTypeRiskResult as ContentTypeRiskResult, type network_ContentTypeSniffRisk as ContentTypeSniffRisk, 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_ManifestIconInfo as ManifestIconInfo, type network_ManifestIssue as ManifestIssue, type network_ManifestValidationResult as ManifestValidationResult, network_PERMISSIONS_POLICY_FEATURES as PERMISSIONS_POLICY_FEATURES, type network_ParsedClientHint as ParsedClientHint, type network_ParsedDnsResult as ParsedDnsResult, type network_ParsedGeoResult as ParsedGeoResult, type network_PermissionsPolicyDirective as PermissionsPolicyDirective, type network_PermissionsPolicyFeatureInput as PermissionsPolicyFeatureInput, type network_PermissionsPolicyResult as PermissionsPolicyResult, type network_PreferParameter as PreferParameter, type network_PreferPreference as PreferPreference, type network_PreferResult as PreferResult, 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_RetryAfterDateResult as RetryAfterDateResult, type network_RetryAfterResult as RetryAfterResult, type network_RetryAfterSecondsResult as RetryAfterSecondsResult, 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_SitemapSplitFile as SitemapSplitFile, type network_SitemapUrlEntry as SitemapUrlEntry, type network_SitemapValidationResult as SitemapValidationResult, type network_SplitSitemapOptions as SplitSitemapOptions, type network_SplitSitemapResult as SplitSitemapResult, 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, type network_XContentTypeOptionsHeader as XContentTypeOptionsHeader, type network_XContentTypeOptionsParseResult as XContentTypeOptionsParseResult, network_X_CONTENT_TYPE_OPTIONS_HEADER as X_CONTENT_TYPE_OPTIONS_HEADER, network_analyzeEmailHeaders as analyzeEmailHeaders, network_assessContentTypeRisk as assessContentTypeRisk, network_buildAcceptLanguage as buildAcceptLanguage, network_buildCacheControl as buildCacheControl, network_buildClientHints as buildClientHints, network_buildContentDisposition as buildContentDisposition, network_buildDnsQueryUrl as buildDnsQueryUrl, network_buildGeoUrl as buildGeoUrl, network_buildLinkHeader as buildLinkHeader, network_buildMapUrl as buildMapUrl, network_buildPermissionsPolicy as buildPermissionsPolicy, network_buildPreferHeader as buildPreferHeader, network_buildRangeHeader as buildRangeHeader, network_buildReferrerPolicy as buildReferrerPolicy, network_buildRetryAfterHeader as buildRetryAfterHeader, network_buildVaryHeader as buildVaryHeader, network_buildXContentTypeOptionsHeader as buildXContentTypeOptionsHeader, 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_parseAcceptLanguage as parseAcceptLanguage, network_parseClientHintHeaders as parseClientHintHeaders, network_parseContentDisposition as parseContentDisposition, network_parseContentRangeHeader as parseContentRangeHeader, network_parseDnsResponse as parseDnsResponse, network_parseGeoResponse as parseGeoResponse, network_parseHar as parseHar, network_parseIpv6Address as parseIpv6Address, network_parsePermissionsPolicy as parsePermissionsPolicy, network_parsePreferHeader as parsePreferHeader, network_parseRetryAfterHeader as parseRetryAfterHeader, network_parseUserAgent as parseUserAgent, network_parseVaryHeader as parseVaryHeader, network_parseXContentTypeOptionsHeader as parseXContentTypeOptionsHeader, network_searchHeaders as searchHeaders, network_searchStatusCodes as searchStatusCodes, network_splitSitemap as splitSitemap, network_statusCodeToText as statusCodeToText, network_typeNumberToLabel as typeNumberToLabel, network_validateDomain as validateDomain, network_validateHeaderName as validateHeaderName, network_validateHeaderValue as validateHeaderValue, network_validateManifest as validateManifest, network_validateRobotsTxt as validateRobotsTxt, network_validateSitemap as validateSitemap };
|
|
1054
|
+
export { type network_AcceptLanguageEntry as AcceptLanguageEntry, type network_AcceptLanguageResult as AcceptLanguageResult, type network_AuthResultEntry as AuthResultEntry, type network_BuildRangeHeaderOptions as BuildRangeHeaderOptions, network_CLIENT_HINTS as CLIENT_HINTS, type network_CacheControlDirective as CacheControlDirective, type network_CacheControlOptions as CacheControlOptions, type network_CacheControlResult as CacheControlResult, type network_ClientHintDef as ClientHintDef, type network_ClientHintValueType as ClientHintValueType, type network_ClientHintsBuildResult as ClientHintsBuildResult, type network_ClientHintsParseResult as ClientHintsParseResult, type network_CloseCodeInfo as CloseCodeInfo, type network_CloseCodeRange as CloseCodeRange, type network_ContentDispositionBuildOptions as ContentDispositionBuildOptions, type network_ContentDispositionBuildResult as ContentDispositionBuildResult, type network_ContentDispositionParseResult as ContentDispositionParseResult, type network_ContentRangeResult as ContentRangeResult, type network_ContentTypeRiskResult as ContentTypeRiskResult, type network_ContentTypeSniffRisk as ContentTypeSniffRisk, 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_ManifestIconInfo as ManifestIconInfo, type network_ManifestIssue as ManifestIssue, type network_ManifestValidationResult as ManifestValidationResult, network_PERMISSIONS_POLICY_FEATURES as PERMISSIONS_POLICY_FEATURES, type network_ParsedClientHint as ParsedClientHint, type network_ParsedDnsResult as ParsedDnsResult, type network_ParsedGeoResult as ParsedGeoResult, type network_PermissionsPolicyDirective as PermissionsPolicyDirective, type network_PermissionsPolicyFeatureInput as PermissionsPolicyFeatureInput, type network_PermissionsPolicyResult as PermissionsPolicyResult, type network_PreferParameter as PreferParameter, type network_PreferPreference as PreferPreference, type network_PreferResult as PreferResult, type network_PriorityResult as PriorityResult, 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_RetryAfterDateResult as RetryAfterDateResult, type network_RetryAfterResult as RetryAfterResult, type network_RetryAfterSecondsResult as RetryAfterSecondsResult, 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_SitemapSplitFile as SitemapSplitFile, type network_SitemapUrlEntry as SitemapUrlEntry, type network_SitemapValidationResult as SitemapValidationResult, type network_SplitSitemapOptions as SplitSitemapOptions, type network_SplitSitemapResult as SplitSitemapResult, 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, type network_XContentTypeOptionsHeader as XContentTypeOptionsHeader, type network_XContentTypeOptionsParseResult as XContentTypeOptionsParseResult, network_X_CONTENT_TYPE_OPTIONS_HEADER as X_CONTENT_TYPE_OPTIONS_HEADER, network_analyzeEmailHeaders as analyzeEmailHeaders, network_assessContentTypeRisk as assessContentTypeRisk, network_buildAcceptLanguage as buildAcceptLanguage, network_buildCacheControl as buildCacheControl, network_buildClientHints as buildClientHints, network_buildContentDisposition as buildContentDisposition, network_buildDnsQueryUrl as buildDnsQueryUrl, network_buildGeoUrl as buildGeoUrl, network_buildLinkHeader as buildLinkHeader, network_buildMapUrl as buildMapUrl, network_buildPermissionsPolicy as buildPermissionsPolicy, network_buildPreferHeader as buildPreferHeader, network_buildPriorityHeader as buildPriorityHeader, network_buildRangeHeader as buildRangeHeader, network_buildReferrerPolicy as buildReferrerPolicy, network_buildRetryAfterHeader as buildRetryAfterHeader, network_buildVaryHeader as buildVaryHeader, network_buildXContentTypeOptionsHeader as buildXContentTypeOptionsHeader, 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_listCloseCodes as listCloseCodes, network_lookupCloseCode as lookupCloseCode, network_parseAcceptLanguage as parseAcceptLanguage, network_parseClientHintHeaders as parseClientHintHeaders, network_parseContentDisposition as parseContentDisposition, network_parseContentRangeHeader as parseContentRangeHeader, network_parseDnsResponse as parseDnsResponse, network_parseGeoResponse as parseGeoResponse, network_parseHar as parseHar, network_parseIpv6Address as parseIpv6Address, network_parsePermissionsPolicy as parsePermissionsPolicy, network_parsePreferHeader as parsePreferHeader, network_parsePriorityHeader as parsePriorityHeader, network_parseRetryAfterHeader as parseRetryAfterHeader, network_parseUserAgent as parseUserAgent, network_parseVaryHeader as parseVaryHeader, network_parseXContentTypeOptionsHeader as parseXContentTypeOptionsHeader, network_searchHeaders as searchHeaders, network_searchStatusCodes as searchStatusCodes, network_splitSitemap as splitSitemap, network_statusCodeToText as statusCodeToText, network_typeNumberToLabel as typeNumberToLabel, network_validateDomain as validateDomain, network_validateHeaderName as validateHeaderName, network_validateHeaderValue as validateHeaderValue, network_validateManifest as validateManifest, network_validateRobotsTxt as validateRobotsTxt, network_validateSitemap as validateSitemap };
|
|
995
1055
|
}
|
|
996
1056
|
|
|
997
|
-
export { type
|
|
1057
|
+
export { type PreferParameter as $, type AcceptLanguageEntry as A, type BuildRangeHeaderOptions as B, CLIENT_HINTS as C, DNS_RECORD_TYPES as D, type EmailHeaderAnalysis as E, type HarSummary as F, type GeoResult as G, HTTP_HEADERS as H, type HeaderCategory as I, type HttpHeader as J, type Ipv6AddressType as K, type Ipv6ParseResult as L, LINK_REL_VALUES as M, type LinkHeaderEntry as N, type LinkHeaderEntryInput as O, type LinkHeaderResult as P, type LinkRel as Q, type ManifestIconInfo as R, type ManifestIssue as S, type ManifestValidationResult as T, PERMISSIONS_POLICY_FEATURES as U, type ParsedClientHint as V, type ParsedDnsResult as W, type ParsedGeoResult as X, type PermissionsPolicyDirective as Y, type PermissionsPolicyFeatureInput as Z, type PermissionsPolicyResult as _, type AcceptLanguageResult as a, isServerError as a$, type PreferPreference as a0, type PreferResult as a1, type PriorityResult as a2, REFERRER_POLICY_VALUES as a3, type RangeEntry as a4, type RangeEntryInput as a5, type RangeHeaderResult as a6, type ReceivedHop as a7, type ReferrerPolicyEntry as a8, type ReferrerPolicyResult as a9, assessContentTypeRisk as aA, buildAcceptLanguage as aB, buildCacheControl as aC, buildClientHints as aD, buildContentDisposition as aE, buildDnsQueryUrl as aF, buildGeoUrl as aG, buildLinkHeader as aH, buildMapUrl as aI, buildPermissionsPolicy as aJ, buildPreferHeader as aK, buildPriorityHeader as aL, buildRangeHeader as aM, buildReferrerPolicy as aN, buildRetryAfterHeader as aO, buildVaryHeader as aP, buildXContentTypeOptionsHeader as aQ, checkSetCookieHeader as aR, countryCodeToFlag as aS, formatCoordinates as aT, formatTtl as aU, getByCategory as aV, getHeader as aW, getHeadersByCategory as aX, getStatusByCategory as aY, getStatusCode as aZ, isClientError as a_, type ReferrerPolicyValue as aa, type RetryAfterDateResult as ab, type RetryAfterResult as ac, type RetryAfterSecondsResult as ad, type RobotsGroup as ae, type RobotsIssue as af, type RobotsRule as ag, type RobotsValidationResult as ah, STATUS_CODES as ai, type SameSiteValue as aj, type SitemapIndexEntry as ak, type SitemapIssue as al, type SitemapSplitFile as am, type SitemapUrlEntry as an, type SitemapValidationResult as ao, type SplitSitemapOptions as ap, type SplitSitemapResult as aq, type StatusCode as ar, type UaDeviceType as as, type UserAgentInfo as at, type VaryHeaderEntry as au, type VaryHeaderResult as av, type XContentTypeOptionsHeader as aw, type XContentTypeOptionsParseResult as ax, X_CONTENT_TYPE_OPTIONS_HEADER as ay, analyzeEmailHeaders as az, type AuthResultEntry as b, isSuccess as b0, isValidIp as b1, isValidIpv4 as b2, isValidIpv6 as b3, listCloseCodes as b4, lookupCloseCode as b5, parseAcceptLanguage as b6, parseClientHintHeaders as b7, parseContentDisposition as b8, parseContentRangeHeader as b9, parseDnsResponse as ba, parseGeoResponse as bb, parseHar as bc, parseIpv6Address as bd, parsePermissionsPolicy as be, parsePreferHeader as bf, parsePriorityHeader as bg, parseRetryAfterHeader as bh, parseUserAgent as bi, parseVaryHeader as bj, parseXContentTypeOptionsHeader as bk, searchHeaders as bl, searchStatusCodes as bm, splitSitemap as bn, statusCodeToText as bo, typeNumberToLabel as bp, validateDomain as bq, validateHeaderName as br, validateHeaderValue as bs, validateManifest as bt, validateRobotsTxt as bu, validateSitemap as bv, type CacheControlDirective as c, type CacheControlOptions as d, type CacheControlResult as e, type ClientHintDef as f, type ClientHintValueType as g, type ClientHintsBuildResult as h, type ClientHintsParseResult as i, type CloseCodeInfo as j, type CloseCodeRange as k, type ContentDispositionBuildOptions as l, type ContentDispositionBuildResult as m, network as n, type ContentDispositionParseResult as o, type ContentRangeResult as p, type ContentTypeRiskResult as q, type ContentTypeSniffRisk as r, type CookieAttributes as s, type CookieCheckResult as t, type DnsRecord as u, type DnsRecordType as v, type DnsResponse as w, type EmailHeaderField as x, type HarEntry as y, type HarParseResult as z };
|
package/dist/tools/network.cjs
CHANGED
|
@@ -2951,6 +2951,97 @@ function parseRetryAfterHeader(raw) {
|
|
|
2951
2951
|
const httpDate = parsed.toUTCString();
|
|
2952
2952
|
return { header: `Retry-After: ${httpDate}`, headerValue: httpDate, type: "http-date", httpDate, iso: parsed.toISOString() };
|
|
2953
2953
|
}
|
|
2954
|
+
function isValidUrgency(n) {
|
|
2955
|
+
return typeof n === "number" && Number.isInteger(n) && n >= 0 && n <= 7;
|
|
2956
|
+
}
|
|
2957
|
+
function buildPriorityHeader(input) {
|
|
2958
|
+
const { urgency, incremental } = input ?? {};
|
|
2959
|
+
if (urgency === void 0 && incremental === void 0) {
|
|
2960
|
+
return { error: "Provide at least one of urgency or incremental" };
|
|
2961
|
+
}
|
|
2962
|
+
if (urgency !== void 0 && !isValidUrgency(urgency)) {
|
|
2963
|
+
return { error: "urgency must be an integer between 0 and 7" };
|
|
2964
|
+
}
|
|
2965
|
+
const parts = [];
|
|
2966
|
+
if (urgency !== void 0) parts.push(`u=${urgency}`);
|
|
2967
|
+
if (incremental === true) parts.push("i");
|
|
2968
|
+
else if (incremental === false) parts.push("i=?0");
|
|
2969
|
+
const headerValue = parts.join(", ");
|
|
2970
|
+
return {
|
|
2971
|
+
header: `Priority: ${headerValue}`,
|
|
2972
|
+
headerValue,
|
|
2973
|
+
urgency: urgency ?? 3,
|
|
2974
|
+
incremental: incremental ?? false
|
|
2975
|
+
};
|
|
2976
|
+
}
|
|
2977
|
+
function parsePriorityHeader(raw) {
|
|
2978
|
+
if (!raw || raw.trim() === "") return { error: "Input is empty" };
|
|
2979
|
+
const withoutLabel = raw.trim().replace(/^priority:\s*/i, "");
|
|
2980
|
+
const parts = withoutLabel.split(",").map((p) => p.trim()).filter((p) => p.length > 0);
|
|
2981
|
+
if (parts.length === 0) return { error: "Input is empty" };
|
|
2982
|
+
let urgency = 3;
|
|
2983
|
+
let incremental = false;
|
|
2984
|
+
for (const part of parts) {
|
|
2985
|
+
const eq = part.indexOf("=");
|
|
2986
|
+
const key = (eq === -1 ? part : part.slice(0, eq)).trim();
|
|
2987
|
+
const rawValue = eq === -1 ? void 0 : part.slice(eq + 1).trim();
|
|
2988
|
+
if (key === "u") {
|
|
2989
|
+
if (rawValue === void 0 || !/^\d+$/.test(rawValue)) return { error: `Invalid urgency value in "${part}"` };
|
|
2990
|
+
const n = Number(rawValue);
|
|
2991
|
+
if (n < 0 || n > 7) return { error: `urgency must be between 0 and 7, got ${n}` };
|
|
2992
|
+
urgency = n;
|
|
2993
|
+
} else if (key === "i") {
|
|
2994
|
+
if (rawValue === void 0 || rawValue === "?1") incremental = true;
|
|
2995
|
+
else if (rawValue === "?0") incremental = false;
|
|
2996
|
+
else return { error: `Invalid incremental value in "${part}"` };
|
|
2997
|
+
}
|
|
2998
|
+
}
|
|
2999
|
+
const headerValue = incremental ? `u=${urgency}, i` : `u=${urgency}, i=?0`;
|
|
3000
|
+
return { header: `Priority: ${headerValue}`, headerValue, urgency, incremental };
|
|
3001
|
+
}
|
|
3002
|
+
var WELL_KNOWN_CLOSE_CODES = {
|
|
3003
|
+
1e3: { name: "Normal Closure", description: "The connection successfully completed the purpose for which it was created.", sentOnWire: true },
|
|
3004
|
+
1001: { name: "Going Away", description: "An endpoint is going away, such as a server shutting down or a browser navigating away from the page.", sentOnWire: true },
|
|
3005
|
+
1002: { name: "Protocol Error", description: "An endpoint is terminating the connection due to a protocol error.", sentOnWire: true },
|
|
3006
|
+
1003: { name: "Unsupported Data", description: "An endpoint received a data type it cannot accept, such as a binary-only endpoint receiving a text message.", sentOnWire: true },
|
|
3007
|
+
1004: { name: "Reserved", description: "Reserved. A meaning might be defined in the future.", sentOnWire: true },
|
|
3008
|
+
1005: { name: "No Status Received", description: "A reserved value used internally by libraries to indicate no status code was actually present in the close frame. Must not be sent on the wire.", sentOnWire: false },
|
|
3009
|
+
1006: { name: "Abnormal Closure", description: "A reserved value used internally by libraries to indicate the connection closed without a close frame, e.g. the TCP connection dropped. Must not be sent on the wire.", sentOnWire: false },
|
|
3010
|
+
1007: { name: "Invalid frame payload data", description: "An endpoint is terminating the connection because it received data inconsistent with the message type, such as non-UTF-8 data in a text message.", sentOnWire: true },
|
|
3011
|
+
1008: { name: "Policy Violation", description: "A generic status code used when no other code fits and the endpoint does not want to reveal further details, or a message violated its policy.", sentOnWire: true },
|
|
3012
|
+
1009: { name: "Message Too Big", description: "An endpoint is terminating the connection because it received a message too large to process.", sentOnWire: true },
|
|
3013
|
+
1010: { name: "Mandatory Extension", description: "A client is terminating the connection because the server did not negotiate one or more extensions the client required.", sentOnWire: true },
|
|
3014
|
+
1011: { name: "Internal Error", description: "A server is terminating the connection because it encountered an unexpected condition that prevented it from fulfilling the request.", sentOnWire: true },
|
|
3015
|
+
1012: { name: "Service Restart", description: "The server is terminating the connection because it is restarting.", sentOnWire: true },
|
|
3016
|
+
1013: { name: "Try Again Later", description: "The server is terminating the connection due to a temporary condition, such as being overloaded, and the client should reconnect later.", sentOnWire: true },
|
|
3017
|
+
1014: { name: "Bad Gateway", description: "The server, acting as a gateway or proxy, received an invalid response from an upstream server it connected to while processing the request.", sentOnWire: true },
|
|
3018
|
+
1015: { name: "TLS Handshake", description: "A reserved value used internally by libraries to indicate the TLS handshake failed. Must not be sent on the wire.", sentOnWire: false }
|
|
3019
|
+
};
|
|
3020
|
+
function listCloseCodes() {
|
|
3021
|
+
return Object.entries(WELL_KNOWN_CLOSE_CODES).map(([code, info]) => ({ code: Number(code), name: info.name, description: info.description, range: "standard", sentOnWire: info.sentOnWire })).sort((a, b) => a.code - b.code);
|
|
3022
|
+
}
|
|
3023
|
+
function lookupCloseCode(code) {
|
|
3024
|
+
if (typeof code !== "number" || !Number.isInteger(code) || code < 0 || code > 65535) {
|
|
3025
|
+
return { error: "code must be an integer between 0 and 65535" };
|
|
3026
|
+
}
|
|
3027
|
+
const known = WELL_KNOWN_CLOSE_CODES[code];
|
|
3028
|
+
if (known) {
|
|
3029
|
+
return { code, name: known.name, description: known.description, range: "standard", sentOnWire: known.sentOnWire };
|
|
3030
|
+
}
|
|
3031
|
+
if (code < 1e3) {
|
|
3032
|
+
return { error: `${code} is not a valid WebSocket close code; codes below 1000 are not permitted on the wire` };
|
|
3033
|
+
}
|
|
3034
|
+
if (code <= 2999) {
|
|
3035
|
+
return { code, name: "Unassigned", description: "Reserved for future use by the WebSocket protocol specification. No meaning is defined yet.", range: "reserved-future", sentOnWire: true };
|
|
3036
|
+
}
|
|
3037
|
+
if (code <= 3999) {
|
|
3038
|
+
return { code, name: "Library/Framework Use", description: "Reserved for use by libraries, frameworks, and applications. Codes in this range are meant to be registered directly with IANA in the WebSocket Close Code Number Registry, so their meaning depends on which library or application defined them.", range: "library-framework", sentOnWire: true };
|
|
3039
|
+
}
|
|
3040
|
+
if (code <= 4999) {
|
|
3041
|
+
return { code, name: "Private Use", description: "Reserved for private use between a specific client and server implementation. These codes cannot be registered with IANA, so their meaning is defined entirely by the application using them.", range: "private-use", sentOnWire: true };
|
|
3042
|
+
}
|
|
3043
|
+
return { error: `${code} is outside the defined close code ranges (0-4999); codes 5000 and above have no assigned meaning` };
|
|
3044
|
+
}
|
|
2954
3045
|
|
|
2955
3046
|
exports.CLIENT_HINTS = CLIENT_HINTS;
|
|
2956
3047
|
exports.DNS_RECORD_TYPES = DNS_RECORD_TYPES;
|
|
@@ -2972,6 +3063,7 @@ exports.buildLinkHeader = buildLinkHeader;
|
|
|
2972
3063
|
exports.buildMapUrl = buildMapUrl;
|
|
2973
3064
|
exports.buildPermissionsPolicy = buildPermissionsPolicy;
|
|
2974
3065
|
exports.buildPreferHeader = buildPreferHeader;
|
|
3066
|
+
exports.buildPriorityHeader = buildPriorityHeader;
|
|
2975
3067
|
exports.buildRangeHeader = buildRangeHeader;
|
|
2976
3068
|
exports.buildReferrerPolicy = buildReferrerPolicy;
|
|
2977
3069
|
exports.buildRetryAfterHeader = buildRetryAfterHeader;
|
|
@@ -2992,6 +3084,8 @@ exports.isSuccess = isSuccess;
|
|
|
2992
3084
|
exports.isValidIp = isValidIp;
|
|
2993
3085
|
exports.isValidIpv4 = isValidIpv4;
|
|
2994
3086
|
exports.isValidIpv6 = isValidIpv6;
|
|
3087
|
+
exports.listCloseCodes = listCloseCodes;
|
|
3088
|
+
exports.lookupCloseCode = lookupCloseCode;
|
|
2995
3089
|
exports.parseAcceptLanguage = parseAcceptLanguage;
|
|
2996
3090
|
exports.parseClientHintHeaders = parseClientHintHeaders;
|
|
2997
3091
|
exports.parseContentDisposition = parseContentDisposition;
|
|
@@ -3002,6 +3096,7 @@ exports.parseHar = parseHar;
|
|
|
3002
3096
|
exports.parseIpv6Address = parseIpv6Address;
|
|
3003
3097
|
exports.parsePermissionsPolicy = parsePermissionsPolicy;
|
|
3004
3098
|
exports.parsePreferHeader = parsePreferHeader;
|
|
3099
|
+
exports.parsePriorityHeader = parsePriorityHeader;
|
|
3005
3100
|
exports.parseRetryAfterHeader = parseRetryAfterHeader;
|
|
3006
3101
|
exports.parseUserAgent = parseUserAgent;
|
|
3007
3102
|
exports.parseVaryHeader = parseVaryHeader;
|
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
|
|
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 HttpHeader, K as Ipv6AddressType, L as Ipv6ParseResult, M as LINK_REL_VALUES, N as LinkHeaderEntry, O as LinkHeaderEntryInput, P as LinkHeaderResult, Q as LinkRel, R as ManifestIconInfo, S as ManifestIssue, T as ManifestValidationResult, U as PERMISSIONS_POLICY_FEATURES, V as ParsedClientHint, W as ParsedDnsResult, X as ParsedGeoResult, Y as PermissionsPolicyDirective, Z as PermissionsPolicyFeatureInput, _ as PermissionsPolicyResult, $ as PreferParameter, a0 as PreferPreference, a1 as PreferResult, a2 as PriorityResult, a3 as REFERRER_POLICY_VALUES, a4 as RangeEntry, a5 as RangeEntryInput, a6 as RangeHeaderResult, a7 as ReceivedHop, a8 as ReferrerPolicyEntry, a9 as ReferrerPolicyResult, aa as ReferrerPolicyValue, ab as RetryAfterDateResult, ac as RetryAfterResult, ad as RetryAfterSecondsResult, ae as RobotsGroup, af as RobotsIssue, ag as RobotsRule, ah as RobotsValidationResult, ai as STATUS_CODES, aj as SameSiteValue, ak as SitemapIndexEntry, al as SitemapIssue, am as SitemapSplitFile, an as SitemapUrlEntry, ao as SitemapValidationResult, ap as SplitSitemapOptions, aq as SplitSitemapResult, ar as StatusCode, as as UaDeviceType, at as UserAgentInfo, au as VaryHeaderEntry, av as VaryHeaderResult, aw as XContentTypeOptionsHeader, ax as XContentTypeOptionsParseResult, ay as X_CONTENT_TYPE_OPTIONS_HEADER, az as analyzeEmailHeaders, aA as assessContentTypeRisk, aB as buildAcceptLanguage, aC as buildCacheControl, aD as buildClientHints, aE as buildContentDisposition, aF as buildDnsQueryUrl, aG as buildGeoUrl, aH as buildLinkHeader, aI as buildMapUrl, aJ as buildPermissionsPolicy, aK as buildPreferHeader, aL as buildPriorityHeader, aM as buildRangeHeader, aN as buildReferrerPolicy, aO as buildRetryAfterHeader, aP as buildVaryHeader, aQ as buildXContentTypeOptionsHeader, aR as checkSetCookieHeader, aS as countryCodeToFlag, aT as formatCoordinates, aU as formatTtl, aV as getByCategory, aW as getHeader, aX as getHeadersByCategory, aY as getStatusByCategory, aZ as getStatusCode, a_ as isClientError, a$ as isServerError, b0 as isSuccess, b1 as isValidIp, b2 as isValidIpv4, b3 as isValidIpv6, b4 as listCloseCodes, b5 as lookupCloseCode, b6 as parseAcceptLanguage, b7 as parseClientHintHeaders, b8 as parseContentDisposition, b9 as parseContentRangeHeader, ba as parseDnsResponse, bb as parseGeoResponse, bc as parseHar, bd as parseIpv6Address, be as parsePermissionsPolicy, bf as parsePreferHeader, bg as parsePriorityHeader, bh as parseRetryAfterHeader, bi as parseUserAgent, bj as parseVaryHeader, bk as parseXContentTypeOptionsHeader, bl as searchHeaders, bm as searchStatusCodes, bn as splitSitemap, bo as statusCodeToText, bp as typeNumberToLabel, bq as validateDomain, br as validateHeaderName, bs as validateHeaderValue, bt as validateManifest, bu as validateRobotsTxt, bv as validateSitemap } from '../network-DewFJy4E.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
|
|
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 HttpHeader, K as Ipv6AddressType, L as Ipv6ParseResult, M as LINK_REL_VALUES, N as LinkHeaderEntry, O as LinkHeaderEntryInput, P as LinkHeaderResult, Q as LinkRel, R as ManifestIconInfo, S as ManifestIssue, T as ManifestValidationResult, U as PERMISSIONS_POLICY_FEATURES, V as ParsedClientHint, W as ParsedDnsResult, X as ParsedGeoResult, Y as PermissionsPolicyDirective, Z as PermissionsPolicyFeatureInput, _ as PermissionsPolicyResult, $ as PreferParameter, a0 as PreferPreference, a1 as PreferResult, a2 as PriorityResult, a3 as REFERRER_POLICY_VALUES, a4 as RangeEntry, a5 as RangeEntryInput, a6 as RangeHeaderResult, a7 as ReceivedHop, a8 as ReferrerPolicyEntry, a9 as ReferrerPolicyResult, aa as ReferrerPolicyValue, ab as RetryAfterDateResult, ac as RetryAfterResult, ad as RetryAfterSecondsResult, ae as RobotsGroup, af as RobotsIssue, ag as RobotsRule, ah as RobotsValidationResult, ai as STATUS_CODES, aj as SameSiteValue, ak as SitemapIndexEntry, al as SitemapIssue, am as SitemapSplitFile, an as SitemapUrlEntry, ao as SitemapValidationResult, ap as SplitSitemapOptions, aq as SplitSitemapResult, ar as StatusCode, as as UaDeviceType, at as UserAgentInfo, au as VaryHeaderEntry, av as VaryHeaderResult, aw as XContentTypeOptionsHeader, ax as XContentTypeOptionsParseResult, ay as X_CONTENT_TYPE_OPTIONS_HEADER, az as analyzeEmailHeaders, aA as assessContentTypeRisk, aB as buildAcceptLanguage, aC as buildCacheControl, aD as buildClientHints, aE as buildContentDisposition, aF as buildDnsQueryUrl, aG as buildGeoUrl, aH as buildLinkHeader, aI as buildMapUrl, aJ as buildPermissionsPolicy, aK as buildPreferHeader, aL as buildPriorityHeader, aM as buildRangeHeader, aN as buildReferrerPolicy, aO as buildRetryAfterHeader, aP as buildVaryHeader, aQ as buildXContentTypeOptionsHeader, aR as checkSetCookieHeader, aS as countryCodeToFlag, aT as formatCoordinates, aU as formatTtl, aV as getByCategory, aW as getHeader, aX as getHeadersByCategory, aY as getStatusByCategory, aZ as getStatusCode, a_ as isClientError, a$ as isServerError, b0 as isSuccess, b1 as isValidIp, b2 as isValidIpv4, b3 as isValidIpv6, b4 as listCloseCodes, b5 as lookupCloseCode, b6 as parseAcceptLanguage, b7 as parseClientHintHeaders, b8 as parseContentDisposition, b9 as parseContentRangeHeader, ba as parseDnsResponse, bb as parseGeoResponse, bc as parseHar, bd as parseIpv6Address, be as parsePermissionsPolicy, bf as parsePreferHeader, bg as parsePriorityHeader, bh as parseRetryAfterHeader, bi as parseUserAgent, bj as parseVaryHeader, bk as parseXContentTypeOptionsHeader, bl as searchHeaders, bm as searchStatusCodes, bn as splitSitemap, bo as statusCodeToText, bp as typeNumberToLabel, bq as validateDomain, br as validateHeaderName, bs as validateHeaderValue, bt as validateManifest, bu as validateRobotsTxt, bv as validateSitemap } from '../network-DewFJy4E.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, buildRangeHeader, buildReferrerPolicy, buildRetryAfterHeader, buildVaryHeader, buildXContentTypeOptionsHeader, checkSetCookieHeader, countryCodeToFlag, formatCoordinates, formatTtl, getByCategory, getHeader, getHeadersByCategory, getStatusByCategory, getStatusCode, isClientError, isServerError, isSuccess, isValidIp, isValidIpv4, isValidIpv6, parseAcceptLanguage, parseClientHintHeaders, parseContentDisposition, parseContentRangeHeader, parseDnsResponse, parseGeoResponse, parseHar, parseIpv6Address, parsePermissionsPolicy, parsePreferHeader, 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, buildLinkHeader, buildMapUrl, buildPermissionsPolicy, buildPreferHeader, buildPriorityHeader, buildRangeHeader, buildReferrerPolicy, buildRetryAfterHeader, buildVaryHeader, buildXContentTypeOptionsHeader, checkSetCookieHeader, countryCodeToFlag, formatCoordinates, formatTtl, getByCategory, getHeader, getHeadersByCategory, getStatusByCategory, getStatusCode, isClientError, isServerError, isSuccess, isValidIp, isValidIpv4, isValidIpv6, listCloseCodes, lookupCloseCode, parseAcceptLanguage, parseClientHintHeaders, parseContentDisposition, parseContentRangeHeader, parseDnsResponse, parseGeoResponse, parseHar, parseIpv6Address, parsePermissionsPolicy, parsePreferHeader, parsePriorityHeader, parseRetryAfterHeader, parseUserAgent, parseVaryHeader, parseXContentTypeOptionsHeader, searchHeaders, searchStatusCodes, splitSitemap, statusCodeToText, typeNumberToLabel, validateDomain, validateHeaderName, validateHeaderValue, validateManifest, validateRobotsTxt, validateSitemap } from '../chunk-43L7H3L2.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.62.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",
|