@utilix-tech/sdk 0.37.0 → 0.39.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.
Files changed (35) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +21 -5
  3. package/dist/{chunk-7AJRK57W.js → chunk-47RI5V3B.js} +31 -1
  4. package/dist/{chunk-YEXQDI3J.js → chunk-RZUNTYEH.js} +40 -1
  5. package/dist/{chunk-GEFVMGZR.js → chunk-VEVNIGJ6.js} +26 -1
  6. package/dist/{chunk-DBNTO3YO.js → chunk-Y4BVU76A.js} +80 -1
  7. package/dist/{data-CFeS9kes.d.cts → data-BCf3dm-E.d.cts} +28 -2
  8. package/dist/{data-CFeS9kes.d.ts → data-BCf3dm-E.d.ts} +28 -2
  9. package/dist/{hashing-CnetQFD_.d.cts → hashing-Dnj0IAZf.d.cts} +27 -2
  10. package/dist/{hashing-CnetQFD_.d.ts → hashing-Dnj0IAZf.d.ts} +27 -2
  11. package/dist/index.cjs +173 -0
  12. package/dist/index.d.cts +4 -4
  13. package/dist/index.d.ts +4 -4
  14. package/dist/index.js +4 -4
  15. package/dist/{network-CnKUQT4g.d.cts → network-CKPoesdD.d.cts} +52 -2
  16. package/dist/{network-CnKUQT4g.d.ts → network-CKPoesdD.d.ts} +52 -2
  17. package/dist/tools/data.cjs +39 -0
  18. package/dist/tools/data.d.cts +1 -1
  19. package/dist/tools/data.d.ts +1 -1
  20. package/dist/tools/data.js +1 -1
  21. package/dist/tools/hashing.cjs +25 -0
  22. package/dist/tools/hashing.d.cts +1 -1
  23. package/dist/tools/hashing.d.ts +1 -1
  24. package/dist/tools/hashing.js +1 -1
  25. package/dist/tools/network.cjs +79 -0
  26. package/dist/tools/network.d.cts +1 -1
  27. package/dist/tools/network.d.ts +1 -1
  28. package/dist/tools/network.js +1 -1
  29. package/dist/tools/units.cjs +30 -0
  30. package/dist/tools/units.d.cts +1 -1
  31. package/dist/tools/units.d.ts +1 -1
  32. package/dist/tools/units.js +1 -1
  33. package/dist/{units-c90DW-OZ.d.cts → units-HQrMCiNM.d.cts} +34 -2
  34. package/dist/{units-c90DW-OZ.d.ts → units-HQrMCiNM.d.ts} +34 -2
  35. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  Full release notes for all Utilix surfaces (browser tools, REST API, SDKs, MCP server) live at [utilix.tech/changelog](https://utilix.tech/changelog). This file tracks just this package.
4
4
 
5
+ ## 0.39.0
6
+ - Add `generateSri`, `generateSriAll` (sri-hash-generator): compute SHA-256/384/512 Subresource Integrity hashes for a script or stylesheet's content, formatted as the `<algorithm>-<base64>` string an HTML `integrity` attribute expects.
7
+ - Add `analyzeEmailHeaders` (email-header-analyzer): parse a raw email header block into structured From/To/Subject fields, the Received hop chain in order, and SPF/DKIM/DMARC results from an Authentication-Results header.
8
+
9
+ ## 0.38.0
10
+ - Add `compareUnitPrices` (unit-price-comparator): compare two or more package options by price and quantity to find the true cost per unit, flag the cheapest, and report how much more expensive each other option is by percentage.
11
+ - Add `csvToSqlInsert` (csv-to-sql-insert-generator): convert CSV data with a header row into parameterless SQL INSERT statements, with basic type inference (numbers/booleans unquoted, empty cells NULL) and ANSI/MySQL identifier quoting.
12
+
5
13
  ## 0.37.0
6
14
  - Add `checkSetCookieHeader` (same-site-cookie-checker): parse a Set-Cookie header value and validate its attribute combination, flagging SameSite=None missing Secure, __Host-/__Secure- prefix violations, a missing Secure attribute, and a Max-Age past 400 days.
7
15
  - Add `testGitignorePatterns` (gitignore-tester): test a list of paths against a .gitignore file's patterns, following git's last-match-wins and negation rules, and report which pattern and line number decided each path's outcome.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @utilix-tech/sdk
2
2
 
3
- **604 developer utility functions for Node.js: runs locally, no API key required.**
3
+ **610 developer utility functions for Node.js: runs locally, no API key required.**
4
4
 
5
5
  [![npm version](https://img.shields.io/npm/v/@utilix-tech/sdk?style=flat-square&color=cb3837)](https://www.npmjs.com/package/@utilix-tech/sdk)
6
6
  [![npm downloads](https://img.shields.io/npm/dm/@utilix-tech/sdk?style=flat-square)](https://www.npmjs.com/package/@utilix-tech/sdk)
@@ -119,7 +119,7 @@ base62Encode("hello world"); // "AAwf93rvy4aWQVw"
119
119
  ### `/hashing`: Hash & Password
120
120
 
121
121
  ```ts
122
- import { hashAll, hashOne, hashPassword, verifyPassword, generateHtpasswdFile } from "@utilix-tech/sdk/hashing";
122
+ import { hashAll, hashOne, hashPassword, verifyPassword, generateHtpasswdFile, generateSriAll } from "@utilix-tech/sdk/hashing";
123
123
 
124
124
  // Hash with MD5, SHA-1, SHA-256, SHA-512 in one call
125
125
  const hashes = await hashAll("my-string");
@@ -131,6 +131,10 @@ const valid = await verifyPassword("my-password", hash);
131
131
 
132
132
  // Generate .htpasswd file
133
133
  generateHtpasswdFile([{ username: "alice", password: "secret" }]);
134
+
135
+ // Subresource Integrity hashes for a script/stylesheet's content (SHA-256/384/512)
136
+ generateSriAll("console.log(1)");
137
+ // [{ algorithm: "SHA-256", base64: "...", integrity: "sha256-..." }, ...]
134
138
  ```
135
139
 
136
140
  ---
@@ -193,7 +197,7 @@ import { parseCsv, csvToJson, validateYaml, tomlToJson, jsonToToml,
193
197
  formatXml, xmlToJson, jsonToXml, parseIni,
194
198
  validateNdjson, formatNdjson, ndjsonToJsonArray, diffEnvExample,
195
199
  parseSubtitles, convertSubtitles, shiftSubtitles, parseFrontMatter,
196
- generateMarkdownToc } from "@utilix-tech/sdk/data";
200
+ generateMarkdownToc, csvToSqlInsert } from "@utilix-tech/sdk/data";
197
201
 
198
202
  // CSV
199
203
  const rows = parseCsv("name,age\nalice,30\nbob,25");
@@ -235,6 +239,10 @@ parseFrontMatter("---\ntitle: Hello World\ntags: [foo, bar]\n---\n# Body");
235
239
  // Markdown table of contents: ATX headings -> nested links with GitHub-style slugs
236
240
  generateMarkdownToc("# Title\n\n## Section One\n\n## Section Two\n");
237
241
  // { toc: "- [Title](#title)\n - [Section One](#section-one)\n - [Section Two](#section-two)", entries: [...] }
242
+
243
+ // CSV to SQL INSERT statements, with basic type inference and identifier quoting
244
+ csvToSqlInsert("name,age\nAlice,30\nBob,25", { tableName: "users" });
245
+ // { sql: 'INSERT INTO "users" ("name", "age") VALUES (\'Alice\', 30);\n...', rowCount: 2, ... }
238
246
  ```
239
247
 
240
248
  ---
@@ -296,7 +304,7 @@ formatIso8601Duration(90061); // { iso: "P1DT1H1M1S", ... }
296
304
  ### `/units`: Conversions
297
305
 
298
306
  ```ts
299
- import { convertBytes, pxToAll, convert, formatValue, validateCardNumber, validateIban, calculateLoan, validateBarcode, calculateTax, calculateCompoundInterest, validateIsbn, calculateTipSplit, calculateSimpleInterest, calculateTimeValue, calculatePercentageChange, convertAprApy, calculateMarginMarkup, calculateDiscount, applySuccessiveDiscounts, calculateBreakEven, calculateVideoBitrate, calculateRuleOf72, calculateEmi, calculateRoi } from "@utilix-tech/sdk/units";
307
+ import { convertBytes, pxToAll, convert, formatValue, validateCardNumber, validateIban, calculateLoan, validateBarcode, calculateTax, calculateCompoundInterest, validateIsbn, calculateTipSplit, calculateSimpleInterest, calculateTimeValue, calculatePercentageChange, convertAprApy, calculateMarginMarkup, calculateDiscount, applySuccessiveDiscounts, calculateBreakEven, calculateVideoBitrate, calculateRuleOf72, calculateEmi, calculateRoi, compareUnitPrices } from "@utilix-tech/sdk/units";
300
308
 
301
309
  // File sizes
302
310
  convertBytes(1073741824, "GB"); // 1
@@ -394,6 +402,10 @@ calculateEmi(500000, 8.5, 5, "years");
394
402
  // ROI: return on investment percent, plus annualized (CAGR) return if years is given
395
403
  calculateRoi({ initialValue: 1000, finalValue: 1610.51, years: 5 });
396
404
  // { profit: 610.51, roiPercent: 61.051, annualizedReturnPercent: 10, ... }
405
+
406
+ // Unit price comparator: true cost per unit across package options, flags the cheapest
407
+ compareUnitPrices([{ label: "12-pack", price: 6, quantity: 12 }, { label: "24-pack", price: 10, quantity: 24 }]);
408
+ // { items: [...], bestLabel: "24-pack" }
397
409
  ```
398
410
 
399
411
  ---
@@ -404,7 +416,7 @@ calculateRoi({ initialValue: 1000, finalValue: 1610.51, years: 5 });
404
416
  import { getStatusCode, isValidIp, isValidIpv4, isValidIpv6,
405
417
  searchStatusCodes, buildGeoUrl, countryCodeToFlag,
406
418
  parseHar, validateSitemap, validateRobotsTxt,
407
- parseUserAgent, buildCacheControl, buildReferrerPolicy, parseIpv6Address, buildLinkHeader, checkSetCookieHeader } from "@utilix-tech/sdk/network";
419
+ parseUserAgent, buildCacheControl, buildReferrerPolicy, parseIpv6Address, buildLinkHeader, checkSetCookieHeader, analyzeEmailHeaders } from "@utilix-tech/sdk/network";
408
420
 
409
421
  getStatusCode(404);
410
422
  // { code: 404, text: "Not Found", description: "...", category: "Client Error" }
@@ -455,6 +467,10 @@ buildLinkHeader([{ url: "/fonts/inter.woff2", rel: "preload", as: "font", type:
455
467
  // Parse and validate a Set-Cookie header's attribute combination
456
468
  checkSetCookieHeader("session=abc123; SameSite=None");
457
469
  // { cookie: {...}, issues: ["SameSite=None requires the Secure attribute..."], warnings: [...], valid: false }
470
+
471
+ // Parse a raw email header block: fields, Received hop chain, SPF/DKIM/DMARC results
472
+ analyzeEmailHeaders(rawHeaderText);
473
+ // { from: "...", to: "...", receivedHops: [...], hopCount: 2, spf: "pass", dkim: "pass", dmarc: "pass", warnings: [] }
458
474
  ```
459
475
 
460
476
  ---
@@ -35,6 +35,7 @@ __export(units_exports, {
35
35
  calculateTipSplit: () => calculateTipSplit,
36
36
  calculateVideoBitrate: () => calculateVideoBitrate,
37
37
  compareSemver: () => compareSemver,
38
+ compareUnitPrices: () => compareUnitPrices,
38
39
  convert: () => convert,
39
40
  convertAprApy: () => convertAprApy,
40
41
  convertBytes: () => convertBytes,
@@ -1837,5 +1838,34 @@ function calculateRoi(input) {
1837
1838
  }
1838
1839
  return result;
1839
1840
  }
1841
+ function compareUnitPrices(items) {
1842
+ if (!Array.isArray(items) || items.length < 2) {
1843
+ return { error: "At least 2 items are required to compare" };
1844
+ }
1845
+ for (const item of items) {
1846
+ if (!item.label || typeof item.label !== "string") {
1847
+ return { error: "Each item must have a non-empty label" };
1848
+ }
1849
+ if (!Number.isFinite(item.price) || item.price <= 0) {
1850
+ return { error: `Item "${item.label}" must have a price greater than zero` };
1851
+ }
1852
+ if (!Number.isFinite(item.quantity) || item.quantity <= 0) {
1853
+ return { error: `Item "${item.label}" must have a quantity greater than zero` };
1854
+ }
1855
+ }
1856
+ const round4 = (n) => Math.round(n * 1e4) / 1e4;
1857
+ const unitPrices = items.map((item) => item.price / item.quantity);
1858
+ const bestUnitPrice = Math.min(...unitPrices);
1859
+ const results = items.map((item, i) => ({
1860
+ label: item.label,
1861
+ price: round4(item.price),
1862
+ quantity: round4(item.quantity),
1863
+ unitPrice: round4(unitPrices[i]),
1864
+ isBest: unitPrices[i] === bestUnitPrice,
1865
+ percentMoreThanBest: round4((unitPrices[i] - bestUnitPrice) / bestUnitPrice * 100)
1866
+ }));
1867
+ const bestLabel = results.find((r) => r.isBest).label;
1868
+ return { items: results, bestLabel };
1869
+ }
1840
1870
 
1841
- 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, 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, units_exports, validateBarcode, validateCardNumber, validateIban, validateIsbn, viewportToPx };
1871
+ 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, units_exports, validateBarcode, validateCardNumber, validateIban, validateIsbn, viewportToPx };
@@ -7,6 +7,7 @@ var data_exports = {};
7
7
  __export(data_exports, {
8
8
  convertSubtitles: () => convertSubtitles,
9
9
  csvToJson: () => csvToJson,
10
+ csvToSqlInsert: () => csvToSqlInsert,
10
11
  detectDelimiter: () => detectDelimiter,
11
12
  detectSubtitleFormat: () => detectSubtitleFormat,
12
13
  diffEnvExample: () => diffEnvExample,
@@ -1461,5 +1462,43 @@ function generateMarkdownToc(markdown, options = {}) {
1461
1462
  });
1462
1463
  return { toc: tocLines.join("\n"), entries };
1463
1464
  }
1465
+ function quoteSqlIdentifier(name, dialect) {
1466
+ if (dialect === "mysql") return "`" + name.replace(/`/g, "``") + "`";
1467
+ return '"' + name.replace(/"/g, '""') + '"';
1468
+ }
1469
+ function formatSqlValue(raw) {
1470
+ const trimmed = raw.trim();
1471
+ if (trimmed === "") return "NULL";
1472
+ if (/^-?\d+(\.\d+)?$/.test(trimmed)) return trimmed;
1473
+ if (/^(true|false)$/i.test(trimmed)) return trimmed.toLowerCase();
1474
+ return "'" + trimmed.replace(/'/g, "''") + "'";
1475
+ }
1476
+ function csvToSqlInsert(input, options) {
1477
+ const parsed = parseCsv(input);
1478
+ if ("error" in parsed) return parsed;
1479
+ const tableName = options?.tableName?.trim() || "my_table";
1480
+ if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(tableName)) {
1481
+ return { error: "tableName must start with a letter or underscore and contain only letters, digits, and underscores" };
1482
+ }
1483
+ const dialect = options?.dialect === "mysql" ? "mysql" : "ansi";
1484
+ const batchSize = options?.batchSize !== void 0 && Number.isFinite(options.batchSize) && options.batchSize > 0 ? Math.floor(options.batchSize) : 1;
1485
+ const columns = parsed.headers.map((h) => h.trim());
1486
+ const quotedTable = quoteSqlIdentifier(tableName, dialect);
1487
+ const quotedColumns = columns.map((c) => quoteSqlIdentifier(c, dialect)).join(", ");
1488
+ const statements = [];
1489
+ for (let i = 0; i < parsed.rows.length; i += batchSize) {
1490
+ const batch = parsed.rows.slice(i, i + batchSize);
1491
+ const tuples = batch.map(
1492
+ (row) => "(" + columns.map((_, idx) => formatSqlValue(row[idx] ?? "")).join(", ") + ")"
1493
+ );
1494
+ statements.push(`INSERT INTO ${quotedTable} (${quotedColumns}) VALUES ${tuples.join(", ")};`);
1495
+ }
1496
+ return {
1497
+ sql: statements.join("\n"),
1498
+ rowCount: parsed.rows.length,
1499
+ columnCount: columns.length,
1500
+ columns
1501
+ };
1502
+ }
1464
1503
 
1465
- export { convertSubtitles, csvToJson, data_exports, 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 };
1504
+ export { convertSubtitles, csvToJson, csvToSqlInsert, data_exports, 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 };
@@ -9,12 +9,15 @@ __export(hashing_exports, {
9
9
  HASH_ALGORITHMS: () => HASH_ALGORITHMS,
10
10
  HASH_BITS: () => HASH_BITS,
11
11
  ROUND_OPTIONS: () => ROUND_OPTIONS,
12
+ SRI_ALGORITHMS: () => SRI_ALGORITHMS,
12
13
  createEntry: () => createEntry,
13
14
  generateBcryptHash: () => generateBcryptHash,
14
15
  generateHtpasswdFile: () => generateHtpasswdFile,
15
16
  generateMd5Hash: () => generateMd5Hash,
16
17
  generatePlain: () => generatePlain,
17
18
  generateSha1Hash: () => generateSha1Hash,
19
+ generateSri: () => generateSri,
20
+ generateSriAll: () => generateSriAll,
18
21
  hashAll: () => hashAll,
19
22
  hashOne: () => hashOne,
20
23
  hashPassword: () => hashPassword,
@@ -247,5 +250,27 @@ function generateHtpasswdFile(entries) {
247
250
  function validateUsername(username) {
248
251
  return /^[^\s:]{1,255}$/.test(username);
249
252
  }
253
+ var SRI_ALGORITHMS = ["SHA-256", "SHA-384", "SHA-512"];
254
+ var SRI_NODE_ALG_MAP = {
255
+ "SHA-256": "sha256",
256
+ "SHA-384": "sha384",
257
+ "SHA-512": "sha512"
258
+ };
259
+ function generateSri(content, algorithm = "SHA-384") {
260
+ if (typeof content !== "string" || content.length === 0) {
261
+ return { error: "Content is required" };
262
+ }
263
+ if (!SRI_ALGORITHMS.includes(algorithm)) {
264
+ return { error: `Unknown algorithm: ${algorithm}. Must be one of ${SRI_ALGORITHMS.join(", ")}` };
265
+ }
266
+ const base64 = createHash(SRI_NODE_ALG_MAP[algorithm]).update(content, "utf8").digest("base64");
267
+ return { algorithm, base64, integrity: `${SRI_NODE_ALG_MAP[algorithm]}-${base64}` };
268
+ }
269
+ function generateSriAll(content) {
270
+ if (typeof content !== "string" || content.length === 0) {
271
+ return { error: "Content is required" };
272
+ }
273
+ return SRI_ALGORITHMS.map((alg) => generateSri(content, alg));
274
+ }
250
275
 
251
- export { HASH_ALGORITHMS, HASH_BITS, ROUND_OPTIONS, createEntry, generateBcryptHash, generateHtpasswdFile, generateMd5Hash, generatePlain, generateSha1Hash, hashAll, hashOne, hashPassword, hashWithTiming, hashing_exports, parseHtpasswdFile, validateRounds, validateUsername, verifyPassword };
276
+ export { HASH_ALGORITHMS, HASH_BITS, ROUND_OPTIONS, SRI_ALGORITHMS, createEntry, generateBcryptHash, generateHtpasswdFile, generateMd5Hash, generatePlain, generateSha1Hash, generateSri, generateSriAll, hashAll, hashOne, hashPassword, hashWithTiming, hashing_exports, parseHtpasswdFile, validateRounds, validateUsername, verifyPassword };
@@ -8,6 +8,7 @@ __export(network_exports, {
8
8
  LINK_REL_VALUES: () => LINK_REL_VALUES,
9
9
  REFERRER_POLICY_VALUES: () => REFERRER_POLICY_VALUES,
10
10
  STATUS_CODES: () => STATUS_CODES,
11
+ analyzeEmailHeaders: () => analyzeEmailHeaders,
11
12
  buildCacheControl: () => buildCacheControl,
12
13
  buildDnsQueryUrl: () => buildDnsQueryUrl,
13
14
  buildGeoUrl: () => buildGeoUrl,
@@ -2130,5 +2131,83 @@ function checkSetCookieHeader(header) {
2130
2131
  }
2131
2132
  return { cookie, issues, warnings, valid: issues.length === 0 };
2132
2133
  }
2134
+ function analyzeEmailHeaders(raw) {
2135
+ if (typeof raw !== "string" || !raw.trim()) {
2136
+ return { error: "Raw email header text is required" };
2137
+ }
2138
+ const normalized = raw.replace(/\r\n/g, "\n");
2139
+ const blockEnd = normalized.indexOf("\n\n");
2140
+ const headerBlock = blockEnd === -1 ? normalized : normalized.slice(0, blockEnd);
2141
+ const rawLines = headerBlock.split("\n");
2142
+ const unfolded = [];
2143
+ for (const line of rawLines) {
2144
+ if (/^[ \t]/.test(line) && unfolded.length > 0) {
2145
+ unfolded[unfolded.length - 1] += " " + line.trim();
2146
+ } else if (line.trim() !== "") {
2147
+ unfolded.push(line);
2148
+ }
2149
+ }
2150
+ const headers = [];
2151
+ for (const line of unfolded) {
2152
+ const colonIdx = line.indexOf(":");
2153
+ if (colonIdx === -1) continue;
2154
+ const name = line.slice(0, colonIdx).trim();
2155
+ const value = line.slice(colonIdx + 1).trim();
2156
+ if (!name) continue;
2157
+ headers.push({ name, value });
2158
+ }
2159
+ if (headers.length === 0) {
2160
+ return { error: 'No parseable headers found \u2014 expected lines like "From: ..." or "Received: ..."' };
2161
+ }
2162
+ const findFirst = (name) => headers.find((h) => h.name.toLowerCase() === name.toLowerCase())?.value ?? null;
2163
+ const findAll = (name) => headers.filter((h) => h.name.toLowerCase() === name.toLowerCase());
2164
+ const receivedHops = findAll("received").map((h, i) => {
2165
+ const fromMatch = h.value.match(/from\s+([^\s;]+(?:\s*\([^)]*\))?)/i);
2166
+ const byMatch = h.value.match(/\bby\s+([^\s;]+)/i);
2167
+ const segments = h.value.split(";");
2168
+ const date = segments.length > 1 ? segments[segments.length - 1].trim() : null;
2169
+ return {
2170
+ index: i + 1,
2171
+ raw: h.value,
2172
+ from: fromMatch ? fromMatch[1].trim() : null,
2173
+ by: byMatch ? byMatch[1].trim() : null,
2174
+ date: date || null
2175
+ };
2176
+ });
2177
+ const authResultsHeader = findFirst("authentication-results");
2178
+ const authResults = [];
2179
+ if (authResultsHeader) {
2180
+ const re = /\b(spf|dkim|dmarc)=(\w+)/gi;
2181
+ let m;
2182
+ while ((m = re.exec(authResultsHeader)) !== null) {
2183
+ authResults.push({ mechanism: m[1].toLowerCase(), result: m[2].toLowerCase() });
2184
+ }
2185
+ }
2186
+ const findAuth = (mechanism) => authResults.find((a) => a.mechanism === mechanism)?.result ?? null;
2187
+ const warnings = [];
2188
+ if (receivedHops.length === 0) {
2189
+ warnings.push("No Received headers found \u2014 this may be a partial header block rather than a full raw source.");
2190
+ }
2191
+ if (!authResultsHeader) {
2192
+ warnings.push("No Authentication-Results header found \u2014 SPF/DKIM/DMARC cannot be determined from this header block alone.");
2193
+ }
2194
+ return {
2195
+ headers,
2196
+ from: findFirst("from"),
2197
+ to: findFirst("to"),
2198
+ subject: findFirst("subject"),
2199
+ date: findFirst("date"),
2200
+ messageId: findFirst("message-id"),
2201
+ returnPath: findFirst("return-path"),
2202
+ replyTo: findFirst("reply-to"),
2203
+ receivedHops,
2204
+ hopCount: receivedHops.length,
2205
+ authResults,
2206
+ spf: findAuth("spf"),
2207
+ dkim: findAuth("dkim"),
2208
+ dmarc: findAuth("dmarc"),
2209
+ warnings
2210
+ };
2211
+ }
2133
2212
 
2134
- export { DNS_RECORD_TYPES, HTTP_HEADERS, LINK_REL_VALUES, REFERRER_POLICY_VALUES, STATUS_CODES, buildCacheControl, buildDnsQueryUrl, buildGeoUrl, buildLinkHeader, buildMapUrl, buildReferrerPolicy, checkSetCookieHeader, countryCodeToFlag, formatCoordinates, formatTtl, getByCategory, getHeader, getHeadersByCategory, getStatusByCategory, getStatusCode, isClientError, isServerError, isSuccess, isValidIp, isValidIpv4, isValidIpv6, network_exports, parseDnsResponse, parseGeoResponse, parseHar, parseIpv6Address, parseUserAgent, searchHeaders, searchStatusCodes, statusCodeToText, typeNumberToLabel, validateDomain, validateHeaderName, validateHeaderValue, validateRobotsTxt, validateSitemap };
2213
+ 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, network_exports, parseDnsResponse, parseGeoResponse, parseHar, parseIpv6Address, parseUserAgent, searchHeaders, searchStatusCodes, statusCodeToText, typeNumberToLabel, validateDomain, validateHeaderName, validateHeaderValue, validateRobotsTxt, validateSitemap };
@@ -15,6 +15,7 @@
15
15
  * - subtitle-converter: parseSubtitleTimestamp, formatSubtitleTimestamp, detectSubtitleFormat, parseSubtitles, serializeSubtitles, convertSubtitles, shiftSubtitles
16
16
  * - markdown-front-matter-parser: parseFrontMatter
17
17
  * - markdown-toc-generator: generateMarkdownToc
18
+ * - csv-to-sql-insert-generator: csvToSqlInsert
18
19
  */
19
20
  interface ValidationResult {
20
21
  valid: boolean;
@@ -320,9 +321,33 @@ interface MarkdownTocResult {
320
321
  declare function generateMarkdownToc(markdown: string, options?: MarkdownTocOptions): MarkdownTocResult | {
321
322
  error: string;
322
323
  };
324
+ interface CsvToSqlOptions {
325
+ tableName?: string;
326
+ dialect?: 'ansi' | 'mysql';
327
+ batchSize?: number;
328
+ }
329
+ interface CsvToSqlResult {
330
+ sql: string;
331
+ rowCount: number;
332
+ columnCount: number;
333
+ columns: string[];
334
+ }
335
+ /**
336
+ * Paste CSV/TSV data and get parameterless SQL INSERT statements back, with
337
+ * basic type inference: unquoted for integers/decimals and true/false,
338
+ * NULL for empty cells, single-quoted (with '' escaping) for everything
339
+ * else. Column and table identifiers are quoted per the chosen dialect
340
+ * (ANSI double quotes or MySQL backticks) so reserved words and mixed-case
341
+ * names round-trip safely.
342
+ */
343
+ declare function csvToSqlInsert(input: string, options?: CsvToSqlOptions): CsvToSqlResult | {
344
+ error: string;
345
+ };
323
346
 
324
347
  type data_ConvertedSubtitles = ConvertedSubtitles;
325
348
  type data_CsvParseResult = CsvParseResult;
349
+ type data_CsvToSqlOptions = CsvToSqlOptions;
350
+ type data_CsvToSqlResult = CsvToSqlResult;
326
351
  type data_EnvDiffError = EnvDiffError;
327
352
  type data_EnvDiffResult = EnvDiffResult;
328
353
  type data_EnvEntry = EnvEntry;
@@ -346,6 +371,7 @@ type data_XmlFormatResult = XmlFormatResult;
346
371
  type data_XmlToJsonOptions = XmlToJsonOptions;
347
372
  declare const data_convertSubtitles: typeof convertSubtitles;
348
373
  declare const data_csvToJson: typeof csvToJson;
374
+ declare const data_csvToSqlInsert: typeof csvToSqlInsert;
349
375
  declare const data_detectDelimiter: typeof detectDelimiter;
350
376
  declare const data_detectSubtitleFormat: typeof detectSubtitleFormat;
351
377
  declare const data_diffEnvExample: typeof diffEnvExample;
@@ -390,7 +416,7 @@ declare const data_validateXml: typeof validateXml;
390
416
  declare const data_validateYaml: typeof validateYaml;
391
417
  declare const data_xmlToJson: typeof xmlToJson;
392
418
  declare namespace data {
393
- export { type data_ConvertedSubtitles as ConvertedSubtitles, type data_CsvParseResult as CsvParseResult, type data_EnvDiffError as EnvDiffError, type data_EnvDiffResult as EnvDiffResult, type data_EnvEntry as EnvEntry, type data_EnvParseResult as EnvParseResult, type data_FrontMatterError as FrontMatterError, type data_FrontMatterResult as FrontMatterResult, type data_IniSection as IniSection, type data_MarkdownTocEntry as MarkdownTocEntry, type data_MarkdownTocOptions as MarkdownTocOptions, type data_MarkdownTocResult as MarkdownTocResult, type data_NdjsonLineResult as NdjsonLineResult, type data_NdjsonValidateResult as NdjsonValidateResult, type data_ParseOptions as ParseOptions, type data_ParsedIni as ParsedIni, type data_ParsedSubtitles as ParsedSubtitles, type data_SubtitleCue as SubtitleCue, type data_SubtitleFormat as SubtitleFormat, type data_TomlFormatResult as TomlFormatResult, type data_ValidationResult as ValidationResult, type data_XmlFormatResult as XmlFormatResult, type data_XmlToJsonOptions as XmlToJsonOptions, data_convertSubtitles as convertSubtitles, data_csvToJson as csvToJson, data_detectDelimiter as detectDelimiter, data_detectSubtitleFormat as detectSubtitleFormat, data_diffEnvExample as diffEnvExample, data_envToExport as envToExport, data_envToJson as envToJson, data_formatNdjson as formatNdjson, data_formatSubtitleTimestamp as formatSubtitleTimestamp, data_formatToml as formatToml, data_formatXml as formatXml, data_generateMarkdownToc as generateMarkdownToc, data_getSection as getSection, data_getSectionNames as getSectionNames, data_getTomlStats as getTomlStats, data_getXmlStats as getXmlStats, data_getYamlStats as getYamlStats, data_iniToJson as iniToJson, data_jsonArrayToNdjson as jsonArrayToNdjson, data_jsonToIni as jsonToIni, data_jsonToToml as jsonToToml, data_jsonToXml as jsonToXml, data_minifyNdjson as minifyNdjson, data_minifyToml as minifyToml, data_minifyXml as minifyXml, data_ndjsonToJsonArray as ndjsonToJsonArray, data_parseCsv as parseCsv, data_parseEnv as parseEnv, data_parseFrontMatter as parseFrontMatter, data_parseIni as parseIni, data_parseSubtitleTimestamp as parseSubtitleTimestamp, data_parseSubtitles as parseSubtitles, data_parseXmlToObject as parseXmlToObject, data_serializeSubtitles as serializeSubtitles, data_shiftSubtitles as shiftSubtitles, data_stringifyIni as stringifyIni, data_toCsvString as toCsvString, data_tomlToJson as tomlToJson, data_validateEnvKey as validateEnvKey, data_validateIni as validateIni, data_validateNdjson as validateNdjson, data_validateToml as validateToml, data_validateXml as validateXml, data_validateYaml as validateYaml, data_xmlToJson as xmlToJson };
419
+ export { type data_ConvertedSubtitles as ConvertedSubtitles, type data_CsvParseResult as CsvParseResult, type data_CsvToSqlOptions as CsvToSqlOptions, type data_CsvToSqlResult as CsvToSqlResult, type data_EnvDiffError as EnvDiffError, type data_EnvDiffResult as EnvDiffResult, type data_EnvEntry as EnvEntry, type data_EnvParseResult as EnvParseResult, type data_FrontMatterError as FrontMatterError, type data_FrontMatterResult as FrontMatterResult, type data_IniSection as IniSection, type data_MarkdownTocEntry as MarkdownTocEntry, type data_MarkdownTocOptions as MarkdownTocOptions, type data_MarkdownTocResult as MarkdownTocResult, type data_NdjsonLineResult as NdjsonLineResult, type data_NdjsonValidateResult as NdjsonValidateResult, type data_ParseOptions as ParseOptions, type data_ParsedIni as ParsedIni, type data_ParsedSubtitles as ParsedSubtitles, type data_SubtitleCue as SubtitleCue, type data_SubtitleFormat as SubtitleFormat, type data_TomlFormatResult as TomlFormatResult, type data_ValidationResult as ValidationResult, type data_XmlFormatResult as XmlFormatResult, type data_XmlToJsonOptions as XmlToJsonOptions, data_convertSubtitles as convertSubtitles, data_csvToJson as csvToJson, data_csvToSqlInsert as csvToSqlInsert, data_detectDelimiter as detectDelimiter, data_detectSubtitleFormat as detectSubtitleFormat, data_diffEnvExample as diffEnvExample, data_envToExport as envToExport, data_envToJson as envToJson, data_formatNdjson as formatNdjson, data_formatSubtitleTimestamp as formatSubtitleTimestamp, data_formatToml as formatToml, data_formatXml as formatXml, data_generateMarkdownToc as generateMarkdownToc, data_getSection as getSection, data_getSectionNames as getSectionNames, data_getTomlStats as getTomlStats, data_getXmlStats as getXmlStats, data_getYamlStats as getYamlStats, data_iniToJson as iniToJson, data_jsonArrayToNdjson as jsonArrayToNdjson, data_jsonToIni as jsonToIni, data_jsonToToml as jsonToToml, data_jsonToXml as jsonToXml, data_minifyNdjson as minifyNdjson, data_minifyToml as minifyToml, data_minifyXml as minifyXml, data_ndjsonToJsonArray as ndjsonToJsonArray, data_parseCsv as parseCsv, data_parseEnv as parseEnv, data_parseFrontMatter as parseFrontMatter, data_parseIni as parseIni, data_parseSubtitleTimestamp as parseSubtitleTimestamp, data_parseSubtitles as parseSubtitles, data_parseXmlToObject as parseXmlToObject, data_serializeSubtitles as serializeSubtitles, data_shiftSubtitles as shiftSubtitles, data_stringifyIni as stringifyIni, data_toCsvString as toCsvString, data_tomlToJson as tomlToJson, data_validateEnvKey as validateEnvKey, data_validateIni as validateIni, data_validateNdjson as validateNdjson, data_validateToml as validateToml, data_validateXml as validateXml, data_validateYaml as validateYaml, data_xmlToJson as xmlToJson };
394
420
  }
395
421
 
396
- export { parseIni as $, getSectionNames as A, getTomlStats as B, type ConvertedSubtitles as C, getXmlStats as D, type EnvDiffError as E, type FrontMatterError as F, getYamlStats as G, iniToJson as H, type IniSection as I, jsonArrayToNdjson as J, jsonToIni as K, jsonToToml as L, type MarkdownTocEntry as M, type NdjsonLineResult as N, jsonToXml as O, type ParseOptions as P, minifyNdjson as Q, minifyToml as R, type SubtitleCue as S, type TomlFormatResult as T, minifyXml as U, type ValidationResult as V, ndjsonToJsonArray as W, type XmlFormatResult as X, parseCsv as Y, parseEnv as Z, parseFrontMatter as _, type CsvParseResult as a, parseSubtitleTimestamp as a0, parseSubtitles as a1, parseXmlToObject as a2, serializeSubtitles as a3, shiftSubtitles as a4, stringifyIni as a5, toCsvString as a6, tomlToJson as a7, validateEnvKey as a8, validateIni as a9, validateNdjson as aa, validateToml as ab, validateXml as ac, validateYaml as ad, xmlToJson as ae, type EnvDiffResult as b, type EnvEntry as c, data as d, type EnvParseResult as e, type FrontMatterResult as f, type MarkdownTocOptions as g, type MarkdownTocResult as h, type NdjsonValidateResult as i, type ParsedIni as j, type ParsedSubtitles as k, type SubtitleFormat as l, type XmlToJsonOptions as m, convertSubtitles as n, csvToJson as o, detectDelimiter as p, detectSubtitleFormat as q, diffEnvExample as r, envToExport as s, envToJson as t, formatNdjson as u, formatSubtitleTimestamp as v, formatToml as w, formatXml as x, generateMarkdownToc as y, getSection as z };
422
+ export { parseCsv as $, formatXml as A, generateMarkdownToc as B, type ConvertedSubtitles as C, getSection as D, type EnvDiffError as E, type FrontMatterError as F, getSectionNames as G, getTomlStats as H, type IniSection as I, getXmlStats as J, getYamlStats as K, iniToJson as L, type MarkdownTocEntry as M, type NdjsonLineResult as N, jsonArrayToNdjson as O, type ParseOptions as P, jsonToIni as Q, jsonToToml as R, type SubtitleCue as S, type TomlFormatResult as T, jsonToXml as U, type ValidationResult as V, minifyNdjson as W, type XmlFormatResult as X, minifyToml as Y, minifyXml as Z, ndjsonToJsonArray as _, type CsvParseResult as a, parseEnv as a0, parseFrontMatter as a1, parseIni as a2, parseSubtitleTimestamp as a3, parseSubtitles as a4, parseXmlToObject as a5, serializeSubtitles as a6, shiftSubtitles as a7, stringifyIni as a8, toCsvString as a9, tomlToJson as aa, validateEnvKey as ab, validateIni as ac, validateNdjson as ad, validateToml as ae, validateXml as af, validateYaml as ag, xmlToJson as ah, type CsvToSqlOptions as b, type CsvToSqlResult as c, data as d, type EnvDiffResult as e, type EnvEntry as f, type EnvParseResult as g, type FrontMatterResult as h, type MarkdownTocOptions as i, type MarkdownTocResult as j, type NdjsonValidateResult as k, type ParsedIni as l, type ParsedSubtitles as m, type SubtitleFormat as n, type XmlToJsonOptions as o, convertSubtitles as p, csvToJson as q, csvToSqlInsert as r, detectDelimiter as s, detectSubtitleFormat as t, diffEnvExample as u, envToExport as v, envToJson as w, formatNdjson as x, formatSubtitleTimestamp as y, formatToml as z };
@@ -15,6 +15,7 @@
15
15
  * - subtitle-converter: parseSubtitleTimestamp, formatSubtitleTimestamp, detectSubtitleFormat, parseSubtitles, serializeSubtitles, convertSubtitles, shiftSubtitles
16
16
  * - markdown-front-matter-parser: parseFrontMatter
17
17
  * - markdown-toc-generator: generateMarkdownToc
18
+ * - csv-to-sql-insert-generator: csvToSqlInsert
18
19
  */
19
20
  interface ValidationResult {
20
21
  valid: boolean;
@@ -320,9 +321,33 @@ interface MarkdownTocResult {
320
321
  declare function generateMarkdownToc(markdown: string, options?: MarkdownTocOptions): MarkdownTocResult | {
321
322
  error: string;
322
323
  };
324
+ interface CsvToSqlOptions {
325
+ tableName?: string;
326
+ dialect?: 'ansi' | 'mysql';
327
+ batchSize?: number;
328
+ }
329
+ interface CsvToSqlResult {
330
+ sql: string;
331
+ rowCount: number;
332
+ columnCount: number;
333
+ columns: string[];
334
+ }
335
+ /**
336
+ * Paste CSV/TSV data and get parameterless SQL INSERT statements back, with
337
+ * basic type inference: unquoted for integers/decimals and true/false,
338
+ * NULL for empty cells, single-quoted (with '' escaping) for everything
339
+ * else. Column and table identifiers are quoted per the chosen dialect
340
+ * (ANSI double quotes or MySQL backticks) so reserved words and mixed-case
341
+ * names round-trip safely.
342
+ */
343
+ declare function csvToSqlInsert(input: string, options?: CsvToSqlOptions): CsvToSqlResult | {
344
+ error: string;
345
+ };
323
346
 
324
347
  type data_ConvertedSubtitles = ConvertedSubtitles;
325
348
  type data_CsvParseResult = CsvParseResult;
349
+ type data_CsvToSqlOptions = CsvToSqlOptions;
350
+ type data_CsvToSqlResult = CsvToSqlResult;
326
351
  type data_EnvDiffError = EnvDiffError;
327
352
  type data_EnvDiffResult = EnvDiffResult;
328
353
  type data_EnvEntry = EnvEntry;
@@ -346,6 +371,7 @@ type data_XmlFormatResult = XmlFormatResult;
346
371
  type data_XmlToJsonOptions = XmlToJsonOptions;
347
372
  declare const data_convertSubtitles: typeof convertSubtitles;
348
373
  declare const data_csvToJson: typeof csvToJson;
374
+ declare const data_csvToSqlInsert: typeof csvToSqlInsert;
349
375
  declare const data_detectDelimiter: typeof detectDelimiter;
350
376
  declare const data_detectSubtitleFormat: typeof detectSubtitleFormat;
351
377
  declare const data_diffEnvExample: typeof diffEnvExample;
@@ -390,7 +416,7 @@ declare const data_validateXml: typeof validateXml;
390
416
  declare const data_validateYaml: typeof validateYaml;
391
417
  declare const data_xmlToJson: typeof xmlToJson;
392
418
  declare namespace data {
393
- export { type data_ConvertedSubtitles as ConvertedSubtitles, type data_CsvParseResult as CsvParseResult, type data_EnvDiffError as EnvDiffError, type data_EnvDiffResult as EnvDiffResult, type data_EnvEntry as EnvEntry, type data_EnvParseResult as EnvParseResult, type data_FrontMatterError as FrontMatterError, type data_FrontMatterResult as FrontMatterResult, type data_IniSection as IniSection, type data_MarkdownTocEntry as MarkdownTocEntry, type data_MarkdownTocOptions as MarkdownTocOptions, type data_MarkdownTocResult as MarkdownTocResult, type data_NdjsonLineResult as NdjsonLineResult, type data_NdjsonValidateResult as NdjsonValidateResult, type data_ParseOptions as ParseOptions, type data_ParsedIni as ParsedIni, type data_ParsedSubtitles as ParsedSubtitles, type data_SubtitleCue as SubtitleCue, type data_SubtitleFormat as SubtitleFormat, type data_TomlFormatResult as TomlFormatResult, type data_ValidationResult as ValidationResult, type data_XmlFormatResult as XmlFormatResult, type data_XmlToJsonOptions as XmlToJsonOptions, data_convertSubtitles as convertSubtitles, data_csvToJson as csvToJson, data_detectDelimiter as detectDelimiter, data_detectSubtitleFormat as detectSubtitleFormat, data_diffEnvExample as diffEnvExample, data_envToExport as envToExport, data_envToJson as envToJson, data_formatNdjson as formatNdjson, data_formatSubtitleTimestamp as formatSubtitleTimestamp, data_formatToml as formatToml, data_formatXml as formatXml, data_generateMarkdownToc as generateMarkdownToc, data_getSection as getSection, data_getSectionNames as getSectionNames, data_getTomlStats as getTomlStats, data_getXmlStats as getXmlStats, data_getYamlStats as getYamlStats, data_iniToJson as iniToJson, data_jsonArrayToNdjson as jsonArrayToNdjson, data_jsonToIni as jsonToIni, data_jsonToToml as jsonToToml, data_jsonToXml as jsonToXml, data_minifyNdjson as minifyNdjson, data_minifyToml as minifyToml, data_minifyXml as minifyXml, data_ndjsonToJsonArray as ndjsonToJsonArray, data_parseCsv as parseCsv, data_parseEnv as parseEnv, data_parseFrontMatter as parseFrontMatter, data_parseIni as parseIni, data_parseSubtitleTimestamp as parseSubtitleTimestamp, data_parseSubtitles as parseSubtitles, data_parseXmlToObject as parseXmlToObject, data_serializeSubtitles as serializeSubtitles, data_shiftSubtitles as shiftSubtitles, data_stringifyIni as stringifyIni, data_toCsvString as toCsvString, data_tomlToJson as tomlToJson, data_validateEnvKey as validateEnvKey, data_validateIni as validateIni, data_validateNdjson as validateNdjson, data_validateToml as validateToml, data_validateXml as validateXml, data_validateYaml as validateYaml, data_xmlToJson as xmlToJson };
419
+ export { type data_ConvertedSubtitles as ConvertedSubtitles, type data_CsvParseResult as CsvParseResult, type data_CsvToSqlOptions as CsvToSqlOptions, type data_CsvToSqlResult as CsvToSqlResult, type data_EnvDiffError as EnvDiffError, type data_EnvDiffResult as EnvDiffResult, type data_EnvEntry as EnvEntry, type data_EnvParseResult as EnvParseResult, type data_FrontMatterError as FrontMatterError, type data_FrontMatterResult as FrontMatterResult, type data_IniSection as IniSection, type data_MarkdownTocEntry as MarkdownTocEntry, type data_MarkdownTocOptions as MarkdownTocOptions, type data_MarkdownTocResult as MarkdownTocResult, type data_NdjsonLineResult as NdjsonLineResult, type data_NdjsonValidateResult as NdjsonValidateResult, type data_ParseOptions as ParseOptions, type data_ParsedIni as ParsedIni, type data_ParsedSubtitles as ParsedSubtitles, type data_SubtitleCue as SubtitleCue, type data_SubtitleFormat as SubtitleFormat, type data_TomlFormatResult as TomlFormatResult, type data_ValidationResult as ValidationResult, type data_XmlFormatResult as XmlFormatResult, type data_XmlToJsonOptions as XmlToJsonOptions, data_convertSubtitles as convertSubtitles, data_csvToJson as csvToJson, data_csvToSqlInsert as csvToSqlInsert, data_detectDelimiter as detectDelimiter, data_detectSubtitleFormat as detectSubtitleFormat, data_diffEnvExample as diffEnvExample, data_envToExport as envToExport, data_envToJson as envToJson, data_formatNdjson as formatNdjson, data_formatSubtitleTimestamp as formatSubtitleTimestamp, data_formatToml as formatToml, data_formatXml as formatXml, data_generateMarkdownToc as generateMarkdownToc, data_getSection as getSection, data_getSectionNames as getSectionNames, data_getTomlStats as getTomlStats, data_getXmlStats as getXmlStats, data_getYamlStats as getYamlStats, data_iniToJson as iniToJson, data_jsonArrayToNdjson as jsonArrayToNdjson, data_jsonToIni as jsonToIni, data_jsonToToml as jsonToToml, data_jsonToXml as jsonToXml, data_minifyNdjson as minifyNdjson, data_minifyToml as minifyToml, data_minifyXml as minifyXml, data_ndjsonToJsonArray as ndjsonToJsonArray, data_parseCsv as parseCsv, data_parseEnv as parseEnv, data_parseFrontMatter as parseFrontMatter, data_parseIni as parseIni, data_parseSubtitleTimestamp as parseSubtitleTimestamp, data_parseSubtitles as parseSubtitles, data_parseXmlToObject as parseXmlToObject, data_serializeSubtitles as serializeSubtitles, data_shiftSubtitles as shiftSubtitles, data_stringifyIni as stringifyIni, data_toCsvString as toCsvString, data_tomlToJson as tomlToJson, data_validateEnvKey as validateEnvKey, data_validateIni as validateIni, data_validateNdjson as validateNdjson, data_validateToml as validateToml, data_validateXml as validateXml, data_validateYaml as validateYaml, data_xmlToJson as xmlToJson };
394
420
  }
395
421
 
396
- export { parseIni as $, getSectionNames as A, getTomlStats as B, type ConvertedSubtitles as C, getXmlStats as D, type EnvDiffError as E, type FrontMatterError as F, getYamlStats as G, iniToJson as H, type IniSection as I, jsonArrayToNdjson as J, jsonToIni as K, jsonToToml as L, type MarkdownTocEntry as M, type NdjsonLineResult as N, jsonToXml as O, type ParseOptions as P, minifyNdjson as Q, minifyToml as R, type SubtitleCue as S, type TomlFormatResult as T, minifyXml as U, type ValidationResult as V, ndjsonToJsonArray as W, type XmlFormatResult as X, parseCsv as Y, parseEnv as Z, parseFrontMatter as _, type CsvParseResult as a, parseSubtitleTimestamp as a0, parseSubtitles as a1, parseXmlToObject as a2, serializeSubtitles as a3, shiftSubtitles as a4, stringifyIni as a5, toCsvString as a6, tomlToJson as a7, validateEnvKey as a8, validateIni as a9, validateNdjson as aa, validateToml as ab, validateXml as ac, validateYaml as ad, xmlToJson as ae, type EnvDiffResult as b, type EnvEntry as c, data as d, type EnvParseResult as e, type FrontMatterResult as f, type MarkdownTocOptions as g, type MarkdownTocResult as h, type NdjsonValidateResult as i, type ParsedIni as j, type ParsedSubtitles as k, type SubtitleFormat as l, type XmlToJsonOptions as m, convertSubtitles as n, csvToJson as o, detectDelimiter as p, detectSubtitleFormat as q, diffEnvExample as r, envToExport as s, envToJson as t, formatNdjson as u, formatSubtitleTimestamp as v, formatToml as w, formatXml as x, generateMarkdownToc as y, getSection as z };
422
+ export { parseCsv as $, formatXml as A, generateMarkdownToc as B, type ConvertedSubtitles as C, getSection as D, type EnvDiffError as E, type FrontMatterError as F, getSectionNames as G, getTomlStats as H, type IniSection as I, getXmlStats as J, getYamlStats as K, iniToJson as L, type MarkdownTocEntry as M, type NdjsonLineResult as N, jsonArrayToNdjson as O, type ParseOptions as P, jsonToIni as Q, jsonToToml as R, type SubtitleCue as S, type TomlFormatResult as T, jsonToXml as U, type ValidationResult as V, minifyNdjson as W, type XmlFormatResult as X, minifyToml as Y, minifyXml as Z, ndjsonToJsonArray as _, type CsvParseResult as a, parseEnv as a0, parseFrontMatter as a1, parseIni as a2, parseSubtitleTimestamp as a3, parseSubtitles as a4, parseXmlToObject as a5, serializeSubtitles as a6, shiftSubtitles as a7, stringifyIni as a8, toCsvString as a9, tomlToJson as aa, validateEnvKey as ab, validateIni as ac, validateNdjson as ad, validateToml as ae, validateXml as af, validateYaml as ag, xmlToJson as ah, type CsvToSqlOptions as b, type CsvToSqlResult as c, data as d, type EnvDiffResult as e, type EnvEntry as f, type EnvParseResult as g, type FrontMatterResult as h, type MarkdownTocOptions as i, type MarkdownTocResult as j, type NdjsonValidateResult as k, type ParsedIni as l, type ParsedSubtitles as m, type SubtitleFormat as n, type XmlToJsonOptions as o, convertSubtitles as p, csvToJson as q, csvToSqlInsert as r, detectDelimiter as s, detectSubtitleFormat as t, diffEnvExample as u, envToExport as v, envToJson as w, formatNdjson as x, formatSubtitleTimestamp as y, formatToml as z };
@@ -7,6 +7,7 @@
7
7
  * - htpasswd : generateSha1Hash, generateMd5Hash, generateBcryptHash,
8
8
  * generatePlain, createEntry, parseHtpasswdFile,
9
9
  * generateHtpasswdFile, validateUsername
10
+ * - sri-hash-generator: generateSri, generateSriAll (SHA-256/384/512 Subresource Integrity hashes)
10
11
  */
11
12
  type HashAlgorithm = 'MD5' | 'SHA-1' | 'SHA-256' | 'SHA-384' | 'SHA-512';
12
13
  declare const HASH_ALGORITHMS: HashAlgorithm[];
@@ -46,6 +47,25 @@ declare function createEntry(username: string, password: string, algorithm?: Htp
46
47
  declare function parseHtpasswdFile(content: string): HtpasswdEntry[];
47
48
  declare function generateHtpasswdFile(entries: HtpasswdEntry[]): string;
48
49
  declare function validateUsername(username: string): boolean;
50
+ type SriAlgorithm = 'SHA-256' | 'SHA-384' | 'SHA-512';
51
+ declare const SRI_ALGORITHMS: SriAlgorithm[];
52
+ interface SriResult {
53
+ algorithm: SriAlgorithm;
54
+ base64: string;
55
+ integrity: string;
56
+ }
57
+ /**
58
+ * Compute a Subresource Integrity hash for the given file/script content:
59
+ * digest it with the chosen algorithm and base64-encode it into the
60
+ * `<algorithm>-<base64>` form used by an HTML `integrity` attribute.
61
+ */
62
+ declare function generateSri(content: string, algorithm?: SriAlgorithm): SriResult | {
63
+ error: string;
64
+ };
65
+ /** Compute SRI hashes for all three algorithms SRI supports (SHA-256/384/512). */
66
+ declare function generateSriAll(content: string): SriResult[] | {
67
+ error: string;
68
+ };
49
69
 
50
70
  type hashing_BcryptResult = BcryptResult;
51
71
  declare const hashing_HASH_ALGORITHMS: typeof HASH_ALGORITHMS;
@@ -55,12 +75,17 @@ type hashing_HashResult = HashResult;
55
75
  type hashing_HtpasswdAlgorithm = HtpasswdAlgorithm;
56
76
  type hashing_HtpasswdEntry = HtpasswdEntry;
57
77
  declare const hashing_ROUND_OPTIONS: typeof ROUND_OPTIONS;
78
+ declare const hashing_SRI_ALGORITHMS: typeof SRI_ALGORITHMS;
79
+ type hashing_SriAlgorithm = SriAlgorithm;
80
+ type hashing_SriResult = SriResult;
58
81
  declare const hashing_createEntry: typeof createEntry;
59
82
  declare const hashing_generateBcryptHash: typeof generateBcryptHash;
60
83
  declare const hashing_generateHtpasswdFile: typeof generateHtpasswdFile;
61
84
  declare const hashing_generateMd5Hash: typeof generateMd5Hash;
62
85
  declare const hashing_generatePlain: typeof generatePlain;
63
86
  declare const hashing_generateSha1Hash: typeof generateSha1Hash;
87
+ declare const hashing_generateSri: typeof generateSri;
88
+ declare const hashing_generateSriAll: typeof generateSriAll;
64
89
  declare const hashing_hashAll: typeof hashAll;
65
90
  declare const hashing_hashOne: typeof hashOne;
66
91
  declare const hashing_hashPassword: typeof hashPassword;
@@ -70,7 +95,7 @@ declare const hashing_validateRounds: typeof validateRounds;
70
95
  declare const hashing_validateUsername: typeof validateUsername;
71
96
  declare const hashing_verifyPassword: typeof verifyPassword;
72
97
  declare namespace hashing {
73
- export { type hashing_BcryptResult as BcryptResult, hashing_HASH_ALGORITHMS as HASH_ALGORITHMS, hashing_HASH_BITS as HASH_BITS, type hashing_HashAlgorithm as HashAlgorithm, type hashing_HashResult as HashResult, type hashing_HtpasswdAlgorithm as HtpasswdAlgorithm, type hashing_HtpasswdEntry as HtpasswdEntry, hashing_ROUND_OPTIONS as ROUND_OPTIONS, hashing_createEntry as createEntry, hashing_generateBcryptHash as generateBcryptHash, hashing_generateHtpasswdFile as generateHtpasswdFile, hashing_generateMd5Hash as generateMd5Hash, hashing_generatePlain as generatePlain, hashing_generateSha1Hash as generateSha1Hash, hashing_hashAll as hashAll, hashing_hashOne as hashOne, hashing_hashPassword as hashPassword, hashing_hashWithTiming as hashWithTiming, hashing_parseHtpasswdFile as parseHtpasswdFile, hashing_validateRounds as validateRounds, hashing_validateUsername as validateUsername, hashing_verifyPassword as verifyPassword };
98
+ export { type hashing_BcryptResult as BcryptResult, hashing_HASH_ALGORITHMS as HASH_ALGORITHMS, hashing_HASH_BITS as HASH_BITS, type hashing_HashAlgorithm as HashAlgorithm, type hashing_HashResult as HashResult, type hashing_HtpasswdAlgorithm as HtpasswdAlgorithm, type hashing_HtpasswdEntry as HtpasswdEntry, hashing_ROUND_OPTIONS as ROUND_OPTIONS, hashing_SRI_ALGORITHMS as SRI_ALGORITHMS, type hashing_SriAlgorithm as SriAlgorithm, type hashing_SriResult as SriResult, hashing_createEntry as createEntry, hashing_generateBcryptHash as generateBcryptHash, hashing_generateHtpasswdFile as generateHtpasswdFile, hashing_generateMd5Hash as generateMd5Hash, hashing_generatePlain as generatePlain, hashing_generateSha1Hash as generateSha1Hash, hashing_generateSri as generateSri, hashing_generateSriAll as generateSriAll, hashing_hashAll as hashAll, hashing_hashOne as hashOne, hashing_hashPassword as hashPassword, hashing_hashWithTiming as hashWithTiming, hashing_parseHtpasswdFile as parseHtpasswdFile, hashing_validateRounds as validateRounds, hashing_validateUsername as validateUsername, hashing_verifyPassword as verifyPassword };
74
99
  }
75
100
 
76
- export { type BcryptResult as B, HASH_ALGORITHMS as H, ROUND_OPTIONS as R, HASH_BITS as a, type HashAlgorithm as b, type HashResult as c, type HtpasswdAlgorithm as d, type HtpasswdEntry as e, createEntry as f, generateBcryptHash as g, hashing as h, generateHtpasswdFile as i, generateMd5Hash as j, generatePlain as k, generateSha1Hash as l, hashAll as m, hashOne as n, hashPassword as o, hashWithTiming as p, parseHtpasswdFile as q, validateUsername as r, verifyPassword as s, validateRounds as v };
101
+ export { type BcryptResult as B, HASH_ALGORITHMS as H, ROUND_OPTIONS as R, SRI_ALGORITHMS as S, HASH_BITS as a, type HashAlgorithm as b, type HashResult as c, type HtpasswdAlgorithm as d, type HtpasswdEntry as e, type SriAlgorithm as f, type SriResult as g, hashing as h, createEntry as i, generateBcryptHash as j, generateHtpasswdFile as k, generateMd5Hash as l, generatePlain as m, generateSha1Hash as n, generateSri as o, generateSriAll as p, hashAll as q, hashOne as r, hashPassword as s, hashWithTiming as t, parseHtpasswdFile as u, validateRounds as v, validateUsername as w, verifyPassword as x };
@@ -7,6 +7,7 @@
7
7
  * - htpasswd : generateSha1Hash, generateMd5Hash, generateBcryptHash,
8
8
  * generatePlain, createEntry, parseHtpasswdFile,
9
9
  * generateHtpasswdFile, validateUsername
10
+ * - sri-hash-generator: generateSri, generateSriAll (SHA-256/384/512 Subresource Integrity hashes)
10
11
  */
11
12
  type HashAlgorithm = 'MD5' | 'SHA-1' | 'SHA-256' | 'SHA-384' | 'SHA-512';
12
13
  declare const HASH_ALGORITHMS: HashAlgorithm[];
@@ -46,6 +47,25 @@ declare function createEntry(username: string, password: string, algorithm?: Htp
46
47
  declare function parseHtpasswdFile(content: string): HtpasswdEntry[];
47
48
  declare function generateHtpasswdFile(entries: HtpasswdEntry[]): string;
48
49
  declare function validateUsername(username: string): boolean;
50
+ type SriAlgorithm = 'SHA-256' | 'SHA-384' | 'SHA-512';
51
+ declare const SRI_ALGORITHMS: SriAlgorithm[];
52
+ interface SriResult {
53
+ algorithm: SriAlgorithm;
54
+ base64: string;
55
+ integrity: string;
56
+ }
57
+ /**
58
+ * Compute a Subresource Integrity hash for the given file/script content:
59
+ * digest it with the chosen algorithm and base64-encode it into the
60
+ * `<algorithm>-<base64>` form used by an HTML `integrity` attribute.
61
+ */
62
+ declare function generateSri(content: string, algorithm?: SriAlgorithm): SriResult | {
63
+ error: string;
64
+ };
65
+ /** Compute SRI hashes for all three algorithms SRI supports (SHA-256/384/512). */
66
+ declare function generateSriAll(content: string): SriResult[] | {
67
+ error: string;
68
+ };
49
69
 
50
70
  type hashing_BcryptResult = BcryptResult;
51
71
  declare const hashing_HASH_ALGORITHMS: typeof HASH_ALGORITHMS;
@@ -55,12 +75,17 @@ type hashing_HashResult = HashResult;
55
75
  type hashing_HtpasswdAlgorithm = HtpasswdAlgorithm;
56
76
  type hashing_HtpasswdEntry = HtpasswdEntry;
57
77
  declare const hashing_ROUND_OPTIONS: typeof ROUND_OPTIONS;
78
+ declare const hashing_SRI_ALGORITHMS: typeof SRI_ALGORITHMS;
79
+ type hashing_SriAlgorithm = SriAlgorithm;
80
+ type hashing_SriResult = SriResult;
58
81
  declare const hashing_createEntry: typeof createEntry;
59
82
  declare const hashing_generateBcryptHash: typeof generateBcryptHash;
60
83
  declare const hashing_generateHtpasswdFile: typeof generateHtpasswdFile;
61
84
  declare const hashing_generateMd5Hash: typeof generateMd5Hash;
62
85
  declare const hashing_generatePlain: typeof generatePlain;
63
86
  declare const hashing_generateSha1Hash: typeof generateSha1Hash;
87
+ declare const hashing_generateSri: typeof generateSri;
88
+ declare const hashing_generateSriAll: typeof generateSriAll;
64
89
  declare const hashing_hashAll: typeof hashAll;
65
90
  declare const hashing_hashOne: typeof hashOne;
66
91
  declare const hashing_hashPassword: typeof hashPassword;
@@ -70,7 +95,7 @@ declare const hashing_validateRounds: typeof validateRounds;
70
95
  declare const hashing_validateUsername: typeof validateUsername;
71
96
  declare const hashing_verifyPassword: typeof verifyPassword;
72
97
  declare namespace hashing {
73
- export { type hashing_BcryptResult as BcryptResult, hashing_HASH_ALGORITHMS as HASH_ALGORITHMS, hashing_HASH_BITS as HASH_BITS, type hashing_HashAlgorithm as HashAlgorithm, type hashing_HashResult as HashResult, type hashing_HtpasswdAlgorithm as HtpasswdAlgorithm, type hashing_HtpasswdEntry as HtpasswdEntry, hashing_ROUND_OPTIONS as ROUND_OPTIONS, hashing_createEntry as createEntry, hashing_generateBcryptHash as generateBcryptHash, hashing_generateHtpasswdFile as generateHtpasswdFile, hashing_generateMd5Hash as generateMd5Hash, hashing_generatePlain as generatePlain, hashing_generateSha1Hash as generateSha1Hash, hashing_hashAll as hashAll, hashing_hashOne as hashOne, hashing_hashPassword as hashPassword, hashing_hashWithTiming as hashWithTiming, hashing_parseHtpasswdFile as parseHtpasswdFile, hashing_validateRounds as validateRounds, hashing_validateUsername as validateUsername, hashing_verifyPassword as verifyPassword };
98
+ export { type hashing_BcryptResult as BcryptResult, hashing_HASH_ALGORITHMS as HASH_ALGORITHMS, hashing_HASH_BITS as HASH_BITS, type hashing_HashAlgorithm as HashAlgorithm, type hashing_HashResult as HashResult, type hashing_HtpasswdAlgorithm as HtpasswdAlgorithm, type hashing_HtpasswdEntry as HtpasswdEntry, hashing_ROUND_OPTIONS as ROUND_OPTIONS, hashing_SRI_ALGORITHMS as SRI_ALGORITHMS, type hashing_SriAlgorithm as SriAlgorithm, type hashing_SriResult as SriResult, hashing_createEntry as createEntry, hashing_generateBcryptHash as generateBcryptHash, hashing_generateHtpasswdFile as generateHtpasswdFile, hashing_generateMd5Hash as generateMd5Hash, hashing_generatePlain as generatePlain, hashing_generateSha1Hash as generateSha1Hash, hashing_generateSri as generateSri, hashing_generateSriAll as generateSriAll, hashing_hashAll as hashAll, hashing_hashOne as hashOne, hashing_hashPassword as hashPassword, hashing_hashWithTiming as hashWithTiming, hashing_parseHtpasswdFile as parseHtpasswdFile, hashing_validateRounds as validateRounds, hashing_validateUsername as validateUsername, hashing_verifyPassword as verifyPassword };
74
99
  }
75
100
 
76
- export { type BcryptResult as B, HASH_ALGORITHMS as H, ROUND_OPTIONS as R, HASH_BITS as a, type HashAlgorithm as b, type HashResult as c, type HtpasswdAlgorithm as d, type HtpasswdEntry as e, createEntry as f, generateBcryptHash as g, hashing as h, generateHtpasswdFile as i, generateMd5Hash as j, generatePlain as k, generateSha1Hash as l, hashAll as m, hashOne as n, hashPassword as o, hashWithTiming as p, parseHtpasswdFile as q, validateUsername as r, verifyPassword as s, validateRounds as v };
101
+ export { type BcryptResult as B, HASH_ALGORITHMS as H, ROUND_OPTIONS as R, SRI_ALGORITHMS as S, HASH_BITS as a, type HashAlgorithm as b, type HashResult as c, type HtpasswdAlgorithm as d, type HtpasswdEntry as e, type SriAlgorithm as f, type SriResult as g, hashing as h, createEntry as i, generateBcryptHash as j, generateHtpasswdFile as k, generateMd5Hash as l, generatePlain as m, generateSha1Hash as n, generateSri as o, generateSriAll as p, hashAll as q, hashOne as r, hashPassword as s, hashWithTiming as t, parseHtpasswdFile as u, validateRounds as v, validateUsername as w, verifyPassword as x };