@sap/ux-specification 1.96.105 → 1.96.107

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 (209) hide show
  1. package/CHANGELOG.md +61 -0
  2. package/dist/documentation/v2/v2-AnalyticalListPage.html +2 -2
  3. package/dist/documentation/v2/v2-ApplicationV2.html +2 -2
  4. package/dist/documentation/v2/v2-ListReport.html +2 -2
  5. package/dist/documentation/v2/v2-ListReportNew.html +2 -2
  6. package/dist/documentation/v2/v2-ObjectPage.html +2 -2
  7. package/dist/documentation/v2/v2-OverviewPage.html +2 -2
  8. package/dist/documentation/v4/v4-ApplicationV4.html +2 -2
  9. package/dist/documentation/v4/v4-BuildingBlocks.html +2 -2
  10. package/dist/documentation/v4/v4-FreestylePage.html +2 -2
  11. package/dist/documentation/v4/v4-ListReport.html +2 -2
  12. package/dist/documentation/v4/v4-ObjectPage.html +2 -2
  13. package/dist/index-min.js +278 -269
  14. package/dist/index-min.js.map +4 -4
  15. package/dist/schemas/v2/ListReportNewConfig.json +165 -7
  16. package/dist/schemas/v4/BuildingBlocksConfig.json +227 -1
  17. package/dist/specification/package.json +10 -10
  18. package/dist/specification/scripts/generate-validity-report.js +1 -1
  19. package/dist/specification/scripts/generate-validity-report.js.map +1 -1
  20. package/dist/specification/scripts/macros/corrections.d.ts +1 -0
  21. package/dist/specification/scripts/macros/corrections.d.ts.map +1 -1
  22. package/dist/specification/scripts/macros/corrections.js +124 -4
  23. package/dist/specification/scripts/macros/corrections.js.map +1 -1
  24. package/dist/specification/scripts/macros/schema.d.ts.map +1 -1
  25. package/dist/specification/scripts/macros/schema.js +36 -10
  26. package/dist/specification/scripts/macros/schema.js.map +1 -1
  27. package/dist/specification/scripts/schema/to-json-schema.js +1 -1
  28. package/dist/specification/scripts/schema/to-json-schema.js.map +1 -1
  29. package/dist/specification/src/api.d.ts.map +1 -1
  30. package/dist/specification/src/api.js +39 -3
  31. package/dist/specification/src/api.js.map +1 -1
  32. package/dist/specification/src/ftfs/ftfs.d.ts +8 -0
  33. package/dist/specification/src/ftfs/ftfs.d.ts.map +1 -1
  34. package/dist/specification/src/ftfs/ftfs.js +1 -0
  35. package/dist/specification/src/ftfs/ftfs.js.map +1 -1
  36. package/dist/specification/src/ftfs/index.d.ts +1 -1
  37. package/dist/specification/src/ftfs/index.d.ts.map +1 -1
  38. package/dist/specification/src/ftfs/index.js +2 -1
  39. package/dist/specification/src/ftfs/index.js.map +1 -1
  40. package/dist/specification/src/ftfs/parser/model/TreeModel.d.ts.map +1 -1
  41. package/dist/specification/src/ftfs/parser/model/TreeModel.js +3 -1
  42. package/dist/specification/src/ftfs/parser/model/TreeModel.js.map +1 -1
  43. package/dist/specification/src/i18n/i18n.d.ts.map +1 -1
  44. package/dist/specification/src/i18n/i18n.js +2 -1
  45. package/dist/specification/src/i18n/i18n.js.map +1 -1
  46. package/dist/specification/src/sync/common/decoration/Decorator.d.ts +91 -0
  47. package/dist/specification/src/sync/common/decoration/Decorator.d.ts.map +1 -0
  48. package/dist/specification/src/sync/common/decoration/Decorator.js +139 -0
  49. package/dist/specification/src/sync/common/decoration/Decorator.js.map +1 -0
  50. package/dist/specification/src/sync/common/decoration/condition-evaluator.d.ts +95 -0
  51. package/dist/specification/src/sync/common/decoration/condition-evaluator.d.ts.map +1 -0
  52. package/dist/specification/src/sync/common/decoration/condition-evaluator.js +210 -0
  53. package/dist/specification/src/sync/common/decoration/condition-evaluator.js.map +1 -0
  54. package/dist/specification/src/sync/common/decoration/decorator-paths.d.ts +5 -22
  55. package/dist/specification/src/sync/common/decoration/decorator-paths.d.ts.map +1 -1
  56. package/dist/specification/src/sync/common/decoration/decorator-paths.js.map +1 -1
  57. package/dist/specification/src/sync/common/decoration/decorators.d.ts +6 -48
  58. package/dist/specification/src/sync/common/decoration/decorators.d.ts.map +1 -1
  59. package/dist/specification/src/sync/common/decoration/decorators.js +26 -106
  60. package/dist/specification/src/sync/common/decoration/decorators.js.map +1 -1
  61. package/dist/specification/src/sync/common/decoration/index.d.ts +4 -0
  62. package/dist/specification/src/sync/common/decoration/index.d.ts.map +1 -1
  63. package/dist/specification/src/sync/common/decoration/index.js +4 -0
  64. package/dist/specification/src/sync/common/decoration/index.js.map +1 -1
  65. package/dist/specification/src/sync/common/decoration/interfaces.d.ts +38 -0
  66. package/dist/specification/src/sync/common/decoration/interfaces.d.ts.map +1 -0
  67. package/dist/specification/src/sync/common/decoration/interfaces.js +3 -0
  68. package/dist/specification/src/sync/common/decoration/interfaces.js.map +1 -0
  69. package/dist/specification/src/sync/common/decoration/steps/Enums.d.ts +18 -0
  70. package/dist/specification/src/sync/common/decoration/steps/Enums.d.ts.map +1 -0
  71. package/dist/specification/src/sync/common/decoration/steps/Enums.js +50 -0
  72. package/dist/specification/src/sync/common/decoration/steps/Enums.js.map +1 -0
  73. package/dist/specification/src/sync/common/decoration/steps/Hide.d.ts +18 -0
  74. package/dist/specification/src/sync/common/decoration/steps/Hide.d.ts.map +1 -0
  75. package/dist/specification/src/sync/common/decoration/steps/Hide.js +46 -0
  76. package/dist/specification/src/sync/common/decoration/steps/Hide.js.map +1 -0
  77. package/dist/specification/src/sync/common/decoration/steps/Message.d.ts +26 -0
  78. package/dist/specification/src/sync/common/decoration/steps/Message.d.ts.map +1 -0
  79. package/dist/specification/src/sync/common/decoration/steps/Message.js +77 -0
  80. package/dist/specification/src/sync/common/decoration/steps/Message.js.map +1 -0
  81. package/dist/specification/src/sync/common/decoration/steps/Readonly.d.ts +18 -0
  82. package/dist/specification/src/sync/common/decoration/steps/Readonly.d.ts.map +1 -0
  83. package/dist/specification/src/sync/common/decoration/steps/Readonly.js +43 -0
  84. package/dist/specification/src/sync/common/decoration/steps/Readonly.js.map +1 -0
  85. package/dist/specification/src/sync/common/decoration/steps/Validity.d.ts +18 -0
  86. package/dist/specification/src/sync/common/decoration/steps/Validity.d.ts.map +1 -0
  87. package/dist/specification/src/sync/common/decoration/steps/Validity.js +68 -0
  88. package/dist/specification/src/sync/common/decoration/steps/Validity.js.map +1 -0
  89. package/dist/specification/src/sync/common/decoration/steps/enum-utils.d.ts +19 -0
  90. package/dist/specification/src/sync/common/decoration/steps/enum-utils.d.ts.map +1 -0
  91. package/dist/specification/src/sync/common/decoration/steps/enum-utils.js +48 -0
  92. package/dist/specification/src/sync/common/decoration/steps/enum-utils.js.map +1 -0
  93. package/dist/specification/src/sync/common/decoration/steps/index.d.ts +6 -0
  94. package/dist/specification/src/sync/common/decoration/steps/index.d.ts.map +1 -0
  95. package/dist/specification/src/sync/common/decoration/steps/index.js +14 -0
  96. package/dist/specification/src/sync/common/decoration/steps/index.js.map +1 -0
  97. package/dist/specification/src/sync/common/i18n.json +18 -0
  98. package/dist/specification/src/sync/v2/export/controls/Fragment.d.ts +4 -5
  99. package/dist/specification/src/sync/v2/export/controls/Fragment.d.ts.map +1 -1
  100. package/dist/specification/src/sync/v2/export/controls/Fragment.js +29 -20
  101. package/dist/specification/src/sync/v2/export/controls/Fragment.js.map +1 -1
  102. package/dist/specification/src/sync/v2/export/export.d.ts.map +1 -1
  103. package/dist/specification/src/sync/v2/export/export.js +3 -2
  104. package/dist/specification/src/sync/v2/export/export.js.map +1 -1
  105. package/dist/specification/src/sync/v2/export/exportPage.d.ts.map +1 -1
  106. package/dist/specification/src/sync/v2/export/exportPage.js +48 -19
  107. package/dist/specification/src/sync/v2/export/exportPage.js.map +1 -1
  108. package/dist/specification/src/sync/v2/export/exportPageGeneric.d.ts +2 -0
  109. package/dist/specification/src/sync/v2/export/exportPageGeneric.d.ts.map +1 -1
  110. package/dist/specification/src/sync/v2/export/exportPageGeneric.js +17 -6
  111. package/dist/specification/src/sync/v2/export/exportPageGeneric.js.map +1 -1
  112. package/dist/specification/src/sync/v2/export/view-controller-generator.d.ts +54 -6
  113. package/dist/specification/src/sync/v2/export/view-controller-generator.d.ts.map +1 -1
  114. package/dist/specification/src/sync/v2/export/view-controller-generator.js +106 -12
  115. package/dist/specification/src/sync/v2/export/view-controller-generator.js.map +1 -1
  116. package/dist/specification/src/sync/v2/generate/analyticalListReport.js +7 -7
  117. package/dist/specification/src/sync/v2/generate/analyticalListReport.js.map +1 -1
  118. package/dist/specification/src/sync/v2/generate/objectPage.d.ts.map +1 -1
  119. package/dist/specification/src/sync/v2/generate/objectPage.js +56 -2
  120. package/dist/specification/src/sync/v2/generate/objectPage.js.map +1 -1
  121. package/dist/specification/src/sync/v2/generate/schemaAdaptation.js +2 -2
  122. package/dist/specification/src/sync/v2/generate/schemaAdaptation.js.map +1 -1
  123. package/dist/specification/src/sync/v2/genericSchemaHandling/controls/FilterBar.js +4 -4
  124. package/dist/specification/src/sync/v2/genericSchemaHandling/controls/MultiTable.js +3 -3
  125. package/dist/specification/src/sync/v2/genericSchemaHandling/controls/MultiTable.js.map +1 -1
  126. package/dist/specification/src/sync/v2/genericSchemaHandling/controls/Table.d.ts +57 -2
  127. package/dist/specification/src/sync/v2/genericSchemaHandling/controls/Table.d.ts.map +1 -1
  128. package/dist/specification/src/sync/v2/genericSchemaHandling/controls/Table.js +567 -7
  129. package/dist/specification/src/sync/v2/genericSchemaHandling/controls/Table.js.map +1 -1
  130. package/dist/specification/src/sync/v2/genericSchemaHandling/pages/pageAccess.d.ts.map +1 -1
  131. package/dist/specification/src/sync/v2/genericSchemaHandling/pages/pageAccess.js +29 -6
  132. package/dist/specification/src/sync/v2/genericSchemaHandling/pages/pageAccess.js.map +1 -1
  133. package/dist/specification/src/sync/v2/types.d.ts +2 -0
  134. package/dist/specification/src/sync/v2/types.d.ts.map +1 -1
  135. package/dist/specification/src/sync/v2/types.js.map +1 -1
  136. package/dist/specification/src/sync/v2/utils.d.ts +25 -0
  137. package/dist/specification/src/sync/v2/utils.d.ts.map +1 -1
  138. package/dist/specification/src/sync/v2/utils.js +28 -4
  139. package/dist/specification/src/sync/v2/utils.js.map +1 -1
  140. package/dist/specification/src/sync/v4/application.d.ts +11 -0
  141. package/dist/specification/src/sync/v4/application.d.ts.map +1 -1
  142. package/dist/specification/src/sync/v4/application.js +16 -1
  143. package/dist/specification/src/sync/v4/application.js.map +1 -1
  144. package/dist/specification/src/sync/v4/export/controls/ToolBarAction.d.ts +3 -1
  145. package/dist/specification/src/sync/v4/export/controls/ToolBarAction.d.ts.map +1 -1
  146. package/dist/specification/src/sync/v4/export/controls/ToolBarAction.js +10 -7
  147. package/dist/specification/src/sync/v4/export/controls/ToolBarAction.js.map +1 -1
  148. package/dist/specification/src/sync/v4/export/fpmCustomPage.d.ts +1 -0
  149. package/dist/specification/src/sync/v4/export/fpmCustomPage.d.ts.map +1 -1
  150. package/dist/specification/src/sync/v4/export/fpmCustomPage.js +212 -46
  151. package/dist/specification/src/sync/v4/export/fpmCustomPage.js.map +1 -1
  152. package/dist/specification/src/sync/v4/generate/fpm-custom-page/annotations.d.ts +13 -0
  153. package/dist/specification/src/sync/v4/generate/fpm-custom-page/annotations.d.ts.map +1 -1
  154. package/dist/specification/src/sync/v4/generate/fpm-custom-page/annotations.js +93 -13
  155. package/dist/specification/src/sync/v4/generate/fpm-custom-page/annotations.js.map +1 -1
  156. package/dist/specification/src/sync/v4/generate/fpm-custom-page/extensions.d.ts.map +1 -1
  157. package/dist/specification/src/sync/v4/generate/fpm-custom-page/extensions.js +4 -3
  158. package/dist/specification/src/sync/v4/generate/fpm-custom-page/extensions.js.map +1 -1
  159. package/dist/specification/src/sync/v4/generate/fpm-custom-page/generator.d.ts.map +1 -1
  160. package/dist/specification/src/sync/v4/generate/fpm-custom-page/generator.js +32 -28
  161. package/dist/specification/src/sync/v4/generate/fpm-custom-page/generator.js.map +1 -1
  162. package/dist/specification/src/sync/v4/generate/fpm-custom-page/utils.d.ts.map +1 -1
  163. package/dist/specification/src/sync/v4/generate/fpm-custom-page/utils.js +12 -3
  164. package/dist/specification/src/sync/v4/generate/fpm-custom-page/utils.js.map +1 -1
  165. package/dist/specification/src/sync/v4/generate/objectPage.js +17 -23
  166. package/dist/specification/src/sync/v4/generate/objectPage.js.map +1 -1
  167. package/dist/specification/src/sync/v4/import/pages/fpmCustomPage.d.ts.map +1 -1
  168. package/dist/specification/src/sync/v4/import/pages/fpmCustomPage.js +20 -0
  169. package/dist/specification/src/sync/v4/import/pages/fpmCustomPage.js.map +1 -1
  170. package/dist/specification/src/sync/v4/sync-rules/App.d.ts +2 -4
  171. package/dist/specification/src/sync/v4/sync-rules/App.d.ts.map +1 -1
  172. package/dist/specification/src/sync/v4/sync-rules/App.js +2 -1
  173. package/dist/specification/src/sync/v4/sync-rules/App.js.map +1 -1
  174. package/dist/specification/src/sync/v4/sync-rules/AppSchema.d.ts +2 -1
  175. package/dist/specification/src/sync/v4/sync-rules/AppSchema.d.ts.map +1 -1
  176. package/dist/specification/src/sync/v4/sync-rules/AppSchema.js +3 -1
  177. package/dist/specification/src/sync/v4/sync-rules/AppSchema.js.map +1 -1
  178. package/dist/specification/src/sync/v4/sync-rules/DecoratorClass.d.ts +119 -127
  179. package/dist/specification/src/sync/v4/sync-rules/DecoratorClass.d.ts.map +1 -1
  180. package/dist/specification/src/sync/v4/sync-rules/DecoratorClass.js +168 -168
  181. package/dist/specification/src/sync/v4/sync-rules/DecoratorClass.js.map +1 -1
  182. package/dist/specification/src/sync/v4/sync-rules/Page.d.ts +5 -0
  183. package/dist/specification/src/sync/v4/sync-rules/Page.d.ts.map +1 -1
  184. package/dist/specification/src/sync/v4/sync-rules/Page.js.map +1 -1
  185. package/dist/specification/src/sync/v4/utils/macros.d.ts +19 -0
  186. package/dist/specification/src/sync/v4/utils/macros.d.ts.map +1 -1
  187. package/dist/specification/src/sync/v4/utils/macros.js +34 -0
  188. package/dist/specification/src/sync/v4/utils/macros.js.map +1 -1
  189. package/dist/specification/test/test-utils/utils.d.ts.map +1 -1
  190. package/dist/specification/test/test-utils/utils.js +4 -0
  191. package/dist/specification/test/test-utils/utils.js.map +1 -1
  192. package/dist/specification/test/unit/decorators/validity-test-utils.d.ts +66 -197
  193. package/dist/specification/test/unit/decorators/validity-test-utils.d.ts.map +1 -1
  194. package/dist/specification/test/unit/decorators/validity-test-utils.js +378 -280
  195. package/dist/specification/test/unit/decorators/validity-test-utils.js.map +1 -1
  196. package/dist/templates/AnalyticalTableColumnsExtension.xml +3 -3
  197. package/dist/templates/GridTableColumnsExtension.xml +3 -3
  198. package/dist/templates/ResponsiveTableColumnsExtension.xml +2 -2
  199. package/dist/templates/TreeTableColumnsExtension.xml +4 -4
  200. package/dist/templates/fragment.xml +3 -3
  201. package/dist/templates/view.xml +3 -3
  202. package/dist/types/src/apiTypes.d.ts +15 -5
  203. package/dist/types/src/apiTypes.d.ts.map +1 -1
  204. package/dist/types/src/apiTypes.js +1 -0
  205. package/dist/types/src/apiTypes.js.map +1 -1
  206. package/dist/types/src/common/types.d.ts +1 -0
  207. package/dist/types/src/common/types.d.ts.map +1 -1
  208. package/dist/types/src/common/types.js.map +1 -1
  209. package/package.json +11 -11
