@utilix-tech/sdk 0.36.0 → 0.38.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-UTHAHRQ7.js → chunk-DBNTO3YO.js} +79 -1
  5. package/dist/{chunk-UUT5HNST.js → chunk-JL7YTXRB.js} +81 -1
  6. package/dist/{chunk-YEXQDI3J.js → chunk-RZUNTYEH.js} +40 -1
  7. package/dist/{code-BK-x8hVx.d.cts → code-KXoRsHtl.d.cts} +21 -2
  8. package/dist/{code-BK-x8hVx.d.ts → code-KXoRsHtl.d.ts} +21 -2
  9. package/dist/{data-CFeS9kes.d.cts → data-BCf3dm-E.d.cts} +28 -2
  10. package/dist/{data-CFeS9kes.d.ts → data-BCf3dm-E.d.ts} +28 -2
  11. package/dist/index.cjs +227 -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-X0EfH9Xq.d.cts → network-CnKUQT4g.d.cts} +36 -2
  16. package/dist/{network-X0EfH9Xq.d.ts → network-CnKUQT4g.d.ts} +36 -2
  17. package/dist/tools/code.cjs +80 -0
  18. package/dist/tools/code.d.cts +1 -1
  19. package/dist/tools/code.d.ts +1 -1
  20. package/dist/tools/code.js +1 -1
  21. package/dist/tools/data.cjs +39 -0
  22. package/dist/tools/data.d.cts +1 -1
  23. package/dist/tools/data.d.ts +1 -1
  24. package/dist/tools/data.js +1 -1
  25. package/dist/tools/network.cjs +78 -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
@@ -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 };
package/dist/index.cjs CHANGED
@@ -4982,6 +4982,7 @@ var data_exports = {};
4982
4982
  __export(data_exports, {
4983
4983
  convertSubtitles: () => convertSubtitles,
4984
4984
  csvToJson: () => csvToJson2,
4985
+ csvToSqlInsert: () => csvToSqlInsert,
4985
4986
  detectDelimiter: () => detectDelimiter2,
4986
4987
  detectSubtitleFormat: () => detectSubtitleFormat,
4987
4988
  diffEnvExample: () => diffEnvExample,
@@ -6436,6 +6437,44 @@ function generateMarkdownToc(markdown, options = {}) {
6436
6437
  });
6437
6438
  return { toc: tocLines.join("\n"), entries };
6438
6439
  }
