@siliconst/metaui 1.4.13 → 1.4.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.
Files changed (184) hide show
  1. package/package.json +1 -1
  2. package/src/nz/co/siliconst/ui5/metaui/controls/DynamicHost-dbg.js +50 -3
  3. package/src/nz/co/siliconst/ui5/metaui/controls/DynamicHost-dbg.js.map +1 -1
  4. package/src/nz/co/siliconst/ui5/metaui/controls/DynamicHost.d.ts +1 -1
  5. package/src/nz/co/siliconst/ui5/metaui/controls/DynamicHost.d.ts.map +1 -1
  6. package/src/nz/co/siliconst/ui5/metaui/controls/DynamicHost.js +1 -1
  7. package/src/nz/co/siliconst/ui5/metaui/controls/DynamicHost.js.map +1 -1
  8. package/src/nz/co/siliconst/ui5/metaui/controls/DynamicHost.ts +57 -4
  9. package/src/nz/co/siliconst/ui5/metaui/controls/host/GeneratorHost-dbg.js +44 -2
  10. package/src/nz/co/siliconst/ui5/metaui/controls/host/GeneratorHost-dbg.js.map +1 -1
  11. package/src/nz/co/siliconst/ui5/metaui/controls/host/GeneratorHost.d.ts +4 -0
  12. package/src/nz/co/siliconst/ui5/metaui/controls/host/GeneratorHost.d.ts.map +1 -1
  13. package/src/nz/co/siliconst/ui5/metaui/controls/host/GeneratorHost.js +1 -1
  14. package/src/nz/co/siliconst/ui5/metaui/controls/host/GeneratorHost.js.map +1 -1
  15. package/src/nz/co/siliconst/ui5/metaui/controls/host/GeneratorHost.ts +51 -4
  16. package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/DialogDelegate-dbg.js +42 -5
  17. package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/DialogDelegate-dbg.js.map +1 -1
  18. package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/DialogDelegate.d.ts +9 -2
  19. package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/DialogDelegate.d.ts.map +1 -1
  20. package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/DialogDelegate.js +1 -1
  21. package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/DialogDelegate.js.map +1 -1
  22. package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/DialogDelegate.ts +44 -5
  23. package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/ValidationDelegate-dbg.js.map +1 -1
  24. package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/ValidationDelegate.js.map +1 -1
  25. package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/ValidationDelegate.ts +2 -2
  26. package/src/nz/co/siliconst/ui5/metaui/core/PluginRegistry-dbg.js +1 -0
  27. package/src/nz/co/siliconst/ui5/metaui/core/PluginRegistry-dbg.js.map +1 -1
  28. package/src/nz/co/siliconst/ui5/metaui/core/PluginRegistry.d.ts.map +1 -1
  29. package/src/nz/co/siliconst/ui5/metaui/core/PluginRegistry.js +1 -1
  30. package/src/nz/co/siliconst/ui5/metaui/core/PluginRegistry.js.map +1 -1
  31. package/src/nz/co/siliconst/ui5/metaui/core/PluginRegistry.ts +1 -0
  32. package/src/nz/co/siliconst/ui5/metaui/core/SchemaBuilderRegistry-dbg.js +47 -0
  33. package/src/nz/co/siliconst/ui5/metaui/core/SchemaBuilderRegistry-dbg.js.map +1 -0
  34. package/src/nz/co/siliconst/ui5/metaui/core/SchemaBuilderRegistry.d.ts +23 -0
  35. package/src/nz/co/siliconst/ui5/metaui/core/SchemaBuilderRegistry.d.ts.map +1 -0
  36. package/src/nz/co/siliconst/ui5/metaui/core/SchemaBuilderRegistry.js +2 -0
  37. package/src/nz/co/siliconst/ui5/metaui/core/SchemaBuilderRegistry.js.map +1 -0
  38. package/src/nz/co/siliconst/ui5/metaui/core/SchemaBuilderRegistry.ts +45 -0
  39. package/src/nz/co/siliconst/ui5/metaui/core/SchemaNormalizer-dbg.js +17 -0
  40. package/src/nz/co/siliconst/ui5/metaui/core/SchemaNormalizer-dbg.js.map +1 -1
  41. package/src/nz/co/siliconst/ui5/metaui/core/SchemaNormalizer.d.ts +10 -1
  42. package/src/nz/co/siliconst/ui5/metaui/core/SchemaNormalizer.d.ts.map +1 -1
  43. package/src/nz/co/siliconst/ui5/metaui/core/SchemaNormalizer.js +1 -1
  44. package/src/nz/co/siliconst/ui5/metaui/core/SchemaNormalizer.js.map +1 -1
  45. package/src/nz/co/siliconst/ui5/metaui/core/SchemaNormalizer.ts +19 -1
  46. package/src/nz/co/siliconst/ui5/metaui/interfaces/ISchema-dbg.js.map +1 -1
  47. package/src/nz/co/siliconst/ui5/metaui/interfaces/ISchema.d.ts +7 -0
  48. package/src/nz/co/siliconst/ui5/metaui/interfaces/ISchema.d.ts.map +1 -1
  49. package/src/nz/co/siliconst/ui5/metaui/interfaces/ISchema.ts +9 -0
  50. package/src/nz/co/siliconst/ui5/metaui/interfaces/ISchemaBuilderPlugin-dbg.js +2 -0
  51. package/src/nz/co/siliconst/ui5/metaui/interfaces/ISchemaBuilderPlugin-dbg.js.map +1 -0
  52. package/src/nz/co/siliconst/ui5/metaui/interfaces/ISchemaBuilderPlugin.d.ts +23 -0
  53. package/src/nz/co/siliconst/ui5/metaui/interfaces/ISchemaBuilderPlugin.d.ts.map +1 -0
  54. package/src/nz/co/siliconst/ui5/metaui/interfaces/ISchemaBuilderPlugin.js +2 -0
  55. package/src/nz/co/siliconst/ui5/metaui/interfaces/ISchemaBuilderPlugin.js.map +1 -0
  56. package/src/nz/co/siliconst/ui5/metaui/interfaces/ISchemaBuilderPlugin.ts +23 -0
  57. package/src/nz/co/siliconst/ui5/metaui/layouts/FormLayout-dbg.js +6 -1
  58. package/src/nz/co/siliconst/ui5/metaui/layouts/FormLayout-dbg.js.map +1 -1
  59. package/src/nz/co/siliconst/ui5/metaui/layouts/FormLayout.d.ts.map +1 -1
  60. package/src/nz/co/siliconst/ui5/metaui/layouts/FormLayout.js +1 -1
  61. package/src/nz/co/siliconst/ui5/metaui/layouts/FormLayout.js.map +1 -1
  62. package/src/nz/co/siliconst/ui5/metaui/layouts/FormLayout.ts +6 -1
  63. package/src/nz/co/siliconst/ui5/metaui/library-preload.js +29 -20
  64. package/src/nz/co/siliconst/ui5/metaui/library-preload.js.map +1 -1
  65. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/BasePlugin-dbg.js +3 -20
  66. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/BasePlugin-dbg.js.map +1 -1
  67. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/BasePlugin.d.ts.map +1 -1
  68. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/BasePlugin.js +1 -1
  69. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/BasePlugin.js.map +1 -1
  70. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/BasePlugin.ts +3 -3
  71. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/BooleanPlugin-dbg.js +1 -0
  72. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/BooleanPlugin-dbg.js.map +1 -1
  73. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/BooleanPlugin.d.ts.map +1 -1
  74. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/BooleanPlugin.js +1 -1
  75. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/BooleanPlugin.js.map +1 -1
  76. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/BooleanPlugin.ts +1 -0
  77. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/DatePlugin-dbg.js +1 -0
  78. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/DatePlugin-dbg.js.map +1 -1
  79. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/DatePlugin.d.ts.map +1 -1
  80. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/DatePlugin.js +1 -1
  81. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/DatePlugin.js.map +1 -1
  82. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/DatePlugin.ts +1 -0
  83. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/DateTimePlugin-dbg.js +1 -0
  84. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/DateTimePlugin-dbg.js.map +1 -1
  85. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/DateTimePlugin.d.ts.map +1 -1
  86. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/DateTimePlugin.js +1 -1
  87. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/DateTimePlugin.js.map +1 -1
  88. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/DateTimePlugin.ts +1 -0
  89. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/DropdownPlugin-dbg.js +1 -0
  90. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/DropdownPlugin-dbg.js.map +1 -1
  91. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/DropdownPlugin.d.ts.map +1 -1
  92. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/DropdownPlugin.js +1 -1
  93. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/DropdownPlugin.js.map +1 -1
  94. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/DropdownPlugin.ts +1 -0
  95. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/FileUploaderPlugin-dbg.js +1 -0
  96. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/FileUploaderPlugin-dbg.js.map +1 -1
  97. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/FileUploaderPlugin.d.ts.map +1 -1
  98. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/FileUploaderPlugin.js +1 -1
  99. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/FileUploaderPlugin.js.map +1 -1
  100. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/FileUploaderPlugin.ts +1 -0
  101. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/MessageStripPlugin-dbg.js +1 -0
  102. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/MessageStripPlugin-dbg.js.map +1 -1
  103. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/MessageStripPlugin.d.ts.map +1 -1
  104. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/MessageStripPlugin.js +1 -1
  105. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/MessageStripPlugin.js.map +1 -1
  106. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/MessageStripPlugin.ts +1 -0
  107. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/MultiInputPlugin-dbg.js +30 -17
  108. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/MultiInputPlugin-dbg.js.map +1 -1
  109. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/MultiInputPlugin.d.ts.map +1 -1
  110. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/MultiInputPlugin.js +1 -1
  111. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/MultiInputPlugin.js.map +1 -1
  112. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/MultiInputPlugin.ts +33 -15
  113. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/MultiSelectPlugin-dbg.js +1 -0
  114. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/MultiSelectPlugin-dbg.js.map +1 -1
  115. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/MultiSelectPlugin.d.ts.map +1 -1
  116. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/MultiSelectPlugin.js +1 -1
  117. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/MultiSelectPlugin.js.map +1 -1
  118. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/MultiSelectPlugin.ts +1 -0
  119. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/NumberPlugin-dbg.js +35 -11
  120. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/NumberPlugin-dbg.js.map +1 -1
  121. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/NumberPlugin.d.ts +4 -4
  122. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/NumberPlugin.d.ts.map +1 -1
  123. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/NumberPlugin.js +1 -1
  124. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/NumberPlugin.js.map +1 -1
  125. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/NumberPlugin.ts +38 -14
  126. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/RatingIndicatorPlugin-dbg.js +1 -0
  127. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/RatingIndicatorPlugin-dbg.js.map +1 -1
  128. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/RatingIndicatorPlugin.d.ts.map +1 -1
  129. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/RatingIndicatorPlugin.js +1 -1
  130. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/RatingIndicatorPlugin.js.map +1 -1
  131. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/RatingIndicatorPlugin.ts +1 -0
  132. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/SliderPlugin-dbg.js +1 -0
  133. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/SliderPlugin-dbg.js.map +1 -1
  134. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/SliderPlugin.d.ts.map +1 -1
  135. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/SliderPlugin.js +1 -1
  136. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/SliderPlugin.js.map +1 -1
  137. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/SliderPlugin.ts +1 -0
  138. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/StepInputPlugin-dbg.js +79 -0
  139. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/StepInputPlugin-dbg.js.map +1 -0
  140. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/StepInputPlugin.d.ts +35 -0
  141. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/StepInputPlugin.d.ts.map +1 -0
  142. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/StepInputPlugin.js +2 -0
  143. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/StepInputPlugin.js.map +1 -0
  144. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/StepInputPlugin.ts +80 -0
  145. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/SwitchPlugin-dbg.js +1 -0
  146. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/SwitchPlugin-dbg.js.map +1 -1
  147. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/SwitchPlugin.d.ts.map +1 -1
  148. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/SwitchPlugin.js +1 -1
  149. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/SwitchPlugin.js.map +1 -1
  150. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/SwitchPlugin.ts +1 -0
  151. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/TimePlugin-dbg.js +1 -0
  152. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/TimePlugin-dbg.js.map +1 -1
  153. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/TimePlugin.d.ts.map +1 -1
  154. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/TimePlugin.js +1 -1
  155. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/TimePlugin.js.map +1 -1
  156. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/TimePlugin.ts +1 -0
  157. package/src/nz/co/siliconst/ui5/metaui/swagger/SwaggerBuilder-dbg.js +226 -0
  158. package/src/nz/co/siliconst/ui5/metaui/swagger/SwaggerBuilder-dbg.js.map +1 -0
  159. package/src/nz/co/siliconst/ui5/metaui/swagger/SwaggerBuilder.d.ts +63 -0
  160. package/src/nz/co/siliconst/ui5/metaui/swagger/SwaggerBuilder.d.ts.map +1 -0
  161. package/src/nz/co/siliconst/ui5/metaui/swagger/SwaggerBuilder.js +2 -0
  162. package/src/nz/co/siliconst/ui5/metaui/swagger/SwaggerBuilder.js.map +1 -0
  163. package/src/nz/co/siliconst/ui5/metaui/swagger/SwaggerBuilder.ts +233 -0
  164. package/src/nz/co/siliconst/ui5/metaui/swagger/SwaggerRefResolver-dbg.js +43 -0
  165. package/src/nz/co/siliconst/ui5/metaui/swagger/SwaggerRefResolver-dbg.js.map +1 -0
  166. package/src/nz/co/siliconst/ui5/metaui/swagger/SwaggerRefResolver.d.ts +15 -0
  167. package/src/nz/co/siliconst/ui5/metaui/swagger/SwaggerRefResolver.d.ts.map +1 -0
  168. package/src/nz/co/siliconst/ui5/metaui/swagger/SwaggerRefResolver.js +2 -0
  169. package/src/nz/co/siliconst/ui5/metaui/swagger/SwaggerRefResolver.js.map +1 -0
  170. package/src/nz/co/siliconst/ui5/metaui/swagger/SwaggerRefResolver.ts +37 -0
  171. package/src/nz/co/siliconst/ui5/metaui/swagger/SwaggerTypeMapper-dbg.js +37 -0
  172. package/src/nz/co/siliconst/ui5/metaui/swagger/SwaggerTypeMapper-dbg.js.map +1 -0
  173. package/src/nz/co/siliconst/ui5/metaui/swagger/SwaggerTypeMapper.d.ts +18 -0
  174. package/src/nz/co/siliconst/ui5/metaui/swagger/SwaggerTypeMapper.d.ts.map +1 -0
  175. package/src/nz/co/siliconst/ui5/metaui/swagger/SwaggerTypeMapper.js +2 -0
  176. package/src/nz/co/siliconst/ui5/metaui/swagger/SwaggerTypeMapper.js.map +1 -0
  177. package/src/nz/co/siliconst/ui5/metaui/swagger/SwaggerTypeMapper.ts +28 -0
  178. package/src/nz/co/siliconst/ui5/metaui/swagger/SwaggerUIMapper-dbg.js +84 -0
  179. package/src/nz/co/siliconst/ui5/metaui/swagger/SwaggerUIMapper-dbg.js.map +1 -0
  180. package/src/nz/co/siliconst/ui5/metaui/swagger/SwaggerUIMapper.d.ts +27 -0
  181. package/src/nz/co/siliconst/ui5/metaui/swagger/SwaggerUIMapper.d.ts.map +1 -0
  182. package/src/nz/co/siliconst/ui5/metaui/swagger/SwaggerUIMapper.js +2 -0
  183. package/src/nz/co/siliconst/ui5/metaui/swagger/SwaggerUIMapper.js.map +1 -0
  184. package/src/nz/co/siliconst/ui5/metaui/swagger/SwaggerUIMapper.ts +80 -0
