@holmdigital/engine 3.1.0 → 3.1.1

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.
@@ -204,7 +204,7 @@ var HtmlValidator = class {
204
204
  // src/core/regulatory-scanner.ts
205
205
  import { readFileSync } from "fs";
206
206
  function getEngineVersion() {
207
- return "3.1.0";
207
+ return "3.1.1";
208
208
  }
209
209
  function getStandardsVersion() {
210
210
  try {
@@ -849,6 +849,42 @@ var RESPONSE_TIME_DEFAULT = {
849
849
  "en-ca": "2 days",
850
850
  "en-au": "2 days"
851
851
  };
852
+ var NATIONAL_LAW_FALLBACK = {
853
+ en: "applicable accessibility requirements",
854
+ sv: "g\xE4llande tillg\xE4nglighetskrav",
855
+ no: "gjeldende tilgjengelighetskrav",
856
+ da: "g\xE6ldende tilg\xE6ngelighedskrav",
857
+ fi: "sovellettavat saavutettavuusvaatimukset",
858
+ de: "die geltenden Barrierefreiheitsanforderungen",
859
+ nl: "de geldende toegankelijkheidseisen",
860
+ fr: "la r\xE9glementation d'accessibilit\xE9 applicable",
861
+ es: "los requisitos de accesibilidad aplicables",
862
+ it: "i requisiti di accessibilit\xE0 applicabili",
863
+ pt: "os requisitos de acessibilidade aplic\xE1veis",
864
+ pl: "obowi\u0105zuj\u0105ce wymagania dost\u0119pno\u015Bci"
865
+ };
866
+ function resolveNationalLawReference(country, sector, lang = "en") {
867
+ if (country === "AU") {
868
+ const ddaLaw = getNationalLawByFramework("DDA", "AU");
869
+ return ddaLaw ? `${ddaLaw.fullName}` : "Disability Discrimination Act 1992 (Cth)";
870
+ }
871
+ if (country === "US") {
872
+ const usLaws = getNationalLaws("US");
873
+ const adaLaw = usLaws.find((l) => l.euFramework === "ADA" && l.scope === sector);
874
+ if (adaLaw) {
875
+ if (sector === "public") {
876
+ const s508 = usLaws.find((l) => l.id === "us-508");
877
+ return s508 ? `${adaLaw.fullName} (${adaLaw.law}) & ${s508.fullName} (${s508.law})` : `${adaLaw.fullName} (${adaLaw.law})`;
878
+ }
879
+ const hhs504 = usLaws.find((l) => l.euFramework === "REHAB" && l.scope === "private");
880
+ return hhs504 ? `${adaLaw.fullName} (${adaLaw.law}) & ${hhs504.fullName} (${hhs504.law})` : `${adaLaw.fullName} (${adaLaw.law})`;
881
+ }
882
+ }
883
+ const law = getNationalLawByFramework(sector === "private" ? "EAA" : "WAD", country);
884
+ if (law) return `${law.fullName} (${law.law})`;
885
+ const langKey = lang.split("-")[0];
886
+ return NATIONAL_LAW_FALLBACK[langKey] ?? NATIONAL_LAW_FALLBACK.en;
887
+ }
852
888
  async function generateStatementContent(result, lang = "en", format = "html", metadata) {
853
889
  const templatePath = path.join(__dirname, "templates", `${lang}.json`);
854
890
  let template;
@@ -1044,26 +1080,7 @@ async function generateStatementContent(result, lang = "en", format = "html", me
1044
1080
  }
1045
1081
  return getEnforcementBody(country, sector);
1046
1082
  })(),
1047
- "{<national_law>}": (() => {
1048
- if (country === "AU") {
1049
- const ddaLaw = getNationalLawByFramework("DDA", "AU");
1050
- return ddaLaw ? `${ddaLaw.fullName}` : "Disability Discrimination Act 1992 (Cth)";
1051
- }
1052
- if (country === "US") {
1053
- const usLaws = getNationalLaws("US");
1054
- const adaLaw = usLaws.find((l) => l.euFramework === "ADA" && l.scope === sector);
1055
- if (adaLaw) {
1056
- if (sector === "public") {
1057
- const s508 = usLaws.find((l) => l.id === "us-508");
1058
- return s508 ? `${adaLaw.fullName} (${adaLaw.law}) & ${s508.fullName} (${s508.law})` : `${adaLaw.fullName} (${adaLaw.law})`;
1059
- }
1060
- const hhs504 = usLaws.find((l) => l.euFramework === "REHAB" && l.scope === "private");
1061
- return hhs504 ? `${adaLaw.fullName} (${adaLaw.law}) & ${hhs504.fullName} (${hhs504.law})` : `${adaLaw.fullName} (${adaLaw.law})`;
1062
- }
1063
- }
1064
- const law = getNationalLawByFramework(sector === "private" ? "EAA" : "WAD", country);
1065
- return law ? `${law.fullName} (${law.law})` : "";
1066
- })(),
1083
+ "{<national_law>}": resolveNationalLawReference(country, sector, lang),
1067
1084
  "{<ahrc_url>}": "https://www.humanrights.gov.au/complaints",
1068
1085
  "{<brister>}": nonComplianceItems.length > 0 ? nonComplianceItems.map((item) => `* ${item}`).join("\n") : lang === "sv" ? "Inga k\xE4nda brister." : "No known issues.",
1069
1086
  "{<puutteet>}": nonComplianceItems.length > 0 ? nonComplianceItems.map((item) => `* ${item}`).join("\n") : lang === "fi" ? "Ei tiedossa olevia puutteita." : "No known issues.",
@@ -1141,6 +1158,7 @@ export {
1141
1158
  generateBadgeUrl,
1142
1159
  generateBadgeMarkdown,
1143
1160
  isBadgeWithheldByRobustness,
1161
+ resolveNationalLawReference,
1144
1162
  generateStatementContent,
1145
1163
  generateStatement
1146
1164
  };
package/dist/cli/index.js CHANGED
@@ -1429,7 +1429,7 @@ async function probeWithoutJavaScript(browser, options) {
1429
1429
  // src/core/regulatory-scanner.ts
1430
1430
  var import_node_fs = require("fs");
1431
1431
  function getEngineVersion() {
1432
- return "3.1.0";
1432
+ return "3.1.1";
1433
1433
  }
1434
1434
  function getStandardsVersion() {
1435
1435
  try {
@@ -2893,6 +2893,42 @@ var RESPONSE_TIME_DEFAULT = {
2893
2893
  "en-ca": "2 days",
2894
2894
  "en-au": "2 days"
2895
2895
  };
2896
+ var NATIONAL_LAW_FALLBACK = {
2897
+ en: "applicable accessibility requirements",
2898
+ sv: "g\xE4llande tillg\xE4nglighetskrav",
2899
+ no: "gjeldende tilgjengelighetskrav",
2900
+ da: "g\xE6ldende tilg\xE6ngelighedskrav",
2901
+ fi: "sovellettavat saavutettavuusvaatimukset",
2902
+ de: "die geltenden Barrierefreiheitsanforderungen",
2903
+ nl: "de geldende toegankelijkheidseisen",
2904
+ fr: "la r\xE9glementation d'accessibilit\xE9 applicable",
2905
+ es: "los requisitos de accesibilidad aplicables",
2906
+ it: "i requisiti di accessibilit\xE0 applicabili",
2907
+ pt: "os requisitos de acessibilidade aplic\xE1veis",
2908
+ pl: "obowi\u0105zuj\u0105ce wymagania dost\u0119pno\u015Bci"
2909
+ };
2910
+ function resolveNationalLawReference(country, sector, lang = "en") {
2911
+ if (country === "AU") {
2912
+ const ddaLaw = (0, import_standards2.getNationalLawByFramework)("DDA", "AU");
2913
+ return ddaLaw ? `${ddaLaw.fullName}` : "Disability Discrimination Act 1992 (Cth)";
2914
+ }
2915
+ if (country === "US") {
2916
+ const usLaws = (0, import_standards2.getNationalLaws)("US");
2917
+ const adaLaw = usLaws.find((l) => l.euFramework === "ADA" && l.scope === sector);
2918
+ if (adaLaw) {
2919
+ if (sector === "public") {
2920
+ const s508 = usLaws.find((l) => l.id === "us-508");
2921
+ return s508 ? `${adaLaw.fullName} (${adaLaw.law}) & ${s508.fullName} (${s508.law})` : `${adaLaw.fullName} (${adaLaw.law})`;
2922
+ }
2923
+ const hhs504 = usLaws.find((l) => l.euFramework === "REHAB" && l.scope === "private");
2924
+ return hhs504 ? `${adaLaw.fullName} (${adaLaw.law}) & ${hhs504.fullName} (${hhs504.law})` : `${adaLaw.fullName} (${adaLaw.law})`;
2925
+ }
2926
+ }
2927
+ const law = (0, import_standards2.getNationalLawByFramework)(sector === "private" ? "EAA" : "WAD", country);
2928
+ if (law) return `${law.fullName} (${law.law})`;
2929
+ const langKey = lang.split("-")[0];
2930
+ return NATIONAL_LAW_FALLBACK[langKey] ?? NATIONAL_LAW_FALLBACK.en;
2931
+ }
2896
2932
  async function generateStatementContent(result, lang = "en", format = "html", metadata) {
2897
2933
  const templatePath = import_path.default.join(__dirname, "templates", `${lang}.json`);
2898
2934
  let template;
@@ -3088,26 +3124,7 @@ async function generateStatementContent(result, lang = "en", format = "html", me
3088
3124
  }
3089
3125
  return (0, import_standards2.getEnforcementBody)(country, sector);
3090
3126
  })(),
3091
- "{<national_law>}": (() => {
3092
- if (country === "AU") {
3093
- const ddaLaw = (0, import_standards2.getNationalLawByFramework)("DDA", "AU");
3094
- return ddaLaw ? `${ddaLaw.fullName}` : "Disability Discrimination Act 1992 (Cth)";
3095
- }
3096
- if (country === "US") {
3097
- const usLaws = (0, import_standards2.getNationalLaws)("US");
3098
- const adaLaw = usLaws.find((l) => l.euFramework === "ADA" && l.scope === sector);
3099
- if (adaLaw) {
3100
- if (sector === "public") {
3101
- const s508 = usLaws.find((l) => l.id === "us-508");
3102
- return s508 ? `${adaLaw.fullName} (${adaLaw.law}) & ${s508.fullName} (${s508.law})` : `${adaLaw.fullName} (${adaLaw.law})`;
3103
- }
3104
- const hhs504 = usLaws.find((l) => l.euFramework === "REHAB" && l.scope === "private");
3105
- return hhs504 ? `${adaLaw.fullName} (${adaLaw.law}) & ${hhs504.fullName} (${hhs504.law})` : `${adaLaw.fullName} (${adaLaw.law})`;
3106
- }
3107
- }
3108
- const law = (0, import_standards2.getNationalLawByFramework)(sector === "private" ? "EAA" : "WAD", country);
3109
- return law ? `${law.fullName} (${law.law})` : "";
3110
- })(),
3127
+ "{<national_law>}": resolveNationalLawReference(country, sector, lang),
3111
3128
  "{<ahrc_url>}": "https://www.humanrights.gov.au/complaints",
3112
3129
  "{<brister>}": nonComplianceItems.length > 0 ? nonComplianceItems.map((item) => `* ${item}`).join("\n") : lang === "sv" ? "Inga k\xE4nda brister." : "No known issues.",
3113
3130
  "{<puutteet>}": nonComplianceItems.length > 0 ? nonComplianceItems.map((item) => `* ${item}`).join("\n") : lang === "fi" ? "Ei tiedossa olevia puutteita." : "No known issues.",
@@ -8,7 +8,7 @@ import {
8
8
  generateStatementContent,
9
9
  getEngineVersion,
10
10
  isBadgeWithheldByRobustness
11
- } from "../chunk-5GP6KD7Q.mjs";
11
+ } from "../chunk-356E3K2G.mjs";
12
12
  import {
13
13
  groupReportsByRule,
14
14
  impactBreakdown,
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { EnrichedReport, RegulatoryReport } from '@holmdigital/standards';
1
+ import { EnrichedReport, RegulatoryReport, Country } from '@holmdigital/standards';
2
2
  import { Browser, Page } from 'puppeteer';
3
3
 
4
4
  interface ValidationResult {
@@ -242,7 +242,8 @@ interface StatementMetadata {
242
242
  sector?: 'public' | 'private';
243
243
  publishDate?: string | Date;
244
244
  }
245
+ declare function resolveNationalLawReference(country: Country, sector: 'public' | 'private', lang?: string): string;
245
246
  declare function generateStatementContent(result: ScanResult, lang?: string, format?: 'html' | 'md' | 'markdown', metadata?: StatementMetadata): Promise<string>;
246
247
  declare function generateStatement(result: ScanResult, outputPath: string, lang?: string, format?: 'html' | 'md' | 'markdown', metadata?: StatementMetadata): Promise<void>;
247
248
 
248
- export { NOSCRIPT_EMPTY_THRESHOLD, NOSCRIPT_PARTIAL_THRESHOLD, type NoScriptProbeMeasurement, type NoScriptProbeOptions, type NoScriptResult, type NoScriptVerdict, PseudoAutomationEngine, RegulatoryScanner, type ScanMetadata, type ScanResult, type ScannerOptions, type StatementMetadata, VirtualDOMBuilder, type VirtualDOMConfig, type VirtualNode, evaluateNoScriptCoverage, generateStatement, generateStatementContent, getCurrentLang, getEngineVersion, probeWithoutJavaScript, setLanguage, t };
249
+ export { NOSCRIPT_EMPTY_THRESHOLD, NOSCRIPT_PARTIAL_THRESHOLD, type NoScriptProbeMeasurement, type NoScriptProbeOptions, type NoScriptResult, type NoScriptVerdict, PseudoAutomationEngine, RegulatoryScanner, type ScanMetadata, type ScanResult, type ScannerOptions, type StatementMetadata, VirtualDOMBuilder, type VirtualDOMConfig, type VirtualNode, evaluateNoScriptCoverage, generateStatement, generateStatementContent, getCurrentLang, getEngineVersion, probeWithoutJavaScript, resolveNationalLawReference, setLanguage, t };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { EnrichedReport, RegulatoryReport } from '@holmdigital/standards';
1
+ import { EnrichedReport, RegulatoryReport, Country } from '@holmdigital/standards';
2
2
  import { Browser, Page } from 'puppeteer';
3
3
 
4
4
  interface ValidationResult {
@@ -242,7 +242,8 @@ interface StatementMetadata {
242
242
  sector?: 'public' | 'private';
243
243
  publishDate?: string | Date;
244
244
  }
245
+ declare function resolveNationalLawReference(country: Country, sector: 'public' | 'private', lang?: string): string;
245
246
  declare function generateStatementContent(result: ScanResult, lang?: string, format?: 'html' | 'md' | 'markdown', metadata?: StatementMetadata): Promise<string>;
246
247
  declare function generateStatement(result: ScanResult, outputPath: string, lang?: string, format?: 'html' | 'md' | 'markdown', metadata?: StatementMetadata): Promise<void>;
247
248
 
248
- export { NOSCRIPT_EMPTY_THRESHOLD, NOSCRIPT_PARTIAL_THRESHOLD, type NoScriptProbeMeasurement, type NoScriptProbeOptions, type NoScriptResult, type NoScriptVerdict, PseudoAutomationEngine, RegulatoryScanner, type ScanMetadata, type ScanResult, type ScannerOptions, type StatementMetadata, VirtualDOMBuilder, type VirtualDOMConfig, type VirtualNode, evaluateNoScriptCoverage, generateStatement, generateStatementContent, getCurrentLang, getEngineVersion, probeWithoutJavaScript, setLanguage, t };
249
+ export { NOSCRIPT_EMPTY_THRESHOLD, NOSCRIPT_PARTIAL_THRESHOLD, type NoScriptProbeMeasurement, type NoScriptProbeOptions, type NoScriptResult, type NoScriptVerdict, PseudoAutomationEngine, RegulatoryScanner, type ScanMetadata, type ScanResult, type ScannerOptions, type StatementMetadata, VirtualDOMBuilder, type VirtualDOMConfig, type VirtualNode, evaluateNoScriptCoverage, generateStatement, generateStatementContent, getCurrentLang, getEngineVersion, probeWithoutJavaScript, resolveNationalLawReference, setLanguage, t };
package/dist/index.js CHANGED
@@ -911,6 +911,7 @@ __export(index_exports, {
911
911
  getCurrentLang: () => getCurrentLang,
912
912
  getEngineVersion: () => getEngineVersion,
913
913
  probeWithoutJavaScript: () => probeWithoutJavaScript,
914
+ resolveNationalLawReference: () => resolveNationalLawReference,
914
915
  setLanguage: () => setLanguage,
915
916
  t: () => t
916
917
  });
@@ -1119,7 +1120,7 @@ async function probeWithoutJavaScript(browser, options) {
1119
1120
  // src/core/regulatory-scanner.ts
1120
1121
  var import_node_fs = require("fs");
1121
1122
  function getEngineVersion() {
1122
- return "3.1.0";
1123
+ return "3.1.1";
1123
1124
  }
1124
1125
  function getStandardsVersion() {
1125
1126
  try {
@@ -1767,6 +1768,42 @@ var RESPONSE_TIME_DEFAULT = {
1767
1768
  "en-ca": "2 days",
1768
1769
  "en-au": "2 days"
1769
1770
  };
1771
+ var NATIONAL_LAW_FALLBACK = {
1772
+ en: "applicable accessibility requirements",
1773
+ sv: "g\xE4llande tillg\xE4nglighetskrav",
1774
+ no: "gjeldende tilgjengelighetskrav",
1775
+ da: "g\xE6ldende tilg\xE6ngelighedskrav",
1776
+ fi: "sovellettavat saavutettavuusvaatimukset",
1777
+ de: "die geltenden Barrierefreiheitsanforderungen",
1778
+ nl: "de geldende toegankelijkheidseisen",
1779
+ fr: "la r\xE9glementation d'accessibilit\xE9 applicable",
1780
+ es: "los requisitos de accesibilidad aplicables",
1781
+ it: "i requisiti di accessibilit\xE0 applicabili",
1782
+ pt: "os requisitos de acessibilidade aplic\xE1veis",
1783
+ pl: "obowi\u0105zuj\u0105ce wymagania dost\u0119pno\u015Bci"
1784
+ };
1785
+ function resolveNationalLawReference(country, sector, lang = "en") {
1786
+ if (country === "AU") {
1787
+ const ddaLaw = (0, import_standards.getNationalLawByFramework)("DDA", "AU");
1788
+ return ddaLaw ? `${ddaLaw.fullName}` : "Disability Discrimination Act 1992 (Cth)";
1789
+ }
1790
+ if (country === "US") {
1791
+ const usLaws = (0, import_standards.getNationalLaws)("US");
1792
+ const adaLaw = usLaws.find((l) => l.euFramework === "ADA" && l.scope === sector);
1793
+ if (adaLaw) {
1794
+ if (sector === "public") {
1795
+ const s508 = usLaws.find((l) => l.id === "us-508");
1796
+ return s508 ? `${adaLaw.fullName} (${adaLaw.law}) & ${s508.fullName} (${s508.law})` : `${adaLaw.fullName} (${adaLaw.law})`;
1797
+ }
1798
+ const hhs504 = usLaws.find((l) => l.euFramework === "REHAB" && l.scope === "private");
1799
+ return hhs504 ? `${adaLaw.fullName} (${adaLaw.law}) & ${hhs504.fullName} (${hhs504.law})` : `${adaLaw.fullName} (${adaLaw.law})`;
1800
+ }
1801
+ }
1802
+ const law = (0, import_standards.getNationalLawByFramework)(sector === "private" ? "EAA" : "WAD", country);
1803
+ if (law) return `${law.fullName} (${law.law})`;
1804
+ const langKey = lang.split("-")[0];
1805
+ return NATIONAL_LAW_FALLBACK[langKey] ?? NATIONAL_LAW_FALLBACK.en;
1806
+ }
1770
1807
  async function generateStatementContent(result, lang = "en", format = "html", metadata) {
1771
1808
  const templatePath = import_path.default.join(__dirname, "templates", `${lang}.json`);
1772
1809
  let template;
@@ -1962,26 +1999,7 @@ async function generateStatementContent(result, lang = "en", format = "html", me
1962
1999
  }
1963
2000
  return (0, import_standards.getEnforcementBody)(country, sector);
1964
2001
  })(),
1965
- "{<national_law>}": (() => {
1966
- if (country === "AU") {
1967
- const ddaLaw = (0, import_standards.getNationalLawByFramework)("DDA", "AU");
1968
- return ddaLaw ? `${ddaLaw.fullName}` : "Disability Discrimination Act 1992 (Cth)";
1969
- }
1970
- if (country === "US") {
1971
- const usLaws = (0, import_standards.getNationalLaws)("US");
1972
- const adaLaw = usLaws.find((l) => l.euFramework === "ADA" && l.scope === sector);
1973
- if (adaLaw) {
1974
- if (sector === "public") {
1975
- const s508 = usLaws.find((l) => l.id === "us-508");
1976
- return s508 ? `${adaLaw.fullName} (${adaLaw.law}) & ${s508.fullName} (${s508.law})` : `${adaLaw.fullName} (${adaLaw.law})`;
1977
- }
1978
- const hhs504 = usLaws.find((l) => l.euFramework === "REHAB" && l.scope === "private");
1979
- return hhs504 ? `${adaLaw.fullName} (${adaLaw.law}) & ${hhs504.fullName} (${hhs504.law})` : `${adaLaw.fullName} (${adaLaw.law})`;
1980
- }
1981
- }
1982
- const law = (0, import_standards.getNationalLawByFramework)(sector === "private" ? "EAA" : "WAD", country);
1983
- return law ? `${law.fullName} (${law.law})` : "";
1984
- })(),
2002
+ "{<national_law>}": resolveNationalLawReference(country, sector, lang),
1985
2003
  "{<ahrc_url>}": "https://www.humanrights.gov.au/complaints",
1986
2004
  "{<brister>}": nonComplianceItems.length > 0 ? nonComplianceItems.map((item) => `* ${item}`).join("\n") : lang === "sv" ? "Inga k\xE4nda brister." : "No known issues.",
1987
2005
  "{<puutteet>}": nonComplianceItems.length > 0 ? nonComplianceItems.map((item) => `* ${item}`).join("\n") : lang === "fi" ? "Ei tiedossa olevia puutteita." : "No known issues.",
@@ -2059,6 +2077,7 @@ async function generateStatement(result, outputPath, lang = "en", format = "html
2059
2077
  getCurrentLang,
2060
2078
  getEngineVersion,
2061
2079
  probeWithoutJavaScript,
2080
+ resolveNationalLawReference,
2062
2081
  setLanguage,
2063
2082
  t
2064
2083
  });
package/dist/index.mjs CHANGED
@@ -8,8 +8,9 @@ import {
8
8
  generateStatement,
9
9
  generateStatementContent,
10
10
  getEngineVersion,
11
- probeWithoutJavaScript
12
- } from "./chunk-5GP6KD7Q.mjs";
11
+ probeWithoutJavaScript,
12
+ resolveNationalLawReference
13
+ } from "./chunk-356E3K2G.mjs";
13
14
  import {
14
15
  getCurrentLang,
15
16
  setLanguage,
@@ -29,6 +30,7 @@ export {
29
30
  getCurrentLang,
30
31
  getEngineVersion,
31
32
  probeWithoutJavaScript,
33
+ resolveNationalLawReference,
32
34
  setLanguage,
33
35
  t
34
36
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@holmdigital/engine",
3
- "version": "3.1.0",
3
+ "version": "3.1.1",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"