@@ -12,23 +12,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.EMOJI_MATCH = exports.EMOJI_DIFF = exports.getPropertiesWithValidity = exports.VERSION_LATEST = exports.SchemaResults = exports.EMOJI_NOT_FOUND = exports.EMOJI_HIDDEN = exports.EMOJI_VISIBLE = void 0;
16
- exports.resolveDefinition = resolveDefinition;
15
+ exports.getPropertiesWithValidity = exports.SchemaResults = exports.INDENT = exports.VERSION_LATEST = exports.EMOJI_DIFF = exports.EMOJI_MATCH = exports.EMOJI_NOT_FOUND = exports.EMOJI_HIDDEN = exports.EMOJI_VISIBLE = void 0;
17
16
  exports.findTableDefinition = findTableDefinition;
18
17
  exports.findDefinitionByName = findDefinitionByName;
19
- exports.getSchemaPropertyNames = getSchemaPropertyNames;
20
- exports.propertyExists = propertyExists;
21
- exports.isPropertyHidden = isPropertyHidden;
22
- exports.compareVersions = compareVersions;
23
- exports.getValidityPropertiesFromClass = getValidityPropertiesFromClass;
18
+ exports.getEnumValidityFromClass = getEnumValidityFromClass;
24
19
  exports.generateExpectedVisibilityTable = generateExpectedVisibilityTable;
