@utilix-tech/sdk 0.39.0 → 0.41.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 +30 -5
- package/dist/{chunk-47RI5V3B.js → chunk-2MTHD2LG.js} +62 -1
- package/dist/{chunk-Y4BVU76A.js → chunk-7WSFJTYP.js} +116 -1
- package/dist/{chunk-RZUNTYEH.js → chunk-JR354NH4.js} +61 -1
- package/dist/{chunk-VEVNIGJ6.js → chunk-PET2CGTH.js} +21 -1
- package/dist/{data-BCf3dm-E.d.cts → data-BKpEOcOX.d.cts} +35 -2
- package/dist/{data-BCf3dm-E.d.ts → data-BKpEOcOX.d.ts} +35 -2
- package/dist/{hashing-Dnj0IAZf.d.cts → hashing-CJjlvqS_.d.cts} +28 -2
- package/dist/{hashing-Dnj0IAZf.d.ts → hashing-CJjlvqS_.d.ts} +28 -2
- package/dist/index.cjs +256 -0
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +4 -4
- package/dist/{network-CKPoesdD.d.ts → network-BC8McQOh.d.cts} +60 -2
- package/dist/{network-CKPoesdD.d.cts → network-BC8McQOh.d.ts} +60 -2
- package/dist/tools/data.cjs +60 -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/hashing.cjs +20 -0
- package/dist/tools/hashing.d.cts +1 -1
- package/dist/tools/hashing.d.ts +1 -1
- package/dist/tools/hashing.js +1 -1
- package/dist/tools/network.cjs +115 -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 +61 -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-HQrMCiNM.d.ts → units-CzPwRC03.d.cts} +50 -2
- package/dist/{units-HQrMCiNM.d.cts → units-CzPwRC03.d.ts} +50 -2
- package/package.json +1 -1
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
* - link-header-builder: buildLinkHeader
|
|
18
18
|
* - same-site-cookie-checker: checkSetCookieHeader
|
|
19
19
|
* - email-header-analyzer: analyzeEmailHeaders
|
|
20
|
+
* - http-range-header-builder: buildRangeHeader, parseContentRangeHeader
|
|
20
21
|
*/
|
|
21
22
|
declare const DNS_RECORD_TYPES: readonly ["A", "AAAA", "CNAME", "MX", "TXT", "NS", "SOA", "PTR", "SRV", "CAA"];
|
|
22
23
|
type DnsRecordType = typeof DNS_RECORD_TYPES[number];
|
|
@@ -447,11 +448,63 @@ interface EmailHeaderAnalysis {
|
|
|
447
448
|
declare function analyzeEmailHeaders(raw: string): EmailHeaderAnalysis | {
|
|
448
449
|
error: string;
|
|
449
450
|
};
|
|
451
|
+
interface RangeEntryInput {
|
|
452
|
+
start?: number;
|
|
453
|
+
end?: number;
|
|
454
|
+
suffixLength?: number;
|
|
455
|
+
}
|
|
456
|
+
interface RangeEntry {
|
|
457
|
+
spec: string;
|
|
458
|
+
start: number | null;
|
|
459
|
+
end: number | null;
|
|
460
|
+
suffixLength: number | null;
|
|
461
|
+
byteLength: number | null;
|
|
462
|
+
percentOfTotal: number | null;
|
|
463
|
+
}
|
|
464
|
+
interface RangeHeaderResult {
|
|
465
|
+
header: string;
|
|
466
|
+
headerValue: string;
|
|
467
|
+
ranges: RangeEntry[];
|
|
468
|
+
totalBytesRequested: number | null;
|
|
469
|
+
warnings: string[];
|
|
470
|
+
}
|
|
471
|
+
interface BuildRangeHeaderOptions {
|
|
472
|
+
totalSize?: number;
|
|
473
|
+
unit?: string;
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* Build an HTTP `Range` request header from a list of byte ranges. Each
|
|
477
|
+
* entry is either `{ start, end? }` (an explicit or open-ended range) or
|
|
478
|
+
* `{ suffixLength }` (the last N bytes). Pass `totalSize` to resolve
|
|
479
|
+
* open-ended/suffix byte lengths and get overlap warnings.
|
|
480
|
+
*/
|
|
481
|
+
declare function buildRangeHeader(entries: RangeEntryInput[], options?: BuildRangeHeaderOptions): RangeHeaderResult | {
|
|
482
|
+
error: string;
|
|
483
|
+
};
|
|
484
|
+
interface ContentRangeResult {
|
|
485
|
+
unit: string;
|
|
486
|
+
start: number | null;
|
|
487
|
+
end: number | null;
|
|
488
|
+
total: number | null;
|
|
489
|
+
isUnsatisfiable: boolean;
|
|
490
|
+
isTotalUnknown: boolean;
|
|
491
|
+
byteLength: number | null;
|
|
492
|
+
}
|
|
493
|
+
/**
|
|
494
|
+
* Parse a `Content-Range` response header (e.g. `bytes 200-1000/67589` or
|
|
495
|
+
* `bytes *\/67589` for an unsatisfiable range) into its unit, byte bounds,
|
|
496
|
+
* and total resource size.
|
|
497
|
+
*/
|
|
498
|
+
declare function parseContentRangeHeader(header: string): ContentRangeResult | {
|
|
499
|
+
error: string;
|
|
500
|
+
};
|
|
450
501
|
|
|
451
502
|
type network_AuthResultEntry = AuthResultEntry;
|
|
503
|
+
type network_BuildRangeHeaderOptions = BuildRangeHeaderOptions;
|
|
452
504
|
type network_CacheControlDirective = CacheControlDirective;
|
|
453
505
|
type network_CacheControlOptions = CacheControlOptions;
|
|
454
506
|
type network_CacheControlResult = CacheControlResult;
|
|
507
|
+
type network_ContentRangeResult = ContentRangeResult;
|
|
455
508
|
type network_CookieAttributes = CookieAttributes;
|
|
456
509
|
type network_CookieCheckResult = CookieCheckResult;
|
|
457
510
|
declare const network_DNS_RECORD_TYPES: typeof DNS_RECORD_TYPES;
|
|
@@ -477,6 +530,9 @@ type network_LinkRel = LinkRel;
|
|
|
477
530
|
type network_ParsedDnsResult = ParsedDnsResult;
|
|
478
531
|
type network_ParsedGeoResult = ParsedGeoResult;
|
|
479
532
|
declare const network_REFERRER_POLICY_VALUES: typeof REFERRER_POLICY_VALUES;
|
|
533
|
+
type network_RangeEntry = RangeEntry;
|
|
534
|
+
type network_RangeEntryInput = RangeEntryInput;
|
|
535
|
+
type network_RangeHeaderResult = RangeHeaderResult;
|
|
480
536
|
type network_ReceivedHop = ReceivedHop;
|
|
481
537
|
type network_ReferrerPolicyEntry = ReferrerPolicyEntry;
|
|
482
538
|
type network_ReferrerPolicyResult = ReferrerPolicyResult;
|
|
@@ -500,6 +556,7 @@ declare const network_buildDnsQueryUrl: typeof buildDnsQueryUrl;
|
|
|
500
556
|
declare const network_buildGeoUrl: typeof buildGeoUrl;
|
|
501
557
|
declare const network_buildLinkHeader: typeof buildLinkHeader;
|
|
502
558
|
declare const network_buildMapUrl: typeof buildMapUrl;
|
|
559
|
+
declare const network_buildRangeHeader: typeof buildRangeHeader;
|
|
503
560
|
declare const network_buildReferrerPolicy: typeof buildReferrerPolicy;
|
|
504
561
|
declare const network_checkSetCookieHeader: typeof checkSetCookieHeader;
|
|
505
562
|
declare const network_countryCodeToFlag: typeof countryCodeToFlag;
|
|
@@ -516,6 +573,7 @@ declare const network_isSuccess: typeof isSuccess;
|
|
|
516
573
|
declare const network_isValidIp: typeof isValidIp;
|
|
517
574
|
declare const network_isValidIpv4: typeof isValidIpv4;
|
|
518
575
|
declare const network_isValidIpv6: typeof isValidIpv6;
|
|
576
|
+
declare const network_parseContentRangeHeader: typeof parseContentRangeHeader;
|
|
519
577
|
declare const network_parseDnsResponse: typeof parseDnsResponse;
|
|
520
578
|
declare const network_parseGeoResponse: typeof parseGeoResponse;
|
|
521
579
|
declare const network_parseHar: typeof parseHar;
|
|
@@ -531,7 +589,7 @@ declare const network_validateHeaderValue: typeof validateHeaderValue;
|
|
|
531
589
|
declare const network_validateRobotsTxt: typeof validateRobotsTxt;
|
|
532
590
|
declare const network_validateSitemap: typeof validateSitemap;
|
|
533
591
|
declare namespace network {
|
|
534
|
-
export { type network_AuthResultEntry as AuthResultEntry, type network_CacheControlDirective as CacheControlDirective, type network_CacheControlOptions as CacheControlOptions, type network_CacheControlResult as CacheControlResult, type network_CookieAttributes as CookieAttributes, type network_CookieCheckResult as CookieCheckResult, network_DNS_RECORD_TYPES as DNS_RECORD_TYPES, type network_DnsRecord as DnsRecord, type network_DnsRecordType as DnsRecordType, type network_DnsResponse as DnsResponse, type network_EmailHeaderAnalysis as EmailHeaderAnalysis, type network_EmailHeaderField as EmailHeaderField, type network_GeoResult as GeoResult, network_HTTP_HEADERS as HTTP_HEADERS, type network_HarEntry as HarEntry, type network_HarParseResult as HarParseResult, type network_HarSummary as HarSummary, type network_HeaderCategory as HeaderCategory, type network_HttpHeader as HttpHeader, type network_Ipv6AddressType as Ipv6AddressType, type network_Ipv6ParseResult as Ipv6ParseResult, network_LINK_REL_VALUES as LINK_REL_VALUES, type network_LinkHeaderEntry as LinkHeaderEntry, type network_LinkHeaderEntryInput as LinkHeaderEntryInput, type network_LinkHeaderResult as LinkHeaderResult, type network_LinkRel as LinkRel, type network_ParsedDnsResult as ParsedDnsResult, type network_ParsedGeoResult as ParsedGeoResult, network_REFERRER_POLICY_VALUES as REFERRER_POLICY_VALUES, type network_ReceivedHop as ReceivedHop, type network_ReferrerPolicyEntry as ReferrerPolicyEntry, type network_ReferrerPolicyResult as ReferrerPolicyResult, type network_ReferrerPolicyValue as ReferrerPolicyValue, type network_RobotsGroup as RobotsGroup, type network_RobotsIssue as RobotsIssue, type network_RobotsRule as RobotsRule, type network_RobotsValidationResult as RobotsValidationResult, network_STATUS_CODES as STATUS_CODES, type network_SameSiteValue as SameSiteValue, type network_SitemapIndexEntry as SitemapIndexEntry, type network_SitemapIssue as SitemapIssue, type network_SitemapUrlEntry as SitemapUrlEntry, type network_SitemapValidationResult as SitemapValidationResult, type network_StatusCode as StatusCode, type network_UaDeviceType as UaDeviceType, type network_UserAgentInfo as UserAgentInfo, network_analyzeEmailHeaders as analyzeEmailHeaders, network_buildCacheControl as buildCacheControl, network_buildDnsQueryUrl as buildDnsQueryUrl, network_buildGeoUrl as buildGeoUrl, network_buildLinkHeader as buildLinkHeader, network_buildMapUrl as buildMapUrl, network_buildReferrerPolicy as buildReferrerPolicy, network_checkSetCookieHeader as checkSetCookieHeader, network_countryCodeToFlag as countryCodeToFlag, network_formatCoordinates as formatCoordinates, network_formatTtl as formatTtl, network_getByCategory as getByCategory, network_getHeader as getHeader, network_getHeadersByCategory as getHeadersByCategory, network_getStatusByCategory as getStatusByCategory, network_getStatusCode as getStatusCode, network_isClientError as isClientError, network_isServerError as isServerError, network_isSuccess as isSuccess, network_isValidIp as isValidIp, network_isValidIpv4 as isValidIpv4, network_isValidIpv6 as isValidIpv6, network_parseDnsResponse as parseDnsResponse, network_parseGeoResponse as parseGeoResponse, network_parseHar as parseHar, network_parseIpv6Address as parseIpv6Address, network_parseUserAgent as parseUserAgent, network_searchHeaders as searchHeaders, network_searchStatusCodes as searchStatusCodes, network_statusCodeToText as statusCodeToText, network_typeNumberToLabel as typeNumberToLabel, network_validateDomain as validateDomain, network_validateHeaderName as validateHeaderName, network_validateHeaderValue as validateHeaderValue, network_validateRobotsTxt as validateRobotsTxt, network_validateSitemap as validateSitemap };
|
|
592
|
+
export { type network_AuthResultEntry as AuthResultEntry, type network_BuildRangeHeaderOptions as BuildRangeHeaderOptions, type network_CacheControlDirective as CacheControlDirective, type network_CacheControlOptions as CacheControlOptions, type network_CacheControlResult as CacheControlResult, type network_ContentRangeResult as ContentRangeResult, type network_CookieAttributes as CookieAttributes, type network_CookieCheckResult as CookieCheckResult, network_DNS_RECORD_TYPES as DNS_RECORD_TYPES, type network_DnsRecord as DnsRecord, type network_DnsRecordType as DnsRecordType, type network_DnsResponse as DnsResponse, type network_EmailHeaderAnalysis as EmailHeaderAnalysis, type network_EmailHeaderField as EmailHeaderField, type network_GeoResult as GeoResult, network_HTTP_HEADERS as HTTP_HEADERS, type network_HarEntry as HarEntry, type network_HarParseResult as HarParseResult, type network_HarSummary as HarSummary, type network_HeaderCategory as HeaderCategory, type network_HttpHeader as HttpHeader, type network_Ipv6AddressType as Ipv6AddressType, type network_Ipv6ParseResult as Ipv6ParseResult, network_LINK_REL_VALUES as LINK_REL_VALUES, type network_LinkHeaderEntry as LinkHeaderEntry, type network_LinkHeaderEntryInput as LinkHeaderEntryInput, type network_LinkHeaderResult as LinkHeaderResult, type network_LinkRel as LinkRel, type network_ParsedDnsResult as ParsedDnsResult, type network_ParsedGeoResult as ParsedGeoResult, network_REFERRER_POLICY_VALUES as REFERRER_POLICY_VALUES, type network_RangeEntry as RangeEntry, type network_RangeEntryInput as RangeEntryInput, type network_RangeHeaderResult as RangeHeaderResult, type network_ReceivedHop as ReceivedHop, type network_ReferrerPolicyEntry as ReferrerPolicyEntry, type network_ReferrerPolicyResult as ReferrerPolicyResult, type network_ReferrerPolicyValue as ReferrerPolicyValue, type network_RobotsGroup as RobotsGroup, type network_RobotsIssue as RobotsIssue, type network_RobotsRule as RobotsRule, type network_RobotsValidationResult as RobotsValidationResult, network_STATUS_CODES as STATUS_CODES, type network_SameSiteValue as SameSiteValue, type network_SitemapIndexEntry as SitemapIndexEntry, type network_SitemapIssue as SitemapIssue, type network_SitemapUrlEntry as SitemapUrlEntry, type network_SitemapValidationResult as SitemapValidationResult, type network_StatusCode as StatusCode, type network_UaDeviceType as UaDeviceType, type network_UserAgentInfo as UserAgentInfo, network_analyzeEmailHeaders as analyzeEmailHeaders, network_buildCacheControl as buildCacheControl, network_buildDnsQueryUrl as buildDnsQueryUrl, network_buildGeoUrl as buildGeoUrl, network_buildLinkHeader as buildLinkHeader, network_buildMapUrl as buildMapUrl, network_buildRangeHeader as buildRangeHeader, network_buildReferrerPolicy as buildReferrerPolicy, network_checkSetCookieHeader as checkSetCookieHeader, network_countryCodeToFlag as countryCodeToFlag, network_formatCoordinates as formatCoordinates, network_formatTtl as formatTtl, network_getByCategory as getByCategory, network_getHeader as getHeader, network_getHeadersByCategory as getHeadersByCategory, network_getStatusByCategory as getStatusByCategory, network_getStatusCode as getStatusCode, network_isClientError as isClientError, network_isServerError as isServerError, network_isSuccess as isSuccess, network_isValidIp as isValidIp, network_isValidIpv4 as isValidIpv4, network_isValidIpv6 as isValidIpv6, network_parseContentRangeHeader as parseContentRangeHeader, network_parseDnsResponse as parseDnsResponse, network_parseGeoResponse as parseGeoResponse, network_parseHar as parseHar, network_parseIpv6Address as parseIpv6Address, network_parseUserAgent as parseUserAgent, network_searchHeaders as searchHeaders, network_searchStatusCodes as searchStatusCodes, network_statusCodeToText as statusCodeToText, network_typeNumberToLabel as typeNumberToLabel, network_validateDomain as validateDomain, network_validateHeaderName as validateHeaderName, network_validateHeaderValue as validateHeaderValue, network_validateRobotsTxt as validateRobotsTxt, network_validateSitemap as validateSitemap };
|
|
535
593
|
}
|
|
536
594
|
|
|
537
|
-
export {
|
|
595
|
+
export { buildCacheControl as $, type AuthResultEntry as A, type BuildRangeHeaderOptions as B, type CacheControlDirective as C, DNS_RECORD_TYPES as D, type EmailHeaderAnalysis as E, type ReferrerPolicyResult as F, type GeoResult as G, HTTP_HEADERS as H, type Ipv6AddressType as I, type ReferrerPolicyValue as J, type RobotsGroup as K, LINK_REL_VALUES as L, type RobotsIssue as M, type RobotsRule as N, type RobotsValidationResult as O, type ParsedDnsResult as P, type SameSiteValue as Q, REFERRER_POLICY_VALUES as R, STATUS_CODES as S, type SitemapIndexEntry as T, type SitemapIssue as U, type SitemapUrlEntry as V, type SitemapValidationResult as W, type StatusCode as X, type UaDeviceType as Y, type UserAgentInfo as Z, analyzeEmailHeaders as _, type CacheControlOptions as a, buildDnsQueryUrl as a0, buildGeoUrl as a1, buildLinkHeader as a2, buildMapUrl as a3, buildRangeHeader as a4, buildReferrerPolicy as a5, checkSetCookieHeader as a6, countryCodeToFlag as a7, formatCoordinates as a8, formatTtl as a9, getByCategory as aa, getHeader as ab, getHeadersByCategory as ac, getStatusByCategory as ad, getStatusCode as ae, isClientError as af, isServerError as ag, isSuccess as ah, isValidIp as ai, isValidIpv4 as aj, isValidIpv6 as ak, parseContentRangeHeader as al, parseDnsResponse as am, parseGeoResponse as an, parseHar as ao, parseIpv6Address as ap, parseUserAgent as aq, searchHeaders as ar, searchStatusCodes as as, statusCodeToText as at, typeNumberToLabel as au, validateDomain as av, validateHeaderName as aw, validateHeaderValue as ax, validateRobotsTxt as ay, validateSitemap as az, type CacheControlResult as b, type ContentRangeResult as c, type CookieAttributes as d, type CookieCheckResult as e, type DnsRecord as f, type DnsRecordType as g, type DnsResponse as h, type EmailHeaderField as i, type HarEntry as j, type HarParseResult as k, type HarSummary as l, type HeaderCategory as m, network as n, type HttpHeader as o, type Ipv6ParseResult as p, type LinkHeaderEntry as q, type LinkHeaderEntryInput as r, type LinkHeaderResult as s, type LinkRel as t, type ParsedGeoResult as u, type RangeEntry as v, type RangeEntryInput as w, type RangeHeaderResult as x, type ReceivedHop as y, type ReferrerPolicyEntry as z };
|
package/dist/tools/data.cjs
CHANGED
|
@@ -1472,6 +1472,65 @@ function csvToSqlInsert(input, options) {
|
|
|
1472
1472
|
columns
|
|
1473
1473
|
};
|
|
1474
1474
|
}
|
|
1475
|
+
function _normalizeDuplicateValue(value, caseSensitive, trimWhitespace) {
|
|
1476
|
+
let v = value;
|
|
1477
|
+
if (trimWhitespace) v = v.trim();
|
|
1478
|
+
if (!caseSensitive) v = v.toLowerCase();
|
|
1479
|
+
return v;
|
|
1480
|
+
}
|
|
1481
|
+
function findCsvDuplicateRows(input, options) {
|
|
1482
|
+
const parsed = parseCsv(input, {
|
|
1483
|
+
delimiter: options?.delimiter ?? ",",
|
|
1484
|
+
hasHeader: options?.hasHeader !== false,
|
|
1485
|
+
trimWhitespace: false
|
|
1486
|
+
});
|
|
1487
|
+
if ("error" in parsed) return parsed;
|
|
1488
|
+
if (parsed.rows.length === 0) return { error: "No data rows found" };
|
|
1489
|
+
const caseSensitive = options?.caseSensitive !== false;
|
|
1490
|
+
const trimWhitespace = options?.trimWhitespace !== false;
|
|
1491
|
+
let keyIndexes;
|
|
1492
|
+
if (options?.keyColumns && options.keyColumns.length > 0) {
|
|
1493
|
+
keyIndexes = [];
|
|
1494
|
+
for (const col of options.keyColumns) {
|
|
1495
|
+
const idx = parsed.headers.indexOf(col);
|
|
1496
|
+
if (idx === -1) {
|
|
1497
|
+
return { error: `Column "${col}" not found. Available columns: ${parsed.headers.join(", ")}` };
|
|
1498
|
+
}
|
|
1499
|
+
keyIndexes.push(idx);
|
|
1500
|
+
}
|
|
1501
|
+
} else {
|
|
1502
|
+
keyIndexes = parsed.headers.map((_, idx) => idx);
|
|
1503
|
+
}
|
|
1504
|
+
const groups = /* @__PURE__ */ new Map();
|
|
1505
|
+
parsed.rows.forEach((row, i) => {
|
|
1506
|
+
const key = keyIndexes.map((idx) => row[idx] ?? "");
|
|
1507
|
+
const normalizedKey = keyIndexes.map((idx) => _normalizeDuplicateValue(row[idx] ?? "", caseSensitive, trimWhitespace));
|
|
1508
|
+
const mapKey = JSON.stringify(normalizedKey);
|
|
1509
|
+
const rowNumber = i + 1;
|
|
1510
|
+
const existing = groups.get(mapKey);
|
|
1511
|
+
if (existing) {
|
|
1512
|
+
existing.rowNumbers.push(rowNumber);
|
|
1513
|
+
} else {
|
|
1514
|
+
groups.set(mapKey, { key, rowNumbers: [rowNumber] });
|
|
1515
|
+
}
|
|
1516
|
+
});
|
|
1517
|
+
const duplicateGroups = [];
|
|
1518
|
+
let duplicateRowCount = 0;
|
|
1519
|
+
for (const group of groups.values()) {
|
|
1520
|
+
if (group.rowNumbers.length > 1) {
|
|
1521
|
+
duplicateGroups.push({ key: group.key, rowNumbers: group.rowNumbers, count: group.rowNumbers.length });
|
|
1522
|
+
duplicateRowCount += group.rowNumbers.length;
|
|
1523
|
+
}
|
|
1524
|
+
}
|
|
1525
|
+
duplicateGroups.sort((a, b) => b.count - a.count);
|
|
1526
|
+
return {
|
|
1527
|
+
headers: parsed.headers,
|
|
1528
|
+
totalRows: parsed.rows.length,
|
|
1529
|
+
duplicateGroups,
|
|
1530
|
+
duplicateRowCount,
|
|
1531
|
+
uniqueRowCount: parsed.rows.length - duplicateRowCount + duplicateGroups.length
|
|
1532
|
+
};
|
|
1533
|
+
}
|
|
1475
1534
|
|
|
1476
1535
|
exports.convertSubtitles = convertSubtitles;
|
|
1477
1536
|
exports.csvToJson = csvToJson;
|
|
@@ -1481,6 +1540,7 @@ exports.detectSubtitleFormat = detectSubtitleFormat;
|
|
|
1481
1540
|
exports.diffEnvExample = diffEnvExample;
|
|
1482
1541
|
exports.envToExport = envToExport;
|
|
1483
1542
|
exports.envToJson = envToJson;
|
|
1543
|
+
exports.findCsvDuplicateRows = findCsvDuplicateRows;
|
|
1484
1544
|
exports.formatNdjson = formatNdjson;
|
|
1485
1545
|
exports.formatSubtitleTimestamp = formatSubtitleTimestamp;
|
|
1486
1546
|
exports.formatToml = formatToml;
|
package/dist/tools/data.d.cts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { C as ConvertedSubtitles, a as
|
|
1
|
+
export { C as ConvertedSubtitles, a as CsvDuplicateGroup, b as CsvDuplicateOptions, c as CsvDuplicateResult, e as CsvParseResult, f as CsvToSqlOptions, g as CsvToSqlResult, E as EnvDiffError, h as EnvDiffResult, i as EnvEntry, j as EnvParseResult, F as FrontMatterError, k as FrontMatterResult, I as IniSection, M as MarkdownTocEntry, l as MarkdownTocOptions, m as MarkdownTocResult, N as NdjsonLineResult, n as NdjsonValidateResult, P as ParseOptions, o as ParsedIni, p as ParsedSubtitles, S as SubtitleCue, q as SubtitleFormat, T as TomlFormatResult, V as ValidationResult, X as XmlFormatResult, r as XmlToJsonOptions, s as convertSubtitles, t as csvToJson, u as csvToSqlInsert, v as detectDelimiter, w as detectSubtitleFormat, x as diffEnvExample, y as envToExport, z as envToJson, A as findCsvDuplicateRows, B as formatNdjson, D as formatSubtitleTimestamp, G as formatToml, H as formatXml, J as generateMarkdownToc, K as getSection, L as getSectionNames, O as getTomlStats, Q as getXmlStats, R as getYamlStats, U as iniToJson, W as jsonArrayToNdjson, Y as jsonToIni, Z as jsonToToml, _ as jsonToXml, $ as minifyNdjson, a0 as minifyToml, a1 as minifyXml, a2 as ndjsonToJsonArray, a3 as parseCsv, a4 as parseEnv, a5 as parseFrontMatter, a6 as parseIni, a7 as parseSubtitleTimestamp, a8 as parseSubtitles, a9 as parseXmlToObject, aa as serializeSubtitles, ab as shiftSubtitles, ac as stringifyIni, ad as toCsvString, ae as tomlToJson, af as validateEnvKey, ag as validateIni, ah as validateNdjson, ai as validateToml, aj as validateXml, ak as validateYaml, al as xmlToJson } from '../data-BKpEOcOX.cjs';
|
package/dist/tools/data.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { C as ConvertedSubtitles, a as
|
|
1
|
+
export { C as ConvertedSubtitles, a as CsvDuplicateGroup, b as CsvDuplicateOptions, c as CsvDuplicateResult, e as CsvParseResult, f as CsvToSqlOptions, g as CsvToSqlResult, E as EnvDiffError, h as EnvDiffResult, i as EnvEntry, j as EnvParseResult, F as FrontMatterError, k as FrontMatterResult, I as IniSection, M as MarkdownTocEntry, l as MarkdownTocOptions, m as MarkdownTocResult, N as NdjsonLineResult, n as NdjsonValidateResult, P as ParseOptions, o as ParsedIni, p as ParsedSubtitles, S as SubtitleCue, q as SubtitleFormat, T as TomlFormatResult, V as ValidationResult, X as XmlFormatResult, r as XmlToJsonOptions, s as convertSubtitles, t as csvToJson, u as csvToSqlInsert, v as detectDelimiter, w as detectSubtitleFormat, x as diffEnvExample, y as envToExport, z as envToJson, A as findCsvDuplicateRows, B as formatNdjson, D as formatSubtitleTimestamp, G as formatToml, H as formatXml, J as generateMarkdownToc, K as getSection, L as getSectionNames, O as getTomlStats, Q as getXmlStats, R as getYamlStats, U as iniToJson, W as jsonArrayToNdjson, Y as jsonToIni, Z as jsonToToml, _ as jsonToXml, $ as minifyNdjson, a0 as minifyToml, a1 as minifyXml, a2 as ndjsonToJsonArray, a3 as parseCsv, a4 as parseEnv, a5 as parseFrontMatter, a6 as parseIni, a7 as parseSubtitleTimestamp, a8 as parseSubtitles, a9 as parseXmlToObject, aa as serializeSubtitles, ab as shiftSubtitles, ac as stringifyIni, ad as toCsvString, ae as tomlToJson, af as validateEnvKey, ag as validateIni, ah as validateNdjson, ai as validateToml, aj as validateXml, ak as validateYaml, al as xmlToJson } from '../data-BKpEOcOX.js';
|
package/dist/tools/data.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { convertSubtitles, csvToJson, csvToSqlInsert, detectDelimiter, detectSubtitleFormat, diffEnvExample, envToExport, envToJson, formatNdjson, formatSubtitleTimestamp, formatToml, formatXml, generateMarkdownToc, getSection, getSectionNames, getTomlStats, getXmlStats, getYamlStats, iniToJson, jsonArrayToNdjson, jsonToIni, jsonToToml, jsonToXml, minifyNdjson, minifyToml, minifyXml, ndjsonToJsonArray, parseCsv, parseEnv, parseFrontMatter, parseIni, parseSubtitleTimestamp, parseSubtitles, parseXmlToObject, serializeSubtitles, shiftSubtitles, stringifyIni, toCsvString, tomlToJson, validateEnvKey, validateIni, validateNdjson, validateToml, validateXml, validateYaml, xmlToJson } from '../chunk-
|
|
1
|
+
export { convertSubtitles, csvToJson, csvToSqlInsert, detectDelimiter, detectSubtitleFormat, diffEnvExample, envToExport, envToJson, findCsvDuplicateRows, formatNdjson, formatSubtitleTimestamp, formatToml, formatXml, generateMarkdownToc, getSection, getSectionNames, getTomlStats, getXmlStats, getYamlStats, iniToJson, jsonArrayToNdjson, jsonToIni, jsonToToml, jsonToXml, minifyNdjson, minifyToml, minifyXml, ndjsonToJsonArray, parseCsv, parseEnv, parseFrontMatter, parseIni, parseSubtitleTimestamp, parseSubtitles, parseXmlToObject, serializeSubtitles, shiftSubtitles, stringifyIni, toCsvString, tomlToJson, validateEnvKey, validateIni, validateNdjson, validateToml, validateXml, validateYaml, xmlToJson } from '../chunk-JR354NH4.js';
|
|
2
2
|
import '../chunk-MLKGABMK.js';
|
package/dist/tools/hashing.cjs
CHANGED
|
@@ -255,13 +255,33 @@ function generateSriAll(content) {
|
|
|
255
255
|
}
|
|
256
256
|
return SRI_ALGORITHMS.map((alg) => generateSri(content, alg));
|
|
257
257
|
}
|
|
258
|
+
var ETAG_ALGORITHMS = ["MD5", "SHA-1", "SHA-256"];
|
|
259
|
+
var ETAG_NODE_ALG_MAP = {
|
|
260
|
+
"MD5": "md5",
|
|
261
|
+
"SHA-1": "sha1",
|
|
262
|
+
"SHA-256": "sha256"
|
|
263
|
+
};
|
|
264
|
+
function generateEtag(content, algorithm = "SHA-1", weak = false) {
|
|
265
|
+
if (typeof content !== "string" || content.length === 0) {
|
|
266
|
+
return { error: "Content is required" };
|
|
267
|
+
}
|
|
268
|
+
if (!ETAG_ALGORITHMS.includes(algorithm)) {
|
|
269
|
+
return { error: `Unknown algorithm: ${algorithm}. Must be one of ${ETAG_ALGORITHMS.join(", ")}` };
|
|
270
|
+
}
|
|
271
|
+
const hash = crypto.createHash(ETAG_NODE_ALG_MAP[algorithm]).update(content, "utf8").digest("hex");
|
|
272
|
+
const quoted = `"${hash}"`;
|
|
273
|
+
const etag = weak ? `W/${quoted}` : quoted;
|
|
274
|
+
return { algorithm, weak, hash, etag, headerName: "ETag", snippet: `ETag: ${etag}` };
|
|
275
|
+
}
|
|
258
276
|
|
|
277
|
+
exports.ETAG_ALGORITHMS = ETAG_ALGORITHMS;
|
|
259
278
|
exports.HASH_ALGORITHMS = HASH_ALGORITHMS;
|
|
260
279
|
exports.HASH_BITS = HASH_BITS;
|
|
261
280
|
exports.ROUND_OPTIONS = ROUND_OPTIONS;
|
|
262
281
|
exports.SRI_ALGORITHMS = SRI_ALGORITHMS;
|
|
263
282
|
exports.createEntry = createEntry;
|
|
264
283
|
exports.generateBcryptHash = generateBcryptHash;
|
|
284
|
+
exports.generateEtag = generateEtag;
|
|
265
285
|
exports.generateHtpasswdFile = generateHtpasswdFile;
|
|
266
286
|
exports.generateMd5Hash = generateMd5Hash;
|
|
267
287
|
exports.generatePlain = generatePlain;
|
package/dist/tools/hashing.d.cts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { B as BcryptResult, H as HASH_ALGORITHMS,
|
|
1
|
+
export { B as BcryptResult, E as ETAG_ALGORITHMS, a as EtagAlgorithm, b as EtagResult, H as HASH_ALGORITHMS, c as HASH_BITS, d as HashAlgorithm, e as HashResult, f as HtpasswdAlgorithm, g as HtpasswdEntry, R as ROUND_OPTIONS, S as SRI_ALGORITHMS, i as SriAlgorithm, j as SriResult, k as createEntry, l as generateBcryptHash, m as generateEtag, n as generateHtpasswdFile, o as generateMd5Hash, p as generatePlain, q as generateSha1Hash, r as generateSri, s as generateSriAll, t as hashAll, u as hashOne, v as hashPassword, w as hashWithTiming, x as parseHtpasswdFile, y as validateRounds, z as validateUsername, A as verifyPassword } from '../hashing-CJjlvqS_.cjs';
|
package/dist/tools/hashing.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { B as BcryptResult, H as HASH_ALGORITHMS,
|
|
1
|
+
export { B as BcryptResult, E as ETAG_ALGORITHMS, a as EtagAlgorithm, b as EtagResult, H as HASH_ALGORITHMS, c as HASH_BITS, d as HashAlgorithm, e as HashResult, f as HtpasswdAlgorithm, g as HtpasswdEntry, R as ROUND_OPTIONS, S as SRI_ALGORITHMS, i as SriAlgorithm, j as SriResult, k as createEntry, l as generateBcryptHash, m as generateEtag, n as generateHtpasswdFile, o as generateMd5Hash, p as generatePlain, q as generateSha1Hash, r as generateSri, s as generateSriAll, t as hashAll, u as hashOne, v as hashPassword, w as hashWithTiming, x as parseHtpasswdFile, y as validateRounds, z as validateUsername, A as verifyPassword } from '../hashing-CJjlvqS_.js';
|
package/dist/tools/hashing.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { HASH_ALGORITHMS, HASH_BITS, ROUND_OPTIONS, SRI_ALGORITHMS, createEntry, generateBcryptHash, generateHtpasswdFile, generateMd5Hash, generatePlain, generateSha1Hash, generateSri, generateSriAll, hashAll, hashOne, hashPassword, hashWithTiming, parseHtpasswdFile, validateRounds, validateUsername, verifyPassword } from '../chunk-
|
|
1
|
+
export { ETAG_ALGORITHMS, HASH_ALGORITHMS, HASH_BITS, ROUND_OPTIONS, SRI_ALGORITHMS, createEntry, generateBcryptHash, generateEtag, generateHtpasswdFile, generateMd5Hash, generatePlain, generateSha1Hash, generateSri, generateSriAll, hashAll, hashOne, hashPassword, hashWithTiming, parseHtpasswdFile, validateRounds, validateUsername, verifyPassword } from '../chunk-PET2CGTH.js';
|
|
2
2
|
import '../chunk-MLKGABMK.js';
|
package/dist/tools/network.cjs
CHANGED
|
@@ -2165,6 +2165,119 @@ function analyzeEmailHeaders(raw) {
|
|
|
2165
2165
|
warnings
|
|
2166
2166
|
};
|
|
2167
2167
|
}
|
|
2168
|
+
function _round2(n) {
|
|
2169
|
+
return Math.round(n * 100) / 100;
|
|
2170
|
+
}
|
|
2171
|
+
function buildRangeHeader(entries, options) {
|
|
2172
|
+
if (!Array.isArray(entries) || entries.length === 0) {
|
|
2173
|
+
return { error: "At least one range is required" };
|
|
2174
|
+
}
|
|
2175
|
+
const unit = options?.unit?.trim() || "bytes";
|
|
2176
|
+
const totalSize = typeof options?.totalSize === "number" && Number.isFinite(options.totalSize) ? options.totalSize : void 0;
|
|
2177
|
+
if (totalSize !== void 0 && totalSize <= 0) {
|
|
2178
|
+
return { error: "totalSize must be a positive number when provided" };
|
|
2179
|
+
}
|
|
2180
|
+
const parsed = [];
|
|
2181
|
+
for (const entry of entries) {
|
|
2182
|
+
if (entry.suffixLength !== void 0) {
|
|
2183
|
+
if (!Number.isFinite(entry.suffixLength) || entry.suffixLength <= 0) {
|
|
2184
|
+
return { error: "suffixLength must be a positive number" };
|
|
2185
|
+
}
|
|
2186
|
+
const suffixLength = Math.floor(entry.suffixLength);
|
|
2187
|
+
const byteLength = totalSize !== void 0 ? Math.min(suffixLength, totalSize) : suffixLength;
|
|
2188
|
+
parsed.push({
|
|
2189
|
+
spec: `-${suffixLength}`,
|
|
2190
|
+
start: null,
|
|
2191
|
+
end: null,
|
|
2192
|
+
suffixLength,
|
|
2193
|
+
byteLength,
|
|
2194
|
+
percentOfTotal: totalSize !== void 0 ? _round2(byteLength / totalSize * 100) : null
|
|
2195
|
+
});
|
|
2196
|
+
continue;
|
|
2197
|
+
}
|
|
2198
|
+
if (entry.start === void 0) {
|
|
2199
|
+
return { error: "Each range requires either a start byte or a suffixLength" };
|
|
2200
|
+
}
|
|
2201
|
+
if (!Number.isFinite(entry.start) || entry.start < 0) {
|
|
2202
|
+
return { error: "start must be a non-negative number" };
|
|
2203
|
+
}
|
|
2204
|
+
const start = Math.floor(entry.start);
|
|
2205
|
+
if (totalSize !== void 0 && start >= totalSize) {
|
|
2206
|
+
return { error: `start byte ${start} is beyond totalSize (${totalSize})` };
|
|
2207
|
+
}
|
|
2208
|
+
if (entry.end !== void 0) {
|
|
2209
|
+
if (!Number.isFinite(entry.end) || entry.end < 0) {
|
|
2210
|
+
return { error: "end must be a non-negative number" };
|
|
2211
|
+
}
|
|
2212
|
+
const end = Math.floor(entry.end);
|
|
2213
|
+
if (end < start) {
|
|
2214
|
+
return { error: `range end (${end}) must be >= start (${start})` };
|
|
2215
|
+
}
|
|
2216
|
+
if (totalSize !== void 0 && end >= totalSize) {
|
|
2217
|
+
return { error: `end byte ${end} is beyond totalSize (${totalSize})` };
|
|
2218
|
+
}
|
|
2219
|
+
const byteLength = end - start + 1;
|
|
2220
|
+
parsed.push({
|
|
2221
|
+
spec: `${start}-${end}`,
|
|
2222
|
+
start,
|
|
2223
|
+
end,
|
|
2224
|
+
suffixLength: null,
|
|
2225
|
+
byteLength,
|
|
2226
|
+
percentOfTotal: totalSize !== void 0 ? _round2(byteLength / totalSize * 100) : null
|
|
2227
|
+
});
|
|
2228
|
+
} else {
|
|
2229
|
+
const byteLength = totalSize !== void 0 ? totalSize - start : null;
|
|
2230
|
+
parsed.push({
|
|
2231
|
+
spec: `${start}-`,
|
|
2232
|
+
start,
|
|
2233
|
+
end: null,
|
|
2234
|
+
suffixLength: null,
|
|
2235
|
+
byteLength,
|
|
2236
|
+
percentOfTotal: byteLength !== null && totalSize !== void 0 ? _round2(byteLength / totalSize * 100) : null
|
|
2237
|
+
});
|
|
2238
|
+
}
|
|
2239
|
+
}
|
|
2240
|
+
const warnings = [];
|
|
2241
|
+
const resolvable = parsed.map((r, i) => ({ i, start: r.start ?? (totalSize !== void 0 && r.suffixLength !== null ? totalSize - Math.min(r.suffixLength, totalSize) : null), end: r.end ?? (totalSize !== void 0 ? totalSize - 1 : null) })).filter((r) => r.start !== null && r.end !== null).sort((a, b) => a.start - b.start);
|
|
2242
|
+
for (let i = 1; i < resolvable.length; i++) {
|
|
2243
|
+
if (resolvable[i].start <= resolvable[i - 1].end) {
|
|
2244
|
+
warnings.push(`ranges "${parsed[resolvable[i - 1].i].spec}" and "${parsed[resolvable[i].i].spec}" overlap - servers may reject overlapping multi-range requests`);
|
|
2245
|
+
}
|
|
2246
|
+
}
|
|
2247
|
+
if (parsed.length > 1 && parsed.some((r) => r.byteLength === null)) {
|
|
2248
|
+
warnings.push("totalSize was not provided, so open-ended ranges cannot be checked for overlap or total byte count");
|
|
2249
|
+
}
|
|
2250
|
+
const totalBytesRequested = parsed.every((r) => r.byteLength !== null) ? parsed.reduce((sum, r) => sum + (r.byteLength ?? 0), 0) : null;
|
|
2251
|
+
const headerValue = `${unit}=${parsed.map((r) => r.spec).join(",")}`;
|
|
2252
|
+
return {
|
|
2253
|
+
header: `Range: ${headerValue}`,
|
|
2254
|
+
headerValue,
|
|
2255
|
+
ranges: parsed,
|
|
2256
|
+
totalBytesRequested,
|
|
2257
|
+
warnings
|
|
2258
|
+
};
|
|
2259
|
+
}
|
|
2260
|
+
function parseContentRangeHeader(header) {
|
|
2261
|
+
if (!header || header.trim() === "") return { error: "Input is empty" };
|
|
2262
|
+
const match = header.trim().match(/^(\S+)\s+(\*|\d+-\d+)\/(\*|\d+)$/);
|
|
2263
|
+
if (!match) {
|
|
2264
|
+
return { error: 'Could not parse Content-Range header. Expected a format like "bytes 200-1000/67589" or "bytes */67589"' };
|
|
2265
|
+
}
|
|
2266
|
+
const [, unit, range, totalRaw] = match;
|
|
2267
|
+
const isUnsatisfiable = range === "*";
|
|
2268
|
+
const isTotalUnknown = totalRaw === "*";
|
|
2269
|
+
const total = isTotalUnknown ? null : Number(totalRaw);
|
|
2270
|
+
if (isUnsatisfiable) {
|
|
2271
|
+
return { unit, start: null, end: null, total, isUnsatisfiable, isTotalUnknown, byteLength: null };
|
|
2272
|
+
}
|
|
2273
|
+
const [startRaw, endRaw] = range.split("-");
|
|
2274
|
+
const start = Number(startRaw);
|
|
2275
|
+
const end = Number(endRaw);
|
|
2276
|
+
if (end < start) {
|
|
2277
|
+
return { error: `Invalid range: end (${end}) is before start (${start})` };
|
|
2278
|
+
}
|
|
2279
|
+
return { unit, start, end, total, isUnsatisfiable, isTotalUnknown, byteLength: end - start + 1 };
|
|
2280
|
+
}
|
|
2168
2281
|
|
|
2169
2282
|
exports.DNS_RECORD_TYPES = DNS_RECORD_TYPES;
|
|
2170
2283
|
exports.HTTP_HEADERS = HTTP_HEADERS;
|
|
@@ -2177,6 +2290,7 @@ exports.buildDnsQueryUrl = buildDnsQueryUrl;
|
|
|
2177
2290
|
exports.buildGeoUrl = buildGeoUrl;
|
|
2178
2291
|
exports.buildLinkHeader = buildLinkHeader;
|
|
2179
2292
|
exports.buildMapUrl = buildMapUrl;
|
|
2293
|
+
exports.buildRangeHeader = buildRangeHeader;
|
|
2180
2294
|
exports.buildReferrerPolicy = buildReferrerPolicy;
|
|
2181
2295
|
exports.checkSetCookieHeader = checkSetCookieHeader;
|
|
2182
2296
|
exports.countryCodeToFlag = countryCodeToFlag;
|
|
@@ -2193,6 +2307,7 @@ exports.isSuccess = isSuccess;
|
|
|
2193
2307
|
exports.isValidIp = isValidIp;
|
|
2194
2308
|
exports.isValidIpv4 = isValidIpv4;
|
|
2195
2309
|
exports.isValidIpv6 = isValidIpv6;
|
|
2310
|
+
exports.parseContentRangeHeader = parseContentRangeHeader;
|
|
2196
2311
|
exports.parseDnsResponse = parseDnsResponse;
|
|
2197
2312
|
exports.parseGeoResponse = parseGeoResponse;
|
|
2198
2313
|
exports.parseHar = parseHar;
|
package/dist/tools/network.d.cts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { A as AuthResultEntry, C as CacheControlDirective, a as CacheControlOptions, b as CacheControlResult, c as
|
|
1
|
+
export { A as AuthResultEntry, B as BuildRangeHeaderOptions, C as CacheControlDirective, a as CacheControlOptions, b as CacheControlResult, c as ContentRangeResult, d as CookieAttributes, e as CookieCheckResult, D as DNS_RECORD_TYPES, f as DnsRecord, g as DnsRecordType, h as DnsResponse, E as EmailHeaderAnalysis, i as EmailHeaderField, G as GeoResult, H as HTTP_HEADERS, j as HarEntry, k as HarParseResult, l as HarSummary, m as HeaderCategory, o as HttpHeader, I as Ipv6AddressType, p as Ipv6ParseResult, L as LINK_REL_VALUES, q as LinkHeaderEntry, r as LinkHeaderEntryInput, s as LinkHeaderResult, t as LinkRel, P as ParsedDnsResult, u as ParsedGeoResult, R as REFERRER_POLICY_VALUES, v as RangeEntry, w as RangeEntryInput, x as RangeHeaderResult, y as ReceivedHop, z as ReferrerPolicyEntry, F as ReferrerPolicyResult, J as ReferrerPolicyValue, K as RobotsGroup, M as RobotsIssue, N as RobotsRule, O as RobotsValidationResult, S as STATUS_CODES, Q as SameSiteValue, T as SitemapIndexEntry, U as SitemapIssue, V as SitemapUrlEntry, W as SitemapValidationResult, X as StatusCode, Y as UaDeviceType, Z as UserAgentInfo, _ as analyzeEmailHeaders, $ as buildCacheControl, a0 as buildDnsQueryUrl, a1 as buildGeoUrl, a2 as buildLinkHeader, a3 as buildMapUrl, a4 as buildRangeHeader, a5 as buildReferrerPolicy, a6 as checkSetCookieHeader, a7 as countryCodeToFlag, a8 as formatCoordinates, a9 as formatTtl, aa as getByCategory, ab as getHeader, ac as getHeadersByCategory, ad as getStatusByCategory, ae as getStatusCode, af as isClientError, ag as isServerError, ah as isSuccess, ai as isValidIp, aj as isValidIpv4, ak as isValidIpv6, al as parseContentRangeHeader, am as parseDnsResponse, an as parseGeoResponse, ao as parseHar, ap as parseIpv6Address, aq as parseUserAgent, ar as searchHeaders, as as searchStatusCodes, at as statusCodeToText, au as typeNumberToLabel, av as validateDomain, aw as validateHeaderName, ax as validateHeaderValue, ay as validateRobotsTxt, az as validateSitemap } from '../network-BC8McQOh.cjs';
|
package/dist/tools/network.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { A as AuthResultEntry, C as CacheControlDirective, a as CacheControlOptions, b as CacheControlResult, c as
|
|
1
|
+
export { A as AuthResultEntry, B as BuildRangeHeaderOptions, C as CacheControlDirective, a as CacheControlOptions, b as CacheControlResult, c as ContentRangeResult, d as CookieAttributes, e as CookieCheckResult, D as DNS_RECORD_TYPES, f as DnsRecord, g as DnsRecordType, h as DnsResponse, E as EmailHeaderAnalysis, i as EmailHeaderField, G as GeoResult, H as HTTP_HEADERS, j as HarEntry, k as HarParseResult, l as HarSummary, m as HeaderCategory, o as HttpHeader, I as Ipv6AddressType, p as Ipv6ParseResult, L as LINK_REL_VALUES, q as LinkHeaderEntry, r as LinkHeaderEntryInput, s as LinkHeaderResult, t as LinkRel, P as ParsedDnsResult, u as ParsedGeoResult, R as REFERRER_POLICY_VALUES, v as RangeEntry, w as RangeEntryInput, x as RangeHeaderResult, y as ReceivedHop, z as ReferrerPolicyEntry, F as ReferrerPolicyResult, J as ReferrerPolicyValue, K as RobotsGroup, M as RobotsIssue, N as RobotsRule, O as RobotsValidationResult, S as STATUS_CODES, Q as SameSiteValue, T as SitemapIndexEntry, U as SitemapIssue, V as SitemapUrlEntry, W as SitemapValidationResult, X as StatusCode, Y as UaDeviceType, Z as UserAgentInfo, _ as analyzeEmailHeaders, $ as buildCacheControl, a0 as buildDnsQueryUrl, a1 as buildGeoUrl, a2 as buildLinkHeader, a3 as buildMapUrl, a4 as buildRangeHeader, a5 as buildReferrerPolicy, a6 as checkSetCookieHeader, a7 as countryCodeToFlag, a8 as formatCoordinates, a9 as formatTtl, aa as getByCategory, ab as getHeader, ac as getHeadersByCategory, ad as getStatusByCategory, ae as getStatusCode, af as isClientError, ag as isServerError, ah as isSuccess, ai as isValidIp, aj as isValidIpv4, ak as isValidIpv6, al as parseContentRangeHeader, am as parseDnsResponse, an as parseGeoResponse, ao as parseHar, ap as parseIpv6Address, aq as parseUserAgent, ar as searchHeaders, as as searchStatusCodes, at as statusCodeToText, au as typeNumberToLabel, av as validateDomain, aw as validateHeaderName, ax as validateHeaderValue, ay as validateRobotsTxt, az as validateSitemap } from '../network-BC8McQOh.js';
|
package/dist/tools/network.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { DNS_RECORD_TYPES, HTTP_HEADERS, LINK_REL_VALUES, REFERRER_POLICY_VALUES, STATUS_CODES, analyzeEmailHeaders, buildCacheControl, buildDnsQueryUrl, buildGeoUrl, buildLinkHeader, buildMapUrl, buildReferrerPolicy, checkSetCookieHeader, countryCodeToFlag, formatCoordinates, formatTtl, getByCategory, getHeader, getHeadersByCategory, getStatusByCategory, getStatusCode, isClientError, isServerError, isSuccess, isValidIp, isValidIpv4, isValidIpv6, parseDnsResponse, parseGeoResponse, parseHar, parseIpv6Address, parseUserAgent, searchHeaders, searchStatusCodes, statusCodeToText, typeNumberToLabel, validateDomain, validateHeaderName, validateHeaderValue, validateRobotsTxt, validateSitemap } from '../chunk-
|
|
1
|
+
export { DNS_RECORD_TYPES, HTTP_HEADERS, LINK_REL_VALUES, REFERRER_POLICY_VALUES, STATUS_CODES, analyzeEmailHeaders, buildCacheControl, buildDnsQueryUrl, buildGeoUrl, buildLinkHeader, buildMapUrl, buildRangeHeader, buildReferrerPolicy, checkSetCookieHeader, countryCodeToFlag, formatCoordinates, formatTtl, getByCategory, getHeader, getHeadersByCategory, getStatusByCategory, getStatusCode, isClientError, isServerError, isSuccess, isValidIp, isValidIpv4, isValidIpv6, parseContentRangeHeader, parseDnsResponse, parseGeoResponse, parseHar, parseIpv6Address, parseUserAgent, searchHeaders, searchStatusCodes, statusCodeToText, typeNumberToLabel, validateDomain, validateHeaderName, validateHeaderValue, validateRobotsTxt, validateSitemap } from '../chunk-7WSFJTYP.js';
|
|
2
2
|
import '../chunk-MLKGABMK.js';
|
package/dist/tools/units.cjs
CHANGED
|
@@ -1780,6 +1780,64 @@ function compareUnitPrices(items) {
|
|
|
1780
1780
|
const bestLabel = results.find((r) => r.isBest).label;
|
|
1781
1781
|
return { items: results, bestLabel };
|
|
1782
1782
|
}
|
|
1783
|
+
var USD_DENOMINATIONS = [100, 50, 20, 10, 5, 1, 0.25, 0.1, 0.05, 0.01];
|
|
1784
|
+
function _cashToCents(n) {
|
|
1785
|
+
return Math.round(n * 100);
|
|
1786
|
+
}
|
|
1787
|
+
function calculateCashBreakdown(amount, denominations) {
|
|
1788
|
+
if (!Number.isFinite(amount) || amount < 0) return { error: "Amount must be zero or a positive number" };
|
|
1789
|
+
if (!Array.isArray(denominations) || denominations.length === 0) {
|
|
1790
|
+
return { error: "At least one denomination is required" };
|
|
1791
|
+
}
|
|
1792
|
+
for (const d of denominations) {
|
|
1793
|
+
if (typeof d !== "number" || !Number.isFinite(d) || d <= 0) {
|
|
1794
|
+
return { error: "Each denomination must be a positive number" };
|
|
1795
|
+
}
|
|
1796
|
+
}
|
|
1797
|
+
const round22 = (n) => Math.round(n * 100) / 100;
|
|
1798
|
+
const sorted = Array.from(new Set(denominations)).sort((a, b) => b - a);
|
|
1799
|
+
let remainingCents = _cashToCents(amount);
|
|
1800
|
+
const breakdown = [];
|
|
1801
|
+
let totalCount = 0;
|
|
1802
|
+
for (const d of sorted) {
|
|
1803
|
+
const dCents = _cashToCents(d);
|
|
1804
|
+
const count = Math.floor(remainingCents / dCents);
|
|
1805
|
+
if (count > 0) {
|
|
1806
|
+
breakdown.push({ denomination: d, count, subtotal: round22(count * d) });
|
|
1807
|
+
remainingCents -= count * dCents;
|
|
1808
|
+
totalCount += count;
|
|
1809
|
+
}
|
|
1810
|
+
}
|
|
1811
|
+
return {
|
|
1812
|
+
amount: round22(amount),
|
|
1813
|
+
denominations: sorted,
|
|
1814
|
+
breakdown,
|
|
1815
|
+
totalCount,
|
|
1816
|
+
remainder: round22(remainingCents / 100)
|
|
1817
|
+
};
|
|
1818
|
+
}
|
|
1819
|
+
function calculateChange(amountDue, amountTendered, denominations) {
|
|
1820
|
+
if (!Number.isFinite(amountDue) || amountDue < 0) return { error: "Amount due must be zero or a positive number" };
|
|
1821
|
+
if (!Number.isFinite(amountTendered) || amountTendered < 0) {
|
|
1822
|
+
return { error: "Amount tendered must be zero or a positive number" };
|
|
1823
|
+
}
|
|
1824
|
+
if (_cashToCents(amountTendered) < _cashToCents(amountDue)) {
|
|
1825
|
+
return { error: "Amount tendered must be greater than or equal to the amount due" };
|
|
1826
|
+
}
|
|
1827
|
+
const round22 = (n) => Math.round(n * 100) / 100;
|
|
1828
|
+
const changeDue = round22(amountTendered - amountDue);
|
|
1829
|
+
const breakdown = calculateCashBreakdown(changeDue, denominations);
|
|
1830
|
+
if ("error" in breakdown) return breakdown;
|
|
1831
|
+
return {
|
|
1832
|
+
amountDue: round22(amountDue),
|
|
1833
|
+
amountTendered: round22(amountTendered),
|
|
1834
|
+
changeDue,
|
|
1835
|
+
denominations: breakdown.denominations,
|
|
1836
|
+
breakdown: breakdown.breakdown,
|
|
1837
|
+
totalCount: breakdown.totalCount,
|
|
1838
|
+
remainder: breakdown.remainder
|
|
1839
|
+
};
|
|
1840
|
+
}
|
|
1783
1841
|
|
|
1784
1842
|
exports.BASE_LABELS = BASE_LABELS;
|
|
1785
1843
|
exports.BASE_PREFIXES = BASE_PREFIXES;
|
|
@@ -1792,12 +1850,15 @@ exports.COMMON_SIZES = COMMON_SIZES;
|
|
|
1792
1850
|
exports.COMMON_TAX_RATES = COMMON_TAX_RATES;
|
|
1793
1851
|
exports.COMMON_TIP_PERCENTAGES = COMMON_TIP_PERCENTAGES;
|
|
1794
1852
|
exports.COMMON_VIEWPORTS = COMMON_VIEWPORTS;
|
|
1853
|
+
exports.USD_DENOMINATIONS = USD_DENOMINATIONS;
|
|
1795
1854
|
exports.applySuccessiveDiscounts = applySuccessiveDiscounts;
|
|
1796
1855
|
exports.autoFormat = autoFormat;
|
|
1797
1856
|
exports.bumpVersion = bumpVersion;
|
|
1798
1857
|
exports.calcAspectRatio = calcAspectRatio;
|
|
1799
1858
|
exports.calcSubnet = calcSubnet;
|
|
1800
1859
|
exports.calculateBreakEven = calculateBreakEven;
|
|
1860
|
+
exports.calculateCashBreakdown = calculateCashBreakdown;
|
|
1861
|
+
exports.calculateChange = calculateChange;
|
|
1801
1862
|
exports.calculateCompoundInterest = calculateCompoundInterest;
|
|
1802
1863
|
exports.calculateDiscount = calculateDiscount;
|
|
1803
1864
|
exports.calculateEmi = calculateEmi;
|
package/dist/tools/units.d.cts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { A as AmortizationRow, a as AprApyDirection, b as AprApyResult, c as AspectRatioResult, B as BASE_LABELS, d as BASE_PREFIXES, e as BYTE_UNITS, f as BarcodeFormat, g as BarcodeValidationResult, h as BaseConvertResult, i as BreakEvenInput, j as BreakEvenResult, k as ByteConvertResult, l as ByteUnit, C as COMMON_CURRENCIES, m as COMMON_LOCALES, n as COMMON_PERMISSIONS, o as COMMON_RATIOS, p as COMMON_SIZES, q as COMMON_TAX_RATES, r as COMMON_TIP_PERCENTAGES, s as COMMON_VIEWPORTS, t as CardValidationResult, v as
|
|
1
|
+
export { A as AmortizationRow, a as AprApyDirection, b as AprApyResult, c as AspectRatioResult, B as BASE_LABELS, d as BASE_PREFIXES, e as BYTE_UNITS, f as BarcodeFormat, g as BarcodeValidationResult, h as BaseConvertResult, i as BreakEvenInput, j as BreakEvenResult, k as ByteConvertResult, l as ByteUnit, C as COMMON_CURRENCIES, m as COMMON_LOCALES, n as COMMON_PERMISSIONS, o as COMMON_RATIOS, p as COMMON_SIZES, q as COMMON_TAX_RATES, r as COMMON_TIP_PERCENTAGES, s as COMMON_VIEWPORTS, t as CardValidationResult, v as CashBreakdownResult, w as CashChangeResult, x as CashDenominationItem, y as CompareUnitPricesResult, z as CompoundInterestResult, D as CompoundYearRow, E as Dimensions, F as DiscountField, G as DiscountInput, H as DiscountResult, I as EmiResult, J as EmiTenureUnit, K as EmiYearlyBreakdownRow, L as FilePermissions, M as FormatOptions, N as IbanValidationResult, O as IpConversion, P as IsbnFormat, Q as IsbnResult, R as LoanResult, S as MarginMarkupField, T as MarginMarkupInput, U as MarginMarkupResult, V as NotationStyle, W as NumberBase, X as PercentChangeDirection, Y as PercentageChangeResult, Z as Permission, _ as PxConvertResult, $ as RoiInput, a0 as RoiResult, a1 as RuleOf72Direction, a2 as RuleOf72Result, a3 as SavingsGoalInput, a4 as SavingsGoalMode, a5 as SavingsGoalResult, a6 as SemverVersion, a7 as SimpleInterestResult, a8 as SubnetInfo, a9 as SuccessiveDiscountResult, aa as SuccessiveDiscountStep, ab as TaxDirection, ac as TaxResult, ad as TimeValueDirection, ae as TimeValueResult, af as TipSplitResult, ag as USD_DENOMINATIONS, ah as UnitPriceItem, ai as UnitPriceResult, aj as VideoBitrateInput, ak as VideoBitrateMode, al as VideoBitrateResult, am as ViewportConvertResult, an as applySuccessiveDiscounts, ao as autoFormat, ap as bumpVersion, aq as calcAspectRatio, ar as calcSubnet, as as calculateBreakEven, at as calculateCashBreakdown, au as calculateChange, av as calculateCompoundInterest, aw as calculateDiscount, ax as calculateEmi, ay as calculateLoan, az as calculateMarginMarkup, aA as calculatePercentageChange, aB as calculateRoi, aC as calculateRuleOf72, aD as calculateSavingsGoal, aE as calculateSimpleInterest, aF as calculateTax, aG as calculateTimeValue, aH as calculateTipSplit, aI as calculateVideoBitrate, aJ as compareSemver, aK as compareUnitPrices, aL as convert, aM as convertAprApy, aN as convertBytes, aO as convertIp, aP as coverBox, aQ as decimalToIp, aR as decimalToIpCidr, aS as describePermissions, aT as fitIntoBox, aU as formatNumber, aV as formatValue, aW as formatVwValue, aX as formatWithSeparator, aY as gcd, aZ as ipFromBinary, a_ as ipFromDecimal, a$ as ipFromHex, b0 as ipToBinary, b1 as ipToDecimal, b2 as ipToDecimalCidr, b3 as ipToHex, b4 as ipToOctal, b5 as isValid, b6 as isValidCidr, b7 as isValidIp, b8 as isValidIpv4, b9 as marginToMarkup, ba as markupToMargin, bb as octalToPermissions, bc as parseFileSize, bd as parseInput, be as parseNumberString, bf as parseSemver, bg as permissionsToChmod, bh as permissionsToOctal, bi as permissionsToSymbolic, bj as ptToPx, bk as pxToAll, bl as pxToViewport, bm as remToPx, bn as satisfiesRange, bo as scaleByHeight, bp as scaleByWidth, bq as sortVersions, br as splitSubnet, bs as symbolicToPermissions, bt as validateBarcode, bu as validateCardNumber, bv as validateIban, bw as validateIsbn, bx as viewportToPx } from '../units-CzPwRC03.cjs';
|
package/dist/tools/units.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { A as AmortizationRow, a as AprApyDirection, b as AprApyResult, c as AspectRatioResult, B as BASE_LABELS, d as BASE_PREFIXES, e as BYTE_UNITS, f as BarcodeFormat, g as BarcodeValidationResult, h as BaseConvertResult, i as BreakEvenInput, j as BreakEvenResult, k as ByteConvertResult, l as ByteUnit, C as COMMON_CURRENCIES, m as COMMON_LOCALES, n as COMMON_PERMISSIONS, o as COMMON_RATIOS, p as COMMON_SIZES, q as COMMON_TAX_RATES, r as COMMON_TIP_PERCENTAGES, s as COMMON_VIEWPORTS, t as CardValidationResult, v as
|
|
1
|
+
export { A as AmortizationRow, a as AprApyDirection, b as AprApyResult, c as AspectRatioResult, B as BASE_LABELS, d as BASE_PREFIXES, e as BYTE_UNITS, f as BarcodeFormat, g as BarcodeValidationResult, h as BaseConvertResult, i as BreakEvenInput, j as BreakEvenResult, k as ByteConvertResult, l as ByteUnit, C as COMMON_CURRENCIES, m as COMMON_LOCALES, n as COMMON_PERMISSIONS, o as COMMON_RATIOS, p as COMMON_SIZES, q as COMMON_TAX_RATES, r as COMMON_TIP_PERCENTAGES, s as COMMON_VIEWPORTS, t as CardValidationResult, v as CashBreakdownResult, w as CashChangeResult, x as CashDenominationItem, y as CompareUnitPricesResult, z as CompoundInterestResult, D as CompoundYearRow, E as Dimensions, F as DiscountField, G as DiscountInput, H as DiscountResult, I as EmiResult, J as EmiTenureUnit, K as EmiYearlyBreakdownRow, L as FilePermissions, M as FormatOptions, N as IbanValidationResult, O as IpConversion, P as IsbnFormat, Q as IsbnResult, R as LoanResult, S as MarginMarkupField, T as MarginMarkupInput, U as MarginMarkupResult, V as NotationStyle, W as NumberBase, X as PercentChangeDirection, Y as PercentageChangeResult, Z as Permission, _ as PxConvertResult, $ as RoiInput, a0 as RoiResult, a1 as RuleOf72Direction, a2 as RuleOf72Result, a3 as SavingsGoalInput, a4 as SavingsGoalMode, a5 as SavingsGoalResult, a6 as SemverVersion, a7 as SimpleInterestResult, a8 as SubnetInfo, a9 as SuccessiveDiscountResult, aa as SuccessiveDiscountStep, ab as TaxDirection, ac as TaxResult, ad as TimeValueDirection, ae as TimeValueResult, af as TipSplitResult, ag as USD_DENOMINATIONS, ah as UnitPriceItem, ai as UnitPriceResult, aj as VideoBitrateInput, ak as VideoBitrateMode, al as VideoBitrateResult, am as ViewportConvertResult, an as applySuccessiveDiscounts, ao as autoFormat, ap as bumpVersion, aq as calcAspectRatio, ar as calcSubnet, as as calculateBreakEven, at as calculateCashBreakdown, au as calculateChange, av as calculateCompoundInterest, aw as calculateDiscount, ax as calculateEmi, ay as calculateLoan, az as calculateMarginMarkup, aA as calculatePercentageChange, aB as calculateRoi, aC as calculateRuleOf72, aD as calculateSavingsGoal, aE as calculateSimpleInterest, aF as calculateTax, aG as calculateTimeValue, aH as calculateTipSplit, aI as calculateVideoBitrate, aJ as compareSemver, aK as compareUnitPrices, aL as convert, aM as convertAprApy, aN as convertBytes, aO as convertIp, aP as coverBox, aQ as decimalToIp, aR as decimalToIpCidr, aS as describePermissions, aT as fitIntoBox, aU as formatNumber, aV as formatValue, aW as formatVwValue, aX as formatWithSeparator, aY as gcd, aZ as ipFromBinary, a_ as ipFromDecimal, a$ as ipFromHex, b0 as ipToBinary, b1 as ipToDecimal, b2 as ipToDecimalCidr, b3 as ipToHex, b4 as ipToOctal, b5 as isValid, b6 as isValidCidr, b7 as isValidIp, b8 as isValidIpv4, b9 as marginToMarkup, ba as markupToMargin, bb as octalToPermissions, bc as parseFileSize, bd as parseInput, be as parseNumberString, bf as parseSemver, bg as permissionsToChmod, bh as permissionsToOctal, bi as permissionsToSymbolic, bj as ptToPx, bk as pxToAll, bl as pxToViewport, bm as remToPx, bn as satisfiesRange, bo as scaleByHeight, bp as scaleByWidth, bq as sortVersions, br as splitSubnet, bs as symbolicToPermissions, bt as validateBarcode, bu as validateCardNumber, bv as validateIban, bw as validateIsbn, bx as viewportToPx } from '../units-CzPwRC03.js';
|
package/dist/tools/units.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { BASE_LABELS, BASE_PREFIXES, BYTE_UNITS, COMMON_CURRENCIES, COMMON_LOCALES, COMMON_PERMISSIONS, COMMON_RATIOS, COMMON_SIZES, COMMON_TAX_RATES, COMMON_TIP_PERCENTAGES, COMMON_VIEWPORTS, applySuccessiveDiscounts, autoFormat, bumpVersion, calcAspectRatio, calcSubnet, calculateBreakEven, calculateCompoundInterest, calculateDiscount, calculateEmi, calculateLoan, calculateMarginMarkup, calculatePercentageChange, calculateRoi, calculateRuleOf72, calculateSavingsGoal, calculateSimpleInterest, calculateTax, calculateTimeValue, calculateTipSplit, calculateVideoBitrate, compareSemver, compareUnitPrices, convert, convertAprApy, convertBytes, convertIp, coverBox, decimalToIp, decimalToIpCidr, describePermissions, fitIntoBox, formatNumber, formatValue, formatVwValue, formatWithSeparator, gcd, ipFromBinary, ipFromDecimal, ipFromHex, ipToBinary, ipToDecimal, ipToDecimalCidr, ipToHex, ipToOctal, isValid, isValidCidr, isValidIp, isValidIpv4, marginToMarkup, markupToMargin, octalToPermissions, parseFileSize, parseInput, parseNumberString, parseSemver, permissionsToChmod, permissionsToOctal, permissionsToSymbolic, ptToPx, pxToAll, pxToViewport, remToPx, satisfiesRange, scaleByHeight, scaleByWidth, sortVersions, splitSubnet, symbolicToPermissions, validateBarcode, validateCardNumber, validateIban, validateIsbn, viewportToPx } from '../chunk-
|
|
1
|
+
export { BASE_LABELS, BASE_PREFIXES, BYTE_UNITS, COMMON_CURRENCIES, COMMON_LOCALES, COMMON_PERMISSIONS, COMMON_RATIOS, COMMON_SIZES, COMMON_TAX_RATES, COMMON_TIP_PERCENTAGES, COMMON_VIEWPORTS, USD_DENOMINATIONS, applySuccessiveDiscounts, autoFormat, bumpVersion, calcAspectRatio, calcSubnet, calculateBreakEven, calculateCashBreakdown, calculateChange, calculateCompoundInterest, calculateDiscount, calculateEmi, calculateLoan, calculateMarginMarkup, calculatePercentageChange, calculateRoi, calculateRuleOf72, calculateSavingsGoal, calculateSimpleInterest, calculateTax, calculateTimeValue, calculateTipSplit, calculateVideoBitrate, compareSemver, compareUnitPrices, convert, convertAprApy, convertBytes, convertIp, coverBox, decimalToIp, decimalToIpCidr, describePermissions, fitIntoBox, formatNumber, formatValue, formatVwValue, formatWithSeparator, gcd, ipFromBinary, ipFromDecimal, ipFromHex, ipToBinary, ipToDecimal, ipToDecimalCidr, ipToHex, ipToOctal, isValid, isValidCidr, isValidIp, isValidIpv4, marginToMarkup, markupToMargin, octalToPermissions, parseFileSize, parseInput, parseNumberString, parseSemver, permissionsToChmod, permissionsToOctal, permissionsToSymbolic, ptToPx, pxToAll, pxToViewport, remToPx, satisfiesRange, scaleByHeight, scaleByWidth, sortVersions, splitSubnet, symbolicToPermissions, validateBarcode, validateCardNumber, validateIban, validateIsbn, viewportToPx } from '../chunk-2MTHD2LG.js';
|
|
2
2
|
import '../chunk-MLKGABMK.js';
|