6440
+ function quoteSqlIdentifier(name, dialect) {
6441
+ if (dialect === "mysql") return "`" + name.replace(/`/g, "``") + "`";
6442
+ return '"' + name.replace(/"/g, '""') + '"';
6443
+ }
6444
+ function formatSqlValue(raw) {
6445
+ const trimmed = raw.trim();
6446
+ if (trimmed === "") return "NULL";
6447
+ if (/^-?\d+(\.\d+)?$/.test(trimmed)) return trimmed;
6448
+ if (/^(true|false)$/i.test(trimmed)) return trimmed.toLowerCase();
6449
+ return "'" + trimmed.replace(/'/g, "''") + "'";
6450
+ }
6451
+ function csvToSqlInsert(input, options) {
6452
+ const parsed = parseCsv(input);
6453
+ if ("error" in parsed) return parsed;
6454
+ const tableName = options?.tableName?.trim() || "my_table";
6455
+ if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(tableName)) {
6456
+ return { error: "tableName must start with a letter or underscore and contain only letters, digits, and underscores" };
6457
+ }
6458
+ const dialect = options?.dialect === "mysql" ? "mysql" : "ansi";
6459
+ const batchSize = options?.batchSize !== void 0 && Number.isFinite(options.batchSize) && options.batchSize > 0 ? Math.floor(options.batchSize) : 1;
6460
+ const columns = parsed.headers.map((h) => h.trim());
6461
+ const quotedTable = quoteSqlIdentifier(tableName, dialect);
6462
+ const quotedColumns = columns.map((c) => quoteSqlIdentifier(c, dialect)).join(", ");
6463
+ const statements = [];
6464
+ for (let i = 0; i < parsed.rows.length; i += batchSize) {
6465
+ const batch = parsed.rows.slice(i, i + batchSize);
6466
+ const tuples = batch.map(
6467
+ (row) => "(" + columns.map((_, idx) => formatSqlValue(row[idx] ?? "")).join(", ") + ")"
6468
+ );
6469
+ statements.push(`INSERT INTO ${quotedTable} (${quotedColumns}) VALUES ${tuples.join(", ")};`);
6470
+ }
6471
+ return {
6472
+ sql: statements.join("\n"),
6473
+ rowCount: parsed.rows.length,
6474
+ columnCount: columns.length,
6475
+ columns
6476
+ };
6477
+ }
6439
6478
 
6440
6479
  // src/tools/generators.ts
6441
6480
  var generators_exports = {};
@@ -7868,6 +7907,7 @@ __export(units_exports, {
7868
7907
  calculateTipSplit: () => calculateTipSplit,
7869
7908
  calculateVideoBitrate: () => calculateVideoBitrate,
7870
7909
  compareSemver: () => compareSemver,
7910
+ compareUnitPrices: () => compareUnitPrices,
7871
7911
  convert: () => convert,
7872
7912
  convertAprApy: () => convertAprApy,
7873
7913
  convertBytes: () => convertBytes,
@@ -9670,6 +9710,35 @@ function calculateRoi(input) {
9670
9710
  }
9671
9711
  return result;
9672
9712
  }
9713
+ function compareUnitPrices(items) {
9714
+ if (!Array.isArray(items) || items.length < 2) {
9715
+ return { error: "At least 2 items are required to compare" };
9716
+ }
9717
+ for (const item of items) {
9718
+ if (!item.label || typeof item.label !== "string") {
9719
+ return { error: "Each item must have a non-empty label" };
9720
+ }
9721
+ if (!Number.isFinite(item.price) || item.price <= 0) {
9722
+ return { error: `Item "${item.label}" must have a price greater than zero` };
9723
+ }
9724
+ if (!Number.isFinite(item.quantity) || item.quantity <= 0) {
9725
+ return { error: `Item "${item.label}" must have a quantity greater than zero` };
9726
+ }
9727
+ }
9728
+ const round4 = (n) => Math.round(n * 1e4) / 1e4;
9729
+ const unitPrices = items.map((item) => item.price / item.quantity);
9730
+ const bestUnitPrice = Math.min(...unitPrices);
9731
+ const results = items.map((item, i) => ({
9732
+ label: item.label,
9733
+ price: round4(item.price),
9734
+ quantity: round4(item.quantity),
9735
+ unitPrice: round4(unitPrices[i]),
9736
+ isBest: unitPrices[i] === bestUnitPrice,
9737
+ percentMoreThanBest: round4((unitPrices[i] - bestUnitPrice) / bestUnitPrice * 100)
9738
+ }));
9739
+ const bestLabel = results.find((r) => r.isBest).label;
9740
+ return { items: results, bestLabel };
9741
+ }
9673
9742
 
9674
9743
  // src/tools/network.ts
9675
9744
  var network_exports = {};
@@ -9685,6 +9754,7 @@ __export(network_exports, {
9685
9754
  buildLinkHeader: () => buildLinkHeader,
9686
9755
  buildMapUrl: () => buildMapUrl,
9687
9756
  buildReferrerPolicy: () => buildReferrerPolicy,
9757
+ checkSetCookieHeader: () => checkSetCookieHeader,
9688
9758
  countryCodeToFlag: () => countryCodeToFlag,
9689
9759
  formatCoordinates: () => formatCoordinates,
9690
9760
  formatTtl: () => formatTtl,
@@ -11723,6 +11793,83 @@ function parseIpv6Address(input) {
11723
11793
  addressType: classifyIpv6(expandedGroups)
11724
11794
  };
11725
11795
  }
11796
+ var MAX_COOKIE_AGE_SECONDS = 400 * 24 * 60 * 60;
11797
+ function checkSetCookieHeader(header) {
11798
+ if (typeof header !== "string" || !header.trim()) {
11799
+ return { error: "A Set-Cookie header value is required" };
11800
+ }
11801
+ const parts = header.split(";").map((p) => p.trim()).filter(Boolean);
11802
+ const [nameValue, ...attrParts] = parts;
11803
+ const eqIdx = nameValue.indexOf("=");
11804
+ if (eqIdx === -1) return { error: "Missing name=value pair" };
11805
+ const name = nameValue.slice(0, eqIdx).trim();
11806
+ const value = nameValue.slice(eqIdx + 1).trim();
11807
+ if (!name) return { error: "Cookie name cannot be empty" };
11808
+ const cookie = {
11809
+ name,
11810
+ value,
11811
+ domain: null,
11812
+ path: null,
11813
+ expires: null,
11814
+ maxAge: null,
11815
+ secure: false,
11816
+ httpOnly: false,
11817
+ sameSite: null
11818
+ };
11819
+ for (const attr of attrParts) {
11820
+ const idx = attr.indexOf("=");
11821
+ const key = (idx === -1 ? attr : attr.slice(0, idx)).trim().toLowerCase();
11822
+ const val = idx === -1 ? "" : attr.slice(idx + 1).trim();
11823
+ switch (key) {
11824
+ case "domain":
11825
+ cookie.domain = val || null;
11826
+ break;
11827
+ case "path":
11828
+ cookie.path = val || null;
11829
+ break;
11830
+ case "expires":
11831
+ cookie.expires = val || null;
11832
+ break;
11833
+ case "max-age": {
11834
+ const n = Number(val);
11835
+ cookie.maxAge = Number.isFinite(n) ? n : null;
11836
+ break;
11837
+ }
11838
+ case "secure":
11839
+ cookie.secure = true;
11840
+ break;
11841
+ case "httponly":
11842
+ cookie.httpOnly = true;
11843
+ break;
11844
+ case "samesite": {
11845
+ const normalized = val.toLowerCase();
11846
+ if (normalized === "strict") cookie.sameSite = "Strict";
11847
+ else if (normalized === "lax") cookie.sameSite = "Lax";
11848
+ else if (normalized === "none") cookie.sameSite = "None";
11849
+ break;
11850
+ }
11851
+ }
11852
+ }
11853
+ const issues = [];
11854
+ const warnings = [];
11855
+ if (cookie.sameSite === "None" && !cookie.secure) {
11856
+ issues.push("SameSite=None requires the Secure attribute \u2014 modern browsers reject this cookie without it.");
11857
+ }
11858
+ if (name.startsWith("__Host-")) {
11859
+ if (!cookie.secure) issues.push("__Host- prefixed cookies require the Secure attribute.");
11860
+ if (cookie.domain) issues.push("__Host- prefixed cookies must not set a Domain attribute.");
11861
+ if (cookie.path !== "/") issues.push("__Host- prefixed cookies must set Path=/.");
11862
+ } else if (name.startsWith("__Secure-")) {
11863
+ if (!cookie.secure) issues.push("__Secure- prefixed cookies require the Secure attribute.");
11864
+ }
11865
+ if (!cookie.secure) {
11866
+ warnings.push("Missing Secure attribute \u2014 the cookie can be sent over a plain HTTP connection.");
11867
+ }
11868
+ if (cookie.maxAge !== null && cookie.maxAge > MAX_COOKIE_AGE_SECONDS) {
11869
+ warnings.push(`Max-Age (${cookie.maxAge}s) exceeds 400 days \u2014 Chromium-based browsers clamp cookie expiry to 400 days from when it's set, so this will be shortened.`);
11870
+ }
11871
+ return { cookie, issues, warnings, valid: issues.length === 0 };
11872
+ }
11726
11873
 
11727
11874
  // src/tools/api.ts
11728
11875
  var api_exports = {};
@@ -13083,6 +13230,7 @@ __export(code_exports, {
13083
13230
  searchCheatsheet: () => searchCheatsheet,
13084
13231
  searchEndpoints: () => searchEndpoints,
13085
13232
  splitStatements: () => splitStatements,
13233
+ testGitignorePatterns: () => testGitignorePatterns,
13086
13234
  testPattern: () => testPattern,
13087
13235
  testRegex: () => testRegex,
13088
13236
  validateEnvKey: () => validateEnvKey2
@@ -15891,6 +16039,85 @@ function lintConventionalCommit(message, options = {}) {
15891
16039
  const valid = !findings.some((f) => f.severity === "error");
15892
16040
  return { message, valid, parsed, findings };
15893
16041
  }
16042
+ function globSegmentToRegexSource(segment) {
16043
+ let out = "";
16044
+ for (let i = 0; i < segment.length; i++) {
16045
+ const c = segment[i];
16046
+ if (c === "*") {
16047
+ out += "[^/]*";
16048
+ } else if (c === "?") {
16049
+ out += "[^/]";
16050
+ } else if (c === "[") {
16051
+ const close = segment.indexOf("]", i + 1);
16052
+ if (close === -1) {
16053
+ out += "\\[";
16054
+ } else {
16055
+ let cls = segment.slice(i + 1, close);
16056
+ if (cls.startsWith("!")) cls = "^" + cls.slice(1);
16057
+ out += `[${cls}]`;
16058
+ i = close;
16059
+ }
16060
+ } else {
16061
+ out += c.replace(/[.+^${}()|\\]/g, "\\$&");
16062
+ }
16063
+ }
16064
+ return out;
16065
+ }
16066
+ function compileGitignorePattern(raw, line) {
16067
+ let pattern = raw.replace(/\s+$/, "");
16068
+ if (!pattern || pattern.startsWith("#")) return null;
16069
+ let negate = false;
16070
+ if (pattern.startsWith("!")) {
16071
+ negate = true;
16072
+ pattern = pattern.slice(1);
16073
+ }
16074
+ pattern = pattern.replace(/\\(.)/g, "$1");
16075
+ if (!pattern) return null;
16076
+ const dirOnly = pattern.endsWith("/") && !pattern.endsWith("\\/");
16077
+ if (dirOnly) pattern = pattern.slice(0, -1);
16078
+ const hasLeadingSlash = pattern.startsWith("/");
16079
+ if (hasLeadingSlash) pattern = pattern.slice(1);
16080
+ const anchored = hasLeadingSlash || pattern.includes("/");
16081
+ const segments = pattern.split("/");
16082
+ const regexParts = segments.map((seg) => {
16083
+ if (seg === "**") return "(?:.*)";
16084
+ return globSegmentToRegexSource(seg);
16085
+ });
16086
+ let body = regexParts.join("/");
16087
+ body = body.replace(/\(\?:\.\*\)\//g, "(?:.*/)?").replace(/\/\(\?:\.\*\)/g, "(?:/.*)?");
16088
+ const prefix = anchored ? "^" : "^(?:.*/)?";
16089
+ const suffix = "(?:/.*)?$";
16090
+ const regex = new RegExp(prefix + body + suffix);
16091
+ return { raw, line, negate, regex };
16092
+ }
16093
+ function testGitignorePatterns(gitignoreContent, paths) {
16094
+ if (typeof gitignoreContent !== "string" || !gitignoreContent.trim()) {
16095
+ return { error: "gitignore content is required" };
16096
+ }
16097
+ if (!Array.isArray(paths) || paths.length === 0) {
16098
+ return { error: "At least one path is required" };
16099
+ }
16100
+ const lines = gitignoreContent.split("\n");
16101
+ const patterns = [];
16102
+ lines.forEach((line, idx) => {
16103
+ const compiled = compileGitignorePattern(line, idx + 1);
16104
+ if (compiled) patterns.push(compiled);
16105
+ });
16106
+ return paths.map((rawPath) => {
16107
+ const path = rawPath.trim().replace(/^\.\//, "");
16108
+ let ignored = false;
16109
+ let matchedPattern = null;
16110
+ let matchedLine = null;
16111
+ for (const p of patterns) {
16112
+ if (p.regex.test(path)) {
16113
+ ignored = !p.negate;
16114
+ matchedPattern = p.raw.trim();
16115
+ matchedLine = p.line;
16116
+ }
16117
+ }
16118
+ return { path, ignored, matchedPattern, matchedLine };
16119
+ });
16120
+ }
15894
16121
 
15895
16122
  // src/tools/color.ts
15896
16123
  var color_exports = {};
package/dist/index.d.cts CHANGED
@@ -2,13 +2,13 @@ export { j as json } from './json-Ta9JykSB.cjs';
2
2
  export { e as encoding } from './encoding-Dk3wpmb3.cjs';
3
3
  export { h as hashing } from './hashing-CnetQFD_.cjs';
4
4
  export { t as text } from './text-kHkT9VtT.cjs';
5
- export { d as data } from './data-CFeS9kes.cjs';
5
+ export { d as data } from './data-BCf3dm-E.cjs';
6
6
  export { g as generators } from './generators-Du8cBesn.cjs';
7
7
  export { t as time } from './time-KqJjdqII.cjs';
8
- export { u as units } from './units-c90DW-OZ.cjs';
9
- export { n as network } from './network-X0EfH9Xq.cjs';
8
+ export { u as units } from './units-HQrMCiNM.cjs';
9
+ export { n as network } from './network-CnKUQT4g.cjs';
10
10
  export { a as api } from './api-DmTNE4c1.cjs';
11
- export { c as code } from './code-BK-x8hVx.cjs';
11
+ export { c as code } from './code-KXoRsHtl.cjs';
12
12
  export { c as color } from './color-tPwZCr9H.cjs';
13
13
  export { c as css } from './css-Cf7AMGM-.cjs';
14
14
  export { m as misc } from './misc-CA3N198T.cjs';
package/dist/index.d.ts CHANGED
@@ -2,13 +2,13 @@ export { j as json } from './json-Ta9JykSB.js';
2
2
  export { e as encoding } from './encoding-Dk3wpmb3.js';
3
3
  export { h as hashing } from './hashing-CnetQFD_.js';
4
4
  export { t as text } from './text-kHkT9VtT.js';
5
- export { d as data } from './data-CFeS9kes.js';
5
+ export { d as data } from './data-BCf3dm-E.js';
6
6
  export { g as generators } from './generators-Du8cBesn.js';
7
7
  export { t as time } from './time-KqJjdqII.js';
8
- export { u as units } from './units-c90DW-OZ.js';
9
- export { n as network } from './network-X0EfH9Xq.js';
8
+ export { u as units } from './units-HQrMCiNM.js';
9
+ export { n as network } from './network-CnKUQT4g.js';
10
10
  export { a as api } from './api-DmTNE4c1.js';
11
- export { c as code } from './code-BK-x8hVx.js';
11
+ export { c as code } from './code-KXoRsHtl.js';
12
12
  export { c as color } from './color-tPwZCr9H.js';
13
13
  export { c as css } from './css-Cf7AMGM-.js';
14
14
  export { m as misc } from './misc-CA3N198T.js';
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  export { media_exports as media } from './chunk-L6V4W4SU.js';
2
- export { units_exports as units } from './chunk-7AJRK57W.js';
3
- export { network_exports as network } from './chunk-UTHAHRQ7.js';
2
+ export { units_exports as units } from './chunk-47RI5V3B.js';
3
+ export { network_exports as network } from './chunk-DBNTO3YO.js';
4
4
  export { api_exports as api } from './chunk-52ZDKSIX.js';
5
- export { code_exports as code } from './chunk-UUT5HNST.js';
5
+ export { code_exports as code } from './chunk-JL7YTXRB.js';
6
6
  export { color_exports as color } from './chunk-BPVAB4P2.js';
7
7
  export { css_exports as css } from './chunk-6YPV2AB5.js';
8
8
  export { misc_exports as misc } from './chunk-GX7H6TAX.js';
@@ -11,7 +11,7 @@ export { json_exports as json } from './chunk-WVEKRKGU.js';
11
11
  export { encoding_exports as encoding } from './chunk-DOWQZUTP.js';
12
12
  export { hashing_exports as hashing } from './chunk-GEFVMGZR.js';
13
13
  export { text_exports as text } from './chunk-F2CEN226.js';
14
- export { data_exports as data } from './chunk-YEXQDI3J.js';
14
+ export { data_exports as data } from './chunk-RZUNTYEH.js';
15
15
  export { generators_exports as generators } from './chunk-3TYWIX3B.js';
16
16
  export { time_exports as time } from './chunk-IEPWZERQ.js';
17
17
  import './chunk-MLKGABMK.js';
@@ -15,6 +15,7 @@
15
15
  * - referrer-policy-builder: buildReferrerPolicy
16
16
  * - ipv6-compressor: parseIpv6Address
17
17
  * - link-header-builder: buildLinkHeader
18
+ * - same-site-cookie-checker: checkSetCookieHeader
18
19
  */
19
20
  declare const DNS_RECORD_TYPES: readonly ["A", "AAAA", "CNAME", "MX", "TXT", "NS", "SOA", "PTR", "SRV", "CAA"];
20
21
  type DnsRecordType = typeof DNS_RECORD_TYPES[number];
@@ -372,10 +373,41 @@ interface Ipv6ParseResult {
372
373
  declare function parseIpv6Address(input: string): Ipv6ParseResult | {
373
374
  error: string;
374
375
  };
376
+ type SameSiteValue = 'Strict' | 'Lax' | 'None';
377
+ interface CookieAttributes {
378
+ name: string;
379
+ value: string;
380
+ domain: string | null;
381
+ path: string | null;
382
+ expires: string | null;
383
+ maxAge: number | null;
384
+ secure: boolean;
385
+ httpOnly: boolean;
386
+ sameSite: SameSiteValue | null;
387
+ }
388
+ interface CookieCheckResult {
389
+ cookie: CookieAttributes;
390
+ issues: string[];
391
+ warnings: string[];
392
+ valid: boolean;
393
+ }
394
+ /**
395
+ * Parse a `Set-Cookie` header value and validate its attribute combination:
396
+ * `SameSite=None` requires `Secure`, the `__Host-`/`__Secure-` name prefixes
397
+ * each require their own attributes (`__Host-` additionally forbids `Domain`
398
+ * and requires `Path=/`), a missing `Secure` attribute is flagged, and a
399
+ * `Max-Age` beyond 400 days is flagged since Chromium-based browsers clamp
400
+ * it to that cap regardless of what was sent.
401
+ */
402
+ declare function checkSetCookieHeader(header: string): CookieCheckResult | {
403
+ error: string;
404
+ };
375
405
 
376
406
  type network_CacheControlDirective = CacheControlDirective;
377
407
  type network_CacheControlOptions = CacheControlOptions;
378
408
  type network_CacheControlResult = CacheControlResult;
409
+ type network_CookieAttributes = CookieAttributes;
410
+ type network_CookieCheckResult = CookieCheckResult;
379
411
  declare const network_DNS_RECORD_TYPES: typeof DNS_RECORD_TYPES;
380
412
  type network_DnsRecord = DnsRecord;
381
413
  type network_DnsRecordType = DnsRecordType;
@@ -405,6 +437,7 @@ type network_RobotsIssue = RobotsIssue;
405
437
  type network_RobotsRule = RobotsRule;
406
438
  type network_RobotsValidationResult = RobotsValidationResult;
407
439
  declare const network_STATUS_CODES: typeof STATUS_CODES;
440
+ type network_SameSiteValue = SameSiteValue;
408
441
  type network_SitemapIndexEntry = SitemapIndexEntry;
409
442
  type network_SitemapIssue = SitemapIssue;
410
443
  type network_SitemapUrlEntry = SitemapUrlEntry;
@@ -418,6 +451,7 @@ declare const network_buildGeoUrl: typeof buildGeoUrl;
418
451
  declare const network_buildLinkHeader: typeof buildLinkHeader;
419
452
  declare const network_buildMapUrl: typeof buildMapUrl;
420
453
  declare const network_buildReferrerPolicy: typeof buildReferrerPolicy;
454
+ declare const network_checkSetCookieHeader: typeof checkSetCookieHeader;
421
455
  declare const network_countryCodeToFlag: typeof countryCodeToFlag;
422
456
  declare const network_formatCoordinates: typeof formatCoordinates;
423
457
  declare const network_formatTtl: typeof formatTtl;
@@ -447,7 +481,7 @@ declare const network_validateHeaderValue: typeof validateHeaderValue;
447
481
  declare const network_validateRobotsTxt: typeof validateRobotsTxt;
448
482
  declare const network_validateSitemap: typeof validateSitemap;
449
483
  declare namespace network {
450
- export { type network_CacheControlDirective as CacheControlDirective, type network_CacheControlOptions as CacheControlOptions, type network_CacheControlResult as CacheControlResult, 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_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_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_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_buildCacheControl as buildCacheControl, network_buildDnsQueryUrl as buildDnsQueryUrl, network_buildGeoUrl as buildGeoUrl, network_buildLinkHeader as buildLinkHeader, network_buildMapUrl as buildMapUrl, network_buildReferrerPolicy as buildReferrerPolicy, 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 };
484
+ export { 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_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_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_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 };
451
485
  }
452
486
 
453
- export { getStatusCode as $, type SitemapUrlEntry as A, type SitemapValidationResult as B, type CacheControlDirective as C, DNS_RECORD_TYPES as D, type StatusCode as E, type UserAgentInfo as F, type GeoResult as G, HTTP_HEADERS as H, type Ipv6AddressType as I, buildCacheControl as J, buildDnsQueryUrl as K, LINK_REL_VALUES as L, buildGeoUrl as M, buildLinkHeader as N, buildMapUrl as O, type ParsedDnsResult as P, buildReferrerPolicy as Q, REFERRER_POLICY_VALUES as R, STATUS_CODES as S, countryCodeToFlag as T, type UaDeviceType as U, formatCoordinates as V, formatTtl as W, getByCategory as X, getHeader as Y, getHeadersByCategory as Z, getStatusByCategory as _, type CacheControlOptions as a, isClientError as a0, isServerError as a1, isSuccess as a2, isValidIp as a3, isValidIpv4 as a4, isValidIpv6 as a5, parseDnsResponse as a6, parseGeoResponse as a7, parseHar as a8, parseIpv6Address as a9, parseUserAgent as aa, searchHeaders as ab, searchStatusCodes as ac, statusCodeToText as ad, typeNumberToLabel as ae, validateDomain as af, validateHeaderName as ag, validateHeaderValue as ah, validateRobotsTxt as ai, validateSitemap as aj, type CacheControlResult as b, type DnsRecord as c, type DnsRecordType as d, type DnsResponse as e, type HarEntry as f, type HarParseResult as g, type HarSummary as h, type HeaderCategory as i, type HttpHeader as j, type Ipv6ParseResult as k, type LinkHeaderEntry as l, type LinkHeaderEntryInput as m, network as n, type LinkHeaderResult as o, type LinkRel as p, type ParsedGeoResult as q, type ReferrerPolicyEntry as r, type ReferrerPolicyResult as s, type ReferrerPolicyValue as t, type RobotsGroup as u, type RobotsIssue as v, type RobotsRule as w, type RobotsValidationResult as x, type SitemapIndexEntry as y, type SitemapIssue as z };
487
+ export { getByCategory as $, type SameSiteValue as A, type SitemapIndexEntry as B, type CacheControlDirective as C, DNS_RECORD_TYPES as D, type SitemapIssue as E, type SitemapUrlEntry as F, type GeoResult as G, HTTP_HEADERS as H, type Ipv6AddressType as I, type SitemapValidationResult as J, type StatusCode as K, LINK_REL_VALUES as L, type UserAgentInfo as M, buildCacheControl as N, buildDnsQueryUrl as O, type ParsedDnsResult as P, buildGeoUrl as Q, REFERRER_POLICY_VALUES as R, STATUS_CODES as S, buildLinkHeader as T, type UaDeviceType as U, buildMapUrl as V, buildReferrerPolicy as W, checkSetCookieHeader as X, countryCodeToFlag as Y, formatCoordinates as Z, formatTtl as _, type CacheControlOptions as a, getHeader as a0, getHeadersByCategory as a1, getStatusByCategory as a2, getStatusCode as a3, isClientError as a4, isServerError as a5, isSuccess as a6, isValidIp as a7, isValidIpv4 as a8, isValidIpv6 as a9, parseDnsResponse as aa, parseGeoResponse as ab, parseHar as ac, parseIpv6Address as ad, parseUserAgent as ae, searchHeaders as af, searchStatusCodes as ag, statusCodeToText as ah, typeNumberToLabel as ai, validateDomain as aj, validateHeaderName as ak, validateHeaderValue as al, validateRobotsTxt as am, validateSitemap as an, type CacheControlResult as b, type CookieAttributes as c, type CookieCheckResult as d, type DnsRecord as e, type DnsRecordType as f, type DnsResponse as g, type HarEntry as h, type HarParseResult as i, type HarSummary as j, type HeaderCategory as k, type HttpHeader as l, type Ipv6ParseResult as m, network as n, type LinkHeaderEntry as o, type LinkHeaderEntryInput as p, type LinkHeaderResult as q, type LinkRel as r, type ParsedGeoResult as s, type ReferrerPolicyEntry as t, type ReferrerPolicyResult as u, type ReferrerPolicyValue as v, type RobotsGroup as w, type RobotsIssue as x, type RobotsRule as y, type RobotsValidationResult as z };
@@ -15,6 +15,7 @@
15
15
  * - referrer-policy-builder: buildReferrerPolicy
16
16
  * - ipv6-compressor: parseIpv6Address
17
17
  * - link-header-builder: buildLinkHeader
18
+ * - same-site-cookie-checker: checkSetCookieHeader
18
19
  */
19
20
  declare const DNS_RECORD_TYPES: readonly ["A", "AAAA", "CNAME", "MX", "TXT", "NS", "SOA", "PTR", "SRV", "CAA"];
20
21
  type DnsRecordType = typeof DNS_RECORD_TYPES[number];
@@ -372,10 +373,41 @@ interface Ipv6ParseResult {
372
373
  declare function parseIpv6Address(input: string): Ipv6ParseResult | {
373
374
  error: string;
374
375
  };
376
+ type SameSiteValue = 'Strict' | 'Lax' | 'None';
377
+ interface CookieAttributes {
378
+ name: string;
379
+ value: string;
380
+ domain: string | null;
381
+ path: string | null;
382
+ expires: string | null;
383
+ maxAge: number | null;
384
+ secure: boolean;
385
+ httpOnly: boolean;
386
+ sameSite: SameSiteValue | null;
387
+ }
388
+ interface CookieCheckResult {
389
+ cookie: CookieAttributes;
390
+ issues: string[];
391
+ warnings: string[];
392
+ valid: boolean;
393
+ }
394
+ /**
395
+ * Parse a `Set-Cookie` header value and validate its attribute combination:
396
+ * `SameSite=None` requires `Secure`, the `__Host-`/`__Secure-` name prefixes
397
+ * each require their own attributes (`__Host-` additionally forbids `Domain`
398
+ * and requires `Path=/`), a missing `Secure` attribute is flagged, and a
399
+ * `Max-Age` beyond 400 days is flagged since Chromium-based browsers clamp
400
+ * it to that cap regardless of what was sent.
401
+ */
402
+ declare function checkSetCookieHeader(header: string): CookieCheckResult | {
403
+ error: string;
404
+ };
375
405
 
376
406
  type network_CacheControlDirective = CacheControlDirective;
377
407
  type network_CacheControlOptions = CacheControlOptions;
378
408
  type network_CacheControlResult = CacheControlResult;
409
+ type network_CookieAttributes = CookieAttributes;
410
+ type network_CookieCheckResult = CookieCheckResult;
379
411
  declare const network_DNS_RECORD_TYPES: typeof DNS_RECORD_TYPES;
380
412
  type network_DnsRecord = DnsRecord;
381
413
  type network_DnsRecordType = DnsRecordType;
@@ -405,6 +437,7 @@ type network_RobotsIssue = RobotsIssue;
405
437
  type network_RobotsRule = RobotsRule;
406
438
  type network_RobotsValidationResult = RobotsValidationResult;
407
439
  declare const network_STATUS_CODES: typeof STATUS_CODES;
440
+ type network_SameSiteValue = SameSiteValue;
408
441
  type network_SitemapIndexEntry = SitemapIndexEntry;
409
442
  type network_SitemapIssue = SitemapIssue;
410
443
  type network_SitemapUrlEntry = SitemapUrlEntry;
@@ -418,6 +451,7 @@ declare const network_buildGeoUrl: typeof buildGeoUrl;
418
451
  declare const network_buildLinkHeader: typeof buildLinkHeader;
419
452
  declare const network_buildMapUrl: typeof buildMapUrl;
420
453
  declare const network_buildReferrerPolicy: typeof buildReferrerPolicy;
454
+ declare const network_checkSetCookieHeader: typeof checkSetCookieHeader;
421
455
  declare const network_countryCodeToFlag: typeof countryCodeToFlag;
422
456
  declare const network_formatCoordinates: typeof formatCoordinates;
423
457
  declare const network_formatTtl: typeof formatTtl;
@@ -447,7 +481,7 @@ declare const network_validateHeaderValue: typeof validateHeaderValue;
447
481
  declare const network_validateRobotsTxt: typeof validateRobotsTxt;
448
482
  declare const network_validateSitemap: typeof validateSitemap;
449
483
  declare namespace network {
450
- export { type network_CacheControlDirective as CacheControlDirective, type network_CacheControlOptions as CacheControlOptions, type network_CacheControlResult as CacheControlResult, 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_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_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_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_buildCacheControl as buildCacheControl, network_buildDnsQueryUrl as buildDnsQueryUrl, network_buildGeoUrl as buildGeoUrl, network_buildLinkHeader as buildLinkHeader, network_buildMapUrl as buildMapUrl, network_buildReferrerPolicy as buildReferrerPolicy, 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 };
484
+ export { 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_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_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_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 };
451
485
  }
452
486
 
453
- export { getStatusCode as $, type SitemapUrlEntry as A, type SitemapValidationResult as B, type CacheControlDirective as C, DNS_RECORD_TYPES as D, type StatusCode as E, type UserAgentInfo as F, type GeoResult as G, HTTP_HEADERS as H, type Ipv6AddressType as I, buildCacheControl as J, buildDnsQueryUrl as K, LINK_REL_VALUES as L, buildGeoUrl as M, buildLinkHeader as N, buildMapUrl as O, type ParsedDnsResult as P, buildReferrerPolicy as Q, REFERRER_POLICY_VALUES as R, STATUS_CODES as S, countryCodeToFlag as T, type UaDeviceType as U, formatCoordinates as V, formatTtl as W, getByCategory as X, getHeader as Y, getHeadersByCategory as Z, getStatusByCategory as _, type CacheControlOptions as a, isClientError as a0, isServerError as a1, isSuccess as a2, isValidIp as a3, isValidIpv4 as a4, isValidIpv6 as a5, parseDnsResponse as a6, parseGeoResponse as a7, parseHar as a8, parseIpv6Address as a9, parseUserAgent as aa, searchHeaders as ab, searchStatusCodes as ac, statusCodeToText as ad, typeNumberToLabel as ae, validateDomain as af, validateHeaderName as ag, validateHeaderValue as ah, validateRobotsTxt as ai, validateSitemap as aj, type CacheControlResult as b, type DnsRecord as c, type DnsRecordType as d, type DnsResponse as e, type HarEntry as f, type HarParseResult as g, type HarSummary as h, type HeaderCategory as i, type HttpHeader as j, type Ipv6ParseResult as k, type LinkHeaderEntry as l, type LinkHeaderEntryInput as m, network as n, type LinkHeaderResult as o, type LinkRel as p, type ParsedGeoResult as q, type ReferrerPolicyEntry as r, type ReferrerPolicyResult as s, type ReferrerPolicyValue as t, type RobotsGroup as u, type RobotsIssue as v, type RobotsRule as w, type RobotsValidationResult as x, type SitemapIndexEntry as y, type SitemapIssue as z };
487
+ export { getByCategory as $, type SameSiteValue as A, type SitemapIndexEntry as B, type CacheControlDirective as C, DNS_RECORD_TYPES as D, type SitemapIssue as E, type SitemapUrlEntry as F, type GeoResult as G, HTTP_HEADERS as H, type Ipv6AddressType as I, type SitemapValidationResult as J, type StatusCode as K, LINK_REL_VALUES as L, type UserAgentInfo as M, buildCacheControl as N, buildDnsQueryUrl as O, type ParsedDnsResult as P, buildGeoUrl as Q, REFERRER_POLICY_VALUES as R, STATUS_CODES as S, buildLinkHeader as T, type UaDeviceType as U, buildMapUrl as V, buildReferrerPolicy as W, checkSetCookieHeader as X, countryCodeToFlag as Y, formatCoordinates as Z, formatTtl as _, type CacheControlOptions as a, getHeader as a0, getHeadersByCategory as a1, getStatusByCategory as a2, getStatusCode as a3, isClientError as a4, isServerError as a5, isSuccess as a6, isValidIp as a7, isValidIpv4 as a8, isValidIpv6 as a9, parseDnsResponse as aa, parseGeoResponse as ab, parseHar as ac, parseIpv6Address as ad, parseUserAgent as ae, searchHeaders as af, searchStatusCodes as ag, statusCodeToText as ah, typeNumberToLabel as ai, validateDomain as aj, validateHeaderName as ak, validateHeaderValue as al, validateRobotsTxt as am, validateSitemap as an, type CacheControlResult as b, type CookieAttributes as c, type CookieCheckResult as d, type DnsRecord as e, type DnsRecordType as f, type DnsResponse as g, type HarEntry as h, type HarParseResult as i, type HarSummary as j, type HeaderCategory as k, type HttpHeader as l, type Ipv6ParseResult as m, network as n, type LinkHeaderEntry as o, type LinkHeaderEntryInput as p, type LinkHeaderResult as q, type LinkRel as r, type ParsedGeoResult as s, type ReferrerPolicyEntry as t, type ReferrerPolicyResult as u, type ReferrerPolicyValue as v, type RobotsGroup as w, type RobotsIssue as x, type RobotsRule as y, type RobotsValidationResult as z };