@openui5/sap.ui.fl 1.128.0 → 1.130.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (187) hide show
  1. package/THIRDPARTY.txt +2 -2
  2. package/package.json +3 -3
  3. package/src/sap/ui/fl/.library +1 -1
  4. package/src/sap/ui/fl/ChangePersistence.js +38 -458
  5. package/src/sap/ui/fl/ChangePersistenceFactory.js +1 -1
  6. package/src/sap/ui/fl/FakeLrepConnectorLocalStorage.js +1 -1
  7. package/src/sap/ui/fl/FakeLrepConnectorSessionStorage.js +1 -1
  8. package/src/sap/ui/fl/FakeLrepLocalStorage.js +1 -1
  9. package/src/sap/ui/fl/FlexController.js +27 -51
  10. package/src/sap/ui/fl/FlexControllerFactory.js +1 -1
  11. package/src/sap/ui/fl/LayerUtils.js +1 -1
  12. package/src/sap/ui/fl/Utils.js +8 -8
  13. package/src/sap/ui/fl/apply/_internal/DelegateMediator.js +1 -1
  14. package/src/sap/ui/fl/apply/_internal/appVariant/DescriptorChangeTypes.js +2 -1
  15. package/src/sap/ui/fl/apply/_internal/changes/Applier.js +152 -197
  16. package/src/sap/ui/fl/apply/_internal/changes/FlexCustomData.js +23 -17
  17. package/src/sap/ui/fl/apply/_internal/changes/Reverter.js +27 -37
  18. package/src/sap/ui/fl/apply/_internal/changes/Utils.js +26 -31
  19. package/src/sap/ui/fl/apply/_internal/changes/descriptor/Preprocessor.js +5 -5
  20. package/src/sap/ui/fl/apply/_internal/changes/descriptor/Registration.js +3 -2
  21. package/src/sap/ui/fl/apply/_internal/changes/descriptor/RegistrationBuild.js +6 -4
  22. package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/AddAnnotationsToOData.js +1 -1
  23. package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/AddNewDataSource.js +152 -0
  24. package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/AddNewInbound.js +12 -18
  25. package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/AddNewOutbound.js +67 -0
  26. package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/AddTechnicalAttributes.js +1 -1
  27. package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/ChangeDataSource.js +1 -1
  28. package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/ChangeInbound.js +11 -9
  29. package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/ChangeOutbound.js +5 -3
  30. package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/RemoveAllInboundsExceptOne.js +1 -1
  31. package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/SetAch.js +1 -1
  32. package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/SetDescription.js +1 -1
  33. package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/SetTitle.js +1 -1
  34. package/src/sap/ui/fl/apply/_internal/changes/descriptor/fiori/SetAbstract.js +1 -1
  35. package/src/sap/ui/fl/apply/_internal/changes/descriptor/fiori/SetCloudDevAdaptationStatus.js +1 -1
  36. package/src/sap/ui/fl/apply/_internal/changes/descriptor/fiori/SetRegistrationIds.js +1 -1
  37. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ovp/AddNewCard.js +1 -1
  38. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ovp/ChangeCard.js +1 -1
  39. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ovp/DeleteCard.js +1 -1
  40. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/AddComponentUsages.js +1 -1
  41. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/AddLibrary.js +1 -1
  42. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/AddNewModel.js +1 -1
  43. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/AddNewModelEnhanceWith.js +1 -1
  44. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/ChangeModel.js +78 -0
  45. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/SetFlexExtensionPointEnabled.js +1 -1
  46. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/SetMinUI5Version.js +1 -1
  47. package/src/sap/ui/fl/apply/_internal/connectors/ObjectStorageUtils.js +1 -1
  48. package/src/sap/ui/fl/apply/_internal/controlVariants/URLHandler.js +18 -5
  49. package/src/sap/ui/fl/apply/_internal/extensionPoint/Processor.js +1 -1
  50. package/src/sap/ui/fl/apply/_internal/extensionPoint/Registry.js +1 -1
  51. package/src/sap/ui/fl/apply/_internal/flexObjects/AnnotationChange.js +2 -2
  52. package/src/sap/ui/fl/apply/_internal/flexObjects/AppDescriptorChange.js +2 -4
  53. package/src/sap/ui/fl/apply/_internal/flexObjects/CompVariant.js +19 -10
  54. package/src/sap/ui/fl/apply/_internal/flexObjects/ControllerExtensionChange.js +4 -3
  55. package/src/sap/ui/fl/apply/_internal/flexObjects/FlVariant.js +4 -3
  56. package/src/sap/ui/fl/apply/_internal/flexObjects/FlexObject.js +16 -12
  57. package/src/sap/ui/fl/apply/_internal/flexObjects/FlexObjectFactory.js +23 -22
  58. package/src/sap/ui/fl/apply/_internal/flexObjects/States.js +4 -3
  59. package/src/sap/ui/fl/apply/_internal/flexObjects/UIChange.js +6 -5
  60. package/src/sap/ui/fl/apply/_internal/flexObjects/UpdatableChange.js +1 -1
  61. package/src/sap/ui/fl/apply/_internal/flexObjects/Variant.js +4 -3
  62. package/src/sap/ui/fl/apply/_internal/flexObjects/getVariantAuthor.js +1 -1
  63. package/src/sap/ui/fl/apply/_internal/flexState/FlexObjectState.js +4 -4
  64. package/src/sap/ui/fl/apply/_internal/flexState/FlexState.js +50 -73
  65. package/src/sap/ui/fl/apply/_internal/flexState/Loader.js +1 -1
  66. package/src/sap/ui/fl/apply/_internal/flexState/ManifestUtils.js +1 -1
  67. package/src/sap/ui/fl/apply/_internal/flexState/UI2Personalization/UI2PersonalizationState.js +1 -1
  68. package/src/sap/ui/fl/apply/_internal/flexState/changes/DependencyHandler.js +1 -1
  69. package/src/sap/ui/fl/apply/_internal/flexState/changes/ExtensionPointState.js +10 -6
  70. package/src/sap/ui/fl/apply/_internal/flexState/changes/UIChangesState.js +1 -1
  71. package/src/sap/ui/fl/apply/_internal/flexState/compVariants/CompVariantManagementState.js +105 -0
  72. package/src/sap/ui/fl/apply/_internal/flexState/compVariants/CompVariantMerger.js +2 -2
  73. package/src/sap/ui/fl/apply/_internal/flexState/compVariants/prepareCompVariantsMap.js +16 -15
  74. package/src/sap/ui/fl/apply/_internal/flexState/controlVariants/Switcher.js +10 -12
  75. package/src/sap/ui/fl/apply/_internal/flexState/controlVariants/VariantManagementState.js +69 -14
  76. package/src/sap/ui/fl/apply/_internal/preprocessors/ComponentLifecycleHooks.js +2 -2
  77. package/src/sap/ui/fl/apply/_internal/preprocessors/ControllerExtension.js +1 -1
  78. package/src/sap/ui/fl/apply/_internal/preprocessors/RegistrationDelegator.js +6 -6
  79. package/src/sap/ui/fl/apply/_internal/preprocessors/XmlPreprocessor.js +1 -1
  80. package/src/sap/ui/fl/apply/api/AnnotationChangeHandlerAPI.js +63 -0
  81. package/src/sap/ui/fl/apply/api/ControlVariantApplyAPI.js +25 -10
  82. package/src/sap/ui/fl/apply/api/SmartVariantManagementApplyAPI.js +18 -45
  83. package/src/sap/ui/fl/changeHandler/AddIFrame.js +4 -4
  84. package/src/sap/ui/fl/changeHandler/AddXML.js +1 -1
  85. package/src/sap/ui/fl/changeHandler/AddXMLAtExtensionPoint.js +2 -1
  86. package/src/sap/ui/fl/changeHandler/Base.js +1 -1
  87. package/src/sap/ui/fl/changeHandler/BaseAddViaDelegate.js +1 -1
  88. package/src/sap/ui/fl/changeHandler/BaseAddXml.js +1 -1
  89. package/src/sap/ui/fl/changeHandler/BaseRename.js +1 -1
  90. package/src/sap/ui/fl/changeHandler/HideControl.js +26 -5
  91. package/src/sap/ui/fl/changeHandler/MoveControls.js +1 -1
  92. package/src/sap/ui/fl/changeHandler/MoveElements.js +1 -1
  93. package/src/sap/ui/fl/changeHandler/PropertyBindingChange.js +1 -1
  94. package/src/sap/ui/fl/changeHandler/PropertyChange.js +1 -1
  95. package/src/sap/ui/fl/changeHandler/StashControl.js +1 -1
  96. package/src/sap/ui/fl/changeHandler/UnhideControl.js +33 -1
  97. package/src/sap/ui/fl/changeHandler/UnstashControl.js +1 -1
  98. package/src/sap/ui/fl/changeHandler/UpdateIFrame.js +1 -1
  99. package/src/sap/ui/fl/descriptorRelated/api/DescriptorChangeFactory.js +14 -13
  100. package/src/sap/ui/fl/descriptorRelated/api/DescriptorInlineChangeFactory.js +1 -1
  101. package/src/sap/ui/fl/descriptorRelated/api/DescriptorVariantFactory.js +1 -1
  102. package/src/sap/ui/fl/designtime/util/editIFrame.js +2 -1
  103. package/src/sap/ui/fl/initial/_internal/FlexConfiguration.js +1 -1
  104. package/src/sap/ui/fl/initial/_internal/Storage.js +46 -8
  105. package/src/sap/ui/fl/initial/_internal/StorageFeaturesMerger.js +1 -1
  106. package/src/sap/ui/fl/initial/_internal/StorageUtils.js +3 -3
  107. package/src/sap/ui/fl/initial/_internal/changeHandlers/ChangeHandlerRegistration.js +25 -2
  108. package/src/sap/ui/fl/initial/_internal/changeHandlers/ChangeHandlerStorage.js +54 -22
  109. package/src/sap/ui/fl/initial/_internal/connectors/Utils.js +1 -1
  110. package/src/sap/ui/fl/initial/_internal/storageResultDisassemble.js +1 -1
  111. package/src/sap/ui/fl/interfaces/BaseLoadConnector.js +15 -1
  112. package/src/sap/ui/fl/interfaces/Delegate.js +1 -1
  113. package/src/sap/ui/fl/library.js +43 -43
  114. package/src/sap/ui/fl/registry/Settings.js +1 -1
  115. package/src/sap/ui/fl/support/_internal/extractChangeDependencies.js +29 -58
  116. package/src/sap/ui/fl/support/_internal/getAllUIChanges.js +1 -1
  117. package/src/sap/ui/fl/support/_internal/getChangeDependencies.js +12 -66
  118. package/src/sap/ui/fl/support/_internal/getFlexObjectInfos.js +7 -4
  119. package/src/sap/ui/fl/support/_internal/getFlexSettings.js +30 -19
  120. package/src/sap/ui/fl/support/api/SupportAPI.js +8 -4
  121. package/src/sap/ui/fl/support/apps/contentbrowser/controller/ContentDetails.controller.js +1 -1
  122. package/src/sap/ui/fl/support/apps/contentbrowser/controller/ContentDetailsEdit.controller.js +1 -1
  123. package/src/sap/ui/fl/support/apps/contentbrowser/controller/LayerContentMaster.controller.js +1 -1
  124. package/src/sap/ui/fl/support/apps/contentbrowser/controller/Layers.controller.js +1 -1
  125. package/src/sap/ui/fl/support/apps/contentbrowser/lrepConnector/LRepConnector.js +1 -1
  126. package/src/sap/ui/fl/support/apps/contentbrowser/utils/DataUtils.js +1 -1
  127. package/src/sap/ui/fl/support/apps/contentbrowser/utils/ErrorUtils.js +1 -1
  128. package/src/sap/ui/fl/transport/TransportSelection.js +1 -1
  129. package/src/sap/ui/fl/util/DescriptorChangeCheck.js +133 -20
  130. package/src/sap/ui/fl/util/IFrame.js +3 -3
  131. package/src/sap/ui/fl/util/ManagedObjectModel.js +1 -1
  132. package/src/sap/ui/fl/util/changePropertyValueByPath.js +15 -4
  133. package/src/sap/ui/fl/util/resolveBinding.js +9 -9
  134. package/src/sap/ui/fl/variants/VariantModel.js +81 -42
  135. package/src/sap/ui/fl/variants/context/controller/ContextVisibility.controller.js +2 -2
  136. package/src/sap/ui/fl/write/_internal/SaveAs.js +12 -3
  137. package/src/sap/ui/fl/write/_internal/Storage.js +6 -6
  138. package/src/sap/ui/fl/write/_internal/Versions.js +7 -3
  139. package/src/sap/ui/fl/write/_internal/appVariant/AppVariant.js +1 -1
  140. package/src/sap/ui/fl/write/_internal/appVariant/AppVariantFactory.js +1 -1
  141. package/src/sap/ui/fl/write/_internal/appVariant/AppVariantInlineChange.js +1 -1
  142. package/src/sap/ui/fl/write/_internal/appVariant/AppVariantInlineChangeFactory.js +34 -1
  143. package/src/sap/ui/fl/write/_internal/condenser/Condenser.js +165 -178
  144. package/src/sap/ui/fl/write/_internal/condenser/UIReconstruction.js +62 -61
  145. package/src/sap/ui/fl/write/_internal/condenser/Utils.js +17 -19
  146. package/src/sap/ui/fl/write/_internal/condenser/classifications/Create.js +13 -13
  147. package/src/sap/ui/fl/write/_internal/condenser/classifications/Destroy.js +17 -19
  148. package/src/sap/ui/fl/write/_internal/condenser/classifications/Move.js +32 -35
  149. package/src/sap/ui/fl/write/_internal/condenser/classifications/Update.js +2 -10
  150. package/src/sap/ui/fl/write/_internal/connectors/BackendConnector.js +1 -1
  151. package/src/sap/ui/fl/write/_internal/connectors/BtpServiceConnector.js +1 -1
  152. package/src/sap/ui/fl/write/_internal/connectors/KeyUserConnector.js +1 -1
  153. package/src/sap/ui/fl/write/_internal/connectors/LrepConnector.js +98 -5
  154. package/src/sap/ui/fl/write/_internal/connectors/NeoLrepConnector.js +1 -1
  155. package/src/sap/ui/fl/write/_internal/connectors/ObjectPathConnector.js +3 -3
  156. package/src/sap/ui/fl/write/_internal/connectors/PersonalizationConnector.js +1 -1
  157. package/src/sap/ui/fl/write/_internal/connectors/Utils.js +1 -1
  158. package/src/sap/ui/fl/write/_internal/controlVariants/ControlVariantWriteUtils.js +59 -0
  159. package/src/sap/ui/fl/write/_internal/delegates/ODataV2ReadDelegate.js +1 -2
  160. package/src/sap/ui/fl/write/_internal/extensionPoint/Processor.js +1 -1
  161. package/src/sap/ui/fl/write/_internal/fieldExtensibility/ABAPAccess.js +1 -1
  162. package/src/sap/ui/fl/write/_internal/fieldExtensibility/ABAPExtensibilityVariant.js +1 -1
  163. package/src/sap/ui/fl/write/_internal/fieldExtensibility/ABAPExtensibilityVariantFactory.js +1 -1
  164. package/src/sap/ui/fl/write/_internal/fieldExtensibility/MultiTenantABAPExtensibilityVariant.js +1 -1
  165. package/src/sap/ui/fl/write/_internal/fieldExtensibility/ServiceValidation.js +1 -1
  166. package/src/sap/ui/fl/write/_internal/fieldExtensibility/SingleTenantABAPExtensibilityVariant.js +122 -77
  167. package/src/sap/ui/fl/write/_internal/fieldExtensibility/UriParser.js +1 -1
  168. package/src/sap/ui/fl/write/_internal/fieldExtensibility/Utils.js +1 -1
  169. package/src/sap/ui/fl/write/_internal/fieldExtensibility/cap/CAPAccess.js +1 -1
  170. package/src/sap/ui/fl/write/_internal/fieldExtensibility/cap/dialog/CustomFieldCAPDialog.js +18 -18
  171. package/src/sap/ui/fl/write/_internal/fieldExtensibility/cap/editor/propertyEditor/booleanEditor/BooleanEditor.js +1 -1
  172. package/src/sap/ui/fl/write/_internal/fieldExtensibility/cap/editor/propertyEditor/rangeEditor/RangeEditor.js +12 -11
  173. package/src/sap/ui/fl/write/_internal/fieldExtensibility/cap/editor/propertyEditor/timeEditor/TimeEditor.js +6 -8
  174. package/src/sap/ui/fl/write/_internal/flexState/FlexObjectManager.js +212 -5
  175. package/src/sap/ui/fl/write/_internal/flexState/UI2Personalization/UI2PersonalizationState.js +1 -1
  176. package/src/sap/ui/fl/write/_internal/flexState/changes/UIChangeManager.js +109 -0
  177. package/src/sap/ui/fl/write/_internal/flexState/compVariants/CompVariantState.js +62 -54
  178. package/src/sap/ui/fl/write/_internal/transport/TransportSelection.js +1 -1
  179. package/src/sap/ui/fl/write/_internal/transport/Transports.js +1 -1
  180. package/src/sap/ui/fl/write/api/ChangesWriteAPI.js +73 -3
  181. package/src/sap/ui/fl/write/api/ContextBasedAdaptationsAPI.js +22 -19
  182. package/src/sap/ui/fl/write/api/ControlPersonalizationWriteAPI.js +56 -30
  183. package/src/sap/ui/fl/write/api/FieldExtensibility.js +1 -1
  184. package/src/sap/ui/fl/write/api/LocalResetAPI.js +17 -27
  185. package/src/sap/ui/fl/write/api/PersistenceWriteAPI.js +28 -51
  186. package/src/sap/ui/fl/write/api/SmartBusinessWriteAPI.js +11 -7
  187. package/src/sap/ui/fl/write/api/VersionsAPI.js +32 -8
