@elisra-devops/docgen-data-provider 1.78.0 → 1.79.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.
@@ -36,6 +36,7 @@ export interface MewpL2RequirementWorkItem {
36
36
  areaPath: string;
37
37
  }
38
38
  export interface MewpL2RequirementFamily {
39
+ workItemId?: number;
39
40
  requirementId: string;
40
41
  baseKey: string;
41
42
  title: string;
@@ -86,7 +86,6 @@ export default class ResultDataProvider {
86
86
  private createEmptyMewpCoverageBugCell;
87
87
  private createEmptyMewpCoverageL3L4Cell;
88
88
  private buildMewpCoverageL3L4Rows;
89
- private formatMewpCustomerId;
90
89
  private buildMewpCoverageRows;
91
90
  private resolveCoverageBugResponsibility;
92
91
  private resolveMewpL2RunStatus;
@@ -694,7 +694,8 @@ class ResultDataProvider {
694
694
  return `MEWP Internal Validation - ${suffix}`;
695
695
  }
696
696
  createMewpCoverageRow(requirement, runStatus, bug, linkedL3L4) {
697
- const l2ReqId = this.formatMewpCustomerId(requirement.requirementId);
697
+ const l2ReqIdNumeric = Number((requirement === null || requirement === void 0 ? void 0 : requirement.workItemId) || 0);
698
+ const l2ReqId = l2ReqIdNumeric > 0 ? String(l2ReqIdNumeric) : '';
698
699
  const l2ReqTitle = this.toMewpComparableText(requirement.title);
699
700
  const l2SubSystem = this.toMewpComparableText(requirement.subSystem);
700
701
  return {
@@ -735,15 +736,6 @@ class ResultDataProvider {
735
736
  }
736
737
  return rows;
737
738
  }
738
- formatMewpCustomerId(rawValue) {
739
- const normalized = this.normalizeMewpRequirementCode(this.toMewpComparableText(rawValue));
740
- if (normalized)
741
- return normalized;
742
- const onlyDigits = String(rawValue || '').replace(/\D/g, '');
743
- if (onlyDigits)
744
- return `SR${onlyDigits}`;
745
- return '';
746
- }
747
739
  buildMewpCoverageRows(requirements, requirementIndex, observedTestCaseIdsByRequirement, linkedRequirementsByTestCase, l3l4ByBaseKey, externalBugsByTestCase) {
748
740
  var _a;
749
741
  const rows = [];
@@ -1369,7 +1361,7 @@ class ResultDataProvider {
1369
1361
  const workItems = await this.fetchWorkItemsByIds(projectName, requirementIds, true);
1370
1362
  const requirements = workItems.map((wi) => {
1371
1363
  const fields = (wi === null || wi === void 0 ? void 0 : wi.fields) || {};
1372
- const requirementId = this.extractMewpRequirementIdentifier(fields, Number((wi === null || wi === void 0 ? void 0 : wi.id) || 0));
1364
+ const requirementId = this.extractMewpRequirementIdentifier(fields);
1373
1365
  const areaPath = this.toMewpComparableText(fields === null || fields === void 0 ? void 0 : fields['System.AreaPath']);
1374
1366
  return {
1375
1367
  workItemId: Number((wi === null || wi === void 0 ? void 0 : wi.id) || 0),
@@ -1451,13 +1443,14 @@ class ResultDataProvider {
1451
1443
  }
1452
1444
  return [...families.entries()]
1453
1445
  .map(([baseKey, family]) => {
1454
- var _a, _b, _c, _d;
1446
+ var _a, _b, _c, _d, _e;
1455
1447
  return ({
1456
- requirementId: String(((_a = family === null || family === void 0 ? void 0 : family.representative) === null || _a === void 0 ? void 0 : _a.requirementId) || baseKey),
1448
+ workItemId: Number(((_a = family === null || family === void 0 ? void 0 : family.representative) === null || _a === void 0 ? void 0 : _a.workItemId) || 0),
1449
+ requirementId: String(((_b = family === null || family === void 0 ? void 0 : family.representative) === null || _b === void 0 ? void 0 : _b.requirementId) || baseKey),
1457
1450
  baseKey,
1458
- title: String(((_b = family === null || family === void 0 ? void 0 : family.representative) === null || _b === void 0 ? void 0 : _b.title) || ''),
1459
- subSystem: String(((_c = family === null || family === void 0 ? void 0 : family.representative) === null || _c === void 0 ? void 0 : _c.subSystem) || ''),
1460
- responsibility: String(((_d = family === null || family === void 0 ? void 0 : family.representative) === null || _d === void 0 ? void 0 : _d.responsibility) || ''),
1451
+ title: String(((_c = family === null || family === void 0 ? void 0 : family.representative) === null || _c === void 0 ? void 0 : _c.title) || ''),
1452
+ subSystem: String(((_d = family === null || family === void 0 ? void 0 : family.representative) === null || _d === void 0 ? void 0 : _d.subSystem) || ''),
1453
+ responsibility: String(((_e = family === null || family === void 0 ? void 0 : family.representative) === null || _e === void 0 ? void 0 : _e.responsibility) || ''),
1461
1454
  linkedTestCaseIds: [...family.linkedTestCaseIds].sort((a, b) => a - b),
1462
1455
  });
1463
1456
  })
@@ -1713,48 +1706,30 @@ class ResultDataProvider {
1713
1706
  }
1714
1707
  return [...out].sort((a, b) => a - b);
1715
1708
  }
1716
- extractMewpRequirementIdentifier(fields, fallbackWorkItemId) {
1709
+ extractMewpRequirementIdentifier(fields) {
1717
1710
  const entries = Object.entries(fields || {});
1718
- // First pass: only trusted identifier-like fields.
1719
- const strictHints = [
1711
+ const normalizeFieldKey = (value) => String(value || '')
1712
+ .toLowerCase()
1713
+ .replace(/[^a-z0-9]/g, '');
1714
+ // Strict MEWP mode: only explicit MEWP customer-id fields are accepted.
1715
+ // API display name: "Customer ID"
1716
+ // API reference name: "Custom.CustomerID"
1717
+ const customerIdFieldKeys = new Set([
1720
1718
  'customerid',
1721
- 'customer id',
1722
- 'customerrequirementid',
1723
- 'requirementid',
1724
- 'externalid',
1725
- 'srid',
1726
- 'sapwbsid',
1727
- ];
1719
+ 'customcustomerid',
1720
+ ]);
1728
1721
  for (const [key, value] of entries) {
1729
- const normalizedKey = String(key || '').toLowerCase();
1730
- if (!strictHints.some((hint) => normalizedKey.includes(hint)))
1722
+ const normalizedKey = normalizeFieldKey(key);
1723
+ if (!customerIdFieldKeys.has(normalizedKey))
1731
1724
  continue;
1732
1725
  const valueAsString = this.toMewpComparableText(value);
1733
1726
  if (!valueAsString)
1734
1727
  continue;
1735
- const normalized = this.normalizeMewpRequirementCodeWithSuffix(valueAsString);
1736
- if (normalized)
1737
- return normalized;
1728
+ const normalizedRequirementId = this.normalizeMewpRequirementCodeWithSuffix(valueAsString);
1729
+ if (normalizedRequirementId)
1730
+ return normalizedRequirementId;
1738
1731
  }
1739
- // Second pass: weaker hints, but still key-based only.
1740
- const looseHints = ['customer', 'requirement', 'external', 'sapwbs', 'sr'];
1741
- for (const [key, value] of entries) {
1742
- const normalizedKey = String(key || '').toLowerCase();
1743
- if (!looseHints.some((hint) => normalizedKey.includes(hint)))
1744
- continue;
1745
- const valueAsString = this.toMewpComparableText(value);
1746
- if (!valueAsString)
1747
- continue;
1748
- const normalized = this.normalizeMewpRequirementCodeWithSuffix(valueAsString);
1749
- if (normalized)
1750
- return normalized;
1751
- }
1752
- // Optional fallback from title only (avoid scanning all fields and accidental SR matches).
1753
- const title = this.toMewpComparableText(fields === null || fields === void 0 ? void 0 : fields['System.Title']);
1754
- const titleCode = this.normalizeMewpRequirementCodeWithSuffix(title);
1755
- if (titleCode)
1756
- return titleCode;
1757
- return fallbackWorkItemId ? `SR${fallbackWorkItemId}` : '';
1732
+ return '';
1758
1733
  }
1759
1734
  deriveMewpResponsibility(fields) {
1760
1735
  const explicitSapWbs = this.toMewpComparableText(fields === null || fields === void 0 ? void 0 : fields['Custom.SAPWBS']);