@sap/ux-specification 1.136.15 → 1.136.17
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.
- package/CHANGELOG.md +258 -165
- package/dist/documentation/v2/v2-AnalyticalListPage.html +2 -2
- package/dist/documentation/v2/v2-ApplicationV2.html +2 -2
- package/dist/documentation/v2/v2-ListReport.html +2 -2
- package/dist/documentation/v2/v2-ListReportNew.html +2 -2
- package/dist/documentation/v2/v2-ObjectPage.html +2 -2
- package/dist/documentation/v2/v2-OverviewPage.html +2 -2
- package/dist/documentation/v4/v4-ApplicationV4.html +2 -2
- package/dist/documentation/v4/v4-BuildingBlocks.html +2 -2
- package/dist/documentation/v4/v4-FreestylePage.html +2 -2
- package/dist/documentation/v4/v4-ListReport.html +2 -2
- package/dist/documentation/v4/v4-ObjectPage.html +2 -2
- package/dist/index-min.js +280 -274
- package/dist/index-min.js.map +4 -4
- package/dist/schemas/v2/AnalyticalListPageConfig.json +3 -3
- package/dist/schemas/v2/ListReportConfig.json +5 -5
- package/dist/schemas/v2/ListReportNewConfig.json +1 -1
- package/dist/schemas/v2/ObjectPageConfig.json +5 -5
- package/dist/schemas/v4/ApplicationV4.json +1 -1
- package/dist/schemas/v4/BuildingBlocksConfig.json +100 -10
- package/dist/schemas/v4/ListReportConfig.json +24 -6
- package/dist/schemas/v4/ObjectPageConfig.json +32 -8
- package/dist/specification/package.json +14 -12
- package/dist/specification/scripts/extractDocu.js +18 -1
- package/dist/specification/scripts/extractDocu.js.map +1 -1
- package/dist/specification/scripts/generate-validity-report.d.ts +15 -0
- package/dist/specification/scripts/generate-validity-report.d.ts.map +1 -0
- package/dist/specification/scripts/generate-validity-report.js +367 -0
- package/dist/specification/scripts/generate-validity-report.js.map +1 -0
- package/dist/specification/scripts/macros/corrections.d.ts +40 -0
- package/dist/specification/scripts/macros/corrections.d.ts.map +1 -1
- package/dist/specification/scripts/macros/corrections.js +114 -7
- package/dist/specification/scripts/macros/corrections.js.map +1 -1
- package/dist/specification/scripts/macros/schema.d.ts.map +1 -1
- package/dist/specification/scripts/macros/schema.js +14 -1
- package/dist/specification/scripts/macros/schema.js.map +1 -1
- package/dist/specification/scripts/macros/types.d.ts +1 -0
- package/dist/specification/scripts/macros/types.d.ts.map +1 -1
- package/dist/specification/scripts/schema/to-json-schema.d.ts.map +1 -1
- package/dist/specification/scripts/schema/to-json-schema.js +2 -13
- package/dist/specification/scripts/schema/to-json-schema.js.map +1 -1
- package/dist/specification/src/api.js +1 -1
- package/dist/specification/src/i18n/i18n.d.ts.map +1 -1
- package/dist/specification/src/i18n/i18n.js +2 -1
- package/dist/specification/src/i18n/i18n.js.map +1 -1
- package/dist/specification/src/sync/common/ManifestDrivenSchemaProcessor.d.ts +8 -1
- package/dist/specification/src/sync/common/ManifestDrivenSchemaProcessor.d.ts.map +1 -1
- package/dist/specification/src/sync/common/ManifestDrivenSchemaProcessor.js +10 -6
- package/dist/specification/src/sync/common/ManifestDrivenSchemaProcessor.js.map +1 -1
- package/dist/specification/src/sync/common/decoration/decorator-paths.d.ts +503 -0
- package/dist/specification/src/sync/common/decoration/decorator-paths.d.ts.map +1 -0
- package/dist/specification/src/sync/common/decoration/decorator-paths.js +497 -0
- package/dist/specification/src/sync/common/decoration/decorator-paths.js.map +1 -0
- package/dist/specification/src/sync/common/decoration/decorators.d.ts +116 -24
- package/dist/specification/src/sync/common/decoration/decorators.d.ts.map +1 -1
- package/dist/specification/src/sync/common/decoration/decorators.js +308 -78
- package/dist/specification/src/sync/common/decoration/decorators.js.map +1 -1
- package/dist/specification/src/sync/common/decoration/index.d.ts +1 -0
- package/dist/specification/src/sync/common/decoration/index.d.ts.map +1 -1
- package/dist/specification/src/sync/common/decoration/index.js +1 -0
- package/dist/specification/src/sync/common/decoration/index.js.map +1 -1
- package/dist/specification/src/sync/common/dist_tag.json +8 -3
- package/dist/specification/src/sync/common/generate/utils.d.ts +2 -1
- package/dist/specification/src/sync/common/generate/utils.d.ts.map +1 -1
- package/dist/specification/src/sync/common/generate/utils.js +5 -1
- package/dist/specification/src/sync/common/generate/utils.js.map +1 -1
- package/dist/specification/src/sync/common/i18n.json +2 -1
- package/dist/specification/src/sync/common/rules.d.ts +20 -0
- package/dist/specification/src/sync/common/rules.d.ts.map +1 -1
- package/dist/specification/src/sync/common/rules.js +22 -2
- package/dist/specification/src/sync/common/rules.js.map +1 -1
- package/dist/specification/src/sync/common/utils.d.ts +22 -6
- package/dist/specification/src/sync/common/utils.d.ts.map +1 -1
- package/dist/specification/src/sync/common/utils.js +122 -18
- package/dist/specification/src/sync/common/utils.js.map +1 -1
- package/dist/specification/src/sync/v2/generate/analyticalListReport.d.ts.map +1 -1
- package/dist/specification/src/sync/v2/generate/analyticalListReport.js +9 -7
- package/dist/specification/src/sync/v2/generate/analyticalListReport.js.map +1 -1
- package/dist/specification/src/sync/v2/generate/listReport.d.ts.map +1 -1
- package/dist/specification/src/sync/v2/generate/listReport.js +3 -1
- package/dist/specification/src/sync/v2/generate/listReport.js.map +1 -1
- package/dist/specification/src/sync/v2/generate/objectPage.d.ts.map +1 -1
- package/dist/specification/src/sync/v2/generate/objectPage.js +58 -2
- package/dist/specification/src/sync/v2/generate/objectPage.js.map +1 -1
- package/dist/specification/src/sync/v2/generate/overviewPage.d.ts +1 -9
- package/dist/specification/src/sync/v2/generate/overviewPage.d.ts.map +1 -1
- package/dist/specification/src/sync/v2/generate/overviewPage.js +30 -1
- package/dist/specification/src/sync/v2/generate/overviewPage.js.map +1 -1
- package/dist/specification/src/sync/v2/import/app/appProvider.d.ts.map +1 -1
- package/dist/specification/src/sync/v2/import/app/appProvider.js +2 -0
- package/dist/specification/src/sync/v2/import/app/appProvider.js.map +1 -1
- package/dist/specification/src/sync/v2/import/pages/analyticalListPage.d.ts +2 -1
- package/dist/specification/src/sync/v2/import/pages/analyticalListPage.d.ts.map +1 -1
- package/dist/specification/src/sync/v2/import/pages/analyticalListPage.js +5 -0
- package/dist/specification/src/sync/v2/import/pages/analyticalListPage.js.map +1 -1
- package/dist/specification/src/sync/v2/import/pages/listReport.d.ts +2 -1
- package/dist/specification/src/sync/v2/import/pages/listReport.d.ts.map +1 -1
- package/dist/specification/src/sync/v2/import/pages/listReport.js +5 -0
- package/dist/specification/src/sync/v2/import/pages/listReport.js.map +1 -1
- package/dist/specification/src/sync/v2/import/pages/objectPage.d.ts.map +1 -1
- package/dist/specification/src/sync/v2/import/pages/objectPage.js +2 -1
- package/dist/specification/src/sync/v2/import/pages/objectPage.js.map +1 -1
- package/dist/specification/src/sync/v2/import/utils.d.ts +28 -1
- package/dist/specification/src/sync/v2/import/utils.d.ts.map +1 -1
- package/dist/specification/src/sync/v2/import/utils.js +37 -0
- package/dist/specification/src/sync/v2/import/utils.js.map +1 -1
- package/dist/specification/src/sync/v2/utils.d.ts +12 -2
- package/dist/specification/src/sync/v2/utils.d.ts.map +1 -1
- package/dist/specification/src/sync/v2/utils.js +19 -2
- package/dist/specification/src/sync/v2/utils.js.map +1 -1
- package/dist/specification/src/sync/v4/application.d.ts +31 -2
- package/dist/specification/src/sync/v4/application.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/application.js +44 -4
- package/dist/specification/src/sync/v4/application.js.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/FilterBar.d.ts +2 -1
- package/dist/specification/src/sync/v4/export/controls/FilterBar.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/FilterBar.js +2 -1
- package/dist/specification/src/sync/v4/export/controls/FilterBar.js.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/Header.d.ts +4 -3
- package/dist/specification/src/sync/v4/export/controls/Header.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/Header.js +7 -3
- package/dist/specification/src/sync/v4/export/controls/Header.js.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/HeaderAction.d.ts +2 -1
- package/dist/specification/src/sync/v4/export/controls/HeaderAction.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/HeaderAction.js +7 -0
- package/dist/specification/src/sync/v4/export/controls/HeaderAction.js.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/ObjectPageCustomSection.d.ts +2 -1
- package/dist/specification/src/sync/v4/export/controls/ObjectPageCustomSection.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/ObjectPageCustomSection.js +2 -1
- package/dist/specification/src/sync/v4/export/controls/ObjectPageCustomSection.js.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/ObjectPageTable.d.ts +1 -1
- package/dist/specification/src/sync/v4/export/controls/ObjectPageTable.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/ObjectPageTable.js +0 -13
- package/dist/specification/src/sync/v4/export/controls/ObjectPageTable.js.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/Table.d.ts +32 -17
- package/dist/specification/src/sync/v4/export/controls/Table.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/Table.js +84 -58
- package/dist/specification/src/sync/v4/export/controls/Table.js.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/TableColumn.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/TableColumn.js +2 -2
- package/dist/specification/src/sync/v4/export/controls/TableColumn.js.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/ToolBarAction.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/ToolBarAction.js +2 -2
- package/dist/specification/src/sync/v4/export/controls/ToolBarAction.js.map +1 -1
- package/dist/specification/src/sync/v4/export/export.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/export/export.js +25 -3
- package/dist/specification/src/sync/v4/export/export.js.map +1 -1
- package/dist/specification/src/sync/v4/export/pages/ListReport.js +1 -1
- package/dist/specification/src/sync/v4/export/pages/ListReport.js.map +1 -1
- package/dist/specification/src/sync/v4/generate/actions.d.ts +1 -1
- package/dist/specification/src/sync/v4/generate/actions.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/generate/fpm-custom-page/annotations.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/generate/fpm-custom-page/annotations.js +20 -12
- package/dist/specification/src/sync/v4/generate/fpm-custom-page/annotations.js.map +1 -1
- package/dist/specification/src/sync/v4/generate/fpm-custom-page/generator.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/generate/fpm-custom-page/generator.js +16 -1
- package/dist/specification/src/sync/v4/generate/fpm-custom-page/generator.js.map +1 -1
- package/dist/specification/src/sync/v4/generate/fpm-custom-page/utils.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/generate/fpm-custom-page/utils.js +10 -1
- package/dist/specification/src/sync/v4/generate/fpm-custom-page/utils.js.map +1 -1
- package/dist/specification/src/sync/v4/generate/index.d.ts +1 -1
- package/dist/specification/src/sync/v4/generate/index.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/generate/index.js +1 -1
- package/dist/specification/src/sync/v4/generate/index.js.map +1 -1
- package/dist/specification/src/sync/v4/generate/list-report/ListReportUtils.d.ts +73 -0
- package/dist/specification/src/sync/v4/generate/list-report/ListReportUtils.d.ts.map +1 -0
- package/dist/specification/src/sync/v4/generate/list-report/ListReportUtils.js +354 -0
- package/dist/specification/src/sync/v4/generate/list-report/ListReportUtils.js.map +1 -0
- package/dist/specification/src/sync/v4/generate/{listReport.d.ts → list-report/listReport.d.ts} +27 -16
- package/dist/specification/src/sync/v4/generate/list-report/listReport.d.ts.map +1 -0
- package/dist/specification/src/sync/v4/generate/{listReport.js → list-report/listReport.js} +191 -163
- package/dist/specification/src/sync/v4/generate/list-report/listReport.js.map +1 -0
- package/dist/specification/src/sync/v4/generate/objectPage.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/generate/objectPage.js +145 -44
- package/dist/specification/src/sync/v4/generate/objectPage.js.map +1 -1
- package/dist/specification/src/sync/v4/import/pages/listReport.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/import/pages/listReport.js +2 -1
- package/dist/specification/src/sync/v4/import/pages/listReport.js.map +1 -1
- package/dist/specification/src/sync/v4/import/utils.js +5 -3
- package/dist/specification/src/sync/v4/import/utils.js.map +1 -1
- package/dist/specification/src/sync/v4/sync-rules/App.d.ts +9 -7
- package/dist/specification/src/sync/v4/sync-rules/App.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/sync-rules/App.js +4 -8
- package/dist/specification/src/sync/v4/sync-rules/App.js.map +1 -1
- package/dist/specification/src/sync/v4/sync-rules/AppSchema.d.ts +2 -9
- package/dist/specification/src/sync/v4/sync-rules/AppSchema.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/sync-rules/AppSchema.js +2 -11
- package/dist/specification/src/sync/v4/sync-rules/AppSchema.js.map +1 -1
- package/dist/specification/src/sync/v4/sync-rules/DecoratorClass.d.ts +219 -96
- package/dist/specification/src/sync/v4/sync-rules/DecoratorClass.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/sync-rules/DecoratorClass.js +557 -211
- package/dist/specification/src/sync/v4/sync-rules/DecoratorClass.js.map +1 -1
- package/dist/specification/src/sync/v4/sync-rules/Page.d.ts +17 -22
- package/dist/specification/src/sync/v4/sync-rules/Page.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/sync-rules/Page.js +15 -22
- package/dist/specification/src/sync/v4/sync-rules/Page.js.map +1 -1
- package/dist/specification/src/sync/v4/sync-rules/controllerExtensions.d.ts +1 -0
- package/dist/specification/src/sync/v4/sync-rules/controllerExtensions.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/sync-rules/controllerExtensions.js +17 -9
- package/dist/specification/src/sync/v4/sync-rules/controllerExtensions.js.map +1 -1
- package/dist/specification/src/sync/v4/sync-rules/index.d.ts +5 -0
- package/dist/specification/src/sync/v4/sync-rules/index.d.ts.map +1 -0
- package/dist/specification/src/sync/v4/sync-rules/index.js +21 -0
- package/dist/specification/src/sync/v4/sync-rules/index.js.map +1 -0
- package/dist/specification/src/sync/v4/sync-rules/utils.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/sync-rules/utils.js +4 -0
- package/dist/specification/src/sync/v4/sync-rules/utils.js.map +1 -1
- package/dist/specification/src/sync/v4/utils/index.d.ts +2 -0
- package/dist/specification/src/sync/v4/utils/index.d.ts.map +1 -0
- package/dist/specification/src/sync/v4/utils/index.js +18 -0
- package/dist/specification/src/sync/v4/utils/index.js.map +1 -0
- package/dist/specification/src/sync/v4/utils/utils.d.ts +9 -1
- package/dist/specification/src/sync/v4/utils/utils.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/utils/utils.js +17 -2
- package/dist/specification/src/sync/v4/utils/utils.js.map +1 -1
- package/dist/specification/test/test-projects/v2sttaProdMan2/webapp/manifest.json +550 -0
- package/dist/specification/test/test-projects/v4new/webapp/manifest.json +147 -0
- package/dist/specification/test/test-utils/utils.d.ts +71 -0
- package/dist/specification/test/test-utils/utils.d.ts.map +1 -0
- package/dist/specification/test/test-utils/utils.js +400 -0
- package/dist/specification/test/test-utils/utils.js.map +1 -0
- package/dist/specification/test/unit/decorators/validity-test-utils.d.ts +131 -0
- package/dist/specification/test/unit/decorators/validity-test-utils.d.ts.map +1 -0
- package/dist/specification/test/unit/decorators/validity-test-utils.js +661 -0
- package/dist/specification/test/unit/decorators/validity-test-utils.js.map +1 -0
- package/dist/types/src/apiTypes.d.ts +2 -3
- package/dist/types/src/apiTypes.d.ts.map +1 -1
- package/dist/types/src/apiTypes.js.map +1 -1
- package/dist/types/src/common/types.d.ts +119 -13
- package/dist/types/src/common/types.d.ts.map +1 -1
- package/dist/types/src/common/types.js.map +1 -1
- package/dist/types/src/v2/controls/ObjectPageTable.d.ts +1 -1
- package/dist/types/src/v2/controls/Table.d.ts +1 -1
- package/dist/types/src/v4/controls/ObjectPageTable.d.ts +1 -1
- package/dist/types/src/v4/controls/ObjectPageTable.d.ts.map +1 -1
- package/dist/types/src/v4/controls/Table.d.ts +3 -3
- package/dist/types/src/v4/controls/Table.d.ts.map +1 -1
- package/package.json +14 -12
- package/dist/specification/src/sync/v4/generate/ListReportUtils.d.ts +0 -107
- package/dist/specification/src/sync/v4/generate/ListReportUtils.d.ts.map +0 -1
- package/dist/specification/src/sync/v4/generate/ListReportUtils.js +0 -394
- package/dist/specification/src/sync/v4/generate/ListReportUtils.js.map +0 -1
- package/dist/specification/src/sync/v4/generate/listReport.d.ts.map +0 -1
- package/dist/specification/src/sync/v4/generate/listReport.js.map +0 -1
|
@@ -0,0 +1,661 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @file Test utilities for validating @validity decorator behavior
|
|
4
|
+
*
|
|
5
|
+
* This module provides helper functions for:
|
|
6
|
+
* - Extracting validity metadata from decorated classes
|
|
7
|
+
* - Generating expected vs actual visibility tables
|
|
8
|
+
* - Comparing property visibility across UI5 versions
|
|
9
|
+
* - Formatting results as markdown for snapshot testing
|
|
10
|
+
*/
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.INDENT = exports.VERSION_LATEST = exports.EMOJI_DIFF = exports.EMOJI_MATCH = exports.EMOJI_NOT_FOUND = exports.EMOJI_HIDDEN = exports.EMOJI_VISIBLE = void 0;
|
|
16
|
+
exports.findTableDefinition = findTableDefinition;
|
|
17
|
+
exports.findDefinitionByName = findDefinitionByName;
|
|
18
|
+
exports.getEnumValidityFromClass = getEnumValidityFromClass;
|
|
19
|
+
exports.generateExpectedVisibilityTable = generateExpectedVisibilityTable;
|
|
20
|
+
exports.generateActualVisibilityTable = generateActualVisibilityTable;
|
|
21
|
+
exports.generateDiffVisibilityTable = generateDiffVisibilityTable;
|
|
22
|
+
exports.formatVisibilityTableMarkdown = formatVisibilityTableMarkdown;
|
|
23
|
+
exports.formatDiffTableMarkdown = formatDiffTableMarkdown;
|
|
24
|
+
exports.formatEnumValidityTableMarkdown = formatEnumValidityTableMarkdown;
|
|
25
|
+
exports.generateSchemasForVersions = generateSchemasForVersions;
|
|
26
|
+
exports.getValidityProperties = getValidityProperties;
|
|
27
|
+
exports.compareExpectedVsActual = compareExpectedVsActual;
|
|
28
|
+
exports.compareExpectedVsActualEnum = compareExpectedVsActualEnum;
|
|
29
|
+
const ux_specification_types_1 = require("@sap/ux-specification-types");
|
|
30
|
+
const api_1 = require("../../../src/api");
|
|
31
|
+
const path_1 = require("path");
|
|
32
|
+
const decorators_1 = require("../../../src/sync/common/decoration/decorators");
|
|
33
|
+
const utils_1 = require("../../test-utils/utils");
|
|
34
|
+
const manifest_json_1 = __importDefault(require("../../test-projects/v4new/webapp/manifest.json"));
|
|
35
|
+
// ============================================================================
|
|
36
|
+
// Constants
|
|
37
|
+
// ============================================================================
|
|
38
|
+
/** Emoji indicator for a visible/available property */
|
|
39
|
+
exports.EMOJI_VISIBLE = '✅';
|
|
40
|
+
/** Emoji indicator for a hidden/unavailable property */
|
|
41
|
+
exports.EMOJI_HIDDEN = '🚫';
|
|
42
|
+
/** Emoji indicator for property not found in schema */
|
|
43
|
+
exports.EMOJI_NOT_FOUND = '❓';
|
|
44
|
+
/** Emoji indicator for a match between expected and actual */
|
|
45
|
+
exports.EMOJI_MATCH = '✅';
|
|
46
|
+
/** Emoji indicator for a mismatch between expected and actual */
|
|
47
|
+
exports.EMOJI_DIFF = '⚠️';
|
|
48
|
+
/** Special version string representing the latest/newest version */
|
|
49
|
+
exports.VERSION_LATEST = 'latest';
|
|
50
|
+
/** Indentation for snapshot content (16 spaces to align within toMatchInlineSnapshot) */
|
|
51
|
+
exports.INDENT = ' ';
|
|
52
|
+
// ============================================================================
|
|
53
|
+
// Helper Functions - Schema Operations
|
|
54
|
+
// ============================================================================
|
|
55
|
+
/**
|
|
56
|
+
* Resolves a definition by following $ref chains in the schema
|
|
57
|
+
*/
|
|
58
|
+
function resolveDefinition(schema, definitionName) {
|
|
59
|
+
let def = schema.definitions?.[definitionName];
|
|
60
|
+
if (!def) {
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
let depth = 0;
|
|
64
|
+
while (def.$ref && depth < 10) {
|
|
65
|
+
const refName = def.$ref.replace('#/definitions/', '');
|
|
66
|
+
def = schema.definitions?.[refName];
|
|
67
|
+
if (!def) {
|
|
68
|
+
return undefined;
|
|
69
|
+
}
|
|
70
|
+
depth++;
|
|
71
|
+
}
|
|
72
|
+
return def;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Finds the definition containing table properties by searching common patterns
|
|
76
|
+
*/
|
|
77
|
+
function findTableDefinition(schema) {
|
|
78
|
+
const definitions = schema.definitions || {};
|
|
79
|
+
// Try common table definition patterns in order of preference
|
|
80
|
+
const patterns = ['TableSPV', 'LRTableView', 'Table'];
|
|
81
|
+
for (const pattern of patterns) {
|
|
82
|
+
const def = definitions[pattern];
|
|
83
|
+
if (def?.properties && Object.keys(def.properties).length > 0) {
|
|
84
|
+
return def;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
// Search for any definition with key table properties
|
|
88
|
+
const keyProps = ['condensedTableLayout', 'enableExport', 'selectionMode'];
|
|
89
|
+
for (const [, def] of Object.entries(definitions)) {
|
|
90
|
+
const d = def;
|
|
91
|
+
if (d?.properties) {
|
|
92
|
+
const hasKeyProps = keyProps.some((p) => p in d.properties);
|
|
93
|
+
if (hasKeyProps) {
|
|
94
|
+
return d;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return undefined;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Creates a definition finder function for a specific definition name
|
|
102
|
+
*/
|
|
103
|
+
function findDefinitionByName(definitionName) {
|
|
104
|
+
return (schema) => {
|
|
105
|
+
const def = schema.definitions?.[definitionName];
|
|
106
|
+
return def?.properties ? def : undefined;
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Gets all property names from a schema definition
|
|
111
|
+
*/
|
|
112
|
+
function getSchemaPropertyNames(schema, definitionName) {
|
|
113
|
+
const def = resolveDefinition(schema, definitionName);
|
|
114
|
+
return def?.properties ? Object.keys(def.properties) : [];
|
|
115
|
+
}
|
|
116
|
+
// ============================================================================
|
|
117
|
+
// Helper Functions - Version Comparison
|
|
118
|
+
// ============================================================================
|
|
119
|
+
/**
|
|
120
|
+
* Compares two semantic version strings
|
|
121
|
+
*/
|
|
122
|
+
function compareVersions(a, b) {
|
|
123
|
+
// Handle 'latest' as a special case - it's always the highest version
|
|
124
|
+
if (a === exports.VERSION_LATEST && b === exports.VERSION_LATEST) {
|
|
125
|
+
return 0;
|
|
126
|
+
}
|
|
127
|
+
if (a === exports.VERSION_LATEST) {
|
|
128
|
+
return 1;
|
|
129
|
+
}
|
|
130
|
+
if (b === exports.VERSION_LATEST) {
|
|
131
|
+
return -1;
|
|
132
|
+
}
|
|
133
|
+
const aParts = a.split('.').map(Number);
|
|
134
|
+
const bParts = b.split('.').map(Number);
|
|
135
|
+
for (let i = 0; i < 3; i++) {
|
|
136
|
+
if ((aParts[i] || 0) !== (bParts[i] || 0)) {
|
|
137
|
+
return (aParts[i] || 0) - (bParts[i] || 0);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return 0;
|
|
141
|
+
}
|
|
142
|
+
// ============================================================================
|
|
143
|
+
// Helper Functions - Validity Metadata Extraction
|
|
144
|
+
// ============================================================================
|
|
145
|
+
/**
|
|
146
|
+
* Extracts all properties from a class, including those with @validity decorator
|
|
147
|
+
*/
|
|
148
|
+
function getValidityPropertiesFromClass(ClassConstructor, schemaPropertyNames = []) {
|
|
149
|
+
const prototype = ClassConstructor.prototype;
|
|
150
|
+
const result = [];
|
|
151
|
+
const candidateProperties = new Set();
|
|
152
|
+
// Walk prototype chain to find all properties
|
|
153
|
+
let current = prototype;
|
|
154
|
+
while (current && current !== Object.prototype) {
|
|
155
|
+
Object.getOwnPropertyNames(current).forEach((name) => {
|
|
156
|
+
if (name !== 'constructor') {
|
|
157
|
+
candidateProperties.add(name);
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
current = Object.getPrototypeOf(current);
|
|
161
|
+
}
|
|
162
|
+
// Add schema property names as candidates
|
|
163
|
+
schemaPropertyNames.forEach((p) => candidateProperties.add(p));
|
|
164
|
+
for (const property of candidateProperties) {
|
|
165
|
+
const validity = (0, decorators_1.getValidityMetadata)(prototype, property);
|
|
166
|
+
if (validity?.since) {
|
|
167
|
+
result.push({ property, since: validity.since });
|
|
168
|
+
}
|
|
169
|
+
else if (validity?.enum) {
|
|
170
|
+
// Property has enum validity but no property-level since
|
|
171
|
+
result.push({ property, since: '-' });
|
|
172
|
+
}
|
|
173
|
+
else if (schemaPropertyNames.includes(property)) {
|
|
174
|
+
// Include properties without @validity if they exist in schema
|
|
175
|
+
result.push({ property, since: '-' });
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
// Sort: properties without version ('-') first, then by version, then alphabetically
|
|
179
|
+
return result.sort((a, b) => {
|
|
180
|
+
if (a.since === '-' && b.since !== '-') {
|
|
181
|
+
return -1;
|
|
182
|
+
}
|
|
183
|
+
if (a.since !== '-' && b.since === '-') {
|
|
184
|
+
return 1;
|
|
185
|
+
}
|
|
186
|
+
if (a.since === '-' && b.since === '-') {
|
|
187
|
+
return a.property.localeCompare(b.property);
|
|
188
|
+
}
|
|
189
|
+
const versionDiff = compareVersions(a.since, b.since);
|
|
190
|
+
if (versionDiff !== 0) {
|
|
191
|
+
return versionDiff;
|
|
192
|
+
}
|
|
193
|
+
return a.property.localeCompare(b.property);
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Gets all property names that have validity metadata on a class prototype
|
|
198
|
+
*/
|
|
199
|
+
function getPropertiesWithValidityMetadata(prototype) {
|
|
200
|
+
const properties = [];
|
|
201
|
+
if (typeof Reflect !== 'undefined' && Reflect.getMetadataKeys) {
|
|
202
|
+
const knownProperties = new Set();
|
|
203
|
+
// Walk the prototype chain
|
|
204
|
+
let current = prototype;
|
|
205
|
+
while (current && current !== Object.prototype) {
|
|
206
|
+
const propNames = Object.getOwnPropertyNames(current);
|
|
207
|
+
propNames.forEach((p) => knownProperties.add(p));
|
|
208
|
+
current = Object.getPrototypeOf(current);
|
|
209
|
+
}
|
|
210
|
+
// Common property names that might have enum validity
|
|
211
|
+
const testProperties = [
|
|
212
|
+
'type',
|
|
213
|
+
'personalization',
|
|
214
|
+
'selectionMode',
|
|
215
|
+
'selectAll',
|
|
216
|
+
'selectionLimit',
|
|
217
|
+
'enableExport',
|
|
218
|
+
'quickVariantSelection',
|
|
219
|
+
'condensedTableLayout',
|
|
220
|
+
'hierarchyQualifier',
|
|
221
|
+
'widthIncludingColumnHeader',
|
|
222
|
+
'disableCopyToClipboard',
|
|
223
|
+
'initialLoad',
|
|
224
|
+
'enableMassEdit',
|
|
225
|
+
'creationMode',
|
|
226
|
+
'analyticalConfiguration',
|
|
227
|
+
'popinLayout',
|
|
228
|
+
'rowCountMode',
|
|
229
|
+
...Array.from(knownProperties)
|
|
230
|
+
];
|
|
231
|
+
for (const prop of testProperties) {
|
|
232
|
+
if (!properties.includes(prop)) {
|
|
233
|
+
const validity = (0, decorators_1.getValidityMetadata)(prototype, prop);
|
|
234
|
+
if (validity?.enum) {
|
|
235
|
+
properties.push(prop);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
return properties;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Extracts enum value validity information from a class's properties
|
|
244
|
+
*/
|
|
245
|
+
function getEnumValidityFromClass(ClassConstructor) {
|
|
246
|
+
const prototype = ClassConstructor.prototype;
|
|
247
|
+
const result = [];
|
|
248
|
+
const propertiesWithValidity = getPropertiesWithValidityMetadata(prototype);
|
|
249
|
+
for (const property of propertiesWithValidity) {
|
|
250
|
+
const validity = (0, decorators_1.getValidityMetadata)(prototype, property);
|
|
251
|
+
if (validity?.enum) {
|
|
252
|
+
for (const [enumValue, config] of Object.entries(validity.enum)) {
|
|
253
|
+
if (config.since) {
|
|
254
|
+
result.push({
|
|
255
|
+
property,
|
|
256
|
+
enumValue,
|
|
257
|
+
since: config.since
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
// Sort by property, then by since version, then by enum value
|
|
264
|
+
return result.sort((a, b) => {
|
|
265
|
+
const propCompare = a.property.localeCompare(b.property);
|
|
266
|
+
if (propCompare !== 0) {
|
|
267
|
+
return propCompare;
|
|
268
|
+
}
|
|
269
|
+
const versionCompare = compareVersions(a.since, b.since);
|
|
270
|
+
if (versionCompare !== 0) {
|
|
271
|
+
return versionCompare;
|
|
272
|
+
}
|
|
273
|
+
return a.enumValue.localeCompare(b.enumValue);
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
// ============================================================================
|
|
277
|
+
// Helper Functions - Table Generation
|
|
278
|
+
// ============================================================================
|
|
279
|
+
/**
|
|
280
|
+
* Generates expected visibility table based on @validity decorator metadata
|
|
281
|
+
*/
|
|
282
|
+
function generateExpectedVisibilityTable(validityInfos, versions) {
|
|
283
|
+
return validityInfos.map((info) => {
|
|
284
|
+
const row = {
|
|
285
|
+
property: info.property,
|
|
286
|
+
since: info.since
|
|
287
|
+
};
|
|
288
|
+
for (const version of versions) {
|
|
289
|
+
const shouldBeVisible = compareVersions(version, info.since) >= 0;
|
|
290
|
+
row[version] = shouldBeVisible ? exports.EMOJI_VISIBLE : exports.EMOJI_HIDDEN;
|
|
291
|
+
}
|
|
292
|
+
return row;
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Generates actual visibility table from generated schemas
|
|
297
|
+
*/
|
|
298
|
+
function generateActualVisibilityTable(validityInfos, versions, schemaResults, findDefinition) {
|
|
299
|
+
return validityInfos.map((info) => {
|
|
300
|
+
const row = {
|
|
301
|
+
property: info.property,
|
|
302
|
+
since: info.since
|
|
303
|
+
};
|
|
304
|
+
for (const version of versions) {
|
|
305
|
+
const schema = schemaResults.get(version);
|
|
306
|
+
if (!schema) {
|
|
307
|
+
row[version] = '?';
|
|
308
|
+
continue;
|
|
309
|
+
}
|
|
310
|
+
const def = findDefinition(schema);
|
|
311
|
+
if (!def?.properties) {
|
|
312
|
+
row[version] = '?';
|
|
313
|
+
continue;
|
|
314
|
+
}
|
|
315
|
+
const propDef = def.properties[info.property];
|
|
316
|
+
if (!propDef) {
|
|
317
|
+
row[version] = exports.EMOJI_NOT_FOUND;
|
|
318
|
+
continue;
|
|
319
|
+
}
|
|
320
|
+
const hidden = propDef[ux_specification_types_1.SchemaTag.hidden] === true;
|
|
321
|
+
row[version] = hidden ? exports.EMOJI_HIDDEN : exports.EMOJI_VISIBLE;
|
|
322
|
+
}
|
|
323
|
+
return row;
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Generates expected enum visibility table based on @validity decorator enum metadata
|
|
328
|
+
*/
|
|
329
|
+
function generateExpectedEnumVisibilityTable(enumInfos, versions) {
|
|
330
|
+
return enumInfos.map((info) => {
|
|
331
|
+
const row = {
|
|
332
|
+
property: `${info.property}.${info.enumValue}`,
|
|
333
|
+
since: info.since
|
|
334
|
+
};
|
|
335
|
+
for (const version of versions) {
|
|
336
|
+
const shouldBeVisible = compareVersions(version, info.since) >= 0;
|
|
337
|
+
row[version] = shouldBeVisible ? exports.EMOJI_VISIBLE : exports.EMOJI_HIDDEN;
|
|
338
|
+
}
|
|
339
|
+
return row;
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Resolves enum values from a property definition.
|
|
344
|
+
*/
|
|
345
|
+
function resolveEnumValues(propDef, schema) {
|
|
346
|
+
// Check for inline enum
|
|
347
|
+
if (propDef.enum && Array.isArray(propDef.enum)) {
|
|
348
|
+
return propDef.enum;
|
|
349
|
+
}
|
|
350
|
+
// Check for anyOf with enums
|
|
351
|
+
if (propDef.anyOf) {
|
|
352
|
+
const values = propDef.anyOf.flatMap((x) => x.enum || []);
|
|
353
|
+
if (values.length > 0) {
|
|
354
|
+
return values;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
// Check for $ref to an enum definition
|
|
358
|
+
if (propDef.$ref) {
|
|
359
|
+
const refName = propDef.$ref.replace('#/definitions/', '');
|
|
360
|
+
const refDef = schema.definitions?.[refName];
|
|
361
|
+
if (refDef?.enum && Array.isArray(refDef.enum)) {
|
|
362
|
+
return refDef.enum;
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
return undefined;
|
|
366
|
+
}
|
|
367
|
+
/**
|
|
368
|
+
* Generates actual enum visibility table from generated schemas
|
|
369
|
+
*/
|
|
370
|
+
function generateActualEnumVisibilityTable(enumInfos, versions, schemaResults, findDefinition) {
|
|
371
|
+
return enumInfos.map((info) => {
|
|
372
|
+
const row = {
|
|
373
|
+
property: `${info.property}.${info.enumValue}`,
|
|
374
|
+
since: info.since
|
|
375
|
+
};
|
|
376
|
+
for (const version of versions) {
|
|
377
|
+
const schema = schemaResults.get(version);
|
|
378
|
+
if (!schema) {
|
|
379
|
+
row[version] = '?';
|
|
380
|
+
continue;
|
|
381
|
+
}
|
|
382
|
+
const def = findDefinition(schema);
|
|
383
|
+
if (!def?.properties) {
|
|
384
|
+
row[version] = '?';
|
|
385
|
+
continue;
|
|
386
|
+
}
|
|
387
|
+
const propDef = def.properties[info.property];
|
|
388
|
+
if (!propDef) {
|
|
389
|
+
row[version] = exports.EMOJI_NOT_FOUND;
|
|
390
|
+
continue;
|
|
391
|
+
}
|
|
392
|
+
const enumValues = resolveEnumValues(propDef, schema);
|
|
393
|
+
if (!enumValues) {
|
|
394
|
+
row[version] = exports.EMOJI_NOT_FOUND;
|
|
395
|
+
continue;
|
|
396
|
+
}
|
|
397
|
+
const enumExists = enumValues.includes(info.enumValue);
|
|
398
|
+
row[version] = enumExists ? exports.EMOJI_VISIBLE : exports.EMOJI_HIDDEN;
|
|
399
|
+
}
|
|
400
|
+
return row;
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* Generates a diff visibility table comparing expected vs actual
|
|
405
|
+
*/
|
|
406
|
+
function generateDiffVisibilityTable(validityInfos, versions, schemaResults, findDefinition) {
|
|
407
|
+
const expectedTable = generateExpectedVisibilityTable(validityInfos, versions);
|
|
408
|
+
const actualTable = generateActualVisibilityTable(validityInfos, versions, schemaResults, findDefinition);
|
|
409
|
+
return validityInfos.map((info, index) => {
|
|
410
|
+
const row = {
|
|
411
|
+
property: info.property,
|
|
412
|
+
since: info.since
|
|
413
|
+
};
|
|
414
|
+
for (const version of versions) {
|
|
415
|
+
const expected = expectedTable[index][version];
|
|
416
|
+
const actual = actualTable[index][version];
|
|
417
|
+
// Match if both are the same, or if actual is not found (❓) we consider it a mismatch
|
|
418
|
+
const isMatch = expected === actual;
|
|
419
|
+
row[version] = isMatch ? exports.EMOJI_MATCH : exports.EMOJI_DIFF;
|
|
420
|
+
}
|
|
421
|
+
return row;
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
// ============================================================================
|
|
425
|
+
// Helper Functions - Table Formatting
|
|
426
|
+
// ============================================================================
|
|
427
|
+
/**
|
|
428
|
+
* Formats visibility table as a markdown string for snapshot testing
|
|
429
|
+
*/
|
|
430
|
+
function formatVisibilityTableMarkdown(rows, versions) {
|
|
431
|
+
const lines = [];
|
|
432
|
+
// Calculate column widths
|
|
433
|
+
const propWidth = Math.max(26, ...rows.map((r) => r.property.length));
|
|
434
|
+
const sinceWidth = 7;
|
|
435
|
+
const versionCellWidth = 10;
|
|
436
|
+
// Helper functions for padding
|
|
437
|
+
const padEnd = (str, width) => str.padEnd(width);
|
|
438
|
+
const padCenterVersion = (str, width) => {
|
|
439
|
+
const padding = width - str.length;
|
|
440
|
+
const left = Math.floor(padding / 2);
|
|
441
|
+
return ' '.repeat(left) + str + ' '.repeat(padding - left);
|
|
442
|
+
};
|
|
443
|
+
const padCenterEmoji = (emoji) => ` ${emoji} `;
|
|
444
|
+
// Header
|
|
445
|
+
const headerCells = [
|
|
446
|
+
padEnd('Property', propWidth),
|
|
447
|
+
padEnd('Since', sinceWidth),
|
|
448
|
+
...versions.map((v) => padCenterVersion(v, versionCellWidth))
|
|
449
|
+
];
|
|
450
|
+
lines.push(`| ${headerCells.join(' | ')} |`);
|
|
451
|
+
// Separator
|
|
452
|
+
const sepCells = [
|
|
453
|
+
'-'.repeat(propWidth),
|
|
454
|
+
'-'.repeat(sinceWidth),
|
|
455
|
+
...versions.map(() => '-'.repeat(versionCellWidth))
|
|
456
|
+
];
|
|
457
|
+
lines.push(`| ${sepCells.join(' | ')} |`);
|
|
458
|
+
// Data rows
|
|
459
|
+
for (const row of rows) {
|
|
460
|
+
const cells = [
|
|
461
|
+
padEnd(row.property, propWidth),
|
|
462
|
+
padEnd(row.since, sinceWidth),
|
|
463
|
+
...versions.map((v) => padCenterEmoji(row[v]))
|
|
464
|
+
];
|
|
465
|
+
lines.push(`| ${cells.join(' | ')} |`);
|
|
466
|
+
}
|
|
467
|
+
// Legend
|
|
468
|
+
lines.push('');
|
|
469
|
+
lines.push(`Legend: ${exports.EMOJI_VISIBLE} = visible (version >= since), ${exports.EMOJI_HIDDEN} = hidden (version < since), ${exports.EMOJI_NOT_FOUND} = not found in schema`);
|
|
470
|
+
return '\n' + lines.map((line) => exports.INDENT + line).join('\n');
|
|
471
|
+
}
|
|
472
|
+
/**
|
|
473
|
+
* Formats diff table as a markdown string for report generation
|
|
474
|
+
*/
|
|
475
|
+
function formatDiffTableMarkdown(rows, versions) {
|
|
476
|
+
const lines = [];
|
|
477
|
+
// Calculate column widths
|
|
478
|
+
const propWidth = Math.max(26, ...rows.map((r) => r.property.length));
|
|
479
|
+
const sinceWidth = 7;
|
|
480
|
+
const versionCellWidth = 10;
|
|
481
|
+
// Helper functions for padding
|
|
482
|
+
const padEnd = (str, width) => str.padEnd(width);
|
|
483
|
+
const padCenterVersion = (str, width) => {
|
|
484
|
+
const padding = width - str.length;
|
|
485
|
+
const left = Math.floor(padding / 2);
|
|
486
|
+
return ' '.repeat(left) + str + ' '.repeat(padding - left);
|
|
487
|
+
};
|
|
488
|
+
const padCenterEmoji = (emoji) => ` ${emoji} `;
|
|
489
|
+
// Header
|
|
490
|
+
const headerCells = [
|
|
491
|
+
padEnd('Property', propWidth),
|
|
492
|
+
padEnd('Since', sinceWidth),
|
|
493
|
+
...versions.map((v) => padCenterVersion(v, versionCellWidth))
|
|
494
|
+
];
|
|
495
|
+
lines.push(`| ${headerCells.join(' | ')} |`);
|
|
496
|
+
// Separator
|
|
497
|
+
const sepCells = [
|
|
498
|
+
'-'.repeat(propWidth),
|
|
499
|
+
'-'.repeat(sinceWidth),
|
|
500
|
+
...versions.map(() => '-'.repeat(versionCellWidth))
|
|
501
|
+
];
|
|
502
|
+
lines.push(`| ${sepCells.join(' | ')} |`);
|
|
503
|
+
// Data rows
|
|
504
|
+
for (const row of rows) {
|
|
505
|
+
const cells = [
|
|
506
|
+
padEnd(row.property, propWidth),
|
|
507
|
+
padEnd(row.since, sinceWidth),
|
|
508
|
+
...versions.map((v) => padCenterEmoji(row[v]))
|
|
509
|
+
];
|
|
510
|
+
lines.push(`| ${cells.join(' | ')} |`);
|
|
511
|
+
}
|
|
512
|
+
// Legend
|
|
513
|
+
lines.push('');
|
|
514
|
+
lines.push(`Legend: ${exports.EMOJI_MATCH} = match (expected === actual), ${exports.EMOJI_DIFF} = mismatch (implementation gap)`);
|
|
515
|
+
return lines.join('\n');
|
|
516
|
+
}
|
|
517
|
+
/**
|
|
518
|
+
* Formats enum validity information as a markdown table for report generation
|
|
519
|
+
*/
|
|
520
|
+
function formatEnumValidityTableMarkdown(enumInfos, versions) {
|
|
521
|
+
if (enumInfos.length === 0) {
|
|
522
|
+
return 'No enum values with version requirements found.';
|
|
523
|
+
}
|
|
524
|
+
const lines = [];
|
|
525
|
+
// Calculate column widths
|
|
526
|
+
const propWidth = Math.max(30, ...enumInfos.map((e) => `${e.property}.${e.enumValue}`.length));
|
|
527
|
+
const sinceWidth = 7;
|
|
528
|
+
const versionCellWidth = 10;
|
|
529
|
+
// Helper functions for padding
|
|
530
|
+
const padEnd = (str, width) => str.padEnd(width);
|
|
531
|
+
const padCenterVersion = (str, width) => {
|
|
532
|
+
const padding = width - str.length;
|
|
533
|
+
const left = Math.floor(padding / 2);
|
|
534
|
+
return ' '.repeat(left) + str + ' '.repeat(padding - left);
|
|
535
|
+
};
|
|
536
|
+
const padCenterEmoji = (emoji) => ` ${emoji} `;
|
|
537
|
+
// Header
|
|
538
|
+
const headerCells = [
|
|
539
|
+
padEnd('Property.EnumValue', propWidth),
|
|
540
|
+
padEnd('Since', sinceWidth),
|
|
541
|
+
...versions.map((v) => padCenterVersion(v, versionCellWidth))
|
|
542
|
+
];
|
|
543
|
+
lines.push(`| ${headerCells.join(' | ')} |`);
|
|
544
|
+
// Separator
|
|
545
|
+
const sepCells = [
|
|
546
|
+
'-'.repeat(propWidth),
|
|
547
|
+
'-'.repeat(sinceWidth),
|
|
548
|
+
...versions.map(() => '-'.repeat(versionCellWidth))
|
|
549
|
+
];
|
|
550
|
+
lines.push(`| ${sepCells.join(' | ')} |`);
|
|
551
|
+
// Data rows - generate expected visibility based on since version
|
|
552
|
+
for (const info of enumInfos) {
|
|
553
|
+
const rowCells = [
|
|
554
|
+
padEnd(`${info.property}.${info.enumValue}`, propWidth),
|
|
555
|
+
padEnd(info.since, sinceWidth),
|
|
556
|
+
...versions.map((v) => {
|
|
557
|
+
const shouldBeVisible = compareVersionsExported(v, info.since) >= 0;
|
|
558
|
+
return padCenterEmoji(shouldBeVisible ? exports.EMOJI_VISIBLE : exports.EMOJI_HIDDEN);
|
|
559
|
+
})
|
|
560
|
+
];
|
|
561
|
+
lines.push(`| ${rowCells.join(' | ')} |`);
|
|
562
|
+
}
|
|
563
|
+
// Legend
|
|
564
|
+
lines.push('');
|
|
565
|
+
lines.push(`Legend: ${exports.EMOJI_VISIBLE} = enum value available, ${exports.EMOJI_HIDDEN} = enum value not available`);
|
|
566
|
+
return lines.join('\n');
|
|
567
|
+
}
|
|
568
|
+
/**
|
|
569
|
+
* Exported version comparison function for use in formatting functions
|
|
570
|
+
*/
|
|
571
|
+
function compareVersionsExported(a, b) {
|
|
572
|
+
// Handle 'latest' as a special case - it's always the highest version
|
|
573
|
+
if (a === exports.VERSION_LATEST && b === exports.VERSION_LATEST) {
|
|
574
|
+
return 0;
|
|
575
|
+
}
|
|
576
|
+
if (a === exports.VERSION_LATEST) {
|
|
577
|
+
return 1;
|
|
578
|
+
}
|
|
579
|
+
if (b === exports.VERSION_LATEST) {
|
|
580
|
+
return -1;
|
|
581
|
+
}
|
|
582
|
+
const aParts = a.split('.').map(Number);
|
|
583
|
+
const bParts = b.split('.').map(Number);
|
|
584
|
+
for (let i = 0; i < 3; i++) {
|
|
585
|
+
if ((aParts[i] || 0) !== (bParts[i] || 0)) {
|
|
586
|
+
return (aParts[i] || 0) - (bParts[i] || 0);
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
return 0;
|
|
590
|
+
}
|
|
591
|
+
// ============================================================================
|
|
592
|
+
// Helper Functions - Schema Generation
|
|
593
|
+
// ============================================================================
|
|
594
|
+
/**
|
|
595
|
+
* Generates an app schema with a specific minUI5Version
|
|
596
|
+
*/
|
|
597
|
+
async function generateSchemaWithVersion(genericSchema, schemaType, minUI5Version) {
|
|
598
|
+
const manifestTemp = JSON.parse(JSON.stringify(manifest_json_1.default));
|
|
599
|
+
manifestTemp['sap.ui5'].dependencies.minUI5Version = minUI5Version;
|
|
600
|
+
const projectRoot = (0, path_1.join)('test', 'test-projects', 'v4new');
|
|
601
|
+
const allAnnotationData = [
|
|
602
|
+
(0, utils_1.prepareFileData)((0, path_1.join)(projectRoot, 'webapp', 'localService', 'metadata.xml')),
|
|
603
|
+
(0, utils_1.prepareFileData)((0, path_1.join)(projectRoot, 'webapp', 'annotations', 'annotation.xml'))
|
|
604
|
+
];
|
|
605
|
+
const schemaParams = {
|
|
606
|
+
genericSchema,
|
|
607
|
+
contextPath: '/Products',
|
|
608
|
+
annotations: allAnnotationData,
|
|
609
|
+
manifest: manifestTemp
|
|
610
|
+
};
|
|
611
|
+
// Use type assertion to handle dynamic schema type
|
|
612
|
+
// The function only supports ListReport, ObjectPage, and AnalyticalListPage for v4
|
|
613
|
+
const v4Params = { [schemaType]: schemaParams };
|
|
614
|
+
return (0, api_1.generateSchema)({
|
|
615
|
+
[ux_specification_types_1.FioriElementsVersion.v4]: v4Params
|
|
616
|
+
});
|
|
617
|
+
}
|
|
618
|
+
/**
|
|
619
|
+
* Generates schemas for multiple UI5 versions
|
|
620
|
+
*/
|
|
621
|
+
async function generateSchemasForVersions(genericSchema, schemaType, versions) {
|
|
622
|
+
const results = new Map();
|
|
623
|
+
for (const version of versions) {
|
|
624
|
+
const schema = await generateSchemaWithVersion(genericSchema, schemaType, version);
|
|
625
|
+
results.set(version, schema);
|
|
626
|
+
}
|
|
627
|
+
return results;
|
|
628
|
+
}
|
|
629
|
+
// ============================================================================
|
|
630
|
+
// Public API
|
|
631
|
+
// ============================================================================
|
|
632
|
+
/**
|
|
633
|
+
* Gets validity properties for a class from a generic schema
|
|
634
|
+
*/
|
|
635
|
+
function getValidityProperties(genericSchema, classRef, schemaName) {
|
|
636
|
+
const schemaProps = getSchemaPropertyNames(genericSchema, schemaName || classRef.name);
|
|
637
|
+
return getValidityPropertiesFromClass(classRef, schemaProps);
|
|
638
|
+
}
|
|
639
|
+
/**
|
|
640
|
+
* Compares expected vs actual visibility and returns both tables for assertion
|
|
641
|
+
*/
|
|
642
|
+
function compareExpectedVsActual(validityInfos, versions, schemaResults, findDefinition) {
|
|
643
|
+
const expectedTable = generateExpectedVisibilityTable(validityInfos, versions);
|
|
644
|
+
const actualTable = generateActualVisibilityTable(validityInfos, versions, schemaResults, findDefinition);
|
|
645
|
+
return {
|
|
646
|
+
expected: formatVisibilityTableMarkdown(expectedTable, versions),
|
|
647
|
+
actual: formatVisibilityTableMarkdown(actualTable, versions)
|
|
648
|
+
};
|
|
649
|
+
}
|
|
650
|
+
/**
|
|
651
|
+
* Compares expected vs actual enum visibility and returns both tables for assertion
|
|
652
|
+
*/
|
|
653
|
+
function compareExpectedVsActualEnum(enumInfos, versions, schemaResults, findDefinition) {
|
|
654
|
+
const expectedTable = generateExpectedEnumVisibilityTable(enumInfos, versions);
|
|
655
|
+
const actualTable = generateActualEnumVisibilityTable(enumInfos, versions, schemaResults, findDefinition);
|
|
656
|
+
return {
|
|
657
|
+
expected: formatVisibilityTableMarkdown(expectedTable, versions),
|
|
658
|
+
actual: formatVisibilityTableMarkdown(actualTable, versions)
|
|
659
|
+
};
|
|
660
|
+
}
|
|
661
|
+
//# sourceMappingURL=validity-test-utils.js.map
|