@utilix-tech/sdk 0.63.0 → 0.65.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/README.md +18 -5
- package/dist/{chunk-YTH76KAF.js → chunk-4HNHEOJL.js} +23 -1
- package/dist/{chunk-QY2M2UHJ.js → chunk-HJVSH7FQ.js} +137 -1
- package/dist/{chunk-43L7H3L2.js → chunk-KEZLVYR3.js} +134 -1
- package/dist/{data-vxXrBlWh.d.ts → data-26TALa9U.d.cts} +35 -2
- package/dist/{data-vxXrBlWh.d.cts → data-26TALa9U.d.ts} +35 -2
- package/dist/index.cjs +291 -0
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/{network-DewFJy4E.d.cts → network-DT-OMHWV.d.cts} +73 -2
- package/dist/{network-DewFJy4E.d.ts → network-DT-OMHWV.d.ts} +73 -2
- package/dist/tools/data.cjs +136 -0
- package/dist/tools/data.d.cts +1 -1
- package/dist/tools/data.d.ts +1 -1
- package/dist/tools/data.js +1 -1
- package/dist/tools/network.cjs +133 -0
- package/dist/tools/network.d.cts +1 -1
- package/dist/tools/network.d.ts +1 -1
- package/dist/tools/network.js +1 -1
- package/dist/tools/units.cjs +22 -0
- package/dist/tools/units.d.cts +1 -1
- package/dist/tools/units.d.ts +1 -1
- package/dist/tools/units.js +1 -1
- package/dist/{units-CLJ16Zzv.d.cts → units-DPefgzmH.d.cts} +24 -2
- package/dist/{units-CLJ16Zzv.d.ts → units-DPefgzmH.d.ts} +24 -2
- package/package.json +1 -1
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
* - retry-after-builder: buildRetryAfterHeader, parseRetryAfterHeader
|
|
28
28
|
* - priority-header: buildPriorityHeader, parsePriorityHeader
|
|
29
29
|
* - websocket-close-codes: lookupCloseCode, listCloseCodes
|
|
30
|
+
* - hsts-header-builder: buildHsts, parseHsts
|
|
30
31
|
*/
|
|
31
32
|
declare const DNS_RECORD_TYPES: readonly ["A", "AAAA", "CNAME", "MX", "TXT", "NS", "SOA", "PTR", "SRV", "CAA"];
|
|
32
33
|
type DnsRecordType = typeof DNS_RECORD_TYPES[number];
|
|
@@ -900,6 +901,68 @@ declare function listCloseCodes(): CloseCodeInfo[];
|
|
|
900
901
|
declare function lookupCloseCode(code: number): CloseCodeInfo | {
|
|
901
902
|
error: string;
|
|
902
903
|
};
|
|
904
|
+
interface MultipartPart {
|
|
905
|
+
name: string | null;
|
|
906
|
+
filename: string | null;
|
|
907
|
+
headers: Record<string, string>;
|
|
908
|
+
value: string;
|
|
909
|
+
isBinary: boolean;
|
|
910
|
+
}
|
|
911
|
+
interface MultipartParseResult {
|
|
912
|
+
boundary: string;
|
|
913
|
+
parts: MultipartPart[];
|
|
914
|
+
}
|
|
915
|
+
/**
|
|
916
|
+
* Extract the `boundary` parameter from a `Content-Type: multipart/form-data;
|
|
917
|
+
* boundary=...` header value. Returns null if the header has no boundary
|
|
918
|
+
* parameter, e.g. because it isn't a multipart Content-Type at all.
|
|
919
|
+
*/
|
|
920
|
+
declare function extractMultipartBoundary(contentType: string): string | null;
|
|
921
|
+
/**
|
|
922
|
+
* Parse a raw multipart/form-data request body into its individual parts:
|
|
923
|
+
* field name, filename (if the part is a file field), headers, and decoded
|
|
924
|
+
* value, per RFC 7578. The body must use the same boundary the request's
|
|
925
|
+
* Content-Type header declared.
|
|
926
|
+
*/
|
|
927
|
+
declare function parseMultipartFormData(body: string, boundary: string): MultipartParseResult | {
|
|
928
|
+
error: string;
|
|
929
|
+
};
|
|
930
|
+
interface HstsOptions {
|
|
931
|
+
maxAge: number;
|
|
932
|
+
includeSubDomains?: boolean;
|
|
933
|
+
preload?: boolean;
|
|
934
|
+
}
|
|
935
|
+
interface HstsResult {
|
|
936
|
+
header: string;
|
|
937
|
+
headerName: 'Strict-Transport-Security';
|
|
938
|
+
snippet: string;
|
|
939
|
+
maxAge: number;
|
|
940
|
+
maxAgeHuman: string;
|
|
941
|
+
includeSubDomains: boolean;
|
|
942
|
+
preload: boolean;
|
|
943
|
+
preloadEligible: boolean;
|
|
944
|
+
warnings: string[];
|
|
945
|
+
}
|
|
946
|
+
/**
|
|
947
|
+
* Build a `Strict-Transport-Security` response-header value from a max-age
|
|
948
|
+
* (in seconds) plus the optional `includeSubDomains` and `preload`
|
|
949
|
+
* directives, flagging combinations that won't qualify for browser HSTS
|
|
950
|
+
* preload lists (which require max-age >= 1 year, includeSubDomains, and
|
|
951
|
+
* preload all together). Pure string assembly; it never inspects a live
|
|
952
|
+
* origin or checks the actual hstspreload.org submission list.
|
|
953
|
+
*/
|
|
954
|
+
declare function buildHsts(options: HstsOptions): HstsResult | {
|
|
955
|
+
error: string;
|
|
956
|
+
};
|
|
957
|
+
/**
|
|
958
|
+
* Parse an existing `Strict-Transport-Security` header value (with or
|
|
959
|
+
* without a leading `Strict-Transport-Security:` label) into the same
|
|
960
|
+
* shape `buildHsts` returns, for explaining a header you found on a real
|
|
961
|
+
* response rather than building one from scratch.
|
|
962
|
+
*/
|
|
963
|
+
declare function parseHsts(raw: string): HstsResult | {
|
|
964
|
+
error: string;
|
|
965
|
+
};
|
|
903
966
|
|
|
904
967
|
type network_AcceptLanguageEntry = AcceptLanguageEntry;
|
|
905
968
|
type network_AcceptLanguageResult = AcceptLanguageResult;
|
|
@@ -935,6 +998,8 @@ type network_HarEntry = HarEntry;
|
|
|
935
998
|
type network_HarParseResult = HarParseResult;
|
|
936
999
|
type network_HarSummary = HarSummary;
|
|
937
1000
|
type network_HeaderCategory = HeaderCategory;
|
|
1001
|
+
type network_HstsOptions = HstsOptions;
|
|
1002
|
+
type network_HstsResult = HstsResult;
|
|
938
1003
|
type network_HttpHeader = HttpHeader;
|
|
939
1004
|
type network_Ipv6AddressType = Ipv6AddressType;
|
|
940
1005
|
type network_Ipv6ParseResult = Ipv6ParseResult;
|
|
@@ -946,6 +1011,8 @@ type network_LinkRel = LinkRel;
|
|
|
946
1011
|
type network_ManifestIconInfo = ManifestIconInfo;
|
|
947
1012
|
type network_ManifestIssue = ManifestIssue;
|
|
948
1013
|
type network_ManifestValidationResult = ManifestValidationResult;
|
|
1014
|
+
type network_MultipartParseResult = MultipartParseResult;
|
|
1015
|
+
type network_MultipartPart = MultipartPart;
|
|
949
1016
|
declare const network_PERMISSIONS_POLICY_FEATURES: typeof PERMISSIONS_POLICY_FEATURES;
|
|
950
1017
|
type network_ParsedClientHint = ParsedClientHint;
|
|
951
1018
|
type network_ParsedDnsResult = ParsedDnsResult;
|
|
@@ -997,6 +1064,7 @@ declare const network_buildClientHints: typeof buildClientHints;
|
|
|
997
1064
|
declare const network_buildContentDisposition: typeof buildContentDisposition;
|
|
998
1065
|
declare const network_buildDnsQueryUrl: typeof buildDnsQueryUrl;
|
|
999
1066
|
declare const network_buildGeoUrl: typeof buildGeoUrl;
|
|
1067
|
+
declare const network_buildHsts: typeof buildHsts;
|
|
1000
1068
|
declare const network_buildLinkHeader: typeof buildLinkHeader;
|
|
1001
1069
|
declare const network_buildMapUrl: typeof buildMapUrl;
|
|
1002
1070
|
declare const network_buildPermissionsPolicy: typeof buildPermissionsPolicy;
|
|
@@ -1009,6 +1077,7 @@ declare const network_buildVaryHeader: typeof buildVaryHeader;
|
|
|
1009
1077
|
declare const network_buildXContentTypeOptionsHeader: typeof buildXContentTypeOptionsHeader;
|
|
1010
1078
|
declare const network_checkSetCookieHeader: typeof checkSetCookieHeader;
|
|
1011
1079
|
declare const network_countryCodeToFlag: typeof countryCodeToFlag;
|
|
1080
|
+
declare const network_extractMultipartBoundary: typeof extractMultipartBoundary;
|
|
1012
1081
|
declare const network_formatCoordinates: typeof formatCoordinates;
|
|
1013
1082
|
declare const network_formatTtl: typeof formatTtl;
|
|
1014
1083
|
declare const network_getByCategory: typeof getByCategory;
|
|
@@ -1031,7 +1100,9 @@ declare const network_parseContentRangeHeader: typeof parseContentRangeHeader;
|
|
|
1031
1100
|
declare const network_parseDnsResponse: typeof parseDnsResponse;
|
|
1032
1101
|
declare const network_parseGeoResponse: typeof parseGeoResponse;
|
|
1033
1102
|
declare const network_parseHar: typeof parseHar;
|
|
1103
|
+
declare const network_parseHsts: typeof parseHsts;
|
|
1034
1104
|
declare const network_parseIpv6Address: typeof parseIpv6Address;
|
|
1105
|
+
declare const network_parseMultipartFormData: typeof parseMultipartFormData;
|
|
1035
1106
|
declare const network_parsePermissionsPolicy: typeof parsePermissionsPolicy;
|
|
1036
1107
|
declare const network_parsePreferHeader: typeof parsePreferHeader;
|
|
1037
1108
|
declare const network_parsePriorityHeader: typeof parsePriorityHeader;
|
|
@@ -1051,7 +1122,7 @@ declare const network_validateManifest: typeof validateManifest;
|
|
|
1051
1122
|
declare const network_validateRobotsTxt: typeof validateRobotsTxt;
|
|
1052
1123
|
declare const network_validateSitemap: typeof validateSitemap;
|
|
1053
1124
|
declare namespace network {
|
|
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 };
|
|
1125
|
+
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_HstsOptions as HstsOptions, type network_HstsResult as HstsResult, 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, type network_MultipartParseResult as MultipartParseResult, type network_MultipartPart as MultipartPart, 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_buildHsts as buildHsts, 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_extractMultipartBoundary as extractMultipartBoundary, 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_parseHsts as parseHsts, network_parseIpv6Address as parseIpv6Address, network_parseMultipartFormData as parseMultipartFormData, 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 };
|
|
1055
1126
|
}
|
|
1056
1127
|
|
|
1057
|
-
export { type
|
|
1128
|
+
export { type ParsedGeoResult 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 HstsOptions as J, type HstsResult as K, type HttpHeader as L, type Ipv6AddressType as M, type Ipv6ParseResult as N, LINK_REL_VALUES as O, type LinkHeaderEntry as P, type LinkHeaderEntryInput as Q, type LinkHeaderResult as R, type LinkRel as S, type ManifestIconInfo as T, type ManifestIssue as U, type ManifestValidationResult as V, type MultipartParseResult as W, type MultipartPart as X, PERMISSIONS_POLICY_FEATURES as Y, type ParsedClientHint as Z, type ParsedDnsResult as _, type AcceptLanguageResult as a, getByCategory as a$, type PermissionsPolicyDirective as a0, type PermissionsPolicyFeatureInput as a1, type PermissionsPolicyResult as a2, type PreferParameter as a3, type PreferPreference as a4, type PreferResult as a5, type PriorityResult as a6, REFERRER_POLICY_VALUES as a7, type RangeEntry as a8, type RangeEntryInput as a9, type XContentTypeOptionsHeader as aA, type XContentTypeOptionsParseResult as aB, X_CONTENT_TYPE_OPTIONS_HEADER as aC, analyzeEmailHeaders as aD, assessContentTypeRisk as aE, buildAcceptLanguage as aF, buildCacheControl as aG, buildClientHints as aH, buildContentDisposition as aI, buildDnsQueryUrl as aJ, buildGeoUrl as aK, buildHsts as aL, buildLinkHeader as aM, buildMapUrl as aN, buildPermissionsPolicy as aO, buildPreferHeader as aP, buildPriorityHeader as aQ, buildRangeHeader as aR, buildReferrerPolicy as aS, buildRetryAfterHeader as aT, buildVaryHeader as aU, buildXContentTypeOptionsHeader as aV, checkSetCookieHeader as aW, countryCodeToFlag as aX, extractMultipartBoundary as aY, formatCoordinates as aZ, formatTtl as a_, type RangeHeaderResult as aa, type ReceivedHop as ab, type ReferrerPolicyEntry as ac, type ReferrerPolicyResult as ad, type ReferrerPolicyValue as ae, type RetryAfterDateResult as af, type RetryAfterResult as ag, type RetryAfterSecondsResult as ah, type RobotsGroup as ai, type RobotsIssue as aj, type RobotsRule as ak, type RobotsValidationResult as al, STATUS_CODES as am, type SameSiteValue as an, type SitemapIndexEntry as ao, type SitemapIssue as ap, type SitemapSplitFile as aq, type SitemapUrlEntry as ar, type SitemapValidationResult as as, type SplitSitemapOptions as at, type SplitSitemapResult as au, type StatusCode as av, type UaDeviceType as aw, type UserAgentInfo as ax, type VaryHeaderEntry as ay, type VaryHeaderResult as az, type AuthResultEntry as b, getHeader as b0, getHeadersByCategory as b1, getStatusByCategory as b2, getStatusCode as b3, isClientError as b4, isServerError as b5, isSuccess as b6, isValidIp as b7, isValidIpv4 as b8, isValidIpv6 as b9, validateHeaderValue as bA, validateManifest as bB, validateRobotsTxt as bC, validateSitemap as bD, listCloseCodes as ba, lookupCloseCode as bb, parseAcceptLanguage as bc, parseClientHintHeaders as bd, parseContentDisposition as be, parseContentRangeHeader as bf, parseDnsResponse as bg, parseGeoResponse as bh, parseHar as bi, parseHsts as bj, parseIpv6Address as bk, parseMultipartFormData as bl, parsePermissionsPolicy as bm, parsePreferHeader as bn, parsePriorityHeader as bo, parseRetryAfterHeader as bp, parseUserAgent as bq, parseVaryHeader as br, parseXContentTypeOptionsHeader as bs, searchHeaders as bt, searchStatusCodes as bu, splitSitemap as bv, statusCodeToText as bw, typeNumberToLabel as bx, validateDomain as by, validateHeaderName as bz, 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/data.cjs
CHANGED
|
@@ -1773,7 +1773,143 @@ function calculateMarkdownTaskListProgress(markdown) {
|
|
|
1773
1773
|
});
|
|
1774
1774
|
return { totalItems, completedItems, percentComplete, sections, items };
|
|
1775
1775
|
}
|
|
1776
|
+
function _splitMarkdownTableRow(line) {
|
|
1777
|
+
const raw = [];
|
|
1778
|
+
let current = "";
|
|
1779
|
+
for (let i = 0; i < line.length; i++) {
|
|
1780
|
+
const ch = line[i];
|
|
1781
|
+
if (ch === "\\" && line[i + 1] === "|") {
|
|
1782
|
+
current += "\\|";
|
|
1783
|
+
i++;
|
|
1784
|
+
continue;
|
|
1785
|
+
}
|
|
1786
|
+
if (ch === "|") {
|
|
1787
|
+
raw.push(current);
|
|
1788
|
+
current = "";
|
|
1789
|
+
continue;
|
|
1790
|
+
}
|
|
1791
|
+
current += ch;
|
|
1792
|
+
}
|
|
1793
|
+
raw.push(current);
|
|
1794
|
+
const cells = raw.map((c) => c.trim());
|
|
1795
|
+
if (cells.length > 1 && cells[0] === "") cells.shift();
|
|
1796
|
+
if (cells.length > 1 && cells[cells.length - 1] === "") cells.pop();
|
|
1797
|
+
return cells;
|
|
1798
|
+
}
|
|
1799
|
+
function _isMarkdownTableDelimiterRow(line) {
|
|
1800
|
+
const trimmed = line.trim();
|
|
1801
|
+
if (trimmed === "" || !trimmed.includes("-")) return false;
|
|
1802
|
+
const cells = _splitMarkdownTableRow(trimmed);
|
|
1803
|
+
if (cells.length === 0) return false;
|
|
1804
|
+
return cells.every((c) => /^:?-+:?$/.test(c));
|
|
1805
|
+
}
|
|
1806
|
+
function _markdownTableCellAlignment(delimCell) {
|
|
1807
|
+
const left = delimCell.startsWith(":");
|
|
1808
|
+
const right = delimCell.endsWith(":");
|
|
1809
|
+
if (left && right) return "center";
|
|
1810
|
+
if (right) return "right";
|
|
1811
|
+
if (left) return "left";
|
|
1812
|
+
return "none";
|
|
1813
|
+
}
|
|
1814
|
+
function _padMarkdownTableCell(text, width, alignment) {
|
|
1815
|
+
const len = [...text].length;
|
|
1816
|
+
const diff = Math.max(0, width - len);
|
|
1817
|
+
if (alignment === "right") return " ".repeat(diff) + text;
|
|
1818
|
+
if (alignment === "center") {
|
|
1819
|
+
const left = Math.floor(diff / 2);
|
|
1820
|
+
const right = diff - left;
|
|
1821
|
+
return " ".repeat(left) + text + " ".repeat(right);
|
|
1822
|
+
}
|
|
1823
|
+
return text + " ".repeat(diff);
|
|
1824
|
+
}
|
|
1825
|
+
function _markdownTableDelimiterCell(width, alignment) {
|
|
1826
|
+
switch (alignment) {
|
|
1827
|
+
case "left":
|
|
1828
|
+
return ":" + "-".repeat(Math.max(1, width - 1));
|
|
1829
|
+
case "right":
|
|
1830
|
+
return "-".repeat(Math.max(1, width - 1)) + ":";
|
|
1831
|
+
case "center":
|
|
1832
|
+
return ":" + "-".repeat(Math.max(1, width - 2)) + ":";
|
|
1833
|
+
default:
|
|
1834
|
+
return "-".repeat(width);
|
|
1835
|
+
}
|
|
1836
|
+
}
|
|
1837
|
+
function alignMarkdownTables(markdown) {
|
|
1838
|
+
if (typeof markdown !== "string") return { error: "markdown must be a string" };
|
|
1839
|
+
const lines = markdown.replace(/\r\n/g, "\n").split("\n");
|
|
1840
|
+
const outputLines = [...lines];
|
|
1841
|
+
const tables = [];
|
|
1842
|
+
const warnings = [];
|
|
1843
|
+
let inFence = false;
|
|
1844
|
+
let fenceMarker = "";
|
|
1845
|
+
let i = 0;
|
|
1846
|
+
while (i < lines.length) {
|
|
1847
|
+
const line = lines[i];
|
|
1848
|
+
const fenceMatch = line.match(/^\s*(```+|~~~+)/);
|
|
1849
|
+
if (fenceMatch) {
|
|
1850
|
+
if (!inFence) {
|
|
1851
|
+
inFence = true;
|
|
1852
|
+
fenceMarker = fenceMatch[1][0];
|
|
1853
|
+
} else if (fenceMatch[1][0] === fenceMarker) {
|
|
1854
|
+
inFence = false;
|
|
1855
|
+
}
|
|
1856
|
+
i++;
|
|
1857
|
+
continue;
|
|
1858
|
+
}
|
|
1859
|
+
if (inFence) {
|
|
1860
|
+
i++;
|
|
1861
|
+
continue;
|
|
1862
|
+
}
|
|
1863
|
+
const nextLine = lines[i + 1];
|
|
1864
|
+
if (line.includes("|") && nextLine !== void 0 && _isMarkdownTableDelimiterRow(nextLine)) {
|
|
1865
|
+
const headerCells = _splitMarkdownTableRow(line);
|
|
1866
|
+
const delimCells = _splitMarkdownTableRow(nextLine);
|
|
1867
|
+
if (headerCells.length > 0 && headerCells.length === delimCells.length) {
|
|
1868
|
+
const columnCount = headerCells.length;
|
|
1869
|
+
const alignments = delimCells.map(_markdownTableCellAlignment);
|
|
1870
|
+
let j = i + 2;
|
|
1871
|
+
const bodyRows = [];
|
|
1872
|
+
while (j < lines.length && lines[j].trim() !== "" && lines[j].includes("|")) {
|
|
1873
|
+
bodyRows.push(_splitMarkdownTableRow(lines[j]));
|
|
1874
|
+
j++;
|
|
1875
|
+
}
|
|
1876
|
+
const normalizedBody = [];
|
|
1877
|
+
for (const row of bodyRows) {
|
|
1878
|
+
if (row.length !== columnCount) {
|
|
1879
|
+
warnings.push(`Table at line ${i + 1}: a row has ${row.length} cell(s) but the header has ${columnCount}; it was padded/truncated to match.`);
|
|
1880
|
+
}
|
|
1881
|
+
normalizedBody.push(Array.from({ length: columnCount }, (_, c) => row[c] ?? ""));
|
|
1882
|
+
}
|
|
1883
|
+
const allRows = [headerCells, ...normalizedBody];
|
|
1884
|
+
const widths = Array.from(
|
|
1885
|
+
{ length: columnCount },
|
|
1886
|
+
(_, c) => Math.max(3, ...allRows.map((r) => [...r[c] ?? ""].length))
|
|
1887
|
+
);
|
|
1888
|
+
const formattedHeader = "| " + headerCells.map((c, idx) => _padMarkdownTableCell(c, widths[idx], alignments[idx])).join(" | ") + " |";
|
|
1889
|
+
const formattedDelim = "| " + widths.map((w, idx) => _markdownTableDelimiterCell(w, alignments[idx])).join(" | ") + " |";
|
|
1890
|
+
const formattedBody = normalizedBody.map((row) => "| " + row.map((c, idx) => _padMarkdownTableCell(c, widths[idx], alignments[idx])).join(" | ") + " |");
|
|
1891
|
+
const formattedLines = [formattedHeader, formattedDelim, ...formattedBody];
|
|
1892
|
+
for (let k = 0; k < formattedLines.length; k++) {
|
|
1893
|
+
outputLines[i + k] = formattedLines[k];
|
|
1894
|
+
}
|
|
1895
|
+
tables.push({
|
|
1896
|
+
startLine: i + 1,
|
|
1897
|
+
endLine: i + formattedLines.length,
|
|
1898
|
+
columnCount,
|
|
1899
|
+
rowCount: normalizedBody.length,
|
|
1900
|
+
alignments
|
|
1901
|
+
});
|
|
1902
|
+
i = j;
|
|
1903
|
+
continue;
|
|
1904
|
+
}
|
|
1905
|
+
}
|
|
1906
|
+
i++;
|
|
1907
|
+
}
|
|
1908
|
+
if (tables.length === 0) return { error: "No Markdown tables found" };
|
|
1909
|
+
return { output: outputLines.join("\n"), tables, warnings };
|
|
1910
|
+
}
|
|
1776
1911
|
|
|
1912
|
+
exports.alignMarkdownTables = alignMarkdownTables;
|
|
1777
1913
|
exports.analyzeCaptionSpeed = analyzeCaptionSpeed;
|
|
1778
1914
|
exports.calculateMarkdownTaskListProgress = calculateMarkdownTaskListProgress;
|
|
1779
1915
|
exports.convertSubtitles = convertSubtitles;
|
package/dist/tools/data.d.cts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { C as CaptionSpeedCue, a as CaptionSpeedResult, b as ConvertedSubtitles, c as CsvColumnType, e as CsvColumnTypeInfo, f as CsvColumnTypeOptions, g as CsvColumnTypeResult, h as CsvDuplicateGroup, i as CsvDuplicateOptions, j as CsvDuplicateResult, k as CsvParseResult, l as CsvToSqlOptions, m as CsvToSqlResult, E as EnvDiffError, n as EnvDiffResult, o as EnvEntry, p as EnvParseResult, F as FrontMatterError, q as FrontMatterResult, I as IniSection, M as
|
|
1
|
+
export { C as CaptionSpeedCue, a as CaptionSpeedResult, b as ConvertedSubtitles, c as CsvColumnType, e as CsvColumnTypeInfo, f as CsvColumnTypeOptions, g as CsvColumnTypeResult, h as CsvDuplicateGroup, i as CsvDuplicateOptions, j as CsvDuplicateResult, k as CsvParseResult, l as CsvToSqlOptions, m as CsvToSqlResult, E as EnvDiffError, n as EnvDiffResult, o as EnvEntry, p as EnvParseResult, F as FrontMatterError, q as FrontMatterResult, I as IniSection, M as MarkdownTableAlignResult, r as MarkdownTableColumnAlignment, s as MarkdownTableInfo, t as MarkdownTaskListItem, u as MarkdownTaskListProgressResult, v as MarkdownTaskListSectionSummary, w as MarkdownTocEntry, x as MarkdownTocOptions, y as MarkdownTocResult, N as NdjsonDedupeResult, z as NdjsonLineResult, A as NdjsonValidateResult, P as ParseOptions, B as ParsedIni, D as ParsedSubtitles, S as SubtitleCue, G as SubtitleFormat, T as TomlFormatResult, V as ValidationResult, X as XmlFormatResult, H as XmlToJsonOptions, Y as YamlAnchorInfo, J as YamlAnchorResolveError, K as YamlAnchorResolveResult, L as alignMarkdownTables, O as analyzeCaptionSpeed, Q as calculateMarkdownTaskListProgress, R as convertSubtitles, U as csvToJson, W as csvToSqlInsert, Z as dedupeNdjson, _ as detectDelimiter, $ as detectSubtitleFormat, a0 as diffEnvExample, a1 as envToExport, a2 as envToJson, a3 as findCsvDuplicateRows, a4 as formatNdjson, a5 as formatSubtitleTimestamp, a6 as formatToml, a7 as formatXml, a8 as generateMarkdownToc, a9 as getSection, aa as getSectionNames, ab as getTomlStats, ac as getXmlStats, ad as getYamlStats, ae as inferCsvColumnTypes, af as iniToJson, ag as jsonArrayToNdjson, ah as jsonToIni, ai as jsonToToml, aj as jsonToXml, ak as minifyNdjson, al as minifyToml, am as minifyXml, an as ndjsonToJsonArray, ao as parseCsv, ap as parseEnv, aq as parseFrontMatter, ar as parseIni, as as parseSubtitleTimestamp, at as parseSubtitles, au as parseXmlToObject, av as resolveYamlAnchors, aw as serializeSubtitles, ax as shiftSubtitles, ay as stringifyIni, az as toCsvString, aA as tomlToJson, aB as validateEnvKey, aC as validateIni, aD as validateNdjson, aE as validateToml, aF as validateXml, aG as validateYaml, aH as xmlToJson } from '../data-26TALa9U.cjs';
|
package/dist/tools/data.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { C as CaptionSpeedCue, a as CaptionSpeedResult, b as ConvertedSubtitles, c as CsvColumnType, e as CsvColumnTypeInfo, f as CsvColumnTypeOptions, g as CsvColumnTypeResult, h as CsvDuplicateGroup, i as CsvDuplicateOptions, j as CsvDuplicateResult, k as CsvParseResult, l as CsvToSqlOptions, m as CsvToSqlResult, E as EnvDiffError, n as EnvDiffResult, o as EnvEntry, p as EnvParseResult, F as FrontMatterError, q as FrontMatterResult, I as IniSection, M as
|
|
1
|
+
export { C as CaptionSpeedCue, a as CaptionSpeedResult, b as ConvertedSubtitles, c as CsvColumnType, e as CsvColumnTypeInfo, f as CsvColumnTypeOptions, g as CsvColumnTypeResult, h as CsvDuplicateGroup, i as CsvDuplicateOptions, j as CsvDuplicateResult, k as CsvParseResult, l as CsvToSqlOptions, m as CsvToSqlResult, E as EnvDiffError, n as EnvDiffResult, o as EnvEntry, p as EnvParseResult, F as FrontMatterError, q as FrontMatterResult, I as IniSection, M as MarkdownTableAlignResult, r as MarkdownTableColumnAlignment, s as MarkdownTableInfo, t as MarkdownTaskListItem, u as MarkdownTaskListProgressResult, v as MarkdownTaskListSectionSummary, w as MarkdownTocEntry, x as MarkdownTocOptions, y as MarkdownTocResult, N as NdjsonDedupeResult, z as NdjsonLineResult, A as NdjsonValidateResult, P as ParseOptions, B as ParsedIni, D as ParsedSubtitles, S as SubtitleCue, G as SubtitleFormat, T as TomlFormatResult, V as ValidationResult, X as XmlFormatResult, H as XmlToJsonOptions, Y as YamlAnchorInfo, J as YamlAnchorResolveError, K as YamlAnchorResolveResult, L as alignMarkdownTables, O as analyzeCaptionSpeed, Q as calculateMarkdownTaskListProgress, R as convertSubtitles, U as csvToJson, W as csvToSqlInsert, Z as dedupeNdjson, _ as detectDelimiter, $ as detectSubtitleFormat, a0 as diffEnvExample, a1 as envToExport, a2 as envToJson, a3 as findCsvDuplicateRows, a4 as formatNdjson, a5 as formatSubtitleTimestamp, a6 as formatToml, a7 as formatXml, a8 as generateMarkdownToc, a9 as getSection, aa as getSectionNames, ab as getTomlStats, ac as getXmlStats, ad as getYamlStats, ae as inferCsvColumnTypes, af as iniToJson, ag as jsonArrayToNdjson, ah as jsonToIni, ai as jsonToToml, aj as jsonToXml, ak as minifyNdjson, al as minifyToml, am as minifyXml, an as ndjsonToJsonArray, ao as parseCsv, ap as parseEnv, aq as parseFrontMatter, ar as parseIni, as as parseSubtitleTimestamp, at as parseSubtitles, au as parseXmlToObject, av as resolveYamlAnchors, aw as serializeSubtitles, ax as shiftSubtitles, ay as stringifyIni, az as toCsvString, aA as tomlToJson, aB as validateEnvKey, aC as validateIni, aD as validateNdjson, aE as validateToml, aF as validateXml, aG as validateYaml, aH as xmlToJson } from '../data-26TALa9U.js';
|
package/dist/tools/data.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { analyzeCaptionSpeed, calculateMarkdownTaskListProgress, convertSubtitles, csvToJson, csvToSqlInsert, dedupeNdjson, detectDelimiter, detectSubtitleFormat, diffEnvExample, envToExport, envToJson, findCsvDuplicateRows, formatNdjson, formatSubtitleTimestamp, formatToml, formatXml, generateMarkdownToc, getSection, getSectionNames, getTomlStats, getXmlStats, getYamlStats, inferCsvColumnTypes, iniToJson, jsonArrayToNdjson, jsonToIni, jsonToToml, jsonToXml, minifyNdjson, minifyToml, minifyXml, ndjsonToJsonArray, parseCsv, parseEnv, parseFrontMatter, parseIni, parseSubtitleTimestamp, parseSubtitles, parseXmlToObject, resolveYamlAnchors, serializeSubtitles, shiftSubtitles, stringifyIni, toCsvString, tomlToJson, validateEnvKey, validateIni, validateNdjson, validateToml, validateXml, validateYaml, xmlToJson } from '../chunk-
|
|
1
|
+
export { alignMarkdownTables, analyzeCaptionSpeed, calculateMarkdownTaskListProgress, convertSubtitles, csvToJson, csvToSqlInsert, dedupeNdjson, detectDelimiter, detectSubtitleFormat, diffEnvExample, envToExport, envToJson, findCsvDuplicateRows, formatNdjson, formatSubtitleTimestamp, formatToml, formatXml, generateMarkdownToc, getSection, getSectionNames, getTomlStats, getXmlStats, getYamlStats, inferCsvColumnTypes, iniToJson, jsonArrayToNdjson, jsonToIni, jsonToToml, jsonToXml, minifyNdjson, minifyToml, minifyXml, ndjsonToJsonArray, parseCsv, parseEnv, parseFrontMatter, parseIni, parseSubtitleTimestamp, parseSubtitles, parseXmlToObject, resolveYamlAnchors, serializeSubtitles, shiftSubtitles, stringifyIni, toCsvString, tomlToJson, validateEnvKey, validateIni, validateNdjson, validateToml, validateXml, validateYaml, xmlToJson } from '../chunk-HJVSH7FQ.js';
|
|
2
2
|
import '../chunk-MLKGABMK.js';
|
package/dist/tools/network.cjs
CHANGED
|
@@ -3042,6 +3042,135 @@ function lookupCloseCode(code) {
|
|
|
3042
3042
|
}
|
|
3043
3043
|
return { error: `${code} is outside the defined close code ranges (0-4999); codes 5000 and above have no assigned meaning` };
|
|
3044
3044
|
}
|
|
3045
|
+
function extractMultipartBoundary(contentType) {
|
|
3046
|
+
if (!contentType) return null;
|
|
3047
|
+
const match = contentType.match(/boundary=(?:"([^"]*)"|([^;\s]+))/i);
|
|
3048
|
+
if (!match) return null;
|
|
3049
|
+
return match[1] ?? match[2] ?? null;
|
|
3050
|
+
}
|
|
3051
|
+
function parseMultipartFormData(body, boundary) {
|
|
3052
|
+
if (!body || !body.trim()) return { error: "Body is empty" };
|
|
3053
|
+
if (!boundary || !boundary.trim()) return { error: "Boundary is required" };
|
|
3054
|
+
const normalized = body.replace(/\r\n/g, "\n");
|
|
3055
|
+
const delimiter = `--${boundary}`;
|
|
3056
|
+
const segments = normalized.split(delimiter);
|
|
3057
|
+
if (segments.length < 3) {
|
|
3058
|
+
return { error: `No parts found for boundary "${boundary}"; check that it matches the boundary used in the body` };
|
|
3059
|
+
}
|
|
3060
|
+
const parts = [];
|
|
3061
|
+
for (let i = 1; i < segments.length; i++) {
|
|
3062
|
+
let segment = segments[i];
|
|
3063
|
+
if (segment.startsWith("--")) break;
|
|
3064
|
+
segment = segment.replace(/^\n/, "").replace(/\n$/, "");
|
|
3065
|
+
const headerEnd = segment.indexOf("\n\n");
|
|
3066
|
+
if (headerEnd === -1) continue;
|
|
3067
|
+
const headerBlock = segment.slice(0, headerEnd);
|
|
3068
|
+
const value = segment.slice(headerEnd + 2);
|
|
3069
|
+
const headers = {};
|
|
3070
|
+
for (const line of headerBlock.split("\n")) {
|
|
3071
|
+
const colon = line.indexOf(":");
|
|
3072
|
+
if (colon === -1) continue;
|
|
3073
|
+
headers[line.slice(0, colon).trim().toLowerCase()] = line.slice(colon + 1).trim();
|
|
3074
|
+
}
|
|
3075
|
+
const disposition = headers["content-disposition"] ?? "";
|
|
3076
|
+
const nameMatch = disposition.match(/name="([^"]*)"/);
|
|
3077
|
+
const filenameMatch = disposition.match(/filename="([^"]*)"/);
|
|
3078
|
+
const partContentType = headers["content-type"] ?? "";
|
|
3079
|
+
const isBinary = !!filenameMatch && !partContentType.startsWith("text/") && !partContentType.includes("json") && !partContentType.includes("xml");
|
|
3080
|
+
parts.push({
|
|
3081
|
+
name: nameMatch ? nameMatch[1] : null,
|
|
3082
|
+
filename: filenameMatch ? filenameMatch[1] : null,
|
|
3083
|
+
headers,
|
|
3084
|
+
value,
|
|
3085
|
+
isBinary
|
|
3086
|
+
});
|
|
3087
|
+
}
|
|
3088
|
+
if (parts.length === 0) {
|
|
3089
|
+
return { error: `No parts found for boundary "${boundary}"; check that it matches the boundary used in the body` };
|
|
3090
|
+
}
|
|
3091
|
+
return { boundary, parts };
|
|
3092
|
+
}
|
|
3093
|
+
var HSTS_ONE_YEAR_SECONDS = 31536e3;
|
|
3094
|
+
function _humanizeHstsMaxAge(seconds) {
|
|
3095
|
+
if (seconds === 0) return "0 seconds (clears HSTS)";
|
|
3096
|
+
if (seconds % HSTS_ONE_YEAR_SECONDS === 0) {
|
|
3097
|
+
const years = seconds / HSTS_ONE_YEAR_SECONDS;
|
|
3098
|
+
return `${years} year${years === 1 ? "" : "s"}`;
|
|
3099
|
+
}
|
|
3100
|
+
if (seconds % 86400 === 0) {
|
|
3101
|
+
const days = seconds / 86400;
|
|
3102
|
+
return `${days} day${days === 1 ? "" : "s"}`;
|
|
3103
|
+
}
|
|
3104
|
+
if (seconds % 3600 === 0) {
|
|
3105
|
+
const hours = seconds / 3600;
|
|
3106
|
+
return `${hours} hour${hours === 1 ? "" : "s"}`;
|
|
3107
|
+
}
|
|
3108
|
+
return `${seconds} second${seconds === 1 ? "" : "s"}`;
|
|
3109
|
+
}
|
|
3110
|
+
function buildHsts(options) {
|
|
3111
|
+
if (!options || typeof options !== "object") return { error: "maxAge is required" };
|
|
3112
|
+
const { maxAge, includeSubDomains = false, preload = false } = options;
|
|
3113
|
+
if (typeof maxAge !== "number" || !Number.isFinite(maxAge) || !Number.isInteger(maxAge) || maxAge < 0) {
|
|
3114
|
+
return { error: "maxAge must be a non-negative integer number of seconds" };
|
|
3115
|
+
}
|
|
3116
|
+
const warnings = [];
|
|
3117
|
+
const preloadEligible = maxAge >= HSTS_ONE_YEAR_SECONDS && includeSubDomains && preload;
|
|
3118
|
+
if (preload && !includeSubDomains) {
|
|
3119
|
+
warnings.push("Browser HSTS preload lists require includeSubDomains whenever preload is set; this header will not qualify for preloading as configured.");
|
|
3120
|
+
}
|
|
3121
|
+
if (preload && maxAge < HSTS_ONE_YEAR_SECONDS) {
|
|
3122
|
+
warnings.push(`Browser HSTS preload lists require max-age of at least ${HSTS_ONE_YEAR_SECONDS} (1 year); ${maxAge} is too low to qualify.`);
|
|
3123
|
+
}
|
|
3124
|
+
if (maxAge === 0) {
|
|
3125
|
+
warnings.push("max-age=0 tells the browser to forget this host supports HSTS immediately, this clears HSTS rather than enabling it.");
|
|
3126
|
+
} else if (maxAge < 86400) {
|
|
3127
|
+
warnings.push("A max-age under a day gives very little protection; most real deployments use at least 15552000 (180 days) once confident HTTPS is fully working.");
|
|
3128
|
+
}
|
|
3129
|
+
const parts = [`max-age=${maxAge}`];
|
|
3130
|
+
if (includeSubDomains) parts.push("includeSubDomains");
|
|
3131
|
+
if (preload) parts.push("preload");
|
|
3132
|
+
const header = parts.join("; ");
|
|
3133
|
+
return {
|
|
3134
|
+
header,
|
|
3135
|
+
headerName: "Strict-Transport-Security",
|
|
3136
|
+
snippet: `Strict-Transport-Security: ${header}`,
|
|
3137
|
+
maxAge,
|
|
3138
|
+
maxAgeHuman: _humanizeHstsMaxAge(maxAge),
|
|
3139
|
+
includeSubDomains,
|
|
3140
|
+
preload,
|
|
3141
|
+
preloadEligible,
|
|
3142
|
+
warnings
|
|
3143
|
+
};
|
|
3144
|
+
}
|
|
3145
|
+
function parseHsts(raw) {
|
|
3146
|
+
if (!raw || raw.trim() === "") return { error: "Input is empty" };
|
|
3147
|
+
const withoutLabel = raw.trim().replace(/^strict-transport-security:\s*/i, "");
|
|
3148
|
+
const tokens = withoutLabel.split(";").map((t) => t.trim()).filter((t) => t !== "");
|
|
3149
|
+
if (tokens.length === 0) return { error: "No directives found" };
|
|
3150
|
+
let maxAge = null;
|
|
3151
|
+
let includeSubDomains = false;
|
|
3152
|
+
let preload = false;
|
|
3153
|
+
for (const token of tokens) {
|
|
3154
|
+
const eq = token.indexOf("=");
|
|
3155
|
+
const name = (eq === -1 ? token : token.slice(0, eq)).trim().toLowerCase();
|
|
3156
|
+
if (name === "max-age") {
|
|
3157
|
+
const rawValue = eq === -1 ? "" : token.slice(eq + 1).trim();
|
|
3158
|
+
const n = Number(rawValue);
|
|
3159
|
+
if (rawValue === "" || !Number.isFinite(n) || !Number.isInteger(n) || n < 0) {
|
|
3160
|
+
return { error: `max-age value "${rawValue}" is not a valid non-negative integer` };
|
|
3161
|
+
}
|
|
3162
|
+
maxAge = n;
|
|
3163
|
+
} else if (name === "includesubdomains") {
|
|
3164
|
+
includeSubDomains = true;
|
|
3165
|
+
} else if (name === "preload") {
|
|
3166
|
+
preload = true;
|
|
3167
|
+
} else {
|
|
3168
|
+
return { error: `Unrecognized directive "${token}"` };
|
|
3169
|
+
}
|
|
3170
|
+
}
|
|
3171
|
+
if (maxAge === null) return { error: "max-age directive is required" };
|
|
3172
|
+
return buildHsts({ maxAge, includeSubDomains, preload });
|
|
3173
|
+
}
|
|
3045
3174
|
|
|
3046
3175
|
exports.CLIENT_HINTS = CLIENT_HINTS;
|
|
3047
3176
|
exports.DNS_RECORD_TYPES = DNS_RECORD_TYPES;
|
|
@@ -3059,6 +3188,7 @@ exports.buildClientHints = buildClientHints;
|
|
|
3059
3188
|
exports.buildContentDisposition = buildContentDisposition;
|
|
3060
3189
|
exports.buildDnsQueryUrl = buildDnsQueryUrl;
|
|
3061
3190
|
exports.buildGeoUrl = buildGeoUrl;
|
|
3191
|
+
exports.buildHsts = buildHsts;
|
|
3062
3192
|
exports.buildLinkHeader = buildLinkHeader;
|
|
3063
3193
|
exports.buildMapUrl = buildMapUrl;
|
|
3064
3194
|
exports.buildPermissionsPolicy = buildPermissionsPolicy;
|
|
@@ -3071,6 +3201,7 @@ exports.buildVaryHeader = buildVaryHeader;
|
|
|
3071
3201
|
exports.buildXContentTypeOptionsHeader = buildXContentTypeOptionsHeader;
|
|
3072
3202
|
exports.checkSetCookieHeader = checkSetCookieHeader;
|
|
3073
3203
|
exports.countryCodeToFlag = countryCodeToFlag;
|
|
3204
|
+
exports.extractMultipartBoundary = extractMultipartBoundary;
|
|
3074
3205
|
exports.formatCoordinates = formatCoordinates;
|
|
3075
3206
|
exports.formatTtl = formatTtl;
|
|
3076
3207
|
exports.getByCategory = getByCategory;
|
|
@@ -3093,7 +3224,9 @@ exports.parseContentRangeHeader = parseContentRangeHeader;
|
|
|
3093
3224
|
exports.parseDnsResponse = parseDnsResponse;
|
|
3094
3225
|
exports.parseGeoResponse = parseGeoResponse;
|
|
3095
3226
|
exports.parseHar = parseHar;
|
|
3227
|
+
exports.parseHsts = parseHsts;
|
|
3096
3228
|
exports.parseIpv6Address = parseIpv6Address;
|
|
3229
|
+
exports.parseMultipartFormData = parseMultipartFormData;
|
|
3097
3230
|
exports.parsePermissionsPolicy = parsePermissionsPolicy;
|
|
3098
3231
|
exports.parsePreferHeader = parsePreferHeader;
|
|
3099
3232
|
exports.parsePriorityHeader = parsePriorityHeader;
|
package/dist/tools/network.d.cts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { A as AcceptLanguageEntry, a as AcceptLanguageResult, b as AuthResultEntry, B as BuildRangeHeaderOptions, C as CLIENT_HINTS, c as CacheControlDirective, d as CacheControlOptions, e as CacheControlResult, f as ClientHintDef, g as ClientHintValueType, h as ClientHintsBuildResult, i as ClientHintsParseResult, j as CloseCodeInfo, k as CloseCodeRange, l as ContentDispositionBuildOptions, m as ContentDispositionBuildResult, o as ContentDispositionParseResult, p as ContentRangeResult, q as ContentTypeRiskResult, r as ContentTypeSniffRisk, s as CookieAttributes, t as CookieCheckResult, D as DNS_RECORD_TYPES, u as DnsRecord, v as DnsRecordType, w as DnsResponse, E as EmailHeaderAnalysis, x as EmailHeaderField, G as GeoResult, H as HTTP_HEADERS, y as HarEntry, z as HarParseResult, F as HarSummary, I as HeaderCategory, J as
|
|
1
|
+
export { A as AcceptLanguageEntry, a as AcceptLanguageResult, b as AuthResultEntry, B as BuildRangeHeaderOptions, C as CLIENT_HINTS, c as CacheControlDirective, d as CacheControlOptions, e as CacheControlResult, f as ClientHintDef, g as ClientHintValueType, h as ClientHintsBuildResult, i as ClientHintsParseResult, j as CloseCodeInfo, k as CloseCodeRange, l as ContentDispositionBuildOptions, m as ContentDispositionBuildResult, o as ContentDispositionParseResult, p as ContentRangeResult, q as ContentTypeRiskResult, r as ContentTypeSniffRisk, s as CookieAttributes, t as CookieCheckResult, D as DNS_RECORD_TYPES, u as DnsRecord, v as DnsRecordType, w as DnsResponse, E as EmailHeaderAnalysis, x as EmailHeaderField, G as GeoResult, H as HTTP_HEADERS, y as HarEntry, z as HarParseResult, F as HarSummary, I as HeaderCategory, J as HstsOptions, K as HstsResult, L as HttpHeader, M as Ipv6AddressType, N as Ipv6ParseResult, O as LINK_REL_VALUES, P as LinkHeaderEntry, Q as LinkHeaderEntryInput, R as LinkHeaderResult, S as LinkRel, T as ManifestIconInfo, U as ManifestIssue, V as ManifestValidationResult, W as MultipartParseResult, X as MultipartPart, Y as PERMISSIONS_POLICY_FEATURES, Z as ParsedClientHint, _ as ParsedDnsResult, $ as ParsedGeoResult, a0 as PermissionsPolicyDirective, a1 as PermissionsPolicyFeatureInput, a2 as PermissionsPolicyResult, a3 as PreferParameter, a4 as PreferPreference, a5 as PreferResult, a6 as PriorityResult, a7 as REFERRER_POLICY_VALUES, a8 as RangeEntry, a9 as RangeEntryInput, aa as RangeHeaderResult, ab as ReceivedHop, ac as ReferrerPolicyEntry, ad as ReferrerPolicyResult, ae as ReferrerPolicyValue, af as RetryAfterDateResult, ag as RetryAfterResult, ah as RetryAfterSecondsResult, ai as RobotsGroup, aj as RobotsIssue, ak as RobotsRule, al as RobotsValidationResult, am as STATUS_CODES, an as SameSiteValue, ao as SitemapIndexEntry, ap as SitemapIssue, aq as SitemapSplitFile, ar as SitemapUrlEntry, as as SitemapValidationResult, at as SplitSitemapOptions, au as SplitSitemapResult, av as StatusCode, aw as UaDeviceType, ax as UserAgentInfo, ay as VaryHeaderEntry, az as VaryHeaderResult, aA as XContentTypeOptionsHeader, aB as XContentTypeOptionsParseResult, aC as X_CONTENT_TYPE_OPTIONS_HEADER, aD as analyzeEmailHeaders, aE as assessContentTypeRisk, aF as buildAcceptLanguage, aG as buildCacheControl, aH as buildClientHints, aI as buildContentDisposition, aJ as buildDnsQueryUrl, aK as buildGeoUrl, aL as buildHsts, aM as buildLinkHeader, aN as buildMapUrl, aO as buildPermissionsPolicy, aP as buildPreferHeader, aQ as buildPriorityHeader, aR as buildRangeHeader, aS as buildReferrerPolicy, aT as buildRetryAfterHeader, aU as buildVaryHeader, aV as buildXContentTypeOptionsHeader, aW as checkSetCookieHeader, aX as countryCodeToFlag, aY as extractMultipartBoundary, aZ as formatCoordinates, a_ as formatTtl, a$ as getByCategory, b0 as getHeader, b1 as getHeadersByCategory, b2 as getStatusByCategory, b3 as getStatusCode, b4 as isClientError, b5 as isServerError, b6 as isSuccess, b7 as isValidIp, b8 as isValidIpv4, b9 as isValidIpv6, ba as listCloseCodes, bb as lookupCloseCode, bc as parseAcceptLanguage, bd as parseClientHintHeaders, be as parseContentDisposition, bf as parseContentRangeHeader, bg as parseDnsResponse, bh as parseGeoResponse, bi as parseHar, bj as parseHsts, bk as parseIpv6Address, bl as parseMultipartFormData, bm as parsePermissionsPolicy, bn as parsePreferHeader, bo as parsePriorityHeader, bp as parseRetryAfterHeader, bq as parseUserAgent, br as parseVaryHeader, bs as parseXContentTypeOptionsHeader, bt as searchHeaders, bu as searchStatusCodes, bv as splitSitemap, bw as statusCodeToText, bx as typeNumberToLabel, by as validateDomain, bz as validateHeaderName, bA as validateHeaderValue, bB as validateManifest, bC as validateRobotsTxt, bD as validateSitemap } from '../network-DT-OMHWV.cjs';
|
package/dist/tools/network.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { A as AcceptLanguageEntry, a as AcceptLanguageResult, b as AuthResultEntry, B as BuildRangeHeaderOptions, C as CLIENT_HINTS, c as CacheControlDirective, d as CacheControlOptions, e as CacheControlResult, f as ClientHintDef, g as ClientHintValueType, h as ClientHintsBuildResult, i as ClientHintsParseResult, j as CloseCodeInfo, k as CloseCodeRange, l as ContentDispositionBuildOptions, m as ContentDispositionBuildResult, o as ContentDispositionParseResult, p as ContentRangeResult, q as ContentTypeRiskResult, r as ContentTypeSniffRisk, s as CookieAttributes, t as CookieCheckResult, D as DNS_RECORD_TYPES, u as DnsRecord, v as DnsRecordType, w as DnsResponse, E as EmailHeaderAnalysis, x as EmailHeaderField, G as GeoResult, H as HTTP_HEADERS, y as HarEntry, z as HarParseResult, F as HarSummary, I as HeaderCategory, J as
|
|
1
|
+
export { A as AcceptLanguageEntry, a as AcceptLanguageResult, b as AuthResultEntry, B as BuildRangeHeaderOptions, C as CLIENT_HINTS, c as CacheControlDirective, d as CacheControlOptions, e as CacheControlResult, f as ClientHintDef, g as ClientHintValueType, h as ClientHintsBuildResult, i as ClientHintsParseResult, j as CloseCodeInfo, k as CloseCodeRange, l as ContentDispositionBuildOptions, m as ContentDispositionBuildResult, o as ContentDispositionParseResult, p as ContentRangeResult, q as ContentTypeRiskResult, r as ContentTypeSniffRisk, s as CookieAttributes, t as CookieCheckResult, D as DNS_RECORD_TYPES, u as DnsRecord, v as DnsRecordType, w as DnsResponse, E as EmailHeaderAnalysis, x as EmailHeaderField, G as GeoResult, H as HTTP_HEADERS, y as HarEntry, z as HarParseResult, F as HarSummary, I as HeaderCategory, J as HstsOptions, K as HstsResult, L as HttpHeader, M as Ipv6AddressType, N as Ipv6ParseResult, O as LINK_REL_VALUES, P as LinkHeaderEntry, Q as LinkHeaderEntryInput, R as LinkHeaderResult, S as LinkRel, T as ManifestIconInfo, U as ManifestIssue, V as ManifestValidationResult, W as MultipartParseResult, X as MultipartPart, Y as PERMISSIONS_POLICY_FEATURES, Z as ParsedClientHint, _ as ParsedDnsResult, $ as ParsedGeoResult, a0 as PermissionsPolicyDirective, a1 as PermissionsPolicyFeatureInput, a2 as PermissionsPolicyResult, a3 as PreferParameter, a4 as PreferPreference, a5 as PreferResult, a6 as PriorityResult, a7 as REFERRER_POLICY_VALUES, a8 as RangeEntry, a9 as RangeEntryInput, aa as RangeHeaderResult, ab as ReceivedHop, ac as ReferrerPolicyEntry, ad as ReferrerPolicyResult, ae as ReferrerPolicyValue, af as RetryAfterDateResult, ag as RetryAfterResult, ah as RetryAfterSecondsResult, ai as RobotsGroup, aj as RobotsIssue, ak as RobotsRule, al as RobotsValidationResult, am as STATUS_CODES, an as SameSiteValue, ao as SitemapIndexEntry, ap as SitemapIssue, aq as SitemapSplitFile, ar as SitemapUrlEntry, as as SitemapValidationResult, at as SplitSitemapOptions, au as SplitSitemapResult, av as StatusCode, aw as UaDeviceType, ax as UserAgentInfo, ay as VaryHeaderEntry, az as VaryHeaderResult, aA as XContentTypeOptionsHeader, aB as XContentTypeOptionsParseResult, aC as X_CONTENT_TYPE_OPTIONS_HEADER, aD as analyzeEmailHeaders, aE as assessContentTypeRisk, aF as buildAcceptLanguage, aG as buildCacheControl, aH as buildClientHints, aI as buildContentDisposition, aJ as buildDnsQueryUrl, aK as buildGeoUrl, aL as buildHsts, aM as buildLinkHeader, aN as buildMapUrl, aO as buildPermissionsPolicy, aP as buildPreferHeader, aQ as buildPriorityHeader, aR as buildRangeHeader, aS as buildReferrerPolicy, aT as buildRetryAfterHeader, aU as buildVaryHeader, aV as buildXContentTypeOptionsHeader, aW as checkSetCookieHeader, aX as countryCodeToFlag, aY as extractMultipartBoundary, aZ as formatCoordinates, a_ as formatTtl, a$ as getByCategory, b0 as getHeader, b1 as getHeadersByCategory, b2 as getStatusByCategory, b3 as getStatusCode, b4 as isClientError, b5 as isServerError, b6 as isSuccess, b7 as isValidIp, b8 as isValidIpv4, b9 as isValidIpv6, ba as listCloseCodes, bb as lookupCloseCode, bc as parseAcceptLanguage, bd as parseClientHintHeaders, be as parseContentDisposition, bf as parseContentRangeHeader, bg as parseDnsResponse, bh as parseGeoResponse, bi as parseHar, bj as parseHsts, bk as parseIpv6Address, bl as parseMultipartFormData, bm as parsePermissionsPolicy, bn as parsePreferHeader, bo as parsePriorityHeader, bp as parseRetryAfterHeader, bq as parseUserAgent, br as parseVaryHeader, bs as parseXContentTypeOptionsHeader, bt as searchHeaders, bu as searchStatusCodes, bv as splitSitemap, bw as statusCodeToText, bx as typeNumberToLabel, by as validateDomain, bz as validateHeaderName, bA as validateHeaderValue, bB as validateManifest, bC as validateRobotsTxt, bD as validateSitemap } from '../network-DT-OMHWV.js';
|
package/dist/tools/network.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { CLIENT_HINTS, DNS_RECORD_TYPES, HTTP_HEADERS, LINK_REL_VALUES, PERMISSIONS_POLICY_FEATURES, REFERRER_POLICY_VALUES, STATUS_CODES, X_CONTENT_TYPE_OPTIONS_HEADER, analyzeEmailHeaders, assessContentTypeRisk, buildAcceptLanguage, buildCacheControl, buildClientHints, buildContentDisposition, buildDnsQueryUrl, buildGeoUrl, buildLinkHeader, buildMapUrl, buildPermissionsPolicy, buildPreferHeader, buildPriorityHeader, buildRangeHeader, buildReferrerPolicy, buildRetryAfterHeader, buildVaryHeader, buildXContentTypeOptionsHeader, checkSetCookieHeader, countryCodeToFlag, 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-
|
|
1
|
+
export { CLIENT_HINTS, DNS_RECORD_TYPES, HTTP_HEADERS, LINK_REL_VALUES, PERMISSIONS_POLICY_FEATURES, REFERRER_POLICY_VALUES, STATUS_CODES, X_CONTENT_TYPE_OPTIONS_HEADER, analyzeEmailHeaders, assessContentTypeRisk, buildAcceptLanguage, buildCacheControl, buildClientHints, buildContentDisposition, buildDnsQueryUrl, buildGeoUrl, buildHsts, buildLinkHeader, buildMapUrl, buildPermissionsPolicy, buildPreferHeader, buildPriorityHeader, buildRangeHeader, buildReferrerPolicy, buildRetryAfterHeader, buildVaryHeader, buildXContentTypeOptionsHeader, checkSetCookieHeader, countryCodeToFlag, extractMultipartBoundary, formatCoordinates, formatTtl, getByCategory, getHeader, getHeadersByCategory, getStatusByCategory, getStatusCode, isClientError, isServerError, isSuccess, isValidIp, isValidIpv4, isValidIpv6, listCloseCodes, lookupCloseCode, parseAcceptLanguage, parseClientHintHeaders, parseContentDisposition, parseContentRangeHeader, parseDnsResponse, parseGeoResponse, parseHar, parseHsts, parseIpv6Address, parseMultipartFormData, parsePermissionsPolicy, parsePreferHeader, parsePriorityHeader, parseRetryAfterHeader, parseUserAgent, parseVaryHeader, parseXContentTypeOptionsHeader, searchHeaders, searchStatusCodes, splitSitemap, statusCodeToText, typeNumberToLabel, validateDomain, validateHeaderName, validateHeaderValue, validateManifest, validateRobotsTxt, validateSitemap } from '../chunk-KEZLVYR3.js';
|
|
2
2
|
import '../chunk-MLKGABMK.js';
|
package/dist/tools/units.cjs
CHANGED
|
@@ -2378,6 +2378,27 @@ function planDebtPayoff(debts, extraMonthlyPayment = 0) {
|
|
|
2378
2378
|
}
|
|
2379
2379
|
};
|
|
2380
2380
|
}
|
|
2381
|
+
function calculateLoanRefinance(currentBalance, currentRatePercent, currentRemainingMonths, newRatePercent, newTermMonths, closingCosts) {
|
|
2382
|
+
const current = calculateLoan(currentBalance, currentRatePercent, currentRemainingMonths);
|
|
2383
|
+
if ("error" in current) return current;
|
|
2384
|
+
const refinanced = calculateLoan(currentBalance, newRatePercent, newTermMonths);
|
|
2385
|
+
if ("error" in refinanced) return refinanced;
|
|
2386
|
+
if (!Number.isFinite(closingCosts) || closingCosts < 0) {
|
|
2387
|
+
return { error: "Closing costs must be zero or a positive number" };
|
|
2388
|
+
}
|
|
2389
|
+
const monthlySavings = round2(current.monthlyPayment - refinanced.monthlyPayment);
|
|
2390
|
+
const breakEvenMonths = monthlySavings > 0 ? Math.ceil(closingCosts / monthlySavings) : null;
|
|
2391
|
+
return {
|
|
2392
|
+
currentMonthlyPayment: current.monthlyPayment,
|
|
2393
|
+
newMonthlyPayment: refinanced.monthlyPayment,
|
|
2394
|
+
monthlySavings,
|
|
2395
|
+
closingCosts: round2(closingCosts),
|
|
2396
|
+
breakEvenMonths,
|
|
2397
|
+
currentTotalInterest: current.totalInterest,
|
|
2398
|
+
newTotalInterest: refinanced.totalInterest,
|
|
2399
|
+
totalInterestSavings: round2(current.totalInterest - refinanced.totalInterest)
|
|
2400
|
+
};
|
|
2401
|
+
}
|
|
2381
2402
|
|
|
2382
2403
|
exports.BASE_LABELS = BASE_LABELS;
|
|
2383
2404
|
exports.BASE_PREFIXES = BASE_PREFIXES;
|
|
@@ -2413,6 +2434,7 @@ exports.calculateExtraPaymentPayoff = calculateExtraPaymentPayoff;
|
|
|
2413
2434
|
exports.calculateFreelancerRate = calculateFreelancerRate;
|
|
2414
2435
|
exports.calculateGpa = calculateGpa;
|
|
2415
2436
|
exports.calculateLoan = calculateLoan;
|
|
2437
|
+
exports.calculateLoanRefinance = calculateLoanRefinance;
|
|
2416
2438
|
exports.calculateMarginMarkup = calculateMarginMarkup;
|
|
2417
2439
|
exports.calculateMovingAverages = calculateMovingAverages;
|
|
2418
2440
|
exports.calculatePaybackPeriod = calculatePaybackPeriod;
|