25
20
  exports.generateActualVisibilityTable = generateActualVisibilityTable;
21
+ exports.generateDiffVisibilityTable = generateDiffVisibilityTable;
26
22
  exports.formatVisibilityTableMarkdown = formatVisibilityTableMarkdown;
27
- exports.generateSchemaWithVersion = generateSchemaWithVersion;
23
+ exports.formatDiffTableMarkdown = formatDiffTableMarkdown;
24
+ exports.formatEnumValidityTableMarkdown = formatEnumValidityTableMarkdown;
28
25
  exports.generateSchemasForVersions = generateSchemasForVersions;
29
26
  exports.getValidityProperties = getValidityProperties;
30
- exports.generateDiffVisibilityTable = generateDiffVisibilityTable;
31
- exports.formatDiffTableMarkdown = formatDiffTableMarkdown;
27
+ exports.compareExpectedVsActual = compareExpectedVsActual;
28
+ exports.compareExpectedVsActualEnum = compareExpectedVsActualEnum;
32
29
  const ux_specification_types_1 = require("@sap/ux-specification-types");
33
30
  const api_1 = require("../../../src/api");
34
31
  const path_1 = require("path");
@@ -44,30 +41,19 @@ exports.EMOJI_VISIBLE = '✅';
44
41
  exports.EMOJI_HIDDEN = '🚫';