@@ -1 +1 @@
1
- {"version":3,"file":"PluginRegistry.js","names":["Logger","___utils_Logger","PluginRegistry","fieldIndex","actionIndex","layoutIndex","activePromises","constructor","this","registerPluginPath","undefined","registerLayoutPath","getInstance","instance","type","widgetName","path","key","registerActionPath","actionName","strategy","getFieldPath","Error","getLayoutPath","getPathsToLoad","schema","pathsToLoad","Set","layoutStrategy","add","scanProperties","props","prop","ui","widget","e","msg","message","error","properties","items","preloadDependencies","promises","Array","from","map","Promise","resolve","reject","sap","require","Module","err","all","extractConstructor","default","keys","Object","getPlugin","PluginClass","getLayout","LayoutClass","__exports","__esModule"],"sources":["PluginRegistry.ts"],"sourcesContent":["/**\n * @file PluginRegistry.ts\n * @description Centralized hub for mapping UI5 controls to SAP schema data types.\n * Enforces the Registry Pattern to decouple the core engine from specific UI5 control implementations.\n * NOW WITH UNIVERSAL LAZY LOADING.\n */\n\nimport { IPlugin } from \"../interfaces/IPlugin\";\nimport { FieldType, ISchema, IPropertyMetadata } from \"../interfaces/ISchema\";\nimport { ILayoutManager } from \"../interfaces/ILayoutManager\";\nimport { Logger } from \"../utils/Logger\";\nimport { DefaultLayoutGenerator } from \"./DefaultLayoutGenerator\";\n\nexport class PluginRegistry {\n private static instance: PluginRegistry;\n \n private fieldIndex: Record<string, string> = {};\n private actionIndex: Record<string, string> = {};\n private layoutIndex: Record<string, string> = {};\n \n private activePromises: Record<string, Promise<unknown>> = {};\n\n private constructor() {\n // Core Mappings\n this.registerPluginPath(\"string\", undefined, \"nz/co/siliconst/ui5/metaui/plugins/controls/StringPlugin\");\n this.registerPluginPath(\"number\", undefined, \"nz/co/siliconst/ui5/metaui/plugins/controls/NumberPlugin\");\n this.registerPluginPath(\"integer\", undefined, \"nz/co/siliconst/ui5/metaui/plugins/controls/NumberPlugin\");\n this.registerPluginPath(\"date\", undefined, \"nz/co/siliconst/ui5/metaui/plugins/controls/DatePlugin\");\n this.registerPluginPath(\"boolean\", undefined, \"nz/co/siliconst/ui5/metaui/plugins/controls/BooleanPlugin\");\n this.registerPluginPath(\"array\", undefined, \"nz/co/siliconst/ui5/metaui/plugins/controls/ArrayPlugin\");\n this.registerPluginPath(\"object\", undefined, \"nz/co/siliconst/ui5/metaui/plugins/controls/ObjectPlugin\");\n\n // Widget Overrides\n this.registerPluginPath(\"string\", \"time\", \"nz/co/siliconst/ui5/metaui/plugins/controls/TimePlugin\");\n this.registerPluginPath(\"string\", \"datetime\", \"nz/co/siliconst/ui5/metaui/plugins/controls/DateTimePlugin\");\n this.registerPluginPath(\"boolean\", \"switch\", \"nz/co/siliconst/ui5/metaui/plugins/controls/SwitchPlugin\");\n this.registerPluginPath(\"string\", \"select\", \"nz/co/siliconst/ui5/metaui/plugins/controls/DropdownPlugin\");\n this.registerPluginPath(\"string\", \"textArea\", \"nz/co/siliconst/ui5/metaui/plugins/controls/TextAreaPlugin\");\n this.registerPluginPath(\"string\", \"codeEditor\", \"nz/co/siliconst/ui5/metaui/plugins/controls/CodeEditorPlugin\");\n \n // Phase 1 Mappings\n this.registerPluginPath(\"string\", \"fileUploader\", \"nz/co/siliconst/ui5/metaui/plugins/controls/FileUploaderPlugin\");\n this.registerPluginPath(\"array\", \"multiSelect\", \"nz/co/siliconst/ui5/metaui/plugins/controls/MultiSelectPlugin\");\n this.registerPluginPath(\"array\", \"multiInput\", \"nz/co/siliconst/ui5/metaui/plugins/controls/MultiInputPlugin\");\n this.registerPluginPath(\"number\", \"slider\", \"nz/co/siliconst/ui5/metaui/plugins/controls/SliderPlugin\");\n this.registerPluginPath(\"number\", \"rating\", \"nz/co/siliconst/ui5/metaui/plugins/controls/RatingIndicatorPlugin\");\n this.registerPluginPath(\"string\", \"messageStrip\", \"nz/co/siliconst/ui5/metaui/plugins/controls/MessageStripPlugin\");\n\n // Phase 5 Mappings (Hardware)\n this.registerPluginPath(\"string\", \"camera\", \"nz/co/siliconst/ui5/metaui/plugins/controls/CameraPlugin\");\n this.registerPluginPath(\"string\", \"signature\", \"nz/co/siliconst/ui5/metaui/plugins/controls/SignaturePlugin\");\n this.registerPluginPath(\"object\", \"location\", \"nz/co/siliconst/ui5/metaui/plugins/controls/GeolocationPlugin\");\n this.registerPluginPath(\"string\", \"scanner\", \"nz/co/siliconst/ui5/metaui/plugins/controls/BarcodeScannerPlugin\");\n this.registerPluginPath(\"string\", \"voiceInput\", \"nz/co/siliconst/ui5/metaui/plugins/controls/VoiceInputPlugin\");\n this.registerPluginPath(\"string\", \"richText\", \"nz/co/siliconst/ui5/metaui/plugins/controls/RichTextPlugin\");\n\n // Actions & Datasources\n this.registerPluginPath(\"string\", \"urlButton\", \"nz/co/siliconst/ui5/metaui/plugins/actions/UrlNavigationActionPlugin\");\n this.registerPluginPath(\"string\", \"submitButton\", \"nz/co/siliconst/ui5/metaui/plugins/actions/SubmitFormActionPlugin\");\n this.registerPluginPath(\"string\", \"odataSelect\", \"nz/co/siliconst/ui5/metaui/plugins/datasources/ODataListBindingPlugin\");\n this.registerPluginPath(\"string\", \"remoteDropdown\", \"nz/co/siliconst/ui5/metaui/plugins/datasources/RemoteDropdownPlugin\");\n this.registerPluginPath(\"string\", \"liveSearch\", \"nz/co/siliconst/ui5/metaui/plugins/datasources/LiveSearchPlugin\");\n this.registerPluginPath(\"string\", \"remoteValueHelp\", \"nz/co/siliconst/ui5/metaui/plugins/datasources/RemoteValueHelpPlugin\");\n\n // Layouts\n this.registerLayoutPath(\"form\", \"nz/co/siliconst/ui5/metaui/layouts/FormLayout\");\n this.registerLayoutPath(\"table\", \"nz/co/siliconst/ui5/metaui/layouts/TableLayout\");\n this.registerLayoutPath(\"wizard\", \"nz/co/siliconst/ui5/metaui/layouts/WizardLayout\");\n this.registerLayoutPath(\"compact\", \"nz/co/siliconst/ui5/metaui/layouts/CompactLayout\");\n }\n\n public static getInstance(): PluginRegistry {\n if (!PluginRegistry.instance) {\n PluginRegistry.instance = new PluginRegistry();\n }\n return PluginRegistry.instance;\n }\n\n public registerPluginPath(type: FieldType, widgetName: string | undefined, path: string): void {\n const key = widgetName ? `${type}:${widgetName}` : type;\n this.fieldIndex[key] = path;\n }\n\n public registerActionPath(actionName: string, path: string): void {\n this.actionIndex[actionName] = path;\n }\n\n public registerLayoutPath(strategy: string, path: string): void {\n this.layoutIndex[strategy] = path;\n }\n\n private getFieldPath(type: FieldType, widgetName?: string): string {\n let path;\n if (widgetName) {\n path = this.fieldIndex[`${type}:${widgetName}`];\n }\n if (!path) {\n path = this.fieldIndex[type];\n }\n if (!path) {\n throw new Error(`No plugin path mapped for FieldType: ${type} (widget: ${widgetName})`);\n }\n return path;\n }\n\n private getLayoutPath(strategy: string): string {\n const path = this.layoutIndex[strategy];\n if (!path) {\n throw new Error(`No layout path mapped for strategy: ${strategy}`);\n }\n return path;\n }\n\n /**\n * Statically traverses the schema structure to identify all required plugins\n * and layouts without actually instantiating them.\n * \n * @param {ISchema} schema The root JSON schema payload to traverse\n * @returns {Set<string>} A distinct set of UI5 module paths required to render the schema\n */\n public getPathsToLoad(schema: ISchema): Set<string> {\n const pathsToLoad = new Set<string>();\n \n // 1. Gather layout strategy\n const strategy = schema.layoutStrategy || (schema.type === \"array\" ? \"table\" : \"form\");\n pathsToLoad.add(this.getLayoutPath(strategy));\n\n // 2. Recursively gather field plugins\n const scanProperties = (props: Record<string, IPropertyMetadata>) => {\n for (const key in props) {\n const prop = props[key];\n try {\n pathsToLoad.add(this.getFieldPath(prop.type || \"string\", prop.ui?.widget));\n } catch (e) {\n const msg = `[MetaUI LazyLoad] Could not find mapped plugin for field ${key}: ${(e as Error).message}`;\n Logger.error(msg);\n throw new Error(msg);\n }\n if (prop.properties) scanProperties(prop.properties);\n if (prop.items && prop.items.properties) scanProperties(prop.items.properties);\n if (prop.items && prop.items.type) {\n try {\n pathsToLoad.add(this.getFieldPath(prop.items.type, prop.items.ui?.widget));\n } catch (e) {\n const msg = `[MetaUI LazyLoad] Could not find mapped plugin for array item type ${prop.items.type}: ${(e as Error).message}`;\n Logger.error(msg);\n throw new Error(msg);\n }\n }\n }\n };\n\n if (schema.properties) {\n scanProperties(schema.properties);\n } else if (schema.items && schema.items.properties) {\n scanProperties(schema.items.properties);\n }\n\n return pathsToLoad;\n }\n\n /**\n * Defers the generation of the UI until all required UI5 modules have been\n * downloaded asynchronously. Maintains a cache of active promises to prevent\n * redundant network requests for the same module.\n * \n * @param {ISchema} schema The root JSON schema payload to parse\n * @returns {Promise<void>} Resolves when all dependencies are securely in the UI5 require cache\n */\n public async preloadDependencies(schema: ISchema): Promise<void> {\n const pathsToLoad = this.getPathsToLoad(schema);\n\n // 3. Batch execute sap.ui.require via Promises\n const promises = Array.from(pathsToLoad).map(path => {\n if (!this.activePromises[path]) {\n this.activePromises[path] = new Promise((resolve, reject) => {\n sap.ui.require([path], \n (Module: unknown) => resolve(Module), \n (err: unknown) => {\n Logger.error(`Failed to lazy load module: ${path}`);\n // CRITICAL: Delete from cache so future attempts can retry the network request\n delete this.activePromises[path];\n reject(err);\n }\n );\n });\n }\n return this.activePromises[path];\n });\n\n await Promise.all(promises);\n }\n\n /**\n * Extracts a valid constructor from a dynamically required module.\n */\n private extractConstructor(Module: unknown): new () => IPlugin | ILayoutManager | null {\n if (!Module) return null;\n if (typeof Module === \"function\") return Module as any;\n if ((Module as any).default && typeof (Module as any).default === \"function\") return (Module as any).default;\n \n // Handle namespace exports (e.g. { FormLayout: class... })\n const keys = Object.keys(Module as object);\n for (const key of keys) {\n if (typeof (Module as any)[key] === \"function\") {\n return (Module as any)[key];\n }\n }\n return null;\n }\n\n /**\n * Instantiates the requested plugin for the given field type.\n */\n public getPlugin(type: FieldType, widgetName?: string): IPlugin {\n const path = this.getFieldPath(type, widgetName);\n const Module = sap.ui.require(path);\n const PluginClass = this.extractConstructor(Module);\n \n if (!PluginClass) {\n throw new Error(`[MetaUI Plugin Instantiation] Plugin ${path} was not preloaded or has no constructor!`);\n }\n \n return new PluginClass();\n }\n\n /**\n * Instantiates the requested layout manager for the given strategy.\n */\n public getLayout(strategy: string): ILayoutManager {\n const path = this.getLayoutPath(strategy);\n const Module = sap.ui.require(path);\n const LayoutClass = this.extractConstructor(Module);\n \n if (!LayoutClass) {\n throw new Error(`[MetaUI Layout Instantiation] Layout ${path} was not preloaded or has no constructor!`);\n }\n \n return new LayoutClass();\n }\n}\n"],"mappings":"2DAAA,MAUSA,EAAMC,EAAA,UAGR,MAAMC,EAGDC,WAAqC,CAAC,EACtCC,YAAsC,CAAC,EACvCC,YAAsC,CAAC,EAEvCC,eAAmD,CAAC,EAEpDC,cAEJC,KAAKC,mBAAmB,SAAUC,UAAW,4DAC7CF,KAAKC,mBAAmB,SAAUC,UAAW,4DAC7CF,KAAKC,mBAAmB,UAAWC,UAAW,4DAC9CF,KAAKC,mBAAmB,OAAQC,UAAW,0DAC3CF,KAAKC,mBAAmB,UAAWC,UAAW,6DAC9CF,KAAKC,mBAAmB,QAASC,UAAW,2DAC5CF,KAAKC,mBAAmB,SAAUC,UAAW,4DAG7CF,KAAKC,mBAAmB,SAAU,OAAQ,0DAC1CD,KAAKC,mBAAmB,SAAU,WAAY,8DAC9CD,KAAKC,mBAAmB,UAAW,SAAU,4DAC7CD,KAAKC,mBAAmB,SAAU,SAAU,8DAC5CD,KAAKC,mBAAmB,SAAU,WAAY,8DAC9CD,KAAKC,mBAAmB,SAAU,aAAc,gEAGhDD,KAAKC,mBAAmB,SAAU,eAAgB,kEAClDD,KAAKC,mBAAmB,QAAS,cAAe,iEAChDD,KAAKC,mBAAmB,QAAS,aAAc,gEAC/CD,KAAKC,mBAAmB,SAAU,SAAU,4DAC5CD,KAAKC,mBAAmB,SAAU,SAAU,qEAC5CD,KAAKC,mBAAmB,SAAU,eAAgB,kEAGlDD,KAAKC,mBAAmB,SAAU,SAAU,4DAC5CD,KAAKC,mBAAmB,SAAU,YAAa,+DAC/CD,KAAKC,mBAAmB,SAAU,WAAY,iEAC9CD,KAAKC,mBAAmB,SAAU,UAAW,oEAC7CD,KAAKC,mBAAmB,SAAU,aAAc,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F,eAAeU,WAGzB8B,QAAQO,IAAIX,EACtB,CAKQY,mBAAmBH,GACvB,IAAKA,EAAQ,OAAO,KACpB,UAAWA,IAAW,WAAY,OAAOA,EACzC,GAAKA,EAAeI,gBAAmBJ,EAAeI,UAAY,WAAY,OAAQJ,EAAeI,QAGrG,MAAMC,EAAOC,OAAOD,KAAKL,GACzB,IAAK,MAAMlC,KAAOuC,EAAM,CACpB,UAAYL,EAAelC,KAAS,WAAY,CAC5C,OAAQkC,EAAelC,EAC3B,CACJ,CACA,OAAO,IACX,CAKOyC,UAAU5C,EAAiBC,GAC9B,MAAMC,EAAOR,KAAKa,aAAaP,EAAMC,GACrC,MAAMoC,EAASF,IAAIhB,GAAGiB,QAAQlC,GAC9B,MAAM2C,EAAcnD,KAAK8C,mBAAmBH,GAE5C,IAAKQ,EAAa,CACd,MAAM,IAAIrC,MAAM,wCAAwCN,6CAC5D,CAEA,OAAO,IAAI2C,CACf,CAKOC,UAAUxC,GACb,MAAMJ,EAAOR,KAAKe,cAAcH,GAChC,MAAM+B,EAASF,IAAIhB,GAAGiB,QAAQlC,GAC9B,MAAM6C,EAAcrD,KAAK8C,mBAAmBH,GAE5C,IAAKU,EAAa,CACd,MAAM,IAAIvC,MAAM,wCAAwCN,6CAC5D,CAEA,OAAO,IAAI6C,CACf,EACH,IAAAC,EAAA,CAAAC,WAAA,MAAAD,EAAA5D,iBAAA,OAAA4D,CAAA","ignoreList":[]}
1
+ {"version":3,"file":"PluginRegistry.js","names":["Logger","___utils_Logger","PluginRegistry","fieldIndex","actionIndex","layoutIndex","activePromises","constructor","this","registerPluginPath","undefined","registerLayoutPath","getInstance","instance","type","widgetName","path","key","registerActionPath","actionName","strategy","getFieldPath","Error","getLayoutPath","getPathsToLoad","schema","pathsToLoad","Set","layoutStrategy","add","scanProperties","props","prop","ui","widget","e","msg","message","error","properties","items","preloadDependencies","promises","Array","from","map","Promise","resolve","reject","sap","require","Module","err","all","extractConstructor","default","keys","Object","getPlugin","PluginClass","getLayout","LayoutClass","__exports","__esModule"],"sources":["PluginRegistry.ts"],"sourcesContent":["/**\n * @file PluginRegistry.ts\n * @description Centralized hub for mapping UI5 controls to SAP schema data types.\n * Enforces the Registry Pattern to decouple the core engine from specific UI5 control implementations.\n * NOW WITH UNIVERSAL LAZY LOADING.\n */\n\nimport { IPlugin } from \"../interfaces/IPlugin\";\nimport { FieldType, ISchema, IPropertyMetadata } from \"../interfaces/ISchema\";\nimport { ILayoutManager } from \"../interfaces/ILayoutManager\";\nimport { Logger } from \"../utils/Logger\";\nimport { DefaultLayoutGenerator } from \"./DefaultLayoutGenerator\";\n\nexport class PluginRegistry {\n private static instance: PluginRegistry;\n \n private fieldIndex: Record<string, string> = {};\n private actionIndex: Record<string, string> = {};\n private layoutIndex: Record<string, string> = {};\n \n private activePromises: Record<string, Promise<unknown>> = {};\n\n private constructor() {\n // Core Mappings\n this.registerPluginPath(\"string\", undefined, \"nz/co/siliconst/ui5/metaui/plugins/controls/StringPlugin\");\n this.registerPluginPath(\"number\", undefined, \"nz/co/siliconst/ui5/metaui/plugins/controls/NumberPlugin\");\n this.registerPluginPath(\"integer\", undefined, \"nz/co/siliconst/ui5/metaui/plugins/controls/NumberPlugin\");\n this.registerPluginPath(\"date\", undefined, \"nz/co/siliconst/ui5/metaui/plugins/controls/DatePlugin\");\n this.registerPluginPath(\"boolean\", undefined, \"nz/co/siliconst/ui5/metaui/plugins/controls/BooleanPlugin\");\n this.registerPluginPath(\"array\", undefined, \"nz/co/siliconst/ui5/metaui/plugins/controls/ArrayPlugin\");\n this.registerPluginPath(\"object\", undefined, \"nz/co/siliconst/ui5/metaui/plugins/controls/ObjectPlugin\");\n\n // Widget Overrides\n this.registerPluginPath(\"string\", \"time\", \"nz/co/siliconst/ui5/metaui/plugins/controls/TimePlugin\");\n this.registerPluginPath(\"string\", \"datetime\", \"nz/co/siliconst/ui5/metaui/plugins/controls/DateTimePlugin\");\n this.registerPluginPath(\"boolean\", \"switch\", \"nz/co/siliconst/ui5/metaui/plugins/controls/SwitchPlugin\");\n this.registerPluginPath(\"number\", \"step\", \"nz/co/siliconst/ui5/metaui/plugins/controls/StepInputPlugin\");\n this.registerPluginPath(\"string\", \"select\", \"nz/co/siliconst/ui5/metaui/plugins/controls/DropdownPlugin\");\n this.registerPluginPath(\"string\", \"textArea\", \"nz/co/siliconst/ui5/metaui/plugins/controls/TextAreaPlugin\");\n this.registerPluginPath(\"string\", \"codeEditor\", \"nz/co/siliconst/ui5/metaui/plugins/controls/CodeEditorPlugin\");\n \n // Phase 1 Mappings\n this.registerPluginPath(\"string\", \"fileUploader\", \"nz/co/siliconst/ui5/metaui/plugins/controls/FileUploaderPlugin\");\n this.registerPluginPath(\"array\", \"multiSelect\", \"nz/co/siliconst/ui5/metaui/plugins/controls/MultiSelectPlugin\");\n this.registerPluginPath(\"array\", \"multiInput\", \"nz/co/siliconst/ui5/metaui/plugins/controls/MultiInputPlugin\");\n this.registerPluginPath(\"number\", \"slider\", \"nz/co/siliconst/ui5/metaui/plugins/controls/SliderPlugin\");\n this.registerPluginPath(\"number\", \"rating\", \"nz/co/siliconst/ui5/metaui/plugins/controls/RatingIndicatorPlugin\");\n this.registerPluginPath(\"string\", \"messageStrip\", \"nz/co/siliconst/ui5/metaui/plugins/controls/MessageStripPlugin\");\n\n // Phase 5 Mappings (Hardware)\n this.registerPluginPath(\"string\", \"camera\", \"nz/co/siliconst/ui5/metaui/plugins/controls/CameraPlugin\");\n this.registerPluginPath(\"string\", \"signature\", \"nz/co/siliconst/ui5/metaui/plugins/controls/SignaturePlugin\");\n this.registerPluginPath(\"object\", \"location\", \"nz/co/siliconst/ui5/metaui/plugins/controls/GeolocationPlugin\");\n this.registerPluginPath(\"string\", \"scanner\", \"nz/co/siliconst/ui5/metaui/plugins/controls/BarcodeScannerPlugin\");\n this.registerPluginPath(\"string\", \"voiceInput\", \"nz/co/siliconst/ui5/metaui/plugins/controls/VoiceInputPlugin\");\n this.registerPluginPath(\"string\", \"richText\", \"nz/co/siliconst/ui5/metaui/plugins/controls/RichTextPlugin\");\n\n // Actions & Datasources\n this.registerPluginPath(\"string\", \"urlButton\", \"nz/co/siliconst/ui5/metaui/plugins/actions/UrlNavigationActionPlugin\");\n this.registerPluginPath(\"string\", \"submitButton\", \"nz/co/siliconst/ui5/metaui/plugins/actions/SubmitFormActionPlugin\");\n this.registerPluginPath(\"string\", \"odataSelect\", \"nz/co/siliconst/ui5/metaui/plugins/datasources/ODataListBindingPlugin\");\n this.registerPluginPath(\"string\", \"remoteDropdown\", \"nz/co/siliconst/ui5/metaui/plugins/datasources/RemoteDropdownPlugin\");\n this.registerPluginPath(\"string\", \"liveSearch\", \"nz/co/siliconst/ui5/metaui/plugins/datasources/LiveSearchPlugin\");\n this.registerPluginPath(\"string\", \"remoteValueHelp\", \"nz/co/siliconst/ui5/metaui/plugins/datasources/RemoteValueHelpPlugin\");\n\n // Layouts\n this.registerLayoutPath(\"form\", \"nz/co/siliconst/ui5/metaui/layouts/FormLayout\");\n this.registerLayoutPath(\"table\", \"nz/co/siliconst/ui5/metaui/layouts/TableLayout\");\n this.registerLayoutPath(\"wizard\", \"nz/co/siliconst/ui5/metaui/layouts/WizardLayout\");\n this.registerLayoutPath(\"compact\", \"nz/co/siliconst/ui5/metaui/layouts/CompactLayout\");\n }\n\n public static getInstance(): PluginRegistry {\n if (!PluginRegistry.instance) {\n PluginRegistry.instance = new PluginRegistry();\n }\n return PluginRegistry.instance;\n }\n\n public registerPluginPath(type: FieldType, widgetName: string | undefined, path: string): void {\n const key = widgetName ? `${type}:${widgetName}` : type;\n this.fieldIndex[key] = path;\n }\n\n public registerActionPath(actionName: string, path: string): void {\n this.actionIndex[actionName] = path;\n }\n\n public registerLayoutPath(strategy: string, path: string): void {\n this.layoutIndex[strategy] = path;\n }\n\n private getFieldPath(type: FieldType, widgetName?: string): string {\n let path;\n if (widgetName) {\n path = this.fieldIndex[`${type}:${widgetName}`];\n }\n if (!path) {\n path = this.fieldIndex[type];\n }\n if (!path) {\n throw new Error(`No plugin path mapped for FieldType: ${type} (widget: ${widgetName})`);\n }\n return path;\n }\n\n private getLayoutPath(strategy: string): string {\n const path = this.layoutIndex[strategy];\n if (!path) {\n throw new Error(`No layout path mapped for strategy: ${strategy}`);\n }\n return path;\n }\n\n /**\n * Statically traverses the schema structure to identify all required plugins\n * and layouts without actually instantiating them.\n * \n * @param {ISchema} schema The root JSON schema payload to traverse\n * @returns {Set<string>} A distinct set of UI5 module paths required to render the schema\n */\n public getPathsToLoad(schema: ISchema): Set<string> {\n const pathsToLoad = new Set<string>();\n \n // 1. Gather layout strategy\n const strategy = schema.layoutStrategy || (schema.type === \"array\" ? \"table\" : \"form\");\n pathsToLoad.add(this.getLayoutPath(strategy));\n\n // 2. Recursively gather field plugins\n const scanProperties = (props: Record<string, IPropertyMetadata>) => {\n for (const key in props) {\n const prop = props[key];\n try {\n pathsToLoad.add(this.getFieldPath(prop.type || \"string\", prop.ui?.widget));\n } catch (e) {\n const msg = `[MetaUI LazyLoad] Could not find mapped plugin for field ${key}: ${(e as Error).message}`;\n Logger.error(msg);\n throw new Error(msg);\n }\n if (prop.properties) scanProperties(prop.properties);\n if (prop.items && prop.items.properties) scanProperties(prop.items.properties);\n if (prop.items && prop.items.type) {\n try {\n pathsToLoad.add(this.getFieldPath(prop.items.type, prop.items.ui?.widget));\n } catch (e) {\n const msg = `[MetaUI LazyLoad] Could not find mapped plugin for array item type ${prop.items.type}: ${(e as Error).message}`;\n Logger.error(msg);\n throw new Error(msg);\n }\n }\n }\n };\n\n if (schema.properties) {\n scanProperties(schema.properties);\n } else if (schema.items && schema.items.properties) {\n scanProperties(schema.items.properties);\n }\n\n return pathsToLoad;\n }\n\n /**\n * Defers the generation of the UI until all required UI5 modules have been\n * downloaded asynchronously. Maintains a cache of active promises to prevent\n * redundant network requests for the same module.\n * \n * @param {ISchema} schema The root JSON schema payload to parse\n * @returns {Promise<void>} Resolves when all dependencies are securely in the UI5 require cache\n */\n public async preloadDependencies(schema: ISchema): Promise<void> {\n const pathsToLoad = this.getPathsToLoad(schema);\n\n // 3. Batch execute sap.ui.require via Promises\n const promises = Array.from(pathsToLoad).map(path => {\n if (!this.activePromises[path]) {\n this.activePromises[path] = new Promise((resolve, reject) => {\n sap.ui.require([path], \n (Module: unknown) => resolve(Module), \n (err: unknown) => {\n Logger.error(`Failed to lazy load module: ${path}`);\n // CRITICAL: Delete from cache so future attempts can retry the network request\n delete this.activePromises[path];\n reject(err);\n }\n );\n });\n }\n return this.activePromises[path];\n });\n\n await Promise.all(promises);\n }\n\n /**\n * Extracts a valid constructor from a dynamically required module.\n */\n private extractConstructor(Module: unknown): new () => IPlugin | ILayoutManager | null {\n if (!Module) return null;\n if (typeof Module === \"function\") return Module as any;\n if ((Module as any).default && typeof (Module as any).default === \"function\") return (Module as any).default;\n \n // Handle namespace exports (e.g. { FormLayout: class... })\n const keys = Object.keys(Module as object);\n for (const key of keys) {\n if (typeof (Module as any)[key] === \"function\") {\n return (Module as any)[key];\n }\n }\n return null;\n }\n\n /**\n * Instantiates the requested plugin for the given field type.\n */\n public getPlugin(type: FieldType, widgetName?: string): IPlugin {\n const path = this.getFieldPath(type, widgetName);\n const Module = sap.ui.require(path);\n const PluginClass = this.extractConstructor(Module);\n \n if (!PluginClass) {\n throw new Error(`[MetaUI Plugin Instantiation] Plugin ${path} was not preloaded or has no constructor!`);\n }\n \n return new PluginClass();\n }\n\n /**\n * Instantiates the requested layout manager for the given strategy.\n */\n public getLayout(strategy: string): ILayoutManager {\n const path = this.getLayoutPath(strategy);\n const Module = sap.ui.require(path);\n const LayoutClass = this.extractConstructor(Module);\n \n if (!LayoutClass) {\n throw new Error(`[MetaUI Layout Instantiation] Layout ${path} was not preloaded or has no constructor!`);\n }\n \n return new LayoutClass();\n }\n}\n"],"mappings":"2DAAA,MAUSA,EAAMC,EAAA,UAGR,MAAMC,EAGDC,WAAqC,CAAC,EACtCC,YAAsC,CAAC,EACvCC,YAAsC,CAAC,EAEvCC,eAAmD,CAAC,EA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AC5C,OAAQkC,EAAelC,EAC3B,CACJ,CACA,OAAO,IACX,CAKOyC,UAAU5C,EAAiBC,GAC9B,MAAMC,EAAOR,KAAKa,aAAaP,EAAMC,GACrC,MAAMoC,EAASF,IAAIhB,GAAGiB,QAAQlC,GAC9B,MAAM2C,EAAcnD,KAAK8C,mBAAmBH,GAE5C,IAAKQ,EAAa,CACd,MAAM,IAAIrC,MAAM,wCAAwCN,6CAC5D,CAEA,OAAO,IAAI2C,CACf,CAKOC,UAAUxC,GACb,MAAMJ,EAAOR,KAAKe,cAAcH,GAChC,MAAM+B,EAASF,IAAIhB,GAAGiB,QAAQlC,GAC9B,MAAM6C,EAAcrD,KAAK8C,mBAAmBH,GAE5C,IAAKU,EAAa,CACd,MAAM,IAAIvC,MAAM,wCAAwCN,6CAC5D,CAEA,OAAO,IAAI6C,CACf,EACH,IAAAC,EAAA,CAAAC,WAAA,MAAAD,EAAA5D,iBAAA,OAAA4D,CAAA","ignoreList":[]}
@@ -34,6 +34,7 @@ export class PluginRegistry {
34
34
  this.registerPluginPath("string", "time", "nz/co/siliconst/ui5/metaui/plugins/controls/TimePlugin");
35
35
  this.registerPluginPath("string", "datetime", "nz/co/siliconst/ui5/metaui/plugins/controls/DateTimePlugin");
36
36
  this.registerPluginPath("boolean", "switch", "nz/co/siliconst/ui5/metaui/plugins/controls/SwitchPlugin");
37
+ this.registerPluginPath("number", "step", "nz/co/siliconst/ui5/metaui/plugins/controls/StepInputPlugin");
37
38
  this.registerPluginPath("string", "select", "nz/co/siliconst/ui5/metaui/plugins/controls/DropdownPlugin");
38
39
  this.registerPluginPath("string", "textArea", "nz/co/siliconst/ui5/metaui/plugins/controls/TextAreaPlugin");
39
40
  this.registerPluginPath("string", "codeEditor", "nz/co/siliconst/ui5/metaui/plugins/controls/CodeEditorPlugin");
@@ -0,0 +1,47 @@
1
+ sap.ui.define(["./SchemaNormalizer", "../swagger/SwaggerBuilder", "../utils/Logger"], function (___SchemaNormalizer, ___swagger_SwaggerBuilder, ___utils_Logger) {
2
+ "use strict";
3
+
4
+ /**
5
+ * @file SchemaBuilderRegistry.ts
6
+ * @description Singleton registry for Schema Builder plugins.
7
+ * Routes unknown JSON payloads to the appropriate parser plugin.
8
+ */
9
+ const SchemaNormalizer = ___SchemaNormalizer["SchemaNormalizer"];
10
+ const SwaggerBuilder = ___swagger_SwaggerBuilder["SwaggerBuilder"];
11
+ const Logger = ___utils_Logger["Logger"];
12
+ class SchemaBuilderRegistry {
13
+ static _plugins = [new SwaggerBuilder(), new SchemaNormalizer()];
14
+
15
+ /**
16
+ * Registers a new schema builder plugin into the engine.
17
+ * @param plugin An instance of ISchemaBuilderPlugin
18
+ */
19
+ static register(plugin) {
20
+ this._plugins.push(plugin);
21
+ }
22
+
23
+ /**
24
+ * Finds the first registered plugin that claims it can handle the payload.
25
+ * @param rawSchema The raw JSON schema object to inspect.
26
+ * @returns The matching plugin instance, or null if none match.
27
+ */
28
+ static getBuilderFor(rawSchema) {
29
+ if (!rawSchema || typeof rawSchema !== "object") {
30
+ return null;
31
+ }
32
+ for (const plugin of this._plugins) {
33
+ if (plugin.canHandle(rawSchema)) {
34
+ return plugin;
35
+ }
36
+ }
37
+ Logger.warn("[SchemaBuilderRegistry]", "No suitable Schema Builder plugin found for the provided payload.");
38
+ return null;
39
+ }
40
+ }
41
+ var __exports = {
42
+ __esModule: true
43
+ };
44
+ __exports.SchemaBuilderRegistry = SchemaBuilderRegistry;
45
+ return __exports;
46
+ });
47
+ //# sourceMappingURL=SchemaBuilderRegistry-dbg.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SchemaBuilderRegistry-dbg.js","names":["SchemaNormalizer","___SchemaNormalizer","SwaggerBuilder","___swagger_SwaggerBuilder","Logger","___utils_Logger","SchemaBuilderRegistry","_plugins","register","plugin","push","getBuilderFor","rawSchema","canHandle","warn","__exports","__esModule"],"sources":["SchemaBuilderRegistry.ts"],"sourcesContent":["/**\n * @file SchemaBuilderRegistry.ts\n * @description Singleton registry for Schema Builder plugins.\n * Routes unknown JSON payloads to the appropriate parser plugin.\n */\n\nimport { ISchemaBuilderPlugin } from \"../interfaces/ISchemaBuilderPlugin\";\nimport { SchemaNormalizer } from \"./SchemaNormalizer\";\nimport { SwaggerBuilder } from \"../swagger/SwaggerBuilder\";\nimport { Logger } from \"../utils/Logger\";\n\nexport class SchemaBuilderRegistry {\n private static _plugins: ISchemaBuilderPlugin[] = [\n new SwaggerBuilder(),\n new SchemaNormalizer()\n ];\n\n /**\n * Registers a new schema builder plugin into the engine.\n * @param plugin An instance of ISchemaBuilderPlugin\n */\n public static register(plugin: ISchemaBuilderPlugin): void {\n this._plugins.push(plugin);\n }\n\n /**\n * Finds the first registered plugin that claims it can handle the payload.\n * @param rawSchema The raw JSON schema object to inspect.\n * @returns The matching plugin instance, or null if none match.\n */\n public static getBuilderFor(rawSchema: any): ISchemaBuilderPlugin | null {\n if (!rawSchema || typeof rawSchema !== \"object\") {\n return null;\n }\n\n for (const plugin of this._plugins) {\n if (plugin.canHandle(rawSchema)) {\n return plugin;\n }\n }\n \n Logger.warn(\"[SchemaBuilderRegistry]\", \"No suitable Schema Builder plugin found for the provided payload.\");\n return null;\n }\n}\n"],"mappings":";;;EAAA;AACA;AACA;AACA;AACA;EAJA,MAOSA,gBAAgB,GAAAC,mBAAA;EAAA,MAChBC,cAAc,GAAAC,yBAAA;EAAA,MACdC,MAAM,GAAAC,eAAA;EAER,MAAMC,qBAAqB,CAAC;IAC/B,OAAeC,QAAQ,GAA2B,CAC9C,IAAIL,cAAc,CAAC,CAAC,EACpB,IAAIF,gBAAgB,CAAC,CAAC,CACzB;;IAED;AACJ;AACA;AACA;IACI,OAAcQ,QAAQA,CAACC,MAA4B,EAAQ;MACvD,IAAI,CAACF,QAAQ,CAACG,IAAI,CAACD,MAAM,CAAC;IAC9B;;IAEA;AACJ;AACA;AACA;AACA;IACI,OAAcE,aAAaA,CAACC,SAAc,EAA+B;MACrE,IAAI,CAACA,SAAS,IAAI,OAAOA,SAAS,KAAK,QAAQ,EAAE;QAC7C,OAAO,IAAI;MACf;MAEA,KAAK,MAAMH,MAAM,IAAI,IAAI,CAACF,QAAQ,EAAE;QAChC,IAAIE,MAAM,CAACI,SAAS,CAACD,SAAS,CAAC,EAAE;UAC7B,OAAOH,MAAM;QACjB;MACJ;MAEAL,MAAM,CAACU,IAAI,CAAC,yBAAyB,EAAE,mEAAmE,CAAC;MAC3G,OAAO,IAAI;IACf;EACJ;EAAC,IAAAC,SAAA;IAAAC,UAAA;EAAA;EAAAD,SAAA,CAAAT,qBAAA,GAAAA,qBAAA;EAAA,OAAAS,SAAA;AAAA","ignoreList":[]}
@@ -0,0 +1,23 @@
1
+ declare module "nz/co/siliconst/ui5/metaui/core/SchemaBuilderRegistry" {
2
+ /**
3
+ * @file SchemaBuilderRegistry.ts
4
+ * @description Singleton registry for Schema Builder plugins.
5
+ * Routes unknown JSON payloads to the appropriate parser plugin.
6
+ */
7
+ import { ISchemaBuilderPlugin } from "nz/co/siliconst/ui5/metaui/interfaces/ISchemaBuilderPlugin";
8
+ export class SchemaBuilderRegistry {
9
+ private static _plugins;
10
+ /**
11
+ * Registers a new schema builder plugin into the engine.
12
+ * @param plugin An instance of ISchemaBuilderPlugin
13
+ */
14
+ static register(plugin: ISchemaBuilderPlugin): void;
15
+ /**
16
+ * Finds the first registered plugin that claims it can handle the payload.
17
+ * @param rawSchema The raw JSON schema object to inspect.
18
+ * @returns The matching plugin instance, or null if none match.
19
+ */
20
+ static getBuilderFor(rawSchema: any): ISchemaBuilderPlugin | null;
21
+ }
22
+ }
23
+ //# sourceMappingURL=SchemaBuilderRegistry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SchemaBuilderRegistry.d.ts","sourceRoot":"../../../../../../../..","sources":["src/nz/co/siliconst/ui5/metaui/core/SchemaBuilderRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,uDAAuD,CAAC;IACvE;;;;OAIG;IAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,4DAA4D,CAAC;IAKlG,MAAa,qBAAqB;QAC9B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAGrB;QAEF;;;WAGG;eACW,QAAQ,CAAC,MAAM,EAAE,oBAAoB,GAAG,IAAI;QAI1D;;;;WAIG;eACW,aAAa,CAAC,SAAS,EAAE,GAAG,GAAG,oBAAoB,GAAG,IAAI;KAc3E;CAEA"}
@@ -0,0 +1,2 @@
1
+ sap.ui.define(["./SchemaNormalizer","../swagger/SwaggerBuilder","../utils/Logger"],function(e,r,i){"use strict";const t=e["SchemaNormalizer"];const s=r["SwaggerBuilder"];const u=i["Logger"];class n{static _plugins=[new s,new t];static register(e){this._plugins.push(e)}static getBuilderFor(e){if(!e||typeof e!=="object"){return null}for(const r of this._plugins){if(r.canHandle(e)){return r}}u.warn("[SchemaBuilderRegistry]","No suitable Schema Builder plugin found for the provided payload.");return null}}var a={__esModule:true};a.SchemaBuilderRegistry=n;return a});
2
+ //# sourceMappingURL=SchemaBuilderRegistry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SchemaBuilderRegistry.js","names":["SchemaNormalizer","___SchemaNormalizer","SwaggerBuilder","___swagger_SwaggerBuilder","Logger","___utils_Logger","SchemaBuilderRegistry","static","register","plugin","this","_plugins","push","getBuilderFor","rawSchema","canHandle","warn","__exports","__esModule"],"sources":["SchemaBuilderRegistry.ts"],"sourcesContent":["/**\n * @file SchemaBuilderRegistry.ts\n * @description Singleton registry for Schema Builder plugins.\n * Routes unknown JSON payloads to the appropriate parser plugin.\n */\n\nimport { ISchemaBuilderPlugin } from \"../interfaces/ISchemaBuilderPlugin\";\nimport { SchemaNormalizer } from \"./SchemaNormalizer\";\nimport { SwaggerBuilder } from \"../swagger/SwaggerBuilder\";\nimport { Logger } from \"../utils/Logger\";\n\nexport class SchemaBuilderRegistry {\n private static _plugins: ISchemaBuilderPlugin[] = [\n new SwaggerBuilder(),\n new SchemaNormalizer()\n ];\n\n /**\n * Registers a new schema builder plugin into the engine.\n * @param plugin An instance of ISchemaBuilderPlugin\n */\n public static register(plugin: ISchemaBuilderPlugin): void {\n this._plugins.push(plugin);\n }\n\n /**\n * Finds the first registered plugin that claims it can handle the payload.\n * @param rawSchema The raw JSON schema object to inspect.\n * @returns The matching plugin instance, or null if none match.\n */\n public static getBuilderFor(rawSchema: any): ISchemaBuilderPlugin | null {\n if (!rawSchema || typeof rawSchema !== \"object\") {\n return null;\n }\n\n for (const plugin of this._plugins) {\n if (plugin.canHandle(rawSchema)) {\n return plugin;\n }\n }\n \n Logger.warn(\"[SchemaBuilderRegistry]\", \"No suitable Schema Builder plugin found for the provided payload.\");\n return null;\n }\n}\n"],"mappings":"gHAAA,MAOSA,EAAgBC,EAAA,0BAChBC,EAAcC,EAAA,wBACdC,EAAMC,EAAA,UAER,MAAMC,EACTC,gBAAkD,CAC9C,IAAIL,EACJ,IAAIF,GAOR,eAAcQ,CAASC,GACnBC,KAAKC,SAASC,KAAKH,EACvB,CAOA,oBAAcI,CAAcC,GACxB,IAAKA,UAAoBA,IAAc,SAAU,CAC7C,OAAO,IACX,CAEA,IAAK,MAAML,KAAUC,KAAKC,SAAU,CAChC,GAAIF,EAAOM,UAAUD,GAAY,CAC7B,OAAOL,CACX,CACJ,CAEAL,EAAOY,KAAK,0BAA2B,qEACvC,OAAO,IACX,EACH,IAAAC,EAAA,CAAAC,WAAA,MAAAD,EAAAX,wBAAA,OAAAW,CAAA","ignoreList":[]}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * @file SchemaBuilderRegistry.ts
3
+ * @description Singleton registry for Schema Builder plugins.
4
+ * Routes unknown JSON payloads to the appropriate parser plugin.
5
+ */
6
+
7
+ import { ISchemaBuilderPlugin } from "../interfaces/ISchemaBuilderPlugin";
8
+ import { SchemaNormalizer } from "./SchemaNormalizer";
9
+ import { SwaggerBuilder } from "../swagger/SwaggerBuilder";
10
+ import { Logger } from "../utils/Logger";
11
+
12
+ export class SchemaBuilderRegistry {
13
+ private static _plugins: ISchemaBuilderPlugin[] = [
14
+ new SwaggerBuilder(),
15
+ new SchemaNormalizer()
16
+ ];
17
+
18
+ /**
19
+ * Registers a new schema builder plugin into the engine.
20
+ * @param plugin An instance of ISchemaBuilderPlugin
21
+ */
22
+ public static register(plugin: ISchemaBuilderPlugin): void {
23
+ this._plugins.push(plugin);
24
+ }
25
+
26
+ /**
27
+ * Finds the first registered plugin that claims it can handle the payload.
28
+ * @param rawSchema The raw JSON schema object to inspect.
29
+ * @returns The matching plugin instance, or null if none match.
30
+ */
31
+ public static getBuilderFor(rawSchema: any): ISchemaBuilderPlugin | null {
32
+ if (!rawSchema || typeof rawSchema !== "object") {
33
+ return null;
34
+ }
35
+
36
+ for (const plugin of this._plugins) {
37
+ if (plugin.canHandle(rawSchema)) {
38
+ return plugin;
39
+ }
40
+ }
41
+
42
+ Logger.warn("[SchemaBuilderRegistry]", "No suitable Schema Builder plugin found for the provided payload.");
43
+ return null;
44
+ }
45
+ }
@@ -7,6 +7,23 @@ sap.ui.define(["../utils/Logger"], function (___utils_Logger) {
7
7
  */
8
8
  const Logger = ___utils_Logger["Logger"];
9
9
  class SchemaNormalizer {
10
+ /**
11
+ * ISchemaBuilderPlugin Contract
12
+ */
13
+ canHandle(rawSchema) {
14
+ // MetaUI native schemas almost always have properties, items, or a layoutStrategy
15
+ // This acts as a fallback for native schemas.
16
+ if (rawSchema.openapi || rawSchema.swagger) return false;
17
+ return true;
18
+ }
19
+
20
+ /**
21
+ * ISchemaBuilderPlugin Contract
22
+ */
23
+ build(rawSchema) {
24
+ return SchemaNormalizer.normalize(rawSchema);
25
+ }
26
+
10
27
  /**
11
28
  * Validates that the provided raw payload conforms to the required ISchema structures.
12
29
  */
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaNormalizer-dbg.js","names":["Logger","___utils_Logger","SchemaNormalizer","normalize","rawSchema","data","schemaObj","trim","JSON","parse","e","msg","message","error","Error","Array","isArray","inferSchemaFromData","normalized","title","type","items","layoutStrategy","uiLayout","additionalProperties","targetProperties","properties","inferred","deepMergeProperties","requiredKeys","required","normalizeProperties","normalizePropertyMetadata","base","override","merged","key","Object","keys","overrideVal","baseVal","normalizedProps","isRequired","includes","prop","keyName","ui","label","generateLabel","isKey","readOnly","widget","valueHelp","enum","undefined","visibleOn","enabledOn","format","validators","formatter","args","rows","fullWidth","dialogButtonText","maxLength","minLength","minimum","maximum","pattern","precision","scale","multipleOf","name","spaced","replace","split","filter","w","length","map","word","charAt","toUpperCase","slice","toLowerCase","join","schema","inferPropertiesFromObject","obj","val","nestedProps","resolveScope","scope","startsWith","meta","bindingPath","propKey","pathSegments","current","debug","stringify","i","segment","__exports","__esModule"],"sources":["SchemaNormalizer.ts"],"sourcesContent":["/**\n * @file SchemaNormalizer.ts\n * @description Transforms and validates incoming JSON payloads into the strict v2 ISchema dictionary matrix.\n */\n\nimport { ISchema, IPropertyMetadata, FieldType } from \"../interfaces/ISchema\";\nimport { Logger } from \"../utils/Logger\";\n\nexport class SchemaNormalizer {\n\n /**\n * Validates that the provided raw payload conforms to the required ISchema structures.\n */\n public static normalize(rawSchema?: unknown, data?: unknown): ISchema {\n let schemaObj = rawSchema;\n\n if (typeof schemaObj === \"string\") {\n if (!schemaObj.trim()) {\n schemaObj = null;\n } else {\n try {\n schemaObj = JSON.parse(schemaObj);\n } catch (e) {\n const msg = \"Failed to parse schema string: \" + (e as Error).message;\n Logger.error(\"[MetaUI SchemaNormalizer]\", msg);\n throw new Error(msg);\n }\n }\n }\n\n if (!schemaObj || typeof schemaObj !== 'object' || Array.isArray(schemaObj)) {\n return this.inferSchemaFromData(data);\n }\n\n try {\n // It is an object. Ensure it conforms to v2 structure.\n const normalized: ISchema = {\n title: schemaObj.title,\n type: schemaObj.type || (schemaObj.items ? \"array\" : \"object\"),\n layoutStrategy: schemaObj.layoutStrategy,\n uiLayout: schemaObj.uiLayout,\n additionalProperties: schemaObj.additionalProperties\n };\n\n let targetProperties = schemaObj.properties || {};\n\n if (schemaObj.additionalProperties === true && data) {\n const inferred = this.inferSchemaFromData(data);\n if (inferred.type === \"object\" && inferred.properties) {\n targetProperties = this.deepMergeProperties(inferred.properties, targetProperties);\n } else if (inferred.type === \"array\" && inferred.items && inferred.items.properties) {\n // Array schema merging could be added here if we want full support.\n }\n }\n\n if (normalized.type === \"object\") {\n const requiredKeys = Array.isArray(schemaObj.required) ? schemaObj.required : [];\n normalized.properties = this.normalizeProperties(targetProperties, requiredKeys);\n } else if (normalized.type === \"array\") {\n // Future expansion: array deep merge\n normalized.items = this.normalizePropertyMetadata(schemaObj.items || { type: \"object\", properties: {} }, \"items\", false);\n }\n\n return normalized;\n } catch (error) {\n const msg = \"Critical error normalizing schema object: \" + (error as Error).message;\n Logger.error(\"[MetaUI SchemaNormalizer]\", msg);\n throw new Error(msg);\n }\n }\n\n /**\n * Recursively deep merges an inferred schema over a base schema.\n * @param base The base property dictionary.\n * @param override The overriding inferred dictionary.\n * @returns A new deeply merged property dictionary.\n */\n private static deepMergeProperties(base: Record<string, unknown>, override: Record<string, unknown>): Record<string, unknown> {\n const merged = { ...base };\n for (const key of Object.keys(override)) {\n const overrideVal = override[key];\n const baseVal = merged[key];\n\n if (baseVal && typeof baseVal === \"object\" && !Array.isArray(baseVal) &&\n overrideVal && typeof overrideVal === \"object\" && !Array.isArray(overrideVal)) {\n merged[key] = this.deepMergeProperties(baseVal, overrideVal);\n } else {\n merged[key] = overrideVal;\n }\n }\n return merged;\n }\n\n /**\n * Normalizes a collection of properties.\n * @param properties The raw properties map.\n * @param requiredKeys An optional array of keys that are required by the parent object.\n * @returns A map of strict IPropertyMetadata objects.\n */\n private static normalizeProperties(properties: Record<string, unknown>, requiredKeys: string[] = []): Record<string, IPropertyMetadata> {\n const normalizedProps: Record<string, IPropertyMetadata> = {};\n for (const key of Object.keys(properties)) {\n const isRequired = requiredKeys.includes(key);\n normalizedProps[key] = this.normalizePropertyMetadata(properties[key], key, isRequired);\n }\n return normalizedProps;\n }\n\n /**\n * Normalizes a single property against the ISchema specification.\n * @param prop The raw property definition.\n * @param keyName The string key name for generating default labels.\n * @param isRequired Indicates if the parent object mandated this property as required.\n * @returns A strict IPropertyMetadata instance.\n */\n private static normalizePropertyMetadata(prop: Record<string, unknown>, keyName: string, isRequired: boolean = false): IPropertyMetadata {\n const normalized: IPropertyMetadata = {\n type: prop.type || \"string\",\n ui: {\n label: prop.ui?.label || this.generateLabel(keyName),\n isKey: !!prop.ui?.isKey,\n readOnly: !!prop.ui?.readOnly,\n widget: prop.ui?.widget || (prop.valueHelp || prop.enum ? \"select\" : undefined),\n visibleOn: prop.ui?.visibleOn,\n enabledOn: prop.ui?.enabledOn,\n format: prop.ui?.format,\n validators: prop.ui?.validators,\n formatter: prop.ui?.formatter,\n args: prop.ui?.args,\n rows: prop.ui?.rows,\n fullWidth: prop.ui?.fullWidth,\n dialogButtonText: prop.ui?.dialogButtonText\n },\n required: isRequired || !!prop.required,\n maxLength: prop.maxLength as number,\n minLength: prop.minLength as number,\n minimum: prop.minimum,\n maximum: prop.maximum,\n pattern: prop.pattern,\n precision: prop.precision,\n scale: prop.scale,\n multipleOf: prop.multipleOf as number,\n valueHelp: prop.valueHelp,\n enum: prop.enum\n };\n\n if (normalized.type === \"object\" && prop.properties) {\n const requiredKeys = Array.isArray(prop.required) ? prop.required : [];\n normalized.properties = this.normalizeProperties(prop.properties as Record<string, unknown>, requiredKeys);\n normalized.uiLayout = prop.uiLayout;\n } else if (normalized.type === \"array\" && prop.items) {\n normalized.items = this.normalizePropertyMetadata(prop.items as Record<string, unknown>, \"items\", false);\n normalized.uiLayout = prop.uiLayout;\n }\n\n return normalized;\n }\n\n /**\n * Generates a Title Case label from camelCase or snake_case technical names.\n */\n private static generateLabel(name: string): string {\n if (!name) return \"\";\n let spaced = name.replace(/([A-Z])/g, \" $1\").replace(/_/g, \" \");\n return spaced.split(' ')\n .filter(w => w.length > 0)\n .map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())\n .join(' ')\n .trim();\n }\n\n /**\n * Infers a v2 ISchema structure dynamically from a plain data payload.\n */\n public static inferSchemaFromData(data: unknown): ISchema {\n const schema: ISchema = { type: \"object\", properties: {}, layoutStrategy: \"compact\", title: \"\" };\n\n if (!data || typeof data !== \"object\") {\n return schema;\n }\n\n if (Array.isArray(data)) {\n schema.type = \"array\";\n if (data.length > 0 && typeof data[0] !== \"object\") {\n schema.layoutStrategy = \"compact\";\n schema.items = { type: typeof data[0] as FieldType };\n } else {\n schema.layoutStrategy = \"table\";\n schema.items = {\n type: \"object\",\n layoutStrategy: \"compact\",\n properties: data.length > 0 ? this.inferPropertiesFromObject(data[0] as Record<string, unknown>) : {}\n };\n }\n } else {\n schema.type = \"object\";\n schema.properties = this.inferPropertiesFromObject(data);\n }\n\n return schema;\n }\n\n /**\n * Infers field metadata recursively from a raw data object.\n * @param obj The raw JavaScript object.\n * @returns A dictionary of inferred IPropertyMetadata.\n */\n private static inferPropertiesFromObject(obj: Record<string, unknown>): Record<string, IPropertyMetadata> {\n const properties: Record<string, IPropertyMetadata> = {};\n if (!obj || typeof obj !== \"object\") return properties;\n\n for (const key of Object.keys(obj)) {\n const val = obj[key];\n if (val === null || val === undefined) continue;\n\n let type: FieldType = \"string\";\n let items: IPropertyMetadata | undefined;\n let nestedProps: Record<string, IPropertyMetadata> | undefined;\n\n if (typeof val === \"number\") type = \"number\";\n else if (typeof val === \"boolean\") type = \"boolean\";\n else if (Array.isArray(val)) {\n type = \"array\";\n if (val.length > 0 && typeof val[0] !== \"object\") {\n items = {\n type: typeof val[0] as FieldType\n };\n } else {\n items = {\n type: \"object\",\n properties: val.length > 0 ? this.inferPropertiesFromObject(val[0] as Record<string, unknown>) : {}\n };\n }\n } else if (typeof val === \"object\") {\n type = \"object\";\n nestedProps = this.inferPropertiesFromObject(val);\n }\n\n properties[key] = {\n type,\n items,\n properties: nestedProps,\n ui: {\n label: this.generateLabel(key),\n isKey: false,\n readOnly: false,\n widget: type === \"array\" && items?.type !== \"object\" ? \"multiInput\" : undefined\n }\n };\n }\n\n return properties;\n }\n\n /**\n * Resolves a JSON Schema scope (e.g. '#/properties/header/properties/id')\n * against the ISchema, returning the PropertyMetadata and the UI5 binding path.\n */\n public static resolveScope(schema: ISchema, scope: string): { meta: IPropertyMetadata | undefined, bindingPath: string, propKey: string } {\n if (!scope || !scope.startsWith(\"#/properties/\")) {\n return { meta: undefined, bindingPath: scope || \"\", propKey: scope || \"\" };\n }\n \n const pathSegments = scope.replace(\"#/properties/\", \"\").split(\"/properties/\");\n let current: Record<string, IPropertyMetadata> | undefined = schema.properties;\n let meta: IPropertyMetadata | undefined;\n \n Logger.debug(\"[MetaUI SchemaNormalizer]\", `Resolving scope '${scope}' with segments: ${JSON.stringify(pathSegments)}`, \"SchemaNormalizer\");\n Logger.debug(\"[MetaUI SchemaNormalizer]\", `Root schema keys: ${Object.keys(schema.properties || {})}`, \"SchemaNormalizer\");\n\n for (let i = 0; i < pathSegments.length; i++) {\n const segment = pathSegments[i];\n if (!current) {\n Logger.debug(\"[MetaUI SchemaNormalizer]\", `current is undefined at segment '${segment}'`, \"SchemaNormalizer\");\n meta = undefined;\n break;\n }\n meta = current[segment];\n Logger.debug(\"[MetaUI SchemaNormalizer]\", `Segment '${segment}' resolved to meta: ${!!meta}. Available keys in current: ${Object.keys(current)}`, \"SchemaNormalizer\");\n if (i < pathSegments.length - 1) {\n current = meta?.properties;\n }\n }\n \n const bindingPath = pathSegments.join(\"/\");\n const propKey = scope.replace(\"#/properties/\", \"\"); // The original raw string for logging\n \n return {\n meta,\n bindingPath,\n propKey\n };\n }\n}\n"],"mappings":";;;EAAA;AACA;AACA;AACA;EAHA,MAMSA,MAAM,GAAAC,eAAA;EAER,MAAMC,gBAAgB,CAAC;IAE1B;AACJ;AACA;IACI,OAAcC,SAASA,CAACC,SAAmB,EAAEC,IAAc,EAAW;MAClE,IAAIC,SAAS,GAAGF,SAAS;MAEzB,IAAI,OAAOE,SAAS,KAAK,QAAQ,EAAE;QAC/B,IAAI,CAACA,SAAS,CAACC,IAAI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CzD,MAAM,CAACC,IAAI,CAAC4D,OAAO,CAAC,EAAE,EAAE,kBAAkB,CAAC;QACrK,IAAIG,CAAC,GAAGJ,YAAY,CAACnB,MAAM,GAAG,CAAC,EAAE;UAC7BoB,OAAO,GAAGJ,IAAI,EAAEpE,UAAU;QAC9B;MACJ;MAEA,MAAMqE,WAAW,GAAGE,YAAY,CAACZ,IAAI,CAAC,GAAG,CAAC;MAC1C,MAAMW,OAAO,GAAGJ,KAAK,CAAClB,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC,CAAC;;MAEpD,OAAO;QACHoB,IAAI;QACJC,WAAW;QACXC;MACJ,CAAC;IACL;EACJ;EAAC,IAAAO,SAAA;IAAAC,UAAA;EAAA;EAAAD,SAAA,CAAArG,gBAAA,GAAAA,gBAAA;EAAA,OAAAqG,SAAA;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"SchemaNormalizer-dbg.js","names":["Logger","___utils_Logger","SchemaNormalizer","canHandle","rawSchema","openapi","swagger","build","normalize","data","schemaObj","trim","JSON","parse","e","msg","message","error","Error","Array","isArray","inferSchemaFromData","normalized","title","type","items","layoutStrategy","uiLayout","additionalProperties","targetProperties","properties","inferred","deepMergeProperties","requiredKeys","required","normalizeProperties","normalizePropertyMetadata","base","override","merged","key","Object","keys","overrideVal","baseVal","normalizedProps","isRequired","includes","prop","keyName","ui","label","generateLabel","isKey","readOnly","widget","valueHelp","enum","undefined","visibleOn","enabledOn","format","validators","formatter","args","rows","fullWidth","dialogButtonText","maxLength","minLength","minimum","maximum","pattern","precision","scale","multipleOf","name","spaced","replace","split","filter","w","length","map","word","charAt","toUpperCase","slice","toLowerCase","join","schema","inferPropertiesFromObject","obj","val","nestedProps","resolveScope","scope","startsWith","meta","bindingPath","propKey","pathSegments","current","debug","stringify","i","segment","__exports","__esModule"],"sources":["SchemaNormalizer.ts"],"sourcesContent":["/**\n * @file SchemaNormalizer.ts\n * @description Transforms and validates incoming JSON payloads into the strict v2 ISchema dictionary matrix.\n */\n\nimport { ISchema, IPropertyMetadata, FieldType } from \"../interfaces/ISchema\";\nimport { ISchemaBuilderPlugin } from \"../interfaces/ISchemaBuilderPlugin\";\nimport { Logger } from \"../utils/Logger\";\n\nexport class SchemaNormalizer implements ISchemaBuilderPlugin {\n\n /**\n * ISchemaBuilderPlugin Contract\n */\n public canHandle(rawSchema: any): boolean {\n // MetaUI native schemas almost always have properties, items, or a layoutStrategy\n // This acts as a fallback for native schemas.\n if (rawSchema.openapi || rawSchema.swagger) return false; \n return true;\n }\n\n /**\n * ISchemaBuilderPlugin Contract\n */\n public build(rawSchema: any): ISchema {\n return SchemaNormalizer.normalize(rawSchema);\n }\n\n /**\n * Validates that the provided raw payload conforms to the required ISchema structures.\n */\n public static normalize(rawSchema?: unknown, data?: unknown): ISchema {\n let schemaObj = rawSchema;\n\n if (typeof schemaObj === \"string\") {\n if (!schemaObj.trim()) {\n schemaObj = null;\n } else {\n try {\n schemaObj = JSON.parse(schemaObj);\n } catch (e) {\n const msg = \"Failed to parse schema string: \" + (e as Error).message;\n Logger.error(\"[MetaUI SchemaNormalizer]\", msg);\n throw new Error(msg);\n }\n }\n }\n\n if (!schemaObj || typeof schemaObj !== 'object' || Array.isArray(schemaObj)) {\n return this.inferSchemaFromData(data);\n }\n\n try {\n // It is an object. Ensure it conforms to v2 structure.\n const normalized: ISchema = {\n title: schemaObj.title,\n type: schemaObj.type || (schemaObj.items ? \"array\" : \"object\"),\n layoutStrategy: schemaObj.layoutStrategy,\n uiLayout: schemaObj.uiLayout,\n additionalProperties: schemaObj.additionalProperties\n };\n\n let targetProperties = schemaObj.properties || {};\n\n if (schemaObj.additionalProperties === true && data) {\n const inferred = this.inferSchemaFromData(data);\n if (inferred.type === \"object\" && inferred.properties) {\n targetProperties = this.deepMergeProperties(inferred.properties, targetProperties);\n } else if (inferred.type === \"array\" && inferred.items && inferred.items.properties) {\n // Array schema merging could be added here if we want full support.\n }\n }\n\n if (normalized.type === \"object\") {\n const requiredKeys = Array.isArray(schemaObj.required) ? schemaObj.required : [];\n normalized.properties = this.normalizeProperties(targetProperties, requiredKeys);\n } else if (normalized.type === \"array\") {\n // Future expansion: array deep merge\n normalized.items = this.normalizePropertyMetadata(schemaObj.items || { type: \"object\", properties: {} }, \"items\", false);\n }\n\n return normalized;\n } catch (error) {\n const msg = \"Critical error normalizing schema object: \" + (error as Error).message;\n Logger.error(\"[MetaUI SchemaNormalizer]\", msg);\n throw new Error(msg);\n }\n }\n\n /**\n * Recursively deep merges an inferred schema over a base schema.\n * @param base The base property dictionary.\n * @param override The overriding inferred dictionary.\n * @returns A new deeply merged property dictionary.\n */\n private static deepMergeProperties(base: Record<string, unknown>, override: Record<string, unknown>): Record<string, unknown> {\n const merged = { ...base };\n for (const key of Object.keys(override)) {\n const overrideVal = override[key];\n const baseVal = merged[key];\n\n if (baseVal && typeof baseVal === \"object\" && !Array.isArray(baseVal) &&\n overrideVal && typeof overrideVal === \"object\" && !Array.isArray(overrideVal)) {\n merged[key] = this.deepMergeProperties(baseVal, overrideVal);\n } else {\n merged[key] = overrideVal;\n }\n }\n return merged;\n }\n\n /**\n * Normalizes a collection of properties.\n * @param properties The raw properties map.\n * @param requiredKeys An optional array of keys that are required by the parent object.\n * @returns A map of strict IPropertyMetadata objects.\n */\n private static normalizeProperties(properties: Record<string, unknown>, requiredKeys: string[] = []): Record<string, IPropertyMetadata> {\n const normalizedProps: Record<string, IPropertyMetadata> = {};\n for (const key of Object.keys(properties)) {\n const isRequired = requiredKeys.includes(key);\n normalizedProps[key] = this.normalizePropertyMetadata(properties[key], key, isRequired);\n }\n return normalizedProps;\n }\n\n /**\n * Normalizes a single property against the ISchema specification.\n * @param prop The raw property definition.\n * @param keyName The string key name for generating default labels.\n * @param isRequired Indicates if the parent object mandated this property as required.\n * @returns A strict IPropertyMetadata instance.\n */\n private static normalizePropertyMetadata(prop: Record<string, unknown>, keyName: string, isRequired: boolean = false): IPropertyMetadata {\n const normalized: IPropertyMetadata = {\n type: prop.type || \"string\",\n ui: {\n label: prop.ui?.label || this.generateLabel(keyName),\n isKey: !!prop.ui?.isKey,\n readOnly: !!prop.ui?.readOnly,\n widget: prop.ui?.widget || (prop.valueHelp || prop.enum ? \"select\" : undefined),\n visibleOn: prop.ui?.visibleOn,\n enabledOn: prop.ui?.enabledOn,\n format: prop.ui?.format,\n validators: prop.ui?.validators,\n formatter: prop.ui?.formatter,\n args: prop.ui?.args,\n rows: prop.ui?.rows,\n fullWidth: prop.ui?.fullWidth,\n dialogButtonText: prop.ui?.dialogButtonText\n },\n required: isRequired || !!prop.required,\n maxLength: prop.maxLength as number,\n minLength: prop.minLength as number,\n minimum: prop.minimum,\n maximum: prop.maximum,\n pattern: prop.pattern,\n precision: prop.precision,\n scale: prop.scale,\n multipleOf: prop.multipleOf as number,\n valueHelp: prop.valueHelp,\n enum: prop.enum\n };\n\n if (normalized.type === \"object\" && prop.properties) {\n const requiredKeys = Array.isArray(prop.required) ? prop.required : [];\n normalized.properties = this.normalizeProperties(prop.properties as Record<string, unknown>, requiredKeys);\n normalized.uiLayout = prop.uiLayout;\n } else if (normalized.type === \"array\" && prop.items) {\n normalized.items = this.normalizePropertyMetadata(prop.items as Record<string, unknown>, \"items\", false);\n normalized.uiLayout = prop.uiLayout;\n }\n\n return normalized;\n }\n\n /**\n * Generates a Title Case label from camelCase or snake_case technical names.\n */\n private static generateLabel(name: string): string {\n if (!name) return \"\";\n let spaced = name.replace(/([A-Z])/g, \" $1\").replace(/_/g, \" \");\n return spaced.split(' ')\n .filter(w => w.length > 0)\n .map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())\n .join(' ')\n .trim();\n }\n\n /**\n * Infers a v2 ISchema structure dynamically from a plain data payload.\n */\n public static inferSchemaFromData(data: unknown): ISchema {\n const schema: ISchema = { type: \"object\", properties: {}, layoutStrategy: \"compact\", title: \"\" };\n\n if (!data || typeof data !== \"object\") {\n return schema;\n }\n\n if (Array.isArray(data)) {\n schema.type = \"array\";\n if (data.length > 0 && typeof data[0] !== \"object\") {\n schema.layoutStrategy = \"compact\";\n schema.items = { type: typeof data[0] as FieldType };\n } else {\n schema.layoutStrategy = \"table\";\n schema.items = {\n type: \"object\",\n layoutStrategy: \"compact\",\n properties: data.length > 0 ? this.inferPropertiesFromObject(data[0] as Record<string, unknown>) : {}\n };\n }\n } else {\n schema.type = \"object\";\n schema.properties = this.inferPropertiesFromObject(data);\n }\n\n return schema;\n }\n\n /**\n * Infers field metadata recursively from a raw data object.\n * @param obj The raw JavaScript object.\n * @returns A dictionary of inferred IPropertyMetadata.\n */\n private static inferPropertiesFromObject(obj: Record<string, unknown>): Record<string, IPropertyMetadata> {\n const properties: Record<string, IPropertyMetadata> = {};\n if (!obj || typeof obj !== \"object\") return properties;\n\n for (const key of Object.keys(obj)) {\n const val = obj[key];\n if (val === null || val === undefined) continue;\n\n let type: FieldType = \"string\";\n let items: IPropertyMetadata | undefined;\n let nestedProps: Record<string, IPropertyMetadata> | undefined;\n\n if (typeof val === \"number\") type = \"number\";\n else if (typeof val === \"boolean\") type = \"boolean\";\n else if (Array.isArray(val)) {\n type = \"array\";\n if (val.length > 0 && typeof val[0] !== \"object\") {\n items = {\n type: typeof val[0] as FieldType\n };\n } else {\n items = {\n type: \"object\",\n properties: val.length > 0 ? this.inferPropertiesFromObject(val[0] as Record<string, unknown>) : {}\n };\n }\n } else if (typeof val === \"object\") {\n type = \"object\";\n nestedProps = this.inferPropertiesFromObject(val);\n }\n\n properties[key] = {\n type,\n items,\n properties: nestedProps,\n ui: {\n label: this.generateLabel(key),\n isKey: false,\n readOnly: false,\n widget: type === \"array\" && items?.type !== \"object\" ? \"multiInput\" : undefined\n }\n };\n }\n\n return properties;\n }\n\n /**\n * Resolves a JSON Schema scope (e.g. '#/properties/header/properties/id')\n * against the ISchema, returning the PropertyMetadata and the UI5 binding path.\n */\n public static resolveScope(schema: ISchema, scope: string): { meta: IPropertyMetadata | undefined, bindingPath: string, propKey: string } {\n if (!scope || !scope.startsWith(\"#/properties/\")) {\n return { meta: undefined, bindingPath: scope || \"\", propKey: scope || \"\" };\n }\n \n const pathSegments = scope.replace(\"#/properties/\", \"\").split(\"/properties/\");\n let current: Record<string, IPropertyMetadata> | undefined = schema.properties;\n let meta: IPropertyMetadata | undefined;\n \n Logger.debug(\"[MetaUI SchemaNormalizer]\", `Resolving scope '${scope}' with segments: ${JSON.stringify(pathSegments)}`, \"SchemaNormalizer\");\n Logger.debug(\"[MetaUI SchemaNormalizer]\", `Root schema keys: ${Object.keys(schema.properties || {})}`, \"SchemaNormalizer\");\n\n for (let i = 0; i < pathSegments.length; i++) {\n const segment = pathSegments[i];\n if (!current) {\n Logger.debug(\"[MetaUI SchemaNormalizer]\", `current is undefined at segment '${segment}'`, \"SchemaNormalizer\");\n meta = undefined;\n break;\n }\n meta = current[segment];\n Logger.debug(\"[MetaUI SchemaNormalizer]\", `Segment '${segment}' resolved to meta: ${!!meta}. Available keys in current: ${Object.keys(current)}`, \"SchemaNormalizer\");\n if (i < pathSegments.length - 1) {\n current = meta?.properties;\n }\n }\n \n const bindingPath = pathSegments.join(\"/\");\n const propKey = scope.replace(\"#/properties/\", \"\"); // The original raw string for logging\n \n return {\n meta,\n bindingPath,\n propKey\n };\n }\n}\n"],"mappings":";;;EAAA;AACA;AACA;AACA;EAHA,MAOSA,MAAM,GAAAC,eAAA;EAER,MAAMC,gBAAgB,CAAiC;IAE1D;AACJ;AACA;IACWC,SAASA,CAACC,SAAc,EAAW;MACtC;MACA;MACA,IAAIA,SAAS,CAACC,OAAO,IAAID,SAAS,CAACE,OAAO,EAAE,OAAO,KAAK;MACxD,OAAO,IAAI;IACf;;IAEA;AACJ;AACA;IACWC,KAAKA,CAACH,SAAc,EAAW;MAClC,OAAOF,gBAAgB,CAACM,SAAS,CAACJ,SAAS,CAAC;IAChD;;IAEA;AACJ;AACA;IACI,OAAcI,SAASA,CAACJ,SAAmB,EAAEK,IAAc,EAAW;MAClE,IAAIC,SAAS,GAAGN,SAAS;MAEzB,IAAI,O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K,CAAC,2BAA2B,EAAE,YAAYG,OAAO,uBAAuB,CAAC,CAACR,IAAI,gCAAgCzD,MAAM,CAACC,IAAI,CAAC4D,OAAO,CAAC,EAAE,EAAE,kBAAkB,CAAC;QACrK,IAAIG,CAAC,GAAGJ,YAAY,CAACnB,MAAM,GAAG,CAAC,EAAE;UAC7BoB,OAAO,GAAGJ,IAAI,EAAEpE,UAAU;QAC9B;MACJ;MAEA,MAAMqE,WAAW,GAAGE,YAAY,CAACZ,IAAI,CAAC,GAAG,CAAC;MAC1C,MAAMW,OAAO,GAAGJ,KAAK,CAAClB,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC,CAAC;;MAEpD,OAAO;QACHoB,IAAI;QACJC,WAAW;QACXC;MACJ,CAAC;IACL;EACJ;EAAC,IAAAO,SAAA;IAAAC,UAAA;EAAA;EAAAD,SAAA,CAAAzG,gBAAA,GAAAA,gBAAA;EAAA,OAAAyG,SAAA;AAAA","ignoreList":[]}
@@ -4,7 +4,16 @@ declare module "nz/co/siliconst/ui5/metaui/core/SchemaNormalizer" {
4
4
  * @description Transforms and validates incoming JSON payloads into the strict v2 ISchema dictionary matrix.
5
5
  */
6
6
  import { ISchema, IPropertyMetadata } from "nz/co/siliconst/ui5/metaui/interfaces/ISchema";
7
- export class SchemaNormalizer {
7
+ import { ISchemaBuilderPlugin } from "nz/co/siliconst/ui5/metaui/interfaces/ISchemaBuilderPlugin";
8
+ export class SchemaNormalizer implements ISchemaBuilderPlugin {
9
+ /**
10
+ * ISchemaBuilderPlugin Contract
11
+ */
12
+ canHandle(rawSchema: any): boolean;
13
+ /**
14
+ * ISchemaBuilderPlugin Contract
15
+ */
16
+ build(rawSchema: any): ISchema;
8
17
  /**
9
18
  * Validates that the provided raw payload conforms to the required ISchema structures.
10
19
  */
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaNormalizer.d.ts","sourceRoot":"../../../../../../../..","sources":["src/nz/co/siliconst/ui5/metaui/core/SchemaNormalizer.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,kDAAkD,CAAC;IAClE;;;OAGG;IAEH,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAa,MAAM,+CAA+C,CAAC;IAGtG,MAAa,gBAAgB;QAEzB;;WAEG;eACW,SAAS,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO;QA0DrE;;;;;WAKG;QACH,OAAO,CAAC,MAAM,CAAC,mBAAmB;QAgBlC;;;;;WAKG;QACH,OAAO,CAAC,MAAM,CAAC,mBAAmB;QASlC;;;;;;WAMG;QACH,OAAO,CAAC,MAAM,CAAC,yBAAyB;QA2CxC;;WAEG;QACH,OAAO,CAAC,MAAM,CAAC,aAAa;QAU5B;;WAEG;eACW,mBAAmB,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO;QA4BzD;;;;WAIG;QACH,OAAO,CAAC,MAAM,CAAC,yBAAyB;QA+CxC;;;WAGG;eACW,YAAY,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG;YAAE,IAAI,EAAE,iBAAiB,GAAG,SAAS,CAAC;YAAC,WAAW,EAAE,MAAM,CAAC;YAAC,OAAO,EAAE,MAAM,CAAA;SAAE;KAmC5I;CAEA"}
1
+ {"version":3,"file":"SchemaNormalizer.d.ts","sourceRoot":"../../../../../../../..","sources":["src/nz/co/siliconst/ui5/metaui/core/SchemaNormalizer.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,kDAAkD,CAAC;IAClE;;;OAGG;IAEH,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAa,MAAM,+CAA+C,CAAC;IACtG,OAAO,EAAE,oBAAoB,EAAE,MAAM,4DAA4D,CAAC;IAGlG,MAAa,gBAAiB,YAAW,oBAAoB;QAEzD;;WAEG;QACI,SAAS,CAAC,SAAS,EAAE,GAAG,GAAG,OAAO;QAOzC;;WAEG;QACI,KAAK,CAAC,SAAS,EAAE,GAAG,GAAG,OAAO;QAIrC;;WAEG;eACW,SAAS,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO;QA0DrE;;;;;WAKG;QACH,OAAO,CAAC,MAAM,CAAC,mBAAmB;QAgBlC;;;;;WAKG;QACH,OAAO,CAAC,MAAM,CAAC,mBAAmB;QASlC;;;;;;WAMG;QACH,OAAO,CAAC,MAAM,CAAC,yBAAyB;QA2CxC;;WAEG;QACH,OAAO,CAAC,MAAM,CAAC,aAAa;QAU5B;;WAEG;eACW,mBAAmB,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO;QA4BzD;;;;WAIG;QACH,OAAO,CAAC,MAAM,CAAC,yBAAyB;QA+CxC;;;WAGG;eACW,YAAY,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG;YAAE,IAAI,EAAE,iBAAiB,GAAG,SAAS,CAAC;YAAC,WAAW,EAAE,MAAM,CAAC;YAAC,OAAO,EAAE,MAAM,CAAA;SAAE;KAmC5I;CAEA"}
@@ -1,2 +1,2 @@
1
- sap.ui.define(["../utils/Logger"],function(e){"use strict";const t=e["Logger"];class r{static normalize(e,r){let i=e;if(typeof i==="string"){if(!i.trim()){i=null}else{try{i=JSON.parse(i)}catch(e){const r="Failed to parse schema string: "+e.message;t.error("[MetaUI SchemaNormalizer]",r);throw new Error(r)}}}if(!i||typeof i!=="object"||Array.isArray(i)){return this.inferSchemaFromData(r)}try{const e={title:i.title,type:i.type||(i.items?"array":"object"),layoutStrategy:i.layoutStrategy,uiLayout:i.uiLayout,additionalProperties:i.additionalProperties};let t=i.properties||{};if(i.additionalProperties===true&&r){const e=this.inferSchemaFromData(r);if(e.type==="object"&&e.properties){t=this.deepMergeProperties(e.properties,t)}else if(e.type==="array"&&e.items&&e.items.properties){}}if(e.type==="object"){const r=Array.isArray(i.required)?i.required:[];e.properties=this.normalizeProperties(t,r)}else if(e.type==="array"){e.items=this.normalizePropertyMetadata(i.items||{type:"object",properties:{}},"items",false)}return e}catch(e){const r="Critical error normalizing schema object: "+e.message;t.error("[MetaUI SchemaNormalizer]",r);throw new Error(r)}}static deepMergeProperties(e,t){const r={...e};for(const e of Object.keys(t)){const i=t[e];const a=r[e];if(a&&typeof a==="object"&&!Array.isArray(a)&&i&&typeof i==="object"&&!Array.isArray(i)){r[e]=this.deepMergeProperties(a,i)}else{r[e]=i}}return r}static normalizeProperties(e,t=[]){const r={};for(const i of Object.keys(e)){const a=t.includes(i);r[i]=this.normalizePropertyMetadata(e[i],i,a)}return r}static normalizePropertyMetadata(e,t,r=false){const i={type:e.type||"string",ui:{label:e.ui?.label||this.generateLabel(t),isKey:!!e.ui?.isKey,readOnly:!!e.ui?.readOnly,widget:e.ui?.widget||(e.valueHelp||e.enum?"select":undefined),visibleOn:e.ui?.visibleOn,enabledOn:e.ui?.enabledOn,format:e.ui?.format,validators:e.ui?.validators,formatter:e.ui?.formatter,args:e.ui?.args,rows:e.ui?.rows,fullWidth:e.ui?.fullWidth,dialogButtonText:e.ui?.dialogButtonText},required:r||!!e.required,maxLength:e.maxLength,minLength:e.minLength,minimum:e.minimum,maximum:e.maximum,pattern:e.pattern,precision:e.precision,scale:e.scale,multipleOf:e.multipleOf,valueHelp:e.valueHelp,enum:e.enum};if(i.type==="object"&&e.properties){const t=Array.isArray(e.required)?e.required:[];i.properties=this.normalizeProperties(e.properties,t);i.uiLayout=e.uiLayout}else if(i.type==="array"&&e.items){i.items=this.normalizePropertyMetadata(e.items,"items",false);i.uiLayout=e.uiLayout}return i}static generateLabel(e){if(!e)return"";let t=e.replace(/([A-Z])/g," $1").replace(/_/g," ");return t.split(" ").filter(e=>e.length>0).map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" ").trim()}static inferSchemaFromData(e){const t={type:"object",properties:{},layoutStrategy:"compact",title:""};if(!e||typeof e!=="object"){return t}if(Array.isArray(e)){t.type="array";if(e.length>0&&typeof e[0]!=="object"){t.layoutStrategy="compact";t.items={type:typeof e[0]}}else{t.layoutStrategy="table";t.items={type:"object",layoutStrategy:"compact",properties:e.length>0?this.inferPropertiesFromObject(e[0]):{}}}}else{t.type="object";t.properties=this.inferPropertiesFromObject(e)}return t}static inferPropertiesFromObject(e){const t={};if(!e||typeof e!=="object")return t;for(const r of Object.keys(e)){const i=e[r];if(i===null||i===undefined)continue;let a="string";let o;let s;if(typeof i==="number")a="number";else if(typeof i==="boolean")a="boolean";else if(Array.isArray(i)){a="array";if(i.length>0&&typeof i[0]!=="object"){o={type:typeof i[0]}}else{o={type:"object",properties:i.length>0?this.inferPropertiesFromObject(i[0]):{}}}}else if(typeof i==="object"){a="object";s=this.inferPropertiesFromObject(i)}t[r]={type:a,items:o,properties:s,ui:{label:this.generateLabel(r),isKey:false,readOnly:false,widget:a==="array"&&o?.type!=="object"?"multiInput":undefined}}}return t}static resolveScope(e,r){if(!r||!r.startsWith("#/properties/")){return{meta:undefined,bindingPath:r||"",propKey:r||""}}const i=r.replace("#/properties/","").split("/properties/");let a=e.properties;let o;t.debug("[MetaUI SchemaNormalizer]",`Resolving scope '${r}' with segments: ${JSON.stringify(i)}`,"SchemaNormalizer");t.debug("[MetaUI SchemaNormalizer]",`Root schema keys: ${Object.keys(e.properties||{})}`,"SchemaNormalizer");for(let e=0;e<i.length;e++){const r=i[e];if(!a){t.debug("[MetaUI SchemaNormalizer]",`current is undefined at segment '${r}'`,"SchemaNormalizer");o=undefined;break}o=a[r];t.debug("[MetaUI SchemaNormalizer]",`Segment '${r}' resolved to meta: ${!!o}. Available keys in current: ${Object.keys(a)}`,"SchemaNormalizer");if(e<i.length-1){a=o?.properties}}const s=i.join("/");const n=r.replace("#/properties/","");return{meta:o,bindingPath:s,propKey:n}}}var i={__esModule:true};i.SchemaNormalizer=r;return i});
1
+ sap.ui.define(["../utils/Logger"],function(e){"use strict";const t=e["Logger"];class r{canHandle(e){if(e.openapi||e.swagger)return false;return true}build(e){return r.normalize(e)}static normalize(e,r){let i=e;if(typeof i==="string"){if(!i.trim()){i=null}else{try{i=JSON.parse(i)}catch(e){const r="Failed to parse schema string: "+e.message;t.error("[MetaUI SchemaNormalizer]",r);throw new Error(r)}}}if(!i||typeof i!=="object"||Array.isArray(i)){return this.inferSchemaFromData(r)}try{const e={title:i.title,type:i.type||(i.items?"array":"object"),layoutStrategy:i.layoutStrategy,uiLayout:i.uiLayout,additionalProperties:i.additionalProperties};let t=i.properties||{};if(i.additionalProperties===true&&r){const e=this.inferSchemaFromData(r);if(e.type==="object"&&e.properties){t=this.deepMergeProperties(e.properties,t)}else if(e.type==="array"&&e.items&&e.items.properties){}}if(e.type==="object"){const r=Array.isArray(i.required)?i.required:[];e.properties=this.normalizeProperties(t,r)}else if(e.type==="array"){e.items=this.normalizePropertyMetadata(i.items||{type:"object",properties:{}},"items",false)}return e}catch(e){const r="Critical error normalizing schema object: "+e.message;t.error("[MetaUI SchemaNormalizer]",r);throw new Error(r)}}static deepMergeProperties(e,t){const r={...e};for(const e of Object.keys(t)){const i=t[e];const a=r[e];if(a&&typeof a==="object"&&!Array.isArray(a)&&i&&typeof i==="object"&&!Array.isArray(i)){r[e]=this.deepMergeProperties(a,i)}else{r[e]=i}}return r}static normalizeProperties(e,t=[]){const r={};for(const i of Object.keys(e)){const a=t.includes(i);r[i]=this.normalizePropertyMetadata(e[i],i,a)}return r}static normalizePropertyMetadata(e,t,r=false){const i={type:e.type||"string",ui:{label:e.ui?.label||this.generateLabel(t),isKey:!!e.ui?.isKey,readOnly:!!e.ui?.readOnly,widget:e.ui?.widget||(e.valueHelp||e.enum?"select":undefined),visibleOn:e.ui?.visibleOn,enabledOn:e.ui?.enabledOn,format:e.ui?.format,validators:e.ui?.validators,formatter:e.ui?.formatter,args:e.ui?.args,rows:e.ui?.rows,fullWidth:e.ui?.fullWidth,dialogButtonText:e.ui?.dialogButtonText},required:r||!!e.required,maxLength:e.maxLength,minLength:e.minLength,minimum:e.minimum,maximum:e.maximum,pattern:e.pattern,precision:e.precision,scale:e.scale,multipleOf:e.multipleOf,valueHelp:e.valueHelp,enum:e.enum};if(i.type==="object"&&e.properties){const t=Array.isArray(e.required)?e.required:[];i.properties=this.normalizeProperties(e.properties,t);i.uiLayout=e.uiLayout}else if(i.type==="array"&&e.items){i.items=this.normalizePropertyMetadata(e.items,"items",false);i.uiLayout=e.uiLayout}return i}static generateLabel(e){if(!e)return"";let t=e.replace(/([A-Z])/g," $1").replace(/_/g," ");return t.split(" ").filter(e=>e.length>0).map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" ").trim()}static inferSchemaFromData(e){const t={type:"object",properties:{},layoutStrategy:"compact",title:""};if(!e||typeof e!=="object"){return t}if(Array.isArray(e)){t.type="array";if(e.length>0&&typeof e[0]!=="object"){t.layoutStrategy="compact";t.items={type:typeof e[0]}}else{t.layoutStrategy="table";t.items={type:"object",layoutStrategy:"compact",properties:e.length>0?this.inferPropertiesFromObject(e[0]):{}}}}else{t.type="object";t.properties=this.inferPropertiesFromObject(e)}return t}static inferPropertiesFromObject(e){const t={};if(!e||typeof e!=="object")return t;for(const r of Object.keys(e)){const i=e[r];if(i===null||i===undefined)continue;let a="string";let o;let s;if(typeof i==="number")a="number";else if(typeof i==="boolean")a="boolean";else if(Array.isArray(i)){a="array";if(i.length>0&&typeof i[0]!=="object"){o={type:typeof i[0]}}else{o={type:"object",properties:i.length>0?this.inferPropertiesFromObject(i[0]):{}}}}else if(typeof i==="object"){a="object";s=this.inferPropertiesFromObject(i)}t[r]={type:a,items:o,properties:s,ui:{label:this.generateLabel(r),isKey:false,readOnly:false,widget:a==="array"&&o?.type!=="object"?"multiInput":undefined}}}return t}static resolveScope(e,r){if(!r||!r.startsWith("#/properties/")){return{meta:undefined,bindingPath:r||"",propKey:r||""}}const i=r.replace("#/properties/","").split("/properties/");let a=e.properties;let o;t.debug("[MetaUI SchemaNormalizer]",`Resolving scope '${r}' with segments: ${JSON.stringify(i)}`,"SchemaNormalizer");t.debug("[MetaUI SchemaNormalizer]",`Root schema keys: ${Object.keys(e.properties||{})}`,"SchemaNormalizer");for(let e=0;e<i.length;e++){const r=i[e];if(!a){t.debug("[MetaUI SchemaNormalizer]",`current is undefined at segment '${r}'`,"SchemaNormalizer");o=undefined;break}o=a[r];t.debug("[MetaUI SchemaNormalizer]",`Segment '${r}' resolved to meta: ${!!o}. Available keys in current: ${Object.keys(a)}`,"SchemaNormalizer");if(e<i.length-1){a=o?.properties}}const s=i.join("/");const n=r.replace("#/properties/","");return{meta:o,bindingPath:s,propKey:n}}}var i={__esModule:true};i.SchemaNormalizer=r;return i});
2
2
  //# sourceMappingURL=SchemaNormalizer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaNormalizer.js","names":["Logger","___utils_Logger","SchemaNormalizer","normalize","rawSchema","data","schemaObj","trim","JSON","parse","e","msg","message","error","Error","Array","isArray","this","inferSchemaFromData","normalized","title","type","items","layoutStrategy","uiLayout","additionalProperties","targetProperties","properties","inferred","deepMergeProperties","requiredKeys","required","normalizeProperties","normalizePropertyMetadata","base","override","merged","key","Object","keys","overrideVal","baseVal","normalizedProps","isRequired","includes","prop","keyName","ui","label","generateLabel","isKey","readOnly","widget","valueHelp","enum","undefined","visibleOn","enabledOn","format","validators","formatter","args","rows","fullWidth","dialogButtonText","maxLength","minLength","minimum","maximum","pattern","precision","scale","multipleOf","name","spaced","replace","split","filter","w","length","map","word","charAt","toUpperCase","slice","toLowerCase","join","schema","inferPropertiesFromObject","obj","val","nestedProps","resolveScope","scope","startsWith","meta","bindingPath","propKey","pathSegments","current","debug","stringify","i","segment","__exports","__esModule"],"sources":["SchemaNormalizer.ts"],"sourcesContent":["/**\n * @file SchemaNormalizer.ts\n * @description Transforms and validates incoming JSON payloads into the strict v2 ISchema dictionary matrix.\n */\n\nimport { ISchema, IPropertyMetadata, FieldType } from \"../interfaces/ISchema\";\nimport { Logger } from \"../utils/Logger\";\n\nexport class SchemaNormalizer {\n\n /**\n * Validates that the provided raw payload conforms to the required ISchema structures.\n */\n public static normalize(rawSchema?: unknown, data?: unknown): ISchema {\n let schemaObj = rawSchema;\n\n if (typeof schemaObj === \"string\") {\n if (!schemaObj.trim()) {\n schemaObj = null;\n } else {\n try {\n schemaObj = JSON.parse(schemaObj);\n } catch (e) {\n const msg = \"Failed to parse schema string: \" + (e as Error).message;\n Logger.error(\"[MetaUI SchemaNormalizer]\", msg);\n throw new Error(msg);\n }\n }\n }\n\n if (!schemaObj || typeof schemaObj !== 'object' || Array.isArray(schemaObj)) {\n return this.inferSchemaFromData(data);\n }\n\n try {\n // It is an object. Ensure it conforms to v2 structure.\n const normalized: ISchema = {\n title: schemaObj.title,\n type: schemaObj.type || (schemaObj.items ? \"array\" : \"object\"),\n layoutStrategy: schemaObj.layoutStrategy,\n uiLayout: schemaObj.uiLayout,\n additionalProperties: schemaObj.additionalProperties\n };\n\n let targetProperties = schemaObj.properties || {};\n\n if (schemaObj.additionalProperties === true && data) {\n const inferred = this.inferSchemaFromData(data);\n if (inferred.type === \"object\" && inferred.properties) {\n targetProperties = this.deepMergeProperties(inferred.properties, targetProperties);\n } else if (inferred.type === \"array\" && inferred.items && inferred.items.properties) {\n // Array schema merging could be added here if we want full support.\n }\n }\n\n if (normalized.type === \"object\") {\n const requiredKeys = Array.isArray(schemaObj.required) ? schemaObj.required : [];\n normalized.properties = this.normalizeProperties(targetProperties, requiredKeys);\n } else if (normalized.type === \"array\") {\n // Future expansion: array deep merge\n normalized.items = this.normalizePropertyMetadata(schemaObj.items || { type: \"object\", properties: {} }, \"items\", false);\n }\n\n return normalized;\n } catch (error) {\n const msg = \"Critical error normalizing schema object: \" + (error as Error).message;\n Logger.error(\"[MetaUI SchemaNormalizer]\", msg);\n throw new Error(msg);\n }\n }\n\n /**\n * Recursively deep merges an inferred schema over a base schema.\n * @param base The base property dictionary.\n * @param override The overriding inferred dictionary.\n * @returns A new deeply merged property dictionary.\n */\n private static deepMergeProperties(base: Record<string, unknown>, override: Record<string, unknown>): Record<string, unknown> {\n const merged = { ...base };\n for (const key of Object.keys(override)) {\n const overrideVal = override[key];\n const baseVal = merged[key];\n\n if (baseVal && typeof baseVal === \"object\" && !Array.isArray(baseVal) &&\n overrideVal && typeof overrideVal === \"object\" && !Array.isArray(overrideVal)) {\n merged[key] = this.deepMergeProperties(baseVal, overrideVal);\n } else {\n merged[key] = overrideVal;\n }\n }\n return merged;\n }\n\n /**\n * Normalizes a collection of properties.\n * @param properties The raw properties map.\n * @param requiredKeys An optional array of keys that are required by the parent object.\n * @returns A map of strict IPropertyMetadata objects.\n */\n private static normalizeProperties(properties: Record<string, unknown>, requiredKeys: string[] = []): Record<string, IPropertyMetadata> {\n const normalizedProps: Record<string, IPropertyMetadata> = {};\n for (const key of Object.keys(properties)) {\n const isRequired = requiredKeys.includes(key);\n normalizedProps[key] = this.normalizePropertyMetadata(properties[key], key, isRequired);\n }\n return normalizedProps;\n }\n\n /**\n * Normalizes a single property against the ISchema specification.\n * @param prop The raw property definition.\n * @param keyName The string key name for generating default labels.\n * @param isRequired Indicates if the parent object mandated this property as required.\n * @returns A strict IPropertyMetadata instance.\n */\n private static normalizePropertyMetadata(prop: Record<string, unknown>, keyName: string, isRequired: boolean = false): IPropertyMetadata {\n const normalized: IPropertyMetadata = {\n type: prop.type || \"string\",\n ui: {\n label: prop.ui?.label || this.generateLabel(keyName),\n isKey: !!prop.ui?.isKey,\n readOnly: !!prop.ui?.readOnly,\n widget: prop.ui?.widget || (prop.valueHelp || prop.enum ? \"select\" : undefined),\n visibleOn: prop.ui?.visibleOn,\n enabledOn: prop.ui?.enabledOn,\n format: prop.ui?.format,\n validators: prop.ui?.validators,\n formatter: prop.ui?.formatter,\n args: prop.ui?.args,\n rows: prop.ui?.rows,\n fullWidth: prop.ui?.fullWidth,\n dialogButtonText: prop.ui?.dialogButtonText\n },\n required: isRequired || !!prop.required,\n maxLength: prop.maxLength as number,\n minLength: prop.minLength as number,\n minimum: prop.minimum,\n maximum: prop.maximum,\n pattern: prop.pattern,\n precision: prop.precision,\n scale: prop.scale,\n multipleOf: prop.multipleOf as number,\n valueHelp: prop.valueHelp,\n enum: prop.enum\n };\n\n if (normalized.type === \"object\" && prop.properties) {\n const requiredKeys = Array.isArray(prop.required) ? prop.required : [];\n normalized.properties = this.normalizeProperties(prop.properties as Record<string, unknown>, requiredKeys);\n normalized.uiLayout = prop.uiLayout;\n } else if (normalized.type === \"array\" && prop.items) {\n normalized.items = this.normalizePropertyMetadata(prop.items as Record<string, unknown>, \"items\", false);\n normalized.uiLayout = prop.uiLayout;\n }\n\n return normalized;\n }\n\n /**\n * Generates a Title Case label from camelCase or snake_case technical names.\n */\n private static generateLabel(name: string): string {\n if (!name) return \"\";\n let spaced = name.replace(/([A-Z])/g, \" $1\").replace(/_/g, \" \");\n return spaced.split(' ')\n .filter(w => w.length > 0)\n .map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())\n .join(' ')\n .trim();\n }\n\n /**\n * Infers a v2 ISchema structure dynamically from a plain data payload.\n */\n public static inferSchemaFromData(data: unknown): ISchema {\n const schema: ISchema = { type: \"object\", properties: {}, layoutStrategy: \"compact\", title: \"\" };\n\n if (!data || typeof data !== \"object\") {\n return schema;\n }\n\n if (Array.isArray(data)) {\n schema.type = \"array\";\n if (data.length > 0 && typeof data[0] !== \"object\") {\n schema.layoutStrategy = \"compact\";\n schema.items = { type: typeof data[0] as FieldType };\n } else {\n schema.layoutStrategy = \"table\";\n schema.items = {\n type: \"object\",\n layoutStrategy: \"compact\",\n properties: data.length > 0 ? this.inferPropertiesFromObject(data[0] as Record<string, unknown>) : {}\n };\n }\n } else {\n schema.type = \"object\";\n schema.properties = this.inferPropertiesFromObject(data);\n }\n\n return schema;\n }\n\n /**\n * Infers field metadata recursively from a raw data object.\n * @param obj The raw JavaScript object.\n * @returns A dictionary of inferred IPropertyMetadata.\n */\n private static inferPropertiesFromObject(obj: Record<string, unknown>): Record<string, IPropertyMetadata> {\n const properties: Record<string, IPropertyMetadata> = {};\n if (!obj || typeof obj !== \"object\") return properties;\n\n for (const key of Object.keys(obj)) {\n const val = obj[key];\n if (val === null || val === undefined) continue;\n\n let type: FieldType = \"string\";\n let items: IPropertyMetadata | undefined;\n let nestedProps: Record<string, IPropertyMetadata> | undefined;\n\n if (typeof val === \"number\") type = \"number\";\n else if (typeof val === \"boolean\") type = \"boolean\";\n else if (Array.isArray(val)) {\n type = \"array\";\n if (val.length > 0 && typeof val[0] !== \"object\") {\n items = {\n type: typeof val[0] as FieldType\n };\n } else {\n items = {\n type: \"object\",\n properties: val.length > 0 ? this.inferPropertiesFromObject(val[0] as Record<string, unknown>) : {}\n };\n }\n } else if (typeof val === \"object\") {\n type = \"object\";\n nestedProps = this.inferPropertiesFromObject(val);\n }\n\n properties[key] = {\n type,\n items,\n properties: nestedProps,\n ui: {\n label: this.generateLabel(key),\n isKey: false,\n readOnly: false,\n widget: type === \"array\" && items?.type !== \"object\" ? \"multiInput\" : undefined\n }\n };\n }\n\n return properties;\n }\n\n /**\n * Resolves a JSON Schema scope (e.g. '#/properties/header/properties/id')\n * against the ISchema, returning the PropertyMetadata and the UI5 binding path.\n */\n public static resolveScope(schema: ISchema, scope: string): { meta: IPropertyMetadata | undefined, bindingPath: string, propKey: string } {\n if (!scope || !scope.startsWith(\"#/properties/\")) {\n return { meta: undefined, bindingPath: scope || \"\", propKey: scope || \"\" };\n }\n \n const pathSegments = scope.replace(\"#/properties/\", \"\").split(\"/properties/\");\n let current: Record<string, IPropertyMetadata> | undefined = schema.properties;\n let meta: IPropertyMetadata | undefined;\n \n Logger.debug(\"[MetaUI SchemaNormalizer]\", `Resolving scope '${scope}' with segments: ${JSON.stringify(pathSegments)}`, \"SchemaNormalizer\");\n Logger.debug(\"[MetaUI SchemaNormalizer]\", `Root schema keys: ${Object.keys(schema.properties || {})}`, \"SchemaNormalizer\");\n\n for (let i = 0; i < pathSegments.length; i++) {\n const segment = pathSegments[i];\n if (!current) {\n Logger.debug(\"[MetaUI SchemaNormalizer]\", `current is undefined at segment '${segment}'`, \"SchemaNormalizer\");\n meta = undefined;\n break;\n }\n meta = current[segment];\n Logger.debug(\"[MetaUI SchemaNormalizer]\", `Segment '${segment}' resolved to meta: ${!!meta}. Available keys in current: ${Object.keys(current)}`, \"SchemaNormalizer\");\n if (i < pathSegments.length - 1) {\n current = meta?.properties;\n }\n }\n \n const bindingPath = pathSegments.join(\"/\");\n const propKey = scope.replace(\"#/properties/\", \"\"); // The original raw string for logging\n \n return {\n meta,\n bindingPath,\n propKey\n };\n }\n}\n"],"mappings":"2DAAA,MAMSA,EAAMC,EAAA,UAER,MAAMC,EAKT,gBAAcC,CAAUC,EAAqBC,GACzC,IAAIC,EAAYF,EAEhB,UAAWE,IAAc,SAAU,CAC/B,IAAKA,EAAUC,OAAQ,CACnBD,EAAY,IAChB,KAAO,CACH,IACIA,EAAYE,KAAKC,MAAMH,EAC3B,CAAE,MAAOI,GACL,MAAMC,EAAM,kCAAqCD,EAAYE,QAC7DZ,EAAOa,MAAM,4BAA6BF,GAC1C,MAAM,IAAIG,MAAMH,EACpB,CACJ,CACJ,CAEA,IAAKL,UAAoBA,IAAc,UAAYS,MAAMC,QAAQV,GAAY,CACzE,OAAOW,KAAKC,oBAAoBb,EACpC,CAEA,IAEI,MAAMc,EAAsB,CACxBC,MAAOd,EAAUc,MACjBC,KAAMf,EAAUe,OAASf,EAAUgB,MAAQ,QAAU,UACrDC,eAAgBjB,EAAUiB,eAC1BC,SAAUlB,EAAUkB,SACpBC,qBAAsBnB,EAAUmB,sBAGpC,IAAIC,EAAmBpB,EAAUqB,YAAc,CAAC,EAEhD,GAAIrB,EAAUmB,uBAAyB,MAAQpB,EAAM,CACjD,MAAMuB,EAAWX,KAAKC,oBAAoBb,GAC1C,GAAIuB,EAASP,OAAS,UAAYO,EAASD,WAAY,CACnDD,EAAmBT,KAAKY,oBAAoBD,EAASD,WAAYD,EACrE,MAAO,GAAIE,EAASP,OAAS,SAAWO,EAASN,OAASM,EAASN,MAAMK,WAAY,CACjF,CAER,CAEA,GAAIR,EAAWE,OAAS,SAAU,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AAD,EAAAtG,mBAAA,OAAAsG,CAAA","ignoreList":[]}
1
+ {"version":3,"file":"SchemaNormalizer.js","names":["Logger","___utils_Logger","SchemaNormalizer","canHandle","rawSchema","openapi","swagger","build","normalize","data","schemaObj","trim","JSON","parse","e","msg","message","error","Error","Array","isArray","this","inferSchemaFromData","normalized","title","type","items","layoutStrategy","uiLayout","additionalProperties","targetProperties","properties","inferred","deepMergeProperties","requiredKeys","required","normalizeProperties","normalizePropertyMetadata","base","override","merged","key","Object","keys","overrideVal","baseVal","normalizedProps","isRequired","includes","prop","keyName","ui","label","generateLabel","isKey","readOnly","widget","valueHelp","enum","undefined","visibleOn","enabledOn","format","validators","formatter","args","rows","fullWidth","dialogButtonText","maxLength","minLength","minimum","maximum","pattern","precision","scale","multipleOf","name","spaced","replace","split","filter","w","length","map","word","charAt","toUpperCase","slice","toLowerCase","join","schema","inferPropertiesFromObject","obj","val","nestedProps","resolveScope","scope","startsWith","meta","bindingPath","propKey","pathSegments","current","debug","stringify","i","segment","__exports","__esModule"],"sources":["SchemaNormalizer.ts"],"sourcesContent":["/**\n * @file SchemaNormalizer.ts\n * @description Transforms and validates incoming JSON payloads into the strict v2 ISchema dictionary matrix.\n */\n\nimport { ISchema, IPropertyMetadata, FieldType } from \"../interfaces/ISchema\";\nimport { ISchemaBuilderPlugin } from \"../interfaces/ISchemaBuilderPlugin\";\nimport { Logger } from \"../utils/Logger\";\n\nexport class SchemaNormalizer implements ISchemaBuilderPlugin {\n\n /**\n * ISchemaBuilderPlugin Contract\n */\n public canHandle(rawSchema: any): boolean {\n // MetaUI native schemas almost always have properties, items, or a layoutStrategy\n // This acts as a fallback for native schemas.\n if (rawSchema.openapi || rawSchema.swagger) return false; \n return true;\n }\n\n /**\n * ISchemaBuilderPlugin Contract\n */\n public build(rawSchema: any): ISchema {\n return SchemaNormalizer.normalize(rawSchema);\n }\n\n /**\n * Validates that the provided raw payload conforms to the required ISchema structures.\n */\n public static normalize(rawSchema?: unknown, data?: unknown): ISchema {\n let schemaObj = rawSchema;\n\n if (typeof schemaObj === \"string\") {\n if (!schemaObj.trim()) {\n schemaObj = null;\n } else {\n try {\n schemaObj = JSON.parse(schemaObj);\n } catch (e) {\n const msg = \"Failed to parse schema string: \" + (e as Error).message;\n Logger.error(\"[MetaUI SchemaNormalizer]\", msg);\n throw new Error(msg);\n }\n }\n }\n\n if (!schemaObj || typeof schemaObj !== 'object' || Array.isArray(schemaObj)) {\n return this.inferSchemaFromData(data);\n }\n\n try {\n // It is an object. Ensure it conforms to v2 structure.\n const normalized: ISchema = {\n title: schemaObj.title,\n type: schemaObj.type || (schemaObj.items ? \"array\" : \"object\"),\n layoutStrategy: schemaObj.layoutStrategy,\n uiLayout: schemaObj.uiLayout,\n additionalProperties: schemaObj.additionalProperties\n };\n\n let targetProperties = schemaObj.properties || {};\n\n if (schemaObj.additionalProperties === true && data) {\n const inferred = this.inferSchemaFromData(data);\n if (inferred.type === \"object\" && inferred.properties) {\n targetProperties = this.deepMergeProperties(inferred.properties, targetProperties);\n } else if (inferred.type === \"array\" && inferred.items && inferred.items.properties) {\n // Array schema merging could be added here if we want full support.\n }\n }\n\n if (normalized.type === \"object\") {\n const requiredKeys = Array.isArray(schemaObj.required) ? schemaObj.required : [];\n normalized.properties = this.normalizeProperties(targetProperties, requiredKeys);\n } else if (normalized.type === \"array\") {\n // Future expansion: array deep merge\n normalized.items = this.normalizePropertyMetadata(schemaObj.items || { type: \"object\", properties: {} }, \"items\", false);\n }\n\n return normalized;\n } catch (error) {\n const msg = \"Critical error normalizing schema object: \" + (error as Error).message;\n Logger.error(\"[MetaUI SchemaNormalizer]\", msg);\n throw new Error(msg);\n }\n }\n\n /**\n * Recursively deep merges an inferred schema over a base schema.\n * @param base The base property dictionary.\n * @param override The overriding inferred dictionary.\n * @returns A new deeply merged property dictionary.\n */\n private static deepMergeProperties(base: Record<string, unknown>, override: Record<string, unknown>): Record<string, unknown> {\n const merged = { ...base };\n for (const key of Object.keys(override)) {\n const overrideVal = override[key];\n const baseVal = merged[key];\n\n if (baseVal && typeof baseVal === \"object\" && !Array.isArray(baseVal) &&\n overrideVal && typeof overrideVal === \"object\" && !Array.isArray(overrideVal)) {\n merged[key] = this.deepMergeProperties(baseVal, overrideVal);\n } else {\n merged[key] = overrideVal;\n }\n }\n return merged;\n }\n\n /**\n * Normalizes a collection of properties.\n * @param properties The raw properties map.\n * @param requiredKeys An optional array of keys that are required by the parent object.\n * @returns A map of strict IPropertyMetadata objects.\n */\n private static normalizeProperties(properties: Record<string, unknown>, requiredKeys: string[] = []): Record<string, IPropertyMetadata> {\n const normalizedProps: Record<string, IPropertyMetadata> = {};\n for (const key of Object.keys(properties)) {\n const isRequired = requiredKeys.includes(key);\n normalizedProps[key] = this.normalizePropertyMetadata(properties[key], key, isRequired);\n }\n return normalizedProps;\n }\n\n /**\n * Normalizes a single property against the ISchema specification.\n * @param prop The raw property definition.\n * @param keyName The string key name for generating default labels.\n * @param isRequired Indicates if the parent object mandated this property as required.\n * @returns A strict IPropertyMetadata instance.\n */\n private static normalizePropertyMetadata(prop: Record<string, unknown>, keyName: string, isRequired: boolean = false): IPropertyMetadata {\n const normalized: IPropertyMetadata = {\n type: prop.type || \"string\",\n ui: {\n label: prop.ui?.label || this.generateLabel(keyName),\n isKey: !!prop.ui?.isKey,\n readOnly: !!prop.ui?.readOnly,\n widget: prop.ui?.widget || (prop.valueHelp || prop.enum ? \"select\" : undefined),\n visibleOn: prop.ui?.visibleOn,\n enabledOn: prop.ui?.enabledOn,\n format: prop.ui?.format,\n validators: prop.ui?.validators,\n formatter: prop.ui?.formatter,\n args: prop.ui?.args,\n rows: prop.ui?.rows,\n fullWidth: prop.ui?.fullWidth,\n dialogButtonText: prop.ui?.dialogButtonText\n },\n required: isRequired || !!prop.required,\n maxLength: prop.maxLength as number,\n minLength: prop.minLength as number,\n minimum: prop.minimum,\n maximum: prop.maximum,\n pattern: prop.pattern,\n precision: prop.precision,\n scale: prop.scale,\n multipleOf: prop.multipleOf as number,\n valueHelp: prop.valueHelp,\n enum: prop.enum\n };\n\n if (normalized.type === \"object\" && prop.properties) {\n const requiredKeys = Array.isArray(prop.required) ? prop.required : [];\n normalized.properties = this.normalizeProperties(prop.properties as Record<string, unknown>, requiredKeys);\n normalized.uiLayout = prop.uiLayout;\n } else if (normalized.type === \"array\" && prop.items) {\n normalized.items = this.normalizePropertyMetadata(prop.items as Record<string, unknown>, \"items\", false);\n normalized.uiLayout = prop.uiLayout;\n }\n\n return normalized;\n }\n\n /**\n * Generates a Title Case label from camelCase or snake_case technical names.\n */\n private static generateLabel(name: string): string {\n if (!name) return \"\";\n let spaced = name.replace(/([A-Z])/g, \" $1\").replace(/_/g, \" \");\n return spaced.split(' ')\n .filter(w => w.length > 0)\n .map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())\n .join(' ')\n .trim();\n }\n\n /**\n * Infers a v2 ISchema structure dynamically from a plain data payload.\n */\n public static inferSchemaFromData(data: unknown): ISchema {\n const schema: ISchema = { type: \"object\", properties: {}, layoutStrategy: \"compact\", title: \"\" };\n\n if (!data || typeof data !== \"object\") {\n return schema;\n }\n\n if (Array.isArray(data)) {\n schema.type = \"array\";\n if (data.length > 0 && typeof data[0] !== \"object\") {\n schema.layoutStrategy = \"compact\";\n schema.items = { type: typeof data[0] as FieldType };\n } else {\n schema.layoutStrategy = \"table\";\n schema.items = {\n type: \"object\",\n layoutStrategy: \"compact\",\n properties: data.length > 0 ? this.inferPropertiesFromObject(data[0] as Record<string, unknown>) : {}\n };\n }\n } else {\n schema.type = \"object\";\n schema.properties = this.inferPropertiesFromObject(data);\n }\n\n return schema;\n }\n\n /**\n * Infers field metadata recursively from a raw data object.\n * @param obj The raw JavaScript object.\n * @returns A dictionary of inferred IPropertyMetadata.\n */\n private static inferPropertiesFromObject(obj: Record<string, unknown>): Record<string, IPropertyMetadata> {\n const properties: Record<string, IPropertyMetadata> = {};\n if (!obj || typeof obj !== \"object\") return properties;\n\n for (const key of Object.keys(obj)) {\n const val = obj[key];\n if (val === null || val === undefined) continue;\n\n let type: FieldType = \"string\";\n let items: IPropertyMetadata | undefined;\n let nestedProps: Record<string, IPropertyMetadata> | undefined;\n\n if (typeof val === \"number\") type = \"number\";\n else if (typeof val === \"boolean\") type = \"boolean\";\n else if (Array.isArray(val)) {\n type = \"array\";\n if (val.length > 0 && typeof val[0] !== \"object\") {\n items = {\n type: typeof val[0] as FieldType\n };\n } else {\n items = {\n type: \"object\",\n properties: val.length > 0 ? this.inferPropertiesFromObject(val[0] as Record<string, unknown>) : {}\n };\n }\n } else if (typeof val === \"object\") {\n type = \"object\";\n nestedProps = this.inferPropertiesFromObject(val);\n }\n\n properties[key] = {\n type,\n items,\n properties: nestedProps,\n ui: {\n label: this.generateLabel(key),\n isKey: false,\n readOnly: false,\n widget: type === \"array\" && items?.type !== \"object\" ? \"multiInput\" : undefined\n }\n };\n }\n\n return properties;\n }\n\n /**\n * Resolves a JSON Schema scope (e.g. '#/properties/header/properties/id')\n * against the ISchema, returning the PropertyMetadata and the UI5 binding path.\n */\n public static resolveScope(schema: ISchema, scope: string): { meta: IPropertyMetadata | undefined, bindingPath: string, propKey: string } {\n if (!scope || !scope.startsWith(\"#/properties/\")) {\n return { meta: undefined, bindingPath: scope || \"\", propKey: scope || \"\" };\n }\n \n const pathSegments = scope.replace(\"#/properties/\", \"\").split(\"/properties/\");\n let current: Record<string, IPropertyMetadata> | undefined = schema.properties;\n let meta: IPropertyMetadata | undefined;\n \n Logger.debug(\"[MetaUI SchemaNormalizer]\", `Resolving scope '${scope}' with segments: ${JSON.stringify(pathSegments)}`, \"SchemaNormalizer\");\n Logger.debug(\"[MetaUI SchemaNormalizer]\", `Root schema keys: ${Object.keys(schema.properties || {})}`, \"SchemaNormalizer\");\n\n for (let i = 0; i < pathSegments.length; i++) {\n const segment = pathSegments[i];\n if (!current) {\n Logger.debug(\"[MetaUI SchemaNormalizer]\", `current is undefined at segment '${segment}'`, \"SchemaNormalizer\");\n meta = undefined;\n break;\n }\n meta = current[segment];\n Logger.debug(\"[MetaUI SchemaNormalizer]\", `Segment '${segment}' resolved to meta: ${!!meta}. Available keys in current: ${Object.keys(current)}`, \"SchemaNormalizer\");\n if (i < pathSegments.length - 1) {\n current = meta?.properties;\n }\n }\n \n const bindingPath = pathSegments.join(\"/\");\n const propKey = scope.replace(\"#/properties/\", \"\"); // The original raw string for logging\n \n return {\n meta,\n bindingPath,\n propKey\n };\n }\n}\n"],"mappings":"2DAAA,MAOSA,EAAMC,EAAA,UAER,MAAMC,EAKFC,UAAUC,GAGb,GAAIA,EAAUC,SAAWD,EAAUE,QAAS,OAAO,MACnD,OAAO,IACX,CAKOC,MAAMH,GACT,OAAOF,EAAiBM,UAAUJ,EACtC,CAKA,gBAAcI,CAAUJ,EAAqBK,GACzC,IAAIC,EAAYN,EAEhB,UAAWM,IAAc,SAAU,CAC/B,IAAKA,EAAUC,OAAQ,CACnBD,EAAY,IAChB,KAAO,CACH,IACIA,EAAYE,KAAKC,MAAMH,EAC3B,CAAE,MAAOI,GACL,MAAMC,EAAM,kCAAqCD,EAAYE,QAC7DhB,EAAOiB,MAAM,4BAA6BF,GAC1C,MAAM,IAAIG,MAAMH,EACpB,CACJ,CACJ,CAEA,IAAKL,UAAoBA,IAAc,UAAYS,MAAMC,QAAQV,GAAY,CACzE,OAAOW,KAAKC,oBAAoBb,EACpC,CAEA,IAEI,MAAMc,EAAsB,CACxBC,MAAOd,EAAUc,MACjBC,KAAMf,EAAUe,OAASf,EAAUgB,MAAQ,QAAU,UACrDC,eAAgBjB,EAAUiB,eAC1BC,SAAUlB,EAAUkB,SACpBC,qBAAsBnB,EAAUmB,sBAGpC,IAAIC,EAAmBpB,EAAUqB,YAAc,CAAC,EAEhD,GAAIrB,EAAUmB,uBAAyB,MAAQpB,EAAM,CACjD,MAAMuB,EAAWX,KAAKC,oBAAoBb,GAC1C,GAAIuB,EAASP,OAAS,UAAYO,EAASD,WAAY,CACnDD,EAAmBT,KAAKY,oBAAoBD,EAASD,WAA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KACtC,MAAMW,EAAUJ,EAAMlB,QAAQ,gBAAiB,IAE/C,MAAO,CACHoB,OACAC,cACAC,UAER,EACH,IAAAO,EAAA,CAAAC,WAAA,MAAAD,EAAA1G,mBAAA,OAAA0G,CAAA","ignoreList":[]}
@@ -4,9 +4,27 @@
4
4
  */
5
5
 
6
6
  import { ISchema, IPropertyMetadata, FieldType } from "../interfaces/ISchema";
7
+ import { ISchemaBuilderPlugin } from "../interfaces/ISchemaBuilderPlugin";
7
8
  import { Logger } from "../utils/Logger";
8
9
 
9
- export class SchemaNormalizer {
10
+ export class SchemaNormalizer implements ISchemaBuilderPlugin {
11
+
12
+ /**
13
+ * ISchemaBuilderPlugin Contract
14
+ */
15
+ public canHandle(rawSchema: any): boolean {
16
+ // MetaUI native schemas almost always have properties, items, or a layoutStrategy
17
+ // This acts as a fallback for native schemas.
18
+ if (rawSchema.openapi || rawSchema.swagger) return false;
19
+ return true;
20
+ }
21
+
22
+ /**
23
+ * ISchemaBuilderPlugin Contract
24
+ */
25
+ public build(rawSchema: any): ISchema {
26
+ return SchemaNormalizer.normalize(rawSchema);
27
+ }
10
28
 
11
29
  /**
12
30
  * Validates that the provided raw payload conforms to the required ISchema structures.