@hamak/smart-data-dico 1.9.3 → 1.10.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.
@@ -161593,7 +161593,7 @@ router24.get("/api/status", (req, res) => {
161593
161593
  status: "operational",
161594
161594
  mode: profile === "local" ? "desktop" : "server",
161595
161595
  profile,
161596
- version: process.env.npm_package_version || "1.1.1",
161596
+ version: process.env.SDD_VERSION || process.env.npm_package_version || "dev",
161597
161597
  auth: profile === "local" ? "none" : "jwt"
161598
161598
  });
161599
161599
  });
@@ -10635,6 +10635,29 @@ function checkFlowSteps(flow, actionUuid, actionName, label, actionUuids, report
10635
10635
  }
10636
10636
  }
10637
10637
  __name(checkFlowSteps, "checkFlowSteps");
10638
+ function countByCode(findings) {
10639
+ const counts = /* @__PURE__ */ new Map();
10640
+ for (const finding of findings) {
10641
+ counts.set(finding.code, (counts.get(finding.code) ?? 0) + 1);
10642
+ }
10643
+ return [...counts.entries()].sort(([codeA, countA], [codeB, countB]) => {
10644
+ if (countA !== countB) return countB - countA;
10645
+ return codeA.localeCompare(codeB);
10646
+ });
10647
+ }
10648
+ __name(countByCode, "countByCode");
10649
+ function printCategoryStats(title, findings) {
10650
+ console.error(`${title}:`);
10651
+ const counts = countByCode(findings);
10652
+ if (counts.length === 0) {
10653
+ console.error(" none");
10654
+ return;
10655
+ }
10656
+ for (const [code, count] of counts) {
10657
+ console.error(` ${code}: ${count}`);
10658
+ }
10659
+ }
10660
+ __name(printCategoryStats, "printCategoryStats");
10638
10661
  function printReport(report, root) {
10639
10662
  const errors = report.findings.filter((f) => f.severity === "error");
10640
10663
  const warnings = report.findings.filter((f) => f.severity === "warning");
@@ -10658,11 +10681,13 @@ Validating data-dictionary project: ${root}
10658
10681
  console.error("");
10659
10682
  }
10660
10683
  if (errors.length === 0 && warnings.length === 0) {
10661
- console.error("OK \u2014 no problems found.\n");
10662
- } else {
10663
- console.error(`Summary: ${errors.length} error(s), ${warnings.length} warning(s).
10664
- `);
10684
+ console.error("OK \u2014 no problems found.");
10665
10685
  }
10686
+ const status = errors.length > 0 ? "FAILED" : "PASSED";
10687
+ console.error(`Summary: ${status} \u2014 ${errors.length} error(s), ${warnings.length} warning(s).`);
10688
+ printCategoryStats("Error categories", errors);
10689
+ printCategoryStats("Warning categories", warnings);
10690
+ console.error("");
10666
10691
  }
10667
10692
  __name(printReport, "printReport");
10668
10693
  var USAGE = `Validate a Smart Data Dictionary project folder.
@@ -10754,6 +10779,7 @@ if (invokedDirectly) {
10754
10779
  }
10755
10780
  export {
10756
10781
  Report,
10782
+ printReport,
10757
10783
  resolveProjectDir,
10758
10784
  validateProject
10759
10785
  };
package/bin/cli.js CHANGED
@@ -9,6 +9,12 @@ import { spawn, spawnSync } from 'child_process';
9
9
  const __filename = fileURLToPath(import.meta.url);
10
10
  const __dirname = dirname(__filename);
11
11
  const PKG_ROOT = join(__dirname, '..');
12
+ let packageVersion = '';
13
+ try {
14
+ packageVersion = JSON.parse(readFileSync(join(PKG_ROOT, 'package.json'), 'utf-8')).version || '';
15
+ } catch {
16
+ packageVersion = '';
17
+ }
12
18
 
13
19
  // Parse CLI arguments
14
20
  const args = process.argv.slice(2);
@@ -169,6 +175,7 @@ function startServer(dir) {
169
175
  NODE_ENV: 'production',
170
176
  PROFILE: process.env.PROFILE || 'local',
171
177
  DATA_DIR: dir,
178
+ SDD_VERSION: packageVersion,
172
179
  SDD_FRONTEND_DIST: frontendDist,
173
180
  SDD_MANAGED: '1',
174
181
  },