45
42
  /** Emoji indicator for property not found in schema */
46
43
  exports.EMOJI_NOT_FOUND = '❓';
47
- // ============================================================================
48
- // Types
49
- // ============================================================================
50
- /**
51
- * Enum to specify which type of visibility table to generate
52
- */
53
- var SchemaResults;
54
- (function (SchemaResults) {
55
- /** Generate expected visibility based on @validity decorator metadata */
56
- SchemaResults["Expected"] = "expected";
57
- /** Generate actual visibility from generated schemas */
58
- SchemaResults["Actual"] = "actual";
59
- })(SchemaResults || (exports.SchemaResults = SchemaResults = {}));
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 = ' ';
60
52
  // ============================================================================
61
53
  // Helper Functions - Schema Operations
62
54
  // ============================================================================
63
55
  /**
64
56
  * Resolves a definition by following $ref chains in the schema
65
- *
66
- * @param schema - The JSON schema containing definitions
67
- * @param definitionName - The name of the definition to resolve
68
- * @returns The resolved definition, or undefined if not found
69
- * @example
70
- * const tableDef = resolveDefinition(schema, 'Table');
71
57
  */
72
58
  function resolveDefinition(schema, definitionName) {
73
59
  let def = schema.definitions?.[definitionName];
@@ -87,12 +73,6 @@ function resolveDefinition(schema, definitionName) {
87
73
  }
88
74
  /**
89
75
  * Finds the definition containing table properties by searching common patterns
90
- *
91
- * Searches for definitions with names like 'TableSPV', 'LRTableView', 'Table',
92
- * or any definition containing key table properties like 'condensedTableLayout'.
93
- *
94
- * @param schema - The JSON schema to search
95
- * @returns The table definition, or undefined if not found
96
76
  */
97
77
  function findTableDefinition(schema) {
98
78
  const definitions = schema.definitions || {};
@@ -119,12 +99,6 @@ function findTableDefinition(schema) {
119
99
  }
120
100
  /**
121
101
  * Creates a definition finder function for a specific definition name
122
- *
123
- * @param definitionName - The name of the definition to find
124
- * @returns A function that finds the definition in a given schema
125
- * @example
126
- * const finder = findDefinitionByName('CustomHeaderAction');
127
- * const def = finder(schema);
128
102
  */
129
103
  function findDefinitionByName(definitionName) {
130
104
  return (schema) => {
@@ -134,59 +108,16 @@ function findDefinitionByName(definitionName) {
134
108
  }
135
109
  /**
136
110
  * Gets all property names from a schema definition
137
- *
138
- * @param schema - The JSON schema containing definitions
139
- * @param definitionName - The name of the definition to get properties from
140
- * @returns Array of property names, or empty array if definition not found
141
111
  */
142
112
  function getSchemaPropertyNames(schema, definitionName) {
143
113
  const def = resolveDefinition(schema, definitionName);
144
114
  return def?.properties ? Object.keys(def.properties) : [];
145
115
  }
146
- /**
147
- * Checks if a property exists in a schema definition
148
- *
149
- * @param schema - The JSON schema containing definitions
150
- * @param definitionName - The name of the definition to check
151
- * @param propertyName - The name of the property to check for
152
- * @returns True if the property exists, false otherwise
153
- */
154
- function propertyExists(schema, definitionName, propertyName) {
155
- const def = resolveDefinition(schema, definitionName);
156
- return def?.properties?.[propertyName] !== undefined;
157
- }
158
- /**
159
- * Checks if a property is marked as hidden in a schema definition
160
- *
161
- * @param schema - The JSON schema containing definitions
162
- * @param definitionName - The name of the definition to check
163
- * @param propertyName - The name of the property to check
164
- * @returns True if hidden, false if visible, undefined if property not found
165
- */
166
- function isPropertyHidden(schema, definitionName, propertyName) {
167
- const def = resolveDefinition(schema, definitionName);
168
- return def?.properties?.[propertyName]?.[ux_specification_types_1.SchemaTag.hidden];
169
- }
170
116
  // ============================================================================
171
117
  // Helper Functions - Version Comparison
172
118
  // ============================================================================
173
- /** Special version string representing the latest/newest version */
174
- exports.VERSION_LATEST = 'latest';
175
119
  /**
176
120
  * Compares two semantic version strings
177
- *
178
- * Handles the special 'latest' version which is always considered
179
- * greater than any other version.
180
- *
181
- * @param a - First version string (e.g., '1.84.0' or 'latest')
182
- * @param b - Second version string (e.g., '1.96.0' or 'latest')
183
- * @returns Negative if a < b, positive if a > b, zero if equal
184
- * @example
185
- * compareVersions('1.84.0', '1.96.0') // returns negative
186
- * compareVersions('1.96.0', '1.84.0') // returns positive
187
- * compareVersions('1.84.0', '1.84.0') // returns 0
188
- * compareVersions('1.142.0', 'latest') // returns negative
189
- * compareVersions('latest', '1.84.0') // returns positive
190
121
  */
191
122
  function compareVersions(a, b) {
192
123
  // Handle 'latest' as a special case - it's always the highest version
@@ -213,20 +144,8 @@ function compareVersions(a, b) {
213
144
  // ============================================================================
214
145
  /**
215
146
  * Extracts all properties from a class, including those with @validity decorator
216
- *
217
- * Walks the prototype chain to find all properties, then checks each
218
- * for validity metadata. Properties without @validity are marked with since: '-'.
219
- * Results are sorted by version (ascending), then alphabetically by property name.
220
- *
221
- * @param ClassConstructor - The class constructor to inspect
222
- * @param schemaPropertyNames - Optional list of additional property names to check
223
- * @param onlyWithValidity - If true, only return properties with @validity decorator (default: false)
224
- * @returns Array of ValidityInfo objects sorted by version then name
225
- * @example
226
- * const validityProps = getValidityPropertiesFromClass(TableSettings, ['type', 'selectAll']);
227
- * // Returns: [{ property: 'enableOnSelect', since: '-' }, { property: 'type', since: '1.84.0' }, ...]
228
147
  */
229
- function getValidityPropertiesFromClass(ClassConstructor, schemaPropertyNames = [], onlyWithValidity = false) {
148
+ function getValidityPropertiesFromClass(ClassConstructor, schemaPropertyNames = []) {
230
149
  const prototype = ClassConstructor.prototype;
231
150
  const result = [];
232
151
  const candidateProperties = new Set();
@@ -243,18 +162,21 @@ function getValidityPropertiesFromClass(ClassConstructor, schemaPropertyNames =
243
162
  // Add schema property names as candidates
244
163
  schemaPropertyNames.forEach((p) => candidateProperties.add(p));
245
164
  for (const property of candidateProperties) {
246
- const validity = (0, decorators_1.getValidityMetadata)(prototype, property);
165
+ const validity = Reflect.getMetadata(decorators_1.metadataKeys.validity, prototype, property);
247
166
  if (validity?.since) {
248
167
  result.push({ property, since: validity.since });
249
168
  }
250
- else if (!onlyWithValidity && schemaPropertyNames.includes(property)) {
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)) {
251
174
  // Include properties without @validity if they exist in schema
252
175
  result.push({ property, since: '-' });
253
176
  }
254
177
  }
255
178
  // Sort: properties without version ('-') first, then by version, then alphabetically
256
179
  return result.sort((a, b) => {
257
- // '-' (no version) comes first
258
180
  if (a.since === '-' && b.since !== '-') {
259
181
  return -1;
260
182
  }
@@ -271,19 +193,91 @@ function getValidityPropertiesFromClass(ClassConstructor, schemaPropertyNames =
271
193
  return a.property.localeCompare(b.property);
272
194
  });
273
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 property of testProperties) {
232
+ if (!properties.includes(property)) {
233
+ const validity = Reflect.getMetadata(decorators_1.metadataKeys.validity, prototype, property);
234
+ if (validity?.enum) {
235
+ properties.push(property);
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 = Reflect.getMetadata(decorators_1.metadataKeys.validity, 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
+ }
274
276
  // ============================================================================
275
- // Helper Functions - Table Formatting
277
+ // Helper Functions - Table Generation
276
278
  // ============================================================================
277
279
  /**
278
280
  * Generates expected visibility table based on @validity decorator metadata
279
- *
280
- * For each property, determines if it should be visible in each version
281
- * based on comparing the version against the property's 'since' value.
282
- * Properties with since: '-' (no @validity) are always visible.
283
- *
284
- * @param validityInfos - Array of properties with their validity info
285
- * @param versions - Array of version strings to generate columns for
286
- * @returns Array of rows with visibility status for each version
287
281
  */
288
282
  function generateExpectedVisibilityTable(validityInfos, versions) {
289
283
  return validityInfos.map((info) => {
@@ -300,21 +294,6 @@ function generateExpectedVisibilityTable(validityInfos, versions) {
300
294
  }
301
295
  /**
302
296
  * Generates actual visibility table from generated schemas
303
- *
304
- * For each property and version, checks the actual generated schema
305
- * to determine if the property is visible (not hidden).
306
- *
307
- * @param validityInfos - Array of properties with their validity info
308
- * @param versions - Array of version strings to check
309
- * @param schemaResults - Map of version strings to generated schemas
310
- * @param findDefinition - Function to locate the definition within each schema
311
- * @returns Array of rows with actual visibility status for each version
312
- * @remarks
313
- * Status symbols:
314
- * - ✅ = property exists and is visible
315
- * - 🚫 = property exists but is hidden
316
- * - ? = schema or definition not found
317
- * - - = property not found in definition
318
297
  */
319
298
  function generateActualVisibilityTable(validityInfos, versions, schemaResults, findDefinition) {
320
299
  return validityInfos.map((info) => {
@@ -344,52 +323,137 @@ function generateActualVisibilityTable(validityInfos, versions, schemaResults, f
344
323
  return row;
345
324
  });
346
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
+ // ============================================================================
347
427
  /**
348
428
  * Formats visibility table as a markdown string for snapshot testing
349
- *
350
- * Generates a properly aligned markdown table with:
351
- * - Header row with Property, Since, and version columns
352
- * - Separator row
353
- * - Data rows with centered emoji indicators
354
- * - Legend explaining the emoji meanings
355
- *
356
- * @param rows - Array of visibility rows to format
357
- * @param versions - Array of version strings for column headers
358
- * @returns Formatted markdown table string
359
- * @example
360
- * ```
361
- * | Property | Since | 1.84.0 | 1.96.0 |
362
- * | -------- | ------ | ------ | ------ |
363
- * | type | 1.84.0 | ✅ | ✅ |
364
- *
365
- * Legend: ✅ = visible, 🚫 = hidden
366
- * ```
367
429
  */
368
430
  function formatVisibilityTableMarkdown(rows, versions) {
369
431
  const lines = [];
370
432
  // Calculate column widths
371
433
  const propWidth = Math.max(26, ...rows.map((r) => r.property.length));
372
434
  const sinceWidth = 7;
373
- const versionWidth = 9;
435
+ const versionCellWidth = 9;
374
436
  // Helper functions for padding
375
437
  const padEnd = (str, width) => str.padEnd(width);
376
- const padCenter = (str, width) => {
438
+ const padCenterVersion = (str, width) => {
377
439
  const padding = width - str.length;
378
440
  const left = Math.floor(padding / 2);
379
441
  return ' '.repeat(left) + str + ' '.repeat(padding - left);
380
442
  };
381
- // Emoji centering - emojis are 1 char but display as 2 wide
382
- // Use fixed padding for consistent appearance: " X " (3 spaces + emoji + 4 spaces = 9 width visually)
383
443
  const padCenterEmoji = (emoji) => ` ${emoji} `;
384
444
  // Header
385
445
  const headerCells = [
386
446
  padEnd('Property', propWidth),
387
447
  padEnd('Since', sinceWidth),
388
- ...versions.map((v) => padCenter(v, versionWidth))
448
+ ...versions.map((v) => padCenterVersion(v, versionCellWidth))
389
449
  ];
390
450
  lines.push(`| ${headerCells.join(' | ')} |`);
391
451
  // Separator
392
- const sepCells = ['-'.repeat(propWidth), '-'.repeat(sinceWidth), ...versions.map(() => '-'.repeat(versionWidth))];
452
+ const sepCells = [
453
+ '-'.repeat(propWidth),
454
+ '-'.repeat(sinceWidth),
455
+ ...versions.map(() => '-'.repeat(versionCellWidth))
456
+ ];
393
457
  lines.push(`| ${sepCells.join(' | ')} |`);
394
458
  // Data rows
395
459
  for (const row of rows) {
@@ -405,20 +469,132 @@ function formatVisibilityTableMarkdown(rows, versions) {
405
469
  lines.push(`Legend: ${exports.EMOJI_VISIBLE} = visible (version >= since), ${exports.EMOJI_HIDDEN} = hidden (version < since), ${exports.EMOJI_NOT_FOUND} = not found in schema`);
406
470
  return lines.join('\n');
407
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 = 9;
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, ${exports.EMOJI_DIFF} = mismatch`);
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
+ }
408
591
  // ============================================================================
409
592
  // Helper Functions - Schema Generation
410
593
  // ============================================================================
411
594
  /**
412
595
  * Generates an app schema with a specific minUI5Version
413
- *
414
- * Creates a schema for the v4new test project with the specified
415
- * UI5 version, using the provided generic schema as base.
416
- *
417
- * @param genericSchema - The generic schema to use as base
418
- * @param minUI5Version - The minimum UI5 version to set (e.g., '1.84.0')
419
- * @returns The generated app schema
420
596
  */
421
- async function generateSchemaWithVersion(genericSchema, minUI5Version) {
597
+ async function generateSchemaWithVersion(genericSchema, schemaType, minUI5Version) {
422
598
  const manifestTemp = JSON.parse(JSON.stringify(manifest_json_1.default));
423
599
  manifestTemp['sap.ui5'].dependencies.minUI5Version = minUI5Version;
424
600
  const projectRoot = (0, path_1.join)('test', 'test-projects', 'v4new');
@@ -426,158 +602,80 @@ async function generateSchemaWithVersion(genericSchema, minUI5Version) {
426
602
  (0, utils_1.prepareFileData)((0, path_1.join)(projectRoot, 'webapp', 'localService', 'metadata.xml')),
427
603
  (0, utils_1.prepareFileData)((0, path_1.join)(projectRoot, 'webapp', 'annotations', 'annotation.xml'))
428
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 };
429
614
  return (0, api_1.generateSchema)({
430
- [ux_specification_types_1.FioriElementsVersion.v4]: {
431
- [ux_specification_types_1.SchemaType.ListReport]: {
432
- genericSchema,
433
- contextPath: '/Products',
434
- annotations: allAnnotationData,
435
- manifest: manifestTemp
436
- }
437
- }
615
+ [ux_specification_types_1.FioriElementsVersion.v4]: v4Params
438
616
  });
439
617
  }
440
618
  /**
441
619
  * Generates schemas for multiple UI5 versions
442
- *
443
- * @param genericSchema - The generic schema to use as base for all versions
444
- * @param versions - Array of version strings to generate schemas for
445
- * @returns Map of version string to generated schema
446
- * @example
447
- * const schemas = await generateSchemasForVersions(genericSchema, ['1.84.0', '1.96.0']);
448
- * const schema84 = schemas.get('1.84.0');
449
620
  */
450
- async function generateSchemasForVersions(genericSchema, versions) {
621
+ async function generateSchemasForVersions(genericSchema, schemaType, versions) {
451
622
  const results = new Map();
452
623
  for (const version of versions) {
453
- const schema = await generateSchemaWithVersion(genericSchema, version);
624
+ const schema = await generateSchemaWithVersion(genericSchema, schemaType, version);
454
625
  results.set(version, schema);
455
626
  }
456
627
  return results;
457
628
  }
629
+ // ============================================================================
630
+ // Public API
631
+ // ============================================================================
458
632
  /**
459
633
  * Gets validity properties for a class from a generic schema
460
- *
461
- * Combines schema property names with validity decorator metadata
462
- * to get complete validity information for testing.
463
- *
464
- * @param genericSchema - The generic schema containing the definition
465
- * @param classRef - The class constructor to extract validity metadata from
466
- * @param schemaName - Optional schema definition name (defaults to class name)
467
- * @returns Array of ValidityInfo objects
468
634
  */
469
635
  function getValidityProperties(genericSchema, classRef, schemaName) {
470
636
  const schemaProps = getSchemaPropertyNames(genericSchema, schemaName || classRef.name);
471
- const validityProperties = getValidityPropertiesFromClass(classRef, schemaProps);
472
- return validityProperties;
637
+ return getValidityPropertiesFromClass(classRef, schemaProps);
473
638
  }
474
639
  /**
475
- * Generates a markdown visibility table for a decorated class
476
- *
477
- * @param config - Configuration object with classRef and optional schemaName
478
- * @param config.classRef - The class constructor containing @validity decorators
479
- * @param config.schemaName - Optional schema definition name (defaults to class name)
480
- * @param schemaType - Whether to generate expected or actual visibility
481
- * @param context - Test context containing genericSchema, versions, and schemaResults
482
- * @returns Formatted markdown table string
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
483
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
+ // ============================================================================
662
+ // Backward-compatible API
663
+ // ============================================================================
664
+ var SchemaResults;
665
+ (function (SchemaResults) {
666
+ SchemaResults["Expected"] = "expected";
667
+ SchemaResults["Actual"] = "actual";
668
+ })(SchemaResults || (exports.SchemaResults = SchemaResults = {}));
484
669
  const getPropertiesWithValidity = ({ classRef, schemaName }, schemaType, { genericSchema, versions, schemaResults }) => {
485
670
  const validityProperties = getValidityProperties(genericSchema, classRef, schemaName);
486
671
  let table;
487
672
  if (schemaType === SchemaResults.Expected) {
488
673
  table = generateExpectedVisibilityTable(validityProperties, versions);
489
674
  }
490
- else if (schemaType === SchemaResults.Actual) {
675
+ else {
491
676
  table = generateActualVisibilityTable(validityProperties, versions, schemaResults, findDefinitionByName(schemaName || classRef.name));
492
677
  }
493
- const tableMarkdown = formatVisibilityTableMarkdown(table, versions);
494
- return tableMarkdown;
678
+ return formatVisibilityTableMarkdown(table, versions);
495
679
  };
496
680
  exports.getPropertiesWithValidity = getPropertiesWithValidity;
497
- /** Emoji indicator for a difference between expected and actual */
498
- exports.EMOJI_DIFF = '⚠️';
499
- /** Emoji indicator for match between expected and actual */
500
- exports.EMOJI_MATCH = '✅';
501
- /**
502
- * Generates a diff table comparing expected vs actual visibility
503
- *
504
- * For each property and version, compares expected (from @validity metadata)
505
- * vs actual (from generated schema) and highlights differences.
506
- *
507
- * @param validityInfos - Array of properties with their validity info
508
- * @param versions - Array of version strings to check
509
- * @param schemaResults - Map of version strings to generated schemas
510
- * @param findDefinition - Function to locate the definition within each schema
511
- * @returns Array of rows showing expected vs actual comparison per version
512
- */
513
- function generateDiffVisibilityTable(validityInfos, versions, schemaResults, findDefinition) {
514
- const expectedTable = generateExpectedVisibilityTable(validityInfos, versions);
515
- const actualTable = generateActualVisibilityTable(validityInfos, versions, schemaResults, findDefinition);
516
- return validityInfos.map((info, index) => {
517
- const row = {
518
- property: info.property,
519
- since: info.since
520
- };
521
- for (const version of versions) {
522
- const expected = expectedTable[index][version];
523
- const actual = actualTable[index][version];
524
- if (expected === actual) {
525
- row[version] = exports.EMOJI_MATCH;
526
- }
527
- else {
528
- row[version] = exports.EMOJI_DIFF;
529
- }
530
- }
531
- return row;
532
- });
533
- }
534
- /**
535
- * Formats diff table as a markdown string for snapshot testing
536
- *
537
- * Shows which property/version combinations have mismatches between
538
- * expected (decorator metadata) and actual (generated schema) visibility.
539
- *
540
- * @param rows - Array of diff rows to format
541
- * @param versions - Array of version strings for column headers
542
- * @returns Formatted markdown table string with diff indicators
543
- */
544
- function formatDiffTableMarkdown(rows, versions) {
545
- const lines = [];
546
- // Calculate column widths
547
- const propWidth = Math.max(26, ...rows.map((r) => r.property.length));
548
- const sinceWidth = 7;
549
- const versionWidth = 9;
550
- // Helper functions for padding
551
- const padEnd = (str, width) => str.padEnd(width);
552
- const padCenter = (str, width) => {
553
- const padding = width - str.length;
554
- const left = Math.floor(padding / 2);
555
- return ' '.repeat(left) + str + ' '.repeat(padding - left);
556
- };
557
- // Emoji centering
558
- const padCenterEmoji = (emoji) => ` ${emoji} `;
559
- // Header
560
- const headerCells = [
561
- padEnd('Property', propWidth),
562
- padEnd('Since', sinceWidth),
563
- ...versions.map((v) => padCenter(v, versionWidth))
564
- ];
565
- lines.push(`| ${headerCells.join(' | ')} |`);
566
- // Separator
567
- const sepCells = ['-'.repeat(propWidth), '-'.repeat(sinceWidth), ...versions.map(() => '-'.repeat(versionWidth))];
568
- lines.push(`| ${sepCells.join(' | ')} |`);
569
- // Data rows
570
- for (const row of rows) {
571
- const cells = [
572
- padEnd(row.property, propWidth),
573
- padEnd(row.since, sinceWidth),
574
- ...versions.map((v) => padCenterEmoji(row[v]))
575
- ];
576
- lines.push(`| ${cells.join(' | ')} |`);
577
- }
578
- // Legend
579
- lines.push('');
580
- lines.push(`Legend: ${exports.EMOJI_MATCH} = match, ${exports.EMOJI_DIFF} = mismatch`);
581
- return lines.join('\n');
582
- }
583
681
  //# sourceMappingURL=validity-test-utils.js.map