@@ -5,11 +5,9 @@
5
5
  */
6
6
 
7
7
  sap.ui.define([
8
- "sap/ui/fl/Utils",
9
8
  "sap/base/Log",
10
9
  "sap/ui/core/CustomData" // needs to be preloaded
11
10
  ], function(
12
- FlUtils,
13
11
  Log
14
12
  ) {
15
13
  "use strict";
@@ -31,9 +29,9 @@ sap.ui.define([
31
29
  * @since 1.61.0
32
30
  * @private
33
31
  * @author SAP SE
34
- * @version 1.128.0
32
+ * @version 1.130.0
35
33
  */
36
- var FlexCustomData = {};
34
+ const FlexCustomData = {};
37
35
 
38
36
  FlexCustomData.appliedChangesCustomDataKey = "sap.ui.fl.appliedChanges";
39
37
  FlexCustomData.failedChangesCustomDataKeyJs = "sap.ui.fl.failedChanges.js";
@@ -41,7 +39,7 @@ sap.ui.define([
41
39
  FlexCustomData.notApplicableChangesCustomDataKey = "sap.ui.fl.notApplicableChanges";
42
40
 
43
41
  function writeCustomData(oControl, sKey, sValue, mPropertyBag) {
44
- var mCustomData = mPropertyBag.modifier.getCustomDataInfo(oControl, sKey);
42
+ const mCustomData = mPropertyBag.modifier.getCustomDataInfo(oControl, sKey);
45
43
  if (!mCustomData.customData) {
46
44
  return mPropertyBag.modifier.createAndAddCustomData(oControl, sKey, sValue, mPropertyBag.appComponent);
47
45
  }
@@ -49,7 +47,7 @@ sap.ui.define([
49
47
  }
50
48
 
51
49
  function getCustomValueData(bSaveRevertData, oChange) {
52
- var vRevertData = oChange.getRevertData();
50
+ const vRevertData = oChange.getRevertData();
53
51
  if (bSaveRevertData && vRevertData !== undefined) {
54
52
  return JSON.stringify(vRevertData);
55
53
  }
@@ -66,7 +64,9 @@ sap.ui.define([
66
64
  * @returns {string|undefined} Custom data or 'undefined'
67
65
  */
68
66
  FlexCustomData.getAppliedCustomDataValue = function(oControl, oChange, oModifier) {
69
- var mCustomData = oModifier.getCustomDataInfo(oControl, FlexCustomData._getCustomDataKey(oChange, FlexCustomData.appliedChangesCustomDataKey));
67
+ const mCustomData = oModifier.getCustomDataInfo(
68
+ oControl, FlexCustomData._getCustomDataKey(oChange, FlexCustomData.appliedChangesCustomDataKey)
69
+ );
70
70
  return mCustomData.customDataValue;
71
71
  };
72
72
 
@@ -80,7 +80,7 @@ sap.ui.define([
80
80
  * @returns {object|undefined} Returns the revert data from the custom data as object or 'undefined'
81
81
  */
82
82
  FlexCustomData.getParsedRevertDataFromCustomData = function(oControl, oChange, oModifier) {
83
- var sCustomDataValue = FlexCustomData.getAppliedCustomDataValue(oControl, oChange, oModifier);
83
+ const sCustomDataValue = FlexCustomData.getAppliedCustomDataValue(oControl, oChange, oModifier);
84
84
  try {
85
85
  return sCustomDataValue && JSON.parse(sCustomDataValue);
86
86
  } catch (oError) {
@@ -99,17 +99,23 @@ sap.ui.define([
99
99
  * @returns {boolean} <code>true</code> if the custom data is there.
100
100
  */
101
101
  FlexCustomData.hasChangeApplyFinishedCustomData = function(oControl, oChange, oModifier) {
102
- var oAppliedCD = oModifier.getCustomDataInfo(oControl, FlexCustomData._getCustomDataKey(oChange, FlexCustomData.appliedChangesCustomDataKey));
102
+ const oAppliedCD = oModifier.getCustomDataInfo(
103
+ oControl, FlexCustomData._getCustomDataKey(oChange, FlexCustomData.appliedChangesCustomDataKey)
104
+ );
103
105
  if (oAppliedCD.customData) {
104
106
  return true;
105
107
  }
106
108
 
107
- var oFailedCD = oModifier.getCustomDataInfo(oControl, FlexCustomData._getCustomDataKey(oChange, FlexCustomData.failedChangesCustomDataKeyJs));
109
+ const oFailedCD = oModifier.getCustomDataInfo(
110
+ oControl, FlexCustomData._getCustomDataKey(oChange, FlexCustomData.failedChangesCustomDataKeyJs)
111
+ );
108
112
  if (oFailedCD.customData) {
109
113
  return true;
110
114
  }
111
115
 
112
- var oNotApplicableCD = oModifier.getCustomDataInfo(oControl, FlexCustomData._getCustomDataKey(oChange, FlexCustomData.notApplicableChangesCustomDataKey));
116
+ const oNotApplicableCD = oModifier.getCustomDataInfo(
117
+ oControl, FlexCustomData._getCustomDataKey(oChange, FlexCustomData.notApplicableChangesCustomDataKey)
118
+ );
113
119
  if (oNotApplicableCD.customData) {
114
120
  return true;
115
121
  }
@@ -131,8 +137,8 @@ sap.ui.define([
131
137
  * @returns {Promise} resolves when custom data is written
132
138
  */
133
139
  FlexCustomData.addAppliedCustomData = function(oControl, oChange, mPropertyBag, bSaveRevertData) {
134
- var sCustomDataValue = getCustomValueData(bSaveRevertData, oChange);
135
- var sCustomDataKey = FlexCustomData._getCustomDataKey(oChange, FlexCustomData.appliedChangesCustomDataKey);
140
+ const sCustomDataValue = getCustomValueData(bSaveRevertData, oChange);
141
+ const sCustomDataKey = FlexCustomData._getCustomDataKey(oChange, FlexCustomData.appliedChangesCustomDataKey);
136
142
  return writeCustomData(oControl, sCustomDataKey, sCustomDataValue, mPropertyBag);
137
143
  };
138
144
 
@@ -150,7 +156,7 @@ sap.ui.define([
150
156
  * @returns {Promise} resolves when custom data is written
151
157
  */
152
158
  FlexCustomData.addFailedCustomData = function(oControl, oChange, mPropertyBag, sIdentifier) {
153
- var sCustomDataKey = FlexCustomData._getCustomDataKey(oChange, sIdentifier);
159
+ const sCustomDataKey = FlexCustomData._getCustomDataKey(oChange, sIdentifier);
154
160
  return writeCustomData(oControl, sCustomDataKey, "true", mPropertyBag);
155
161
  };
156
162
 
@@ -162,8 +168,8 @@ sap.ui.define([
162
168
  * @param {sap.ui.core.util.reflection.BaseTreeModifier} oModifier The control tree modifier
163
169
  */
164
170
  FlexCustomData.destroyAppliedCustomData = function(oControl, oChange, oModifier) {
165
- var sKey = FlexCustomData._getCustomDataKey(oChange, FlexCustomData.appliedChangesCustomDataKey);
166
- var mCustomData = oModifier.getCustomDataInfo(oControl, sKey);
171
+ const sKey = FlexCustomData._getCustomDataKey(oChange, FlexCustomData.appliedChangesCustomDataKey);
172
+ const mCustomData = oModifier.getCustomDataInfo(oControl, sKey);
167
173
  if (mCustomData.customData) {
168
174
  oModifier.destroy(mCustomData.customData);
169
175
  }
@@ -209,4 +215,4 @@ sap.ui.define([
209
215
  };
210
216
 
211
217
  return FlexCustomData;
212
- }, /* bExport= */true);
218
+ });
@@ -23,19 +23,17 @@ sap.ui.define([
23
23
  ) {
24
24
  "use strict";
25
25
 
26
- var Reverter = {};
26
+ const Reverter = {};
27
27
 
28
- function _waitForApplyIfNecessary(oChange) {
28
+ async function waitForApplyIfNecessary(oChange) {
29
29
  if (!oChange.isApplyProcessFinished() && oChange.hasApplyProcessStarted()) {
30
30
  // wait for the change to be applied
31
- return oChange.addPromiseForApplyProcessing().then(function(oResult) {
32
- if (oResult && oResult.error) {
33
- oChange.markRevertFinished(oResult.error);
34
- throw Error(oResult.error);
35
- }
36
- });
31
+ const oResult = await oChange.addPromiseForApplyProcessing();
32
+ if (oResult && oResult.error) {
33
+ oChange.markRevertFinished(oResult.error);
34
+ throw Error(oResult.error);
35
+ }
37
36
  }
38
- return Promise.resolve();
39
37
  }
40
38
 
41
39
  function removeChangeFromMaps(oChange, sReference) {
@@ -63,41 +61,33 @@ sap.ui.define([
63
61
  * @param {object} mPropertyBag.appDescriptor - App descriptor containing the metadata of the current application
64
62
  * @param {sap.ui.core.util.reflection.BaseTreeModifier} mPropertyBag.modifier - Polymorph reuse operations handling the changes on the given view type
65
63
  * @param {sap.ui.core.mvc.View} mPropertyBag.view - View to process
66
- * @returns {Promise|sap.ui.fl.Utils.FakePromise} Resolving Promise/FakePromise with either the control (success) or <code>false</code> (failure) as value
64
+ * @returns {Promise} Resolving Promise with either the control (success) or <code>false</code> (failure) as value
67
65
  */
68
- Reverter.revertChangeOnControl = function(oChange, oControl, mPropertyBag) {
69
- var mControl = Utils.getControlIfTemplateAffected(oChange, oControl, mPropertyBag);
70
- var oChangeHandler;
71
-
72
- return Utils.getChangeHandler(oChange, mControl, mPropertyBag).then(function(oReturnedChangeHandler) {
73
- oChangeHandler = oReturnedChangeHandler;
74
- })
75
- .then(_waitForApplyIfNecessary.bind(null, oChange))
76
- .then(function() {
66
+ Reverter.revertChangeOnControl = async function(oChange, oControl, mPropertyBag) {
67
+ const mControl = Utils.getControlIfTemplateAffected(oChange, oControl, mPropertyBag);
68
+ try {
69
+ const oChangeHandler = await Utils.getChangeHandler(oChange, mControl, mPropertyBag);
70
+ await waitForApplyIfNecessary(oChange);
77
71
  if (oChange.isSuccessfullyApplied()) {
78
72
  oChange.startReverting();
79
- return oChangeHandler.revertChange(oChange, mControl.control, mPropertyBag);
73
+ } else {
74
+ throw Error("Change was never applied");
80
75
  }
81
- throw Error("Change was never applied");
82
- })
83
- .then(function() {
76
+
77
+ await oChangeHandler.revertChange(oChange, mControl.control, mPropertyBag);
84
78
  // After revert the relevant control for the change might have changed, therefore it must be retrieved again (e.g. stashing)
85
79
  mControl.control = mPropertyBag.modifier.bySelector(oChange.getSelector(), mPropertyBag.appComponent, mPropertyBag.view);
86
80
  if (mControl.bTemplateAffected) {
87
- return mPropertyBag.modifier.updateAggregation(mControl.control, oChange.getContent().boundAggregation);
81
+ await mPropertyBag.modifier.updateAggregation(mControl.control, oChange.getContent().boundAggregation);
88
82
  }
89
- return undefined;
90
- })
91
- .then(function() {
92
83
  oChange.markRevertFinished();
93
84
  return mControl.control;
94
- })
95
- .catch(function(oError) {
96
- var sErrorMessage = `Change could not be reverted: ${oError.message}`;
85
+ } catch (oError) {
86
+ const sErrorMessage = `Change could not be reverted: ${oError.message}`;
97
87
  Log.error(sErrorMessage);
98
88
  oChange.markRevertFinished(sErrorMessage);
99
89
  return false;
100
- });
90
+ }
101
91
  };
102
92
 
103
93
  /**
@@ -111,18 +101,18 @@ sap.ui.define([
111
101
  * @returns {Promise|sap.ui.fl.Utils.FakePromise} Promise/FakePromise that resolves as soon as all changes are reverted
112
102
  */
113
103
  Reverter.revertMultipleChanges = function(aChanges, mPropertyBag) {
114
- var aPromiseStack = [];
115
- aChanges.forEach(function(oChange) {
104
+ const aPromiseStack = [];
105
+ aChanges.forEach((oChange) => {
116
106
  // Queued 'state' will be removed once the revert process is done
117
107
  oChange.setQueuedForRevert();
118
- aPromiseStack.push(function() {
119
- var oSelector = oChange.getSelector && oChange.getSelector();
120
- var oControl = mPropertyBag.modifier.bySelector(oSelector, mPropertyBag.appComponent);
108
+ aPromiseStack.push(() => {
109
+ const oSelector = oChange.getSelector && oChange.getSelector();
110
+ const oControl = mPropertyBag.modifier.bySelector(oSelector, mPropertyBag.appComponent);
121
111
  if (!oControl) {
122
112
  removeChangeFromMaps(oChange, mPropertyBag.reference);
123
113
  return (FlUtils.FakePromise ? new FlUtils.FakePromise() : Promise.resolve());
124
114
  }
125
- var mRevertProperties = {
115
+ const mRevertProperties = {
126
116
  modifier: mPropertyBag.modifier,
127
117
  appComponent: mPropertyBag.appComponent,
128
118
  view: FlUtils.getViewForControl(oControl)
@@ -22,7 +22,7 @@ sap.ui.define([
22
22
  *
23
23
  * @namespace sap.ui.fl.apply._internal.changes.Utils
24
24
  * @since 1.70
25
- * @version 1.128.0
25
+ * @version 1.130.0
26
26
  * @private
27
27
  * @ui5-restricted sap.ui.fl.apply._internal, sap.ui.fl.write._internal
28
28
  */
@@ -36,7 +36,7 @@ sap.ui.define([
36
36
  return true;
37
37
  }
38
38
 
39
- var Utils = {
39
+ const Utils = {
40
40
  /**
41
41
  * Returns the control map containing control, controlType, bTemplateAffected and originalControl
42
42
  *
@@ -45,16 +45,16 @@ sap.ui.define([
45
45
  * @param {object} mPropertyBag - Contains additional data that are needed for reading of changes
46
46
  * @param {sap.ui.core.util.reflection.BaseTreeModifier} mPropertyBag.modifier - Control tree modifier
47
47
  * @param {sap.ui.core.Component} mPropertyBag.appComponent - Component instance that is currently loading
48
- * @param {object} mPropertyBag.view - The currenty loaded view
48
+ * @param {object} mPropertyBag.view - The currently loaded view
49
49
  * @returns {object} Contains the information about the control
50
50
  * @private
51
51
  */
52
52
  getControlIfTemplateAffected(oChange, oControl, mPropertyBag) {
53
- var oModifier = mPropertyBag.modifier;
54
- var mControl = {
53
+ const oModifier = mPropertyBag.modifier;
54
+ const mControl = {
55
55
  originalControl: oControl
56
56
  };
57
- var oOriginalDependentSelector = oChange.getOriginalSelector();
57
+ const oOriginalDependentSelector = oChange.getOriginalSelector();
58
58
  if (oChange.getContent().boundAggregation && oOriginalDependentSelector) {
59
59
  mControl.control = oModifier.bySelector(oOriginalDependentSelector, mPropertyBag.appComponent, mPropertyBag.view);
60
60
  mControl.controlType = oModifier.getControlType(mControl.control);
@@ -79,38 +79,33 @@ sap.ui.define([
79
79
  * @param {sap.ui.core.util.reflection.BaseTreeModifier} mPropertyBag.modifier - Control tree modifier
80
80
  * @returns {Promise} Promise resolving with the change handler or an empty object
81
81
  */
82
- getChangeHandler(oChange, mControl, mPropertyBag) {
83
- var oLibraryNamePromise = mPropertyBag.modifier.getLibraryName(mControl.control);
82
+ async getChangeHandler(oChange, mControl, mPropertyBag) {
83
+ const sLibraryName = await mPropertyBag.modifier.getLibraryName(mControl.control);
84
84
  // the ChangeHandlerRegistration includes all the predefined ChangeHandlers.
85
85
  // With this as a standard import the ChangeHandlers would not be able to access API classes due to circular dependencies.
86
86
  // TODO should be removed as soon as the ChangePersistence / FlexController are gone
87
- return Promise.all([
88
- requireAsync("sap/ui/fl/initial/_internal/changeHandlers/ChangeHandlerRegistration"),
89
- oLibraryNamePromise
90
- ])
91
- .then(function(aPromiseValues) {
92
- return aPromiseValues[0].waitForChangeHandlerRegistration(aPromiseValues[1]);
93
- })
94
- .then(function() {
95
- var sChangeType = oChange.getChangeType();
96
- var sLayer = oChange.getLayer();
97
- return ChangeHandlerStorage.getChangeHandler(sChangeType, mControl.controlType, mControl.control, mPropertyBag.modifier, sLayer);
98
- });
87
+ const ChangeHandlerRegistration = await requireAsync("sap/ui/fl/initial/_internal/changeHandlers/ChangeHandlerRegistration");
88
+ await ChangeHandlerRegistration.waitForChangeHandlerRegistration(sLibraryName);
89
+ const sChangeType = oChange.getChangeType();
90
+ const sLayer = oChange.getLayer();
91
+ return ChangeHandlerStorage.getChangeHandler(
92
+ sChangeType, mControl.controlType, mControl.control, mPropertyBag.modifier, sLayer
93
+ );
99
94
  },
100
95
 
101
96
  checkIfDependencyIsStillValid(oAppComponent, oModifier, mChangesMap, sChangeId) {
102
- var oChange = FlUtils.getChangeFromChangesMap(mChangesMap.mChanges, sChangeId);
97
+ const oChange = FlUtils.getChangeFromChangesMap(mChangesMap.mChanges, sChangeId);
103
98
  // Change could be deleted after a save (condensing) so it is no longer a relevant dependency
104
99
  if (!oChange) {
105
100
  return false;
106
101
  }
107
- var oControl = oModifier.bySelector(oChange.getSelector(), oAppComponent);
102
+ const oControl = oModifier.bySelector(oChange.getSelector(), oAppComponent);
108
103
  // if the control is currently not available,
109
104
  // the change is also not applied anymore and the dependency is still valid
110
105
  if (!oControl) {
111
106
  return true;
112
107
  }
113
- var bHasChangeApplyFinishedCustomData = FlexCustomData.hasChangeApplyFinishedCustomData(oControl, oChange, oModifier);
108
+ const bHasChangeApplyFinishedCustomData = FlexCustomData.hasChangeApplyFinishedCustomData(oControl, oChange, oModifier);
114
109
  return isDependencyStillValid(oChange, bHasChangeApplyFinishedCustomData);
115
110
  },
116
111
 
@@ -125,19 +120,19 @@ sap.ui.define([
125
120
  * @returns {boolean} <code>true</code> if the change belongs to the given view
126
121
  */
127
122
  isChangeInView(mPropertyBag, oChange) {
128
- var oModifier = mPropertyBag.modifier;
129
- var oAppComponent = mPropertyBag.appComponent;
130
- var oSelector = oChange.getSelector();
123
+ const oModifier = mPropertyBag.modifier;
124
+ const oAppComponent = mPropertyBag.appComponent;
125
+ const oSelector = oChange.getSelector();
131
126
  if (!oSelector) {
132
127
  return false;
133
128
  }
134
129
  if (oSelector.viewSelector) {
135
- var sSelectorViewId = oModifier.getControlIdBySelector(oSelector.viewSelector, oAppComponent);
130
+ const sSelectorViewId = oModifier.getControlIdBySelector(oSelector.viewSelector, oAppComponent);
136
131
  return sSelectorViewId === mPropertyBag.viewId;
137
132
  }
138
- var sSelectorId = oSelector.id;
133
+ const sSelectorId = oSelector.id;
139
134
  if (sSelectorId) {
140
- var sViewId;
135
+ let sViewId;
141
136
  if (oChange.getSelector().idIsLocal) {
142
137
  if (oAppComponent) {
143
138
  sViewId = oAppComponent.getLocalId(mPropertyBag.viewId);
@@ -145,8 +140,8 @@ sap.ui.define([
145
140
  } else {
146
141
  sViewId = mPropertyBag.viewId;
147
142
  }
148
- var iIndex = 0;
149
- var sSelectorIdViewPrefix;
143
+ let iIndex = 0;
144
+ let sSelectorIdViewPrefix;
150
145
  do {
151
146
  iIndex = sSelectorId.indexOf("--", iIndex);
152
147
  sSelectorIdViewPrefix = sSelectorId.slice(0, iIndex);
@@ -27,7 +27,7 @@ sap.ui.define([
27
27
  *
28
28
  * @namespace sap.ui.fl.apply._internal.changes.descriptor.Preprocessor
29
29
  * @since 1.74
30
- * @version 1.128.0
30
+ * @version 1.130.0
31
31
  * @private
32
32
  * @ui5-restricted sap.ui.fl.apply._internal
33
33
  */
@@ -50,8 +50,8 @@ sap.ui.define([
50
50
 
51
51
  Measurement.start("flexStateInitialize", "Initialization of flex state", ["sap.ui.fl"]);
52
52
 
53
- var oComponentData = oConfig.componentData || {};
54
- var sReference = ManifestUtils.getFlexReference({
53
+ const oComponentData = oConfig.componentData || {};
54
+ const sReference = ManifestUtils.getFlexReference({
55
55
  manifest: oManifest,
56
56
  componentData: oComponentData
57
57
  });
@@ -80,8 +80,8 @@ sap.ui.define([
80
80
  }).then(function() {
81
81
  Measurement.end("flexStateInitialize");
82
82
  Measurement.start("flexAppDescriptorMerger", "Client side app descriptor merger", ["sap.ui.fl"]);
83
- var oUpdatedManifest = Object.assign({}, oManifest);
84
- var aAppDescriptorChanges = FlexState.getAppDescriptorChanges(sReference);
83
+ const oUpdatedManifest = { ...oManifest };
84
+ const aAppDescriptorChanges = FlexState.getAppDescriptorChanges(sReference);
85
85
  return Applier.applyChanges(oUpdatedManifest, aAppDescriptorChanges, ApplyStrategyFactory.getRuntimeStrategy());
86
86
  }).then(function(oManifest) {
87
87
  Measurement.end("flexAppDescriptorMerger");
@@ -17,7 +17,7 @@ sap.ui.define([
17
17
  *
18
18
  * @namespace sap.ui.fl.apply._internal.changes.descriptor.Registration
19
19
  * @since 1.74
20
- * @version 1.128.0
20
+ * @version 1.130.0
21
21
  * @private
22
22
  * @ui5-restricted sap.ui.fl.apply._internal
23
23
  */
@@ -30,7 +30,8 @@ sap.ui.define([
30
30
  appdescr_ovp_removeCard: requireAsync.bind(this, "sap/ui/fl/apply/_internal/changes/descriptor/ovp/DeleteCard"),
31
31
  appdescr_ui_generic_app_addNewObjectPage: requireAsync.bind(this, "sap/suite/ui/generic/template/manifestMerger/AddNewObjectPage"),
32
32
  appdescr_ui_generic_app_changePageConfiguration: requireAsync.bind(this, "sap/suite/ui/generic/template/manifestMerger/ChangePageConfiguration"),
33
- appdescr_fe_changePageConfiguration: requireAsync.bind(this, "sap/fe/core/manifestMerger/ChangePageConfiguration")
33
+ appdescr_fe_changePageConfiguration: requireAsync.bind(this, "sap/fe/core/manifestMerger/ChangePageConfiguration"),
34
+ appdescr_fe_addNewPage: requireAsync.bind(this, "sap/fe/core/manifestMerger/AddNewPage")
34
35
  };
35
36
  return Registration;
36
37
  });
@@ -20,14 +20,15 @@ sap.ui.define([
20
20
  *
21
21
  * @namespace sap.ui.fl.apply._internal.changes.descriptor.RegistrationBuild
22
22
  * @since 1.77
23
- * @version 1.128.0
23
+ * @version 1.130.0
24
24
  * @private
25
25
  * @ui5-restricted sap.ui.fl.apply._internal
26
26
  */
27
- var RegistrationBuild = {
27
+ const RegistrationBuild = {
28
28
  appdescr_app_changeDataSource: requireAsync.bind(this, "sap/ui/fl/apply/_internal/changes/descriptor/app/ChangeDataSource"),
29
29
  appdescr_ui5_addNewModelEnhanceWith: requireAsync.bind(this, "sap/ui/fl/apply/_internal/changes/descriptor/ui5/AddNewModelEnhanceWith"),
30
30
  appdescr_ui5_addComponentUsages: requireAsync.bind(this, "sap/ui/fl/apply/_internal/changes/descriptor/ui5/AddComponentUsages"),
31
+ appdescr_ui5_changeModel: requireAsync.bind(this, "sap/ui/fl/apply/_internal/changes/descriptor/ui5/ChangeModel"),
31
32
  appdescr_ui5_setMinUI5Version: requireAsync.bind(this, "sap/ui/fl/apply/_internal/changes/descriptor/ui5/SetMinUI5Version"),
32
33
  appdescr_fiori_setRegistrationIds: requireAsync.bind(this, "sap/ui/fl/apply/_internal/changes/descriptor/fiori/SetRegistrationIds"),
33
34
  appdescr_ui5_setFlexExtensionPointEnabled: requireAsync.bind(this, "sap/ui/fl/apply/_internal/changes/descriptor/ui5/SetFlexExtensionPointEnabled"),
@@ -37,12 +38,13 @@ sap.ui.define([
37
38
  appdescr_app_changeInbound: requireAsync.bind(this, "sap/ui/fl/apply/_internal/changes/descriptor/app/ChangeInbound"),
38
39
  appdescr_app_changeOutbound: requireAsync.bind(this, "sap/ui/fl/apply/_internal/changes/descriptor/app/ChangeOutbound"),
39
40
  appdescr_app_addNewInbound: requireAsync.bind(this, "sap/ui/fl/apply/_internal/changes/descriptor/app/AddNewInbound"),
41
+ appdescr_app_addNewOutbound: requireAsync.bind(this, "sap/ui/fl/apply/_internal/changes/descriptor/app/AddNewOutbound"),
42
+ appdescr_app_addNewDataSource: requireAsync.bind(this, "sap/ui/fl/apply/_internal/changes/descriptor/app/AddNewDataSource"),
40
43
  appdescr_app_setAch: requireAsync.bind(this, "sap/ui/fl/apply/_internal/changes/descriptor/app/SetAch"),
41
44
  appdescr_app_addTechnicalAttributes: requireAsync.bind(this, "sap/ui/fl/apply/_internal/changes/descriptor/app/AddTechnicalAttributes"),
42
45
  appdescr_fiori_setAbstract: requireAsync.bind(this, "sap/ui/fl/apply/_internal/changes/descriptor/fiori/SetAbstract"),
43
46
  appdescr_fiori_setCloudDevAdaptationStatus: requireAsync.bind(this, "sap/ui/fl/apply/_internal/changes/descriptor/fiori/SetCloudDevAdaptationStatus")
44
47
  };
45
48
 
46
- var RegistrationCopy = Object.assign({}, Registration);
47
- return Object.assign(RegistrationCopy, RegistrationBuild);
49
+ return { ...Registration, ...RegistrationBuild };
48
50
  });
@@ -135,7 +135,7 @@ sap.ui.define([
135
135
  * @namespace
136
136
  * @alias sap.ui.fl.apply._internal.changes.descriptor.app.AddAnnotationsToOData
137
137
  * @since 1.87
138
- * @version 1.128.0
138
+ * @version 1.130.0
139
139
  * @private
140
140
  * @ui5-restricted sap.ui.fl.apply._internal
141
141
  */
@@ -0,0 +1,152 @@
1
+
2
+ /*!
3
+ * OpenUI5
4
+ * (c) Copyright 2009-2024 SAP SE or an SAP affiliate company.
5
+ * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
6
+ */
7
+
8
+ sap.ui.define([
9
+ "sap/ui/fl/util/DescriptorChangeCheck"
10
+ ], function(
11
+ DescriptorChangeCheck
12
+ ) {
13
+ "use strict";
14
+
15
+ const MANDATORY_PROPERTIES = ["uri"];
16
+ const SUPPORTED_PROPERTIES = [...MANDATORY_PROPERTIES, "type", "settings", "customType"];
17
+ const PROPERTIES_PATTERNS = {
18
+ type: "^(OData|ODataAnnotation|INA|XML|JSON|FHIR|WebSocket|http)$",
19
+ customType: "^false$"
20
+ };
21
+ const SUPPORTED_TYPES = {
22
+ uri: typeof "string",
23
+ type: typeof "string",
24
+ settings: typeof {},
25
+ dataSourceCustom: typeof false,
26
+ annotations: typeof []
27
+ };
28
+
29
+ function isDataSourceIdExistingInManifest(oManifestDataSources, sDataSourceId) {
30
+ return Object.keys(oManifestDataSources).includes(sDataSourceId);
31
+ }
32
+
33
+ function getDataSourceType(oDataSource) {
34
+ return oDataSource.type || "OData";
35
+ }
36
+
37
+ function getDataSourceNameByType(oChangeDataSource, sType) {
38
+ const [sDataSourceName] = Object.entries(oChangeDataSource).find(([, oDataSource]) => getDataSourceType(oDataSource) === sType) || [];
39
+ return sDataSourceName;
40
+ }
41
+
42
+ function checkDefinedAnnotationsExistInManifest(oManifestDataSources, sDataSourceOfTypeOData, aToBeCheckedInManifestAnnotations) {
43
+ aToBeCheckedInManifestAnnotations.forEach(function(sAnnotation) {
44
+ if (!isDataSourceIdExistingInManifest(oManifestDataSources, sAnnotation)) {
45
+ throw new Error(`Referenced annotation '${sAnnotation}' in the annotation array of data source '${sDataSourceOfTypeOData}' does not exist in the manifest.`);
46
+ }
47
+ });
48
+ }
49
+
50
+ function checksWhenAddingTwoDataSources(oManifestDataSources, oChangeDataSource) {
51
+ const sDataSourceOfTypeOData = getDataSourceNameByType(oChangeDataSource, "OData");
52
+ const sDataSourceOfTypeODataAnnotation = getDataSourceNameByType(oChangeDataSource, "ODataAnnotation");
53
+
54
+ if (!(sDataSourceOfTypeOData && sDataSourceOfTypeODataAnnotation)) {
55
+ throw new Error(`When adding two data sources it is only allwoed to add a data source with type 'OData' and the other one must be of type 'ODataAnnotation'.`);
56
+ }
57
+
58
+ if (!oChangeDataSource[sDataSourceOfTypeOData]?.settings?.annotations?.includes(sDataSourceOfTypeODataAnnotation)) {
59
+ throw new Error(`Data source '${sDataSourceOfTypeOData}' does not include annotation '${sDataSourceOfTypeODataAnnotation}' under 'settings/annotations' array.`);
60
+ }
61
+
62
+ const aToBeCheckedInManifestAnnotations = oChangeDataSource[sDataSourceOfTypeOData].settings.annotations.filter(function(sAnnotation) {
63
+ return sAnnotation !== sDataSourceOfTypeODataAnnotation;
64
+ });
65
+ checkDefinedAnnotationsExistInManifest(oManifestDataSources, sDataSourceOfTypeOData, aToBeCheckedInManifestAnnotations);
66
+ }
67
+
68
+ function checksWhenAddingOneDataSource(oManifestDataSources, oChangeDataSource) {
69
+ const sDataSourceOfTypeOData = getDataSourceNameByType(oChangeDataSource, "OData");
70
+ if (oChangeDataSource[sDataSourceOfTypeOData].settings?.annotations) {
71
+ checkDefinedAnnotationsExistInManifest(oManifestDataSources, sDataSourceOfTypeOData, oChangeDataSource[sDataSourceOfTypeOData].settings.annotations);
72
+ }
73
+ }
74
+
75
+ function postChecks(oManifestDataSources, oChangeDataSource, aDataSources) {
76
+ aDataSources.forEach(function(sDataSource) {
77
+ if (isDataSourceIdExistingInManifest(oManifestDataSources, sDataSource)) {
78
+ throw new Error(`There is already a dataSource '${sDataSource}' existing in the manifest.`);
79
+ }
80
+
81
+ checkIfAnnotationsPropertyIsAnArray(oChangeDataSource, sDataSource);
82
+ });
83
+ if (aDataSources.length === 1) {
84
+ checksWhenAddingOneDataSource(oManifestDataSources, oChangeDataSource);
85
+ }
86
+ if (aDataSources.length === 2) {
87
+ checksWhenAddingTwoDataSources(oManifestDataSources, oChangeDataSource);
88
+ }
89
+ }
90
+
91
+ function checkIfAnnotationsPropertyIsAnArray(oChangeDataSource, sDataSource) {
92
+ const sDataSourceType = getDataSourceType(oChangeDataSource[sDataSource]);
93
+
94
+ if (oChangeDataSource[sDataSource].settings?.annotations) {
95
+ if (sDataSourceType !== "OData") {
96
+ throw new Error(`Data source '${sDataSource}' which is of type '${sDataSourceType}' contains the annotations array. Only data sources with type 'OData' could contain the 'settings/annotations' array.`);
97
+ }
98
+
99
+ if (!Array.isArray(oChangeDataSource[sDataSource].settings.annotations)) {
100
+ throw new Error(`Property 'annotations' must be of type 'array'.`);
101
+ }
102
+ }
103
+ }
104
+
105
+ /**
106
+ * Descriptor change merger for change type <code>appdescr_app_addNewDataSource</code>.
107
+ * Adds a new data source to the manifest.json file under the path sap.app.dataSources.
108
+ *
109
+ * Available only for build {@link sap.ui.fl.apply._internal.changes.descriptor.RegistrationBuild}.
110
+ *
111
+ * @namespace
112
+ * @alias sap.ui.fl.apply._internal.changes.descriptor.app.AddNewDataSource
113
+ * @since 1.87
114
+ * @version 1.130.0
115
+ * @private
116
+ * @ui5-restricted sap.ui.fl.apply._internal
117
+ */
118
+ const AddNewDataSource = {
119
+
120
+ /**
121
+ * Applies the <code>appdescr_app_addNewDataSource</code> change to the manifest.
122
+ *
123
+ * @param {object} oManifest - Original manifest
124
+ * @param {sap.ui.fl.apply._internal.flexObjects.AppDescriptorChange} oChange - Change with type <code>appdescr_app_addNewDataSource</code>
125
+ * @param {object} oChange.content - Details of the change
126
+ * @param {object} oChange.content.dataSource - Data source of <code>sap.app/dataSource</code> that is being changed
127
+ * @returns {object} Updated manifest with changed <code>sap.app/dataSource</code>
128
+ *
129
+ * @private
130
+ * @ui5-restricted sap.ui.fl.apply._internal
131
+ */
132
+ applyChange(oManifest, oChange) {
133
+ oManifest["sap.app"].dataSources ||= {};
134
+ const oChangeContent = oChange.getContent();
135
+
136
+ const aDataSources = DescriptorChangeCheck.getAndCheckContentObject(oChangeContent, "dataSource", oChange.getChangeType(), MANDATORY_PROPERTIES, SUPPORTED_PROPERTIES, PROPERTIES_PATTERNS, SUPPORTED_TYPES);
137
+
138
+ aDataSources.forEach(function(sDataSource) {
139
+ DescriptorChangeCheck.checkIdNamespaceCompliance(sDataSource, oChange);
140
+ });
141
+
142
+ postChecks(oManifest["sap.app"].dataSources, oChangeContent.dataSource, aDataSources);
143
+
144
+ Object.assign(oManifest["sap.app"].dataSources, oChangeContent.dataSource);
145
+
146
+ return oManifest;
147
+ }
148
+
149
+ };
150
+
151
+ return AddNewDataSource;
152
+ });
@@ -12,19 +12,13 @@ sap.ui.define([
12
12
  ) {
13
13
  "use strict";
14
14
 
15
- function getAndCheckInboundId(oChangeContent) {
16
- var aInbounds = Object.keys(oChangeContent.inbound);
17
- if (aInbounds.length > 1) {
18
- throw new Error("It is not allowed to add more than one inbound");
19
- }
20
- if (aInbounds.length < 1) {
21
- throw new Error("Inbound does not exist");
22
- }
23
- if (aInbounds[0] === "") {
24
- throw new Error("The ID of your inbound is empty");
25
- }
26
- return aInbounds[aInbounds.length - 1];
27
- }
15
+ const MANDATORY_PROPERTIES = ["semanticObject", "action"];
16
+ const SUPPORTED_PROPERTIES = [...MANDATORY_PROPERTIES, "hideLauncher", "icon", "title", "shortTitle", "subTitle", "info", "indicatorDataSource", "deviceTypes", "displayMode", "signature"];
17
+
18
+ const PROPERTIES_PATTERNS = {
19
+ semanticObject: "^[\\w\\*]{0,30}$",
20
+ action: "^[\\w\\*]{0,60}$"
21
+ };
28
22
 
29
23
  /**
30
24
  * Descriptor change merger for change type <code>appdescr_app_addNewInbound</code>.
@@ -34,11 +28,11 @@ sap.ui.define([
34
28
  *
35
29
  * @namespace
36
30
  * @alias sap.ui.fl.apply._internal.changes.descriptor.app.AddNewInbound
37
- * @version 1.128.0
31
+ * @version 1.130.0
38
32
  * @private
39
33
  * @ui5-restricted sap.ui.fl.apply._internal
40
34
  */
41
- var AddNewInbound = /** @lends sap.ui.fl.apply._internal.changes.descriptor.app.AddNewInbound */ {
35
+ const AddNewInbound = /** @lends sap.ui.fl.apply._internal.changes.descriptor.app.AddNewInbound */ {
42
36
 
43
37
  /**
44
38
  * Method to apply the <code>appdescr_app_addNewInbound</code> change to the manifest.
@@ -56,9 +50,9 @@ sap.ui.define([
56
50
  oManifest["sap.app"].crossNavigation ||= {};
57
51
  oManifest["sap.app"].crossNavigation.inbounds ||= {};
58
52
 
59
- var oChangeContent = oChange.getContent();
60
- var sInboundId = getAndCheckInboundId(oChangeContent);
61
- var oInboundInManifest = oManifest["sap.app"].crossNavigation.inbounds[sInboundId];
53
+ const oChangeContent = oChange.getContent();
54
+ const sInboundId = DescriptorChangeCheck.getAndCheckContentObject(oChangeContent, "inbound", oChange.getChangeType(), MANDATORY_PROPERTIES, SUPPORTED_PROPERTIES, PROPERTIES_PATTERNS);
55
+ const oInboundInManifest = oManifest["sap.app"].crossNavigation.inbounds[sInboundId];
62
56
  if (!oInboundInManifest) {
63
57
  DescriptorChangeCheck.checkIdNamespaceCompliance(sInboundId, oChange);
64
58
  oManifest["sap.app"].crossNavigation.inbounds[sInboundId] = oChangeContent.inbound[sInboundId];