@ui5/task-adaptation 1.3.3 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bundle.js CHANGED
@@ -1909,7 +1909,13 @@ function splitEscapePath(sPropertyPath) {
1909
1909
  const aPath = sReplaceEscapeWithDummy.split("/");
1910
1910
  return aPath.map(element => element.replaceAll("*", "/"));
1911
1911
  }
1912
- function setPropValueByPath(oEntityProp, oRoot) {
1912
+ function deleteProperty(aPath, oRoot) {
1913
+ for (let i = 0; i < aPath.length - 1; i++) {
1914
+ oRoot = oRoot[aPath[i]];
1915
+ }
1916
+ delete oRoot[aPath[aPath.length - 1]];
1917
+ }
1918
+ function setOrDeletePropValueByPath(oEntityProp, oRoot) {
1913
1919
  let aPath;
1914
1920
  if (oEntityProp.propertyPath.includes("\\")) {
1915
1921
  aPath = splitEscapePath(oEntityProp.propertyPath);
@@ -1923,15 +1929,19 @@ function setPropValueByPath(oEntityProp, oRoot) {
1923
1929
  if (!valueByPath && oEntityProp.operation === "UPDATE") {
1924
1930
  throw new Error("Path does not contain a value. 'UPDATE' operation is not appropriate.");
1925
1931
  }
1926
- ObjectPath.set(aPath, oEntityProp.propertyValue, oRoot);
1932
+ if (oEntityProp.operation === "DELETE") {
1933
+ deleteProperty(aPath, oRoot);
1934
+ } else {
1935
+ ObjectPath.set(aPath, oEntityProp.propertyValue, oRoot);
1936
+ }
1927
1937
  }
1928
1938
  function changePropertyValueByPath (vChanges, oRootPath) {
1929
1939
  if (Array.isArray(vChanges)) {
1930
1940
  vChanges.forEach(function (oEntityProp) {
1931
- setPropValueByPath(oEntityProp, oRootPath);
1941
+ setOrDeletePropValueByPath(oEntityProp, oRootPath);
1932
1942
  });
1933
1943
  } else {
1934
- setPropValueByPath(vChanges, oRootPath);
1944
+ setOrDeletePropValueByPath(vChanges, oRootPath);
1935
1945
  }
1936
1946
  }
1937
1947
 
@@ -1945,10 +1955,85 @@ var Layer = {
1945
1955
  BASE: "BASE"
1946
1956
  };
1947
1957
 
1948
- function checkChange(oEntityPropertyChange, aSupportedProperties, aSupportedOperations, oSupportedPropertyPattern) {
1958
+ function checkObjectProperties(oChangeObject, aObjects, aMandatoryProperties, aSupportedProperties, oSupportedPropertyPattern, oSupportedPropertyTypes) {
1959
+ aObjects.forEach(function (sObject) {
1960
+ const oSetOfProperties = new Set(Object.keys(oChangeObject[sObject]));
1961
+ if (aMandatoryProperties) {
1962
+ aMandatoryProperties.forEach(function (sMandatoryProperty) {
1963
+ if (!oSetOfProperties.has(sMandatoryProperty)) {
1964
+ const sText = aMandatoryProperties.length > 1 ? "properties are" : "property is";
1965
+ throw new Error(`Mandatory property '${sMandatoryProperty}' is missing. Mandatory ${sText} ${aMandatoryProperties.join("|")}.`);
1966
+ }
1967
+ });
1968
+ }
1969
+ if (aSupportedProperties) {
1970
+ const notSupportedProperties = [];
1971
+ oSetOfProperties.forEach(function (sProperty) {
1972
+ if (!aSupportedProperties.includes(sProperty)) {
1973
+ notSupportedProperties.push(sProperty);
1974
+ }
1975
+ });
1976
+ if (notSupportedProperties.length > 0) {
1977
+ const sText1 = notSupportedProperties.length > 1 ? `Properties ${notSupportedProperties.join("|")} are not supported. ` : `Property ${notSupportedProperties.join("|")} is not supported. `;
1978
+ const sText2 = aSupportedProperties.length > 1 ? `Supported properties are ${aSupportedProperties.join("|")}.` : `Supported property is $${aSupportedProperties.join("|")}.`;
1979
+ throw new Error(sText1 + sText2);
1980
+ }
1981
+ }
1982
+ if (oSupportedPropertyTypes) {
1983
+ oSetOfProperties.forEach(function (sProperty) {
1984
+ if (oSupportedPropertyTypes[sProperty]) {
1985
+ if (String(typeof oChangeObject[sObject][sProperty]) !== oSupportedPropertyTypes[sProperty]) {
1986
+ throw new Error(`The property '${sProperty}' is type of '${typeof oChangeObject[sObject][sProperty]}'. Supported type for property '${sProperty}' is '${oSupportedPropertyTypes[sProperty]}'`);
1987
+ }
1988
+ }
1989
+ });
1990
+ }
1991
+ if (oSupportedPropertyPattern) {
1992
+ oSetOfProperties.forEach(function (sProperty) {
1993
+ if (oSupportedPropertyPattern[sProperty]) {
1994
+ const regex = new RegExp(oSupportedPropertyPattern[sProperty]);
1995
+ if (!regex.test(oChangeObject[sObject][sProperty])) {
1996
+ throw new Error(`The property has disallowed values. Supported values for '${sProperty}' should adhere to regular expression ${regex}.`);
1997
+ }
1998
+ }
1999
+ });
2000
+ }
2001
+ });
2002
+ }
2003
+ function getAndCheckContentObject(oChangeContent, sKey, sChangeType, aMandatoryProperties, aSupportedProperties, oSupportedPropertyPattern, oSupportedPropertyTypes) {
2004
+ const aObjectKeyNames = Object.keys(oChangeContent);
2005
+ if (aObjectKeyNames.length > 1) {
2006
+ throw new Error("It is not allowed to add more than one object under change object 'content'.");
2007
+ }
2008
+ if (aObjectKeyNames.length < 1) {
2009
+ throw new Error(`The change object 'content' cannot be empty. Please provide the necessary property, as outlined in the change schema for '${sChangeType}'.`);
2010
+ }
2011
+ if (aObjectKeyNames[0] !== sKey) {
2012
+ throw new Error(`The provided property '${aObjectKeyNames[0]}' is not supported. Supported property for change '${sChangeType}' is '${sKey}'.`);
2013
+ }
2014
+ const aObjectKeys = Object.keys(oChangeContent[sKey]);
2015
+ if (aObjectKeys.length > 1) {
2016
+ if (sKey === "dataSource") {
2017
+ if (aObjectKeys.length !== 2) {
2018
+ throw new Error(`It is not allowed to add more than two data sources to manifest.`);
2019
+ }
2020
+ } else {
2021
+ throw new Error(`It is not allowed to add more than one ${sKey}: ${aObjectKeys.join(", ")}.`);
2022
+ }
2023
+ }
2024
+ if (aObjectKeys.length < 1) {
2025
+ throw new Error(`There is no ${sKey} provided. Please provide an ${sKey}.`);
2026
+ }
2027
+ if (aObjectKeys.includes("")) {
2028
+ throw new Error(`The ID of your ${sKey} is empty.`);
2029
+ }
2030
+ checkObjectProperties(oChangeContent[sKey], aObjectKeys, aMandatoryProperties, aSupportedProperties, oSupportedPropertyPattern, oSupportedPropertyTypes);
2031
+ return sKey !== "dataSource" ? aObjectKeys[aObjectKeys.length - 1] : aObjectKeys;
2032
+ }
2033
+ function checkChange(oEntityPropertyChange, aSupportedProperties, aSupportedOperations, oSupportedPropertyPattern, aNotAllowedToBeDeleteProperties, oSupportedPropertyTypes) {
1949
2034
  const aEntityPropertyChanges = Array.isArray(oEntityPropertyChange) ? oEntityPropertyChange : [oEntityPropertyChange];
1950
2035
  aEntityPropertyChanges.forEach(function (oChange) {
1951
- formatEntityCheck(oChange, aSupportedProperties, aSupportedOperations);
2036
+ formatEntityCheck(oChange, aSupportedProperties, aSupportedOperations, aNotAllowedToBeDeleteProperties, oSupportedPropertyTypes);
1952
2037
  checkPropertyValuePattern(oChange, oSupportedPropertyPattern);
1953
2038
  });
1954
2039
  }
@@ -1966,31 +2051,58 @@ function getClearedGenericPath(aSupportedProperties) {
1966
2051
  return aPropertiesClearedGenericPath;
1967
2052
  }
1968
2053
  function isGenericPropertyPathSupported(aSupportedProperties, sPropertyPath) {
1969
- var aClearedGenericPath = getClearedGenericPath(aSupportedProperties);
1970
- return aClearedGenericPath.some(function (path) {
1971
- return sPropertyPath.startsWith(path);
2054
+ const aClearedGenericPath = getClearedGenericPath(aSupportedProperties);
2055
+ let bIsGenericPathSupported = false;
2056
+ aClearedGenericPath.forEach(function (path) {
2057
+ if (sPropertyPath.startsWith(path)) {
2058
+ const sPathWithoutRoot = sPropertyPath.replace(path, "");
2059
+ if (sPathWithoutRoot.startsWith("/") || sPathWithoutRoot === "") {
2060
+ bIsGenericPathSupported = true;
2061
+ }
2062
+ }
1972
2063
  });
2064
+ return bIsGenericPathSupported;
1973
2065
  }
1974
- function formatEntityCheck(oChangeEntity, aSupportedProperties, aSupportedOperations) {
2066
+ function formatEntityCheck(oChangeEntity, aSupportedProperties, aSupportedOperations, aNotAllowedToBeDeleteProperties, oSupportedPropertyTypes) {
1975
2067
  if (!oChangeEntity.propertyPath) {
1976
2068
  throw new Error("Invalid change format: The mandatory 'propertyPath' is not defined. Please define the mandatory property 'propertyPath'");
1977
2069
  }
1978
2070
  if (!oChangeEntity.operation) {
1979
2071
  throw new Error("Invalid change format: The mandatory 'operation' is not defined. Please define the mandatory property 'operation'");
1980
2072
  }
1981
- if (oChangeEntity.operation.toUpperCase() !== "DELETE") {
2073
+ const sOpertationUpperCase = oChangeEntity.operation.toUpperCase();
2074
+ if (sOpertationUpperCase === "DELETE") {
2075
+ if (aNotAllowedToBeDeleteProperties) {
2076
+ if (aNotAllowedToBeDeleteProperties.includes(oChangeEntity.propertyPath)) {
2077
+ throw new Error(`The property '${oChangeEntity.propertyPath}' was attempted to be deleted. The mandatory properties ${aNotAllowedToBeDeleteProperties.join("|")} cannot be deleted.`);
2078
+ }
2079
+ }
2080
+ if (oChangeEntity.hasOwnProperty("propertyValue")) {
2081
+ throw new Error(`The property 'propertyValue' must not be provided in a 'DELETE' operation. Please remove 'propertyValue'.`);
2082
+ }
2083
+ }
2084
+ if (sOpertationUpperCase !== "DELETE") {
1982
2085
  if (!oChangeEntity.hasOwnProperty("propertyValue")) {
1983
2086
  throw new Error("Invalid change format: The mandatory 'propertyValue' is not defined. Please define the mandatory property 'propertyValue'");
1984
2087
  }
2088
+ if (!aSupportedProperties.includes(oChangeEntity.propertyPath) && !isGenericPropertyPathSupported(aSupportedProperties, oChangeEntity.propertyPath)) {
2089
+ throw new Error(`Changing ${oChangeEntity.propertyPath} is not supported. The supported 'propertyPath' is: ${aSupportedProperties.join("|")}`);
2090
+ }
2091
+ if (oSupportedPropertyTypes) {
2092
+ const aPropertyPath = oChangeEntity.propertyPath.split("/");
2093
+ const sProperty = aPropertyPath[aPropertyPath.length - 1];
2094
+ if (oSupportedPropertyTypes[sProperty]) {
2095
+ if (String(typeof oChangeEntity.propertyValue) !== oSupportedPropertyTypes[sProperty]) {
2096
+ throw new Error(`The property '${sProperty}' is type of '${typeof oChangeEntity.propertyValue}'. Supported type for property '${sProperty}' is '${oSupportedPropertyTypes[sProperty]}'.`);
2097
+ }
2098
+ }
2099
+ }
1985
2100
  }
1986
- if (!aSupportedProperties.includes(oChangeEntity.propertyPath) && !isGenericPropertyPathSupported(aSupportedProperties, oChangeEntity.propertyPath)) {
1987
- throw new Error(`Changing ${oChangeEntity.propertyPath} is not supported. The supported 'propertyPath' is: ${aSupportedProperties.join("|")}`);
1988
- }
1989
- if (!aSupportedOperations.includes(oChangeEntity.operation)) {
1990
- throw new Error(`Operation ${oChangeEntity.operation} is not supported. The supported 'operation' is ${aSupportedOperations.join("|")}`);
2101
+ if (!aSupportedOperations.includes(sOpertationUpperCase)) {
2102
+ throw new Error(`Operation ${sOpertationUpperCase} is not supported. The supported 'operation' is ${aSupportedOperations.join("|")}`);
1991
2103
  }
1992
2104
  }
1993
- function checkEntityPropertyChange(oChange, aSupportedProperties, aSupportedOperations, oSupportedPropertyPattern) {
2105
+ function checkEntityPropertyChange(oChange, aSupportedProperties, aSupportedOperations, oSupportedPropertyPattern, aNotAllowedToBeDeleteProperties, oSupportedPropertyTypes) {
1994
2106
  var sId = Object.keys(oChange).filter(function (sKey) {
1995
2107
  return sKey.endsWith("Id");
1996
2108
  }).shift();
@@ -2000,7 +2112,7 @@ function checkEntityPropertyChange(oChange, aSupportedProperties, aSupportedOper
2000
2112
  if (!oChange.entityPropertyChange) {
2001
2113
  throw new Error(`Changes for "${oChange[sId]}" are not provided.`);
2002
2114
  }
2003
- checkChange(oChange.entityPropertyChange, aSupportedProperties, aSupportedOperations, oSupportedPropertyPattern);
2115
+ checkChange(oChange.entityPropertyChange, aSupportedProperties, aSupportedOperations, oSupportedPropertyPattern, aNotAllowedToBeDeleteProperties, oSupportedPropertyTypes);
2004
2116
  }
2005
2117
  var layer_prefixes = {};
2006
2118
  layer_prefixes[Layer.CUSTOMER] = "customer.";
@@ -2031,11 +2143,13 @@ function getNamespacePrefixForLayer(sLayer) {
2031
2143
  return sPrefix;
2032
2144
  }
2033
2145
  function checkPropertyValuePattern(oChange, oSupportedPattern) {
2034
- if (!Object.keys(oSupportedPattern).includes(oChange.propertyPath)) {
2035
- return;
2036
- }
2037
- if (!oChange.propertyValue.match(oSupportedPattern[oChange.propertyPath])) {
2038
- throw new Error(`Not supported format for propertyPath ${oChange.propertyPath}. ` + `The supported pattern is ${oSupportedPattern[oChange.propertyPath]}`);
2146
+ if (oSupportedPattern) {
2147
+ if (!Object.keys(oSupportedPattern).includes(oChange.propertyPath)) {
2148
+ return;
2149
+ }
2150
+ if (!oChange.propertyValue.match(oSupportedPattern[oChange.propertyPath])) {
2151
+ throw new Error(`Not supported format for propertyPath ${oChange.propertyPath}. ` + `The supported pattern is ${oSupportedPattern[oChange.propertyPath]}`);
2152
+ }
2039
2153
  }
2040
2154
  }
2041
2155
  var DescriptorChangeCheck = {
@@ -2043,17 +2157,18 @@ var DescriptorChangeCheck = {
2043
2157
  checkIdNamespaceCompliance,
2044
2158
  getNamespacePrefixForLayer,
2045
2159
  getClearedGenericPath,
2046
- isGenericPropertyPathSupported
2160
+ isGenericPropertyPathSupported,
2161
+ getAndCheckContentObject
2047
2162
  };
2048
2163
 
2049
- var SUPPORTED_OPERATIONS$2 = ["UPDATE", "UPSERT"];
2050
- var SUPPORTED_PROPERTIES$2 = ["uri", "settings/maxAge"];
2051
- var PROPERTIES_PATTERNS$2 = {};
2164
+ var SUPPORTED_OPERATIONS$3 = ["UPDATE", "UPSERT"];
2165
+ var SUPPORTED_PROPERTIES$6 = ["uri", "settings/maxAge"];
2166
+ var PROPERTIES_PATTERNS$5 = {};
2052
2167
  var ChangeDataSource = {
2053
2168
  applyChange(oManifest, oChange) {
2054
2169
  var oDataSources = oManifest["sap.app"].dataSources;
2055
2170
  var oChangeContent = oChange.getContent();
2056
- DescriptorChangeCheck.checkEntityPropertyChange(oChangeContent, SUPPORTED_PROPERTIES$2, SUPPORTED_OPERATIONS$2, PROPERTIES_PATTERNS$2);
2171
+ DescriptorChangeCheck.checkEntityPropertyChange(oChangeContent, SUPPORTED_PROPERTIES$6, SUPPORTED_OPERATIONS$3, PROPERTIES_PATTERNS$5);
2057
2172
  if (oDataSources) {
2058
2173
  var oDataSource = oDataSources[oChangeContent.dataSourceId];
2059
2174
  if (oDataSource) {
@@ -2141,6 +2256,34 @@ var AddComponentUsages = {
2141
2256
  }
2142
2257
  };
2143
2258
 
2259
+ const SUPPORTED_OPERATIONS$2 = ["UPDATE", "UPSERT", "DELETE", "INSERT"];
2260
+ const SUPPORTED_PROPERTIES$5 = ["settings/*"];
2261
+ const SUPPORTED_TYPES$1 = {
2262
+ settings: typeof ({})
2263
+ };
2264
+ const RESOURCE_MODEL = "sap.ui.model.resource.ResourceModel";
2265
+ const ChangeModel = {
2266
+ applyChange(oManifest, oChange) {
2267
+ const oModels = oManifest["sap.ui5"].models;
2268
+ const oChangeContent = oChange.getContent();
2269
+ DescriptorChangeCheck.checkEntityPropertyChange(oChangeContent, SUPPORTED_PROPERTIES$5, SUPPORTED_OPERATIONS$2, null, null, SUPPORTED_TYPES$1);
2270
+ if (oModels) {
2271
+ const oModel = oModels[oChangeContent.modelId];
2272
+ if (oModel) {
2273
+ if (oModel.type === RESOURCE_MODEL) {
2274
+ throw new Error(`Model '${oChangeContent.modelId}' is of type '${RESOURCE_MODEL}'. Changing models of type '${RESOURCE_MODEL}' are not supported.`);
2275
+ }
2276
+ changePropertyValueByPath(oChangeContent.entityPropertyChange, oModel);
2277
+ } else {
2278
+ throw new Error(`Nothing to update. Model with ID "${oChangeContent.modelId}" does not exist in the manifest.json.`);
2279
+ }
2280
+ } else {
2281
+ throw new Error("sap.ui5/models section have not been found in manifest.json.");
2282
+ }
2283
+ return oManifest;
2284
+ }
2285
+ };
2286
+
2144
2287
  var rVersion = /^[0-9]+(?:\.([0-9]+)(?:\.([0-9]+))?)?(.*)$/;
2145
2288
  function Version(vMajor, iMinor, iPatch, sSuffix) {
2146
2289
  if (vMajor instanceof Version) {
@@ -2350,7 +2493,7 @@ var AddNewModel = {
2350
2493
  };
2351
2494
 
2352
2495
  var SUPPORTED_INSERT_POSITION = ["BEGINNING", "END"];
2353
- function isDataSourceIdExistingInManifest(oManifestDataSources, sDataSourceId) {
2496
+ function isDataSourceIdExistingInManifest$1(oManifestDataSources, sDataSourceId) {
2354
2497
  return Object.keys(oManifestDataSources).indexOf(sDataSourceId) >= 0;
2355
2498
  }
2356
2499
  function isDataSourceTypeOData(oManifestDataSources, sDataSource) {
@@ -2368,7 +2511,7 @@ function isAnnotationPartOfAnnotationsArray(aChangeAnnotations, sAnnotation) {
2368
2511
  function checkingDataSourceId(oManifestDataSources, sChangeDataSourceId) {
2369
2512
  if (sChangeDataSourceId) {
2370
2513
  if (Object.keys(oManifestDataSources).length > 0) {
2371
- if (!isDataSourceIdExistingInManifest(oManifestDataSources, sChangeDataSourceId)) {
2514
+ if (!isDataSourceIdExistingInManifest$1(oManifestDataSources, sChangeDataSourceId)) {
2372
2515
  throw new Error(`There is no dataSource '${sChangeDataSourceId}' existing in the manifest. You can only add annotations to already existing dataSources in the manifest`);
2373
2516
  }
2374
2517
  if (!isDataSourceTypeOData(oManifestDataSources, sChangeDataSourceId)) {
@@ -2433,7 +2576,7 @@ function mergeAnnotationArray(oManifestDataSourceId, aChangeAnnotations, sChange
2433
2576
  function mergeAnnotationDataSources(oManifestDataSources, oChangeDataSource) {
2434
2577
  Object.assign(oManifestDataSources, oChangeDataSource);
2435
2578
  }
2436
- function postChecks(oManifestDataSources, oChangeDataSource, aChangeAnnotations) {
2579
+ function postChecks$1(oManifestDataSources, oChangeDataSource, aChangeAnnotations) {
2437
2580
  aChangeAnnotations.forEach(function (sAnnotation) {
2438
2581
  if (!isAnnotationExisting(oManifestDataSources, oChangeDataSource, sAnnotation)) {
2439
2582
  throw new Error(`The annotation '${sAnnotation}' is part of 'annotations' array property but does not exists in the change property 'dataSource' and in the manifest (or it is not type of 'ODataAnnotation' in the manifest)`);
@@ -2450,7 +2593,7 @@ var AddAnnotationsToOData = {
2450
2593
  checkingAnnotationArray(aChangeAnnotations);
2451
2594
  checkingAnnotationsInsertPosition(sChangeAnnotationsInsertPosition);
2452
2595
  checkingAnnotationDataSource(oChangeDataSource, aChangeAnnotations, oChange);
2453
- postChecks(oManifest["sap.app"].dataSources, oChangeDataSource, aChangeAnnotations);
2596
+ postChecks$1(oManifest["sap.app"].dataSources, oChangeDataSource, aChangeAnnotations);
2454
2597
  merge$1(oManifest["sap.app"].dataSources, sChangeDataSourceId, aChangeAnnotations, sChangeAnnotationsInsertPosition, oChangeDataSource);
2455
2598
  return oManifest;
2456
2599
  }
@@ -2464,7 +2607,7 @@ function checkManifestPath(oManifest) {
2464
2607
  throw new Error("No sap.app/crossNavigation/inbounds path exists in the manifest");
2465
2608
  }
2466
2609
  }
2467
- function getAndCheckInboundId$1(oChangeContent) {
2610
+ function getAndCheckInboundId(oChangeContent) {
2468
2611
  var sInbounds = oChangeContent.inboundId;
2469
2612
  if (sInbounds === "") {
2470
2613
  throw new Error("The ID of your inbound is empty");
@@ -2482,7 +2625,7 @@ function merge(oManifest, sInboundId) {
2482
2625
  var RemoveAllInboundsExceptOne = {
2483
2626
  applyChange(oManifest, oChange) {
2484
2627
  checkManifestPath(oManifest);
2485
- var sInboundId = getAndCheckInboundId$1(oChange.getContent());
2628
+ var sInboundId = getAndCheckInboundId(oChange.getContent());
2486
2629
  if (oManifest["sap.app"].crossNavigation.inbounds[sInboundId]) {
2487
2630
  merge(oManifest, sInboundId);
2488
2631
  } else {
@@ -2492,19 +2635,20 @@ var RemoveAllInboundsExceptOne = {
2492
2635
  }
2493
2636
  };
2494
2637
 
2495
- var SUPPORTED_OPERATIONS$1 = ["UPDATE", "UPSERT"];
2496
- var SUPPORTED_PROPERTIES$1 = ["semanticObject", "action", "title", "subTitle", "icon", "signature/parameters/*"];
2497
- var PROPERTIES_PATTERNS$1 = {
2638
+ const SUPPORTED_OPERATIONS$1 = ["UPDATE", "UPSERT", "DELETE", "INSERT"];
2639
+ const SUPPORTED_PROPERTIES$4 = ["semanticObject", "action", "hideLauncher", "icon", "title", "shortTitle", "subTitle", "info", "indicatorDataSource", "deviceTypes", "displayMode", "signature/parameters/*"];
2640
+ const NOT_ALLOWED_TO_DELETE_PROPERTIES$1 = ["semanticObject", "action"];
2641
+ const PROPERTIES_PATTERNS$4 = {
2498
2642
  semanticObject: "^[\\w\\*]{0,30}$",
2499
2643
  action: "^[\\w\\*]{0,60}$"
2500
2644
  };
2501
- var ChangeInbound = {
2645
+ const ChangeInbound = {
2502
2646
  applyChange(oManifest, oChange) {
2503
- var oCrossNavigation = oManifest["sap.app"].crossNavigation;
2504
- var oChangeContent = oChange.getContent();
2505
- DescriptorChangeCheck.checkEntityPropertyChange(oChangeContent, SUPPORTED_PROPERTIES$1, SUPPORTED_OPERATIONS$1, PROPERTIES_PATTERNS$1);
2647
+ const oCrossNavigation = oManifest["sap.app"].crossNavigation;
2648
+ const oChangeContent = oChange.getContent();
2649
+ DescriptorChangeCheck.checkEntityPropertyChange(oChangeContent, SUPPORTED_PROPERTIES$4, SUPPORTED_OPERATIONS$1, PROPERTIES_PATTERNS$4, NOT_ALLOWED_TO_DELETE_PROPERTIES$1);
2506
2650
  if (oCrossNavigation && oCrossNavigation.inbounds) {
2507
- var oInbound = oCrossNavigation.inbounds[oChangeContent.inboundId];
2651
+ const oInbound = oCrossNavigation.inbounds[oChangeContent.inboundId];
2508
2652
  if (oInbound) {
2509
2653
  changePropertyValueByPath(oChangeContent.entityPropertyChange, oInbound);
2510
2654
  } else {
@@ -2517,9 +2661,10 @@ var ChangeInbound = {
2517
2661
  }
2518
2662
  };
2519
2663
 
2520
- const SUPPORTED_OPERATIONS = ["UPDATE", "UPSERT"];
2521
- const SUPPORTED_PROPERTIES = ["semanticObject", "action", "additionalParameters", "parameters/*"];
2522
- const PROPERTIES_PATTERNS = {
2664
+ const SUPPORTED_OPERATIONS = ["UPDATE", "UPSERT", "DELETE", "INSERT"];
2665
+ const SUPPORTED_PROPERTIES$3 = ["semanticObject", "action", "additionalParameters", "parameters/*"];
2666
+ const NOT_ALLOWED_TO_DELETE_PROPERTIES = ["semanticObject", "action"];
2667
+ const PROPERTIES_PATTERNS$3 = {
2523
2668
  semanticObject: "^[\\w\\*]{0,30}$",
2524
2669
  action: "^[\\w\\*]{0,60}$",
2525
2670
  additionalParameters: "^(ignored|allowed|notallowed)$"
@@ -2528,7 +2673,7 @@ const ChangeOutbound = {
2528
2673
  applyChange(oManifest, oChange) {
2529
2674
  const oCrossNavigation = oManifest["sap.app"].crossNavigation;
2530
2675
  const oChangeContent = oChange.getContent();
2531
- DescriptorChangeCheck.checkEntityPropertyChange(oChangeContent, SUPPORTED_PROPERTIES, SUPPORTED_OPERATIONS, PROPERTIES_PATTERNS);
2676
+ DescriptorChangeCheck.checkEntityPropertyChange(oChangeContent, SUPPORTED_PROPERTIES$3, SUPPORTED_OPERATIONS, PROPERTIES_PATTERNS$3, NOT_ALLOWED_TO_DELETE_PROPERTIES);
2532
2677
  if (oCrossNavigation && oCrossNavigation.outbounds) {
2533
2678
  const oOutbound = oCrossNavigation.outbounds[oChangeContent.outboundId];
2534
2679
  if (oOutbound) {
@@ -2543,26 +2688,19 @@ const ChangeOutbound = {
2543
2688
  }
2544
2689
  };
2545
2690
 
2546
- function getAndCheckInboundId(oChangeContent) {
2547
- var aInbounds = Object.keys(oChangeContent.inbound);
2548
- if (aInbounds.length > 1) {
2549
- throw new Error("It is not allowed to add more than one inbound");
2550
- }
2551
- if (aInbounds.length < 1) {
2552
- throw new Error("Inbound does not exist");
2553
- }
2554
- if (aInbounds[0] === "") {
2555
- throw new Error("The ID of your inbound is empty");
2556
- }
2557
- return aInbounds[aInbounds.length - 1];
2558
- }
2559
- var AddNewInbound = {
2691
+ const MANDATORY_PROPERTIES$2 = ["semanticObject", "action"];
2692
+ const SUPPORTED_PROPERTIES$2 = [...MANDATORY_PROPERTIES$2, "hideLauncher", "icon", "title", "shortTitle", "subTitle", "info", "indicatorDataSource", "deviceTypes", "displayMode", "signature"];
2693
+ const PROPERTIES_PATTERNS$2 = {
2694
+ semanticObject: "^[\\w\\*]{0,30}$",
2695
+ action: "^[\\w\\*]{0,60}$"
2696
+ };
2697
+ const AddNewInbound = {
2560
2698
  applyChange(oManifest, oChange) {
2561
2699
  oManifest["sap.app"].crossNavigation ||= {};
2562
2700
  oManifest["sap.app"].crossNavigation.inbounds ||= {};
2563
- var oChangeContent = oChange.getContent();
2564
- var sInboundId = getAndCheckInboundId(oChangeContent);
2565
- var oInboundInManifest = oManifest["sap.app"].crossNavigation.inbounds[sInboundId];
2701
+ const oChangeContent = oChange.getContent();
2702
+ const sInboundId = DescriptorChangeCheck.getAndCheckContentObject(oChangeContent, "inbound", oChange.getChangeType(), MANDATORY_PROPERTIES$2, SUPPORTED_PROPERTIES$2, PROPERTIES_PATTERNS$2);
2703
+ const oInboundInManifest = oManifest["sap.app"].crossNavigation.inbounds[sInboundId];
2566
2704
  if (!oInboundInManifest) {
2567
2705
  DescriptorChangeCheck.checkIdNamespaceCompliance(sInboundId, oChange);
2568
2706
  oManifest["sap.app"].crossNavigation.inbounds[sInboundId] = oChangeContent.inbound[sInboundId];
@@ -2573,6 +2711,119 @@ var AddNewInbound = {
2573
2711
  }
2574
2712
  };
2575
2713
 
2714
+ const MANDATORY_PROPERTIES$1 = ["semanticObject", "action"];
2715
+ const SUPPORTED_PROPERTIES$1 = [...MANDATORY_PROPERTIES$1, "additionalParameters", "parameters"];
2716
+ const PROPERTIES_PATTERNS$1 = {
2717
+ semanticObject: "^[\\w\\*]{0,30}$",
2718
+ action: "^[\\w\\*]{0,60}$",
2719
+ additionalParameters: "^(ignored|allowed|notallowed)$"
2720
+ };
2721
+ const AddNewOutbound = {
2722
+ applyChange(oManifest, oChange) {
2723
+ oManifest["sap.app"].crossNavigation ||= {};
2724
+ oManifest["sap.app"].crossNavigation.outbounds ||= {};
2725
+ const oChangeContent = oChange.getContent();
2726
+ const sOutboundId = DescriptorChangeCheck.getAndCheckContentObject(oChangeContent, "outbound", oChange.getChangeType(), MANDATORY_PROPERTIES$1, SUPPORTED_PROPERTIES$1, PROPERTIES_PATTERNS$1);
2727
+ const oOutboundInManifest = oManifest["sap.app"].crossNavigation.outbounds[sOutboundId];
2728
+ if (!oOutboundInManifest) {
2729
+ DescriptorChangeCheck.checkIdNamespaceCompliance(sOutboundId, oChange);
2730
+ oManifest["sap.app"].crossNavigation.outbounds[sOutboundId] = oChangeContent.outbound[sOutboundId];
2731
+ } else {
2732
+ throw new Error(`Outbound with ID "${sOutboundId}" already exist.`);
2733
+ }
2734
+ return oManifest;
2735
+ }
2736
+ };
2737
+
2738
+ const MANDATORY_PROPERTIES = ["uri"];
2739
+ const SUPPORTED_PROPERTIES = [...MANDATORY_PROPERTIES, "type", "settings", "customType"];
2740
+ const PROPERTIES_PATTERNS = {
2741
+ type: "^(OData|ODataAnnotation|INA|XML|JSON|FHIR|WebSocket|http)$",
2742
+ customType: "^false$"
2743
+ };
2744
+ const SUPPORTED_TYPES = {
2745
+ uri: typeof "string",
2746
+ type: typeof "string",
2747
+ settings: typeof ({}),
2748
+ dataSourceCustom: typeof false,
2749
+ annotations: typeof []
2750
+ };
2751
+ function isDataSourceIdExistingInManifest(oManifestDataSources, sDataSourceId) {
2752
+ return Object.keys(oManifestDataSources).includes(sDataSourceId);
2753
+ }
2754
+ function getDataSourceType(oDataSource) {
2755
+ return oDataSource.type || "OData";
2756
+ }
2757
+ function getDataSourceNameByType(oChangeDataSource, sType) {
2758
+ const [sDataSourceName] = Object.entries(oChangeDataSource).find(([, oDataSource]) => getDataSourceType(oDataSource) === sType) || [];
2759
+ return sDataSourceName;
2760
+ }
2761
+ function checkDefinedAnnotationsExistInManifest(oManifestDataSources, sDataSourceOfTypeOData, aToBeCheckedInManifestAnnotations) {
2762
+ aToBeCheckedInManifestAnnotations.forEach(function (sAnnotation) {
2763
+ if (!isDataSourceIdExistingInManifest(oManifestDataSources, sAnnotation)) {
2764
+ throw new Error(`Referenced annotation '${sAnnotation}' in the annotation array of data source '${sDataSourceOfTypeOData}' does not exist in the manifest.`);
2765
+ }
2766
+ });
2767
+ }
2768
+ function checksWhenAddingTwoDataSources(oManifestDataSources, oChangeDataSource) {
2769
+ const sDataSourceOfTypeOData = getDataSourceNameByType(oChangeDataSource, "OData");
2770
+ const sDataSourceOfTypeODataAnnotation = getDataSourceNameByType(oChangeDataSource, "ODataAnnotation");
2771
+ if (!(sDataSourceOfTypeOData && sDataSourceOfTypeODataAnnotation)) {
2772
+ 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'.`);
2773
+ }
2774
+ if (!oChangeDataSource[sDataSourceOfTypeOData]?.settings?.annotations?.includes(sDataSourceOfTypeODataAnnotation)) {
2775
+ throw new Error(`Data source '${sDataSourceOfTypeOData}' does not include annotation '${sDataSourceOfTypeODataAnnotation}' under 'settings/annotations' array.`);
2776
+ }
2777
+ const aToBeCheckedInManifestAnnotations = oChangeDataSource[sDataSourceOfTypeOData].settings.annotations.filter(function (sAnnotation) {
2778
+ return sAnnotation !== sDataSourceOfTypeODataAnnotation;
2779
+ });
2780
+ checkDefinedAnnotationsExistInManifest(oManifestDataSources, sDataSourceOfTypeOData, aToBeCheckedInManifestAnnotations);
2781
+ }
2782
+ function checksWhenAddingOneDataSource(oManifestDataSources, oChangeDataSource) {
2783
+ const sDataSourceOfTypeOData = getDataSourceNameByType(oChangeDataSource, "OData");
2784
+ if (oChangeDataSource[sDataSourceOfTypeOData].settings?.annotations) {
2785
+ checkDefinedAnnotationsExistInManifest(oManifestDataSources, sDataSourceOfTypeOData, oChangeDataSource[sDataSourceOfTypeOData].settings.annotations);
2786
+ }
2787
+ }
2788
+ function postChecks(oManifestDataSources, oChangeDataSource, aDataSources) {
2789
+ aDataSources.forEach(function (sDataSource) {
2790
+ if (isDataSourceIdExistingInManifest(oManifestDataSources, sDataSource)) {
2791
+ throw new Error(`There is already a dataSource '${sDataSource}' existing in the manifest.`);
2792
+ }
2793
+ checkIfAnnotationsPropertyIsAnArray(oChangeDataSource, sDataSource);
2794
+ });
2795
+ if (aDataSources.length === 1) {
2796
+ checksWhenAddingOneDataSource(oManifestDataSources, oChangeDataSource);
2797
+ }
2798
+ if (aDataSources.length === 2) {
2799
+ checksWhenAddingTwoDataSources(oManifestDataSources, oChangeDataSource);
2800
+ }
2801
+ }
2802
+ function checkIfAnnotationsPropertyIsAnArray(oChangeDataSource, sDataSource) {
2803
+ const sDataSourceType = getDataSourceType(oChangeDataSource[sDataSource]);
2804
+ if (oChangeDataSource[sDataSource].settings?.annotations) {
2805
+ if (sDataSourceType !== "OData") {
2806
+ 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.`);
2807
+ }
2808
+ if (!Array.isArray(oChangeDataSource[sDataSource].settings.annotations)) {
2809
+ throw new Error(`Property 'annotations' must be of type 'array'.`);
2810
+ }
2811
+ }
2812
+ }
2813
+ const AddNewDataSource = {
2814
+ applyChange(oManifest, oChange) {
2815
+ oManifest["sap.app"].dataSources ||= {};
2816
+ const oChangeContent = oChange.getContent();
2817
+ const aDataSources = DescriptorChangeCheck.getAndCheckContentObject(oChangeContent, "dataSource", oChange.getChangeType(), MANDATORY_PROPERTIES, SUPPORTED_PROPERTIES, PROPERTIES_PATTERNS, SUPPORTED_TYPES);
2818
+ aDataSources.forEach(function (sDataSource) {
2819
+ DescriptorChangeCheck.checkIdNamespaceCompliance(sDataSource, oChange);
2820
+ });
2821
+ postChecks(oManifest["sap.app"].dataSources, oChangeContent.dataSource, aDataSources);
2822
+ Object.assign(oManifest["sap.app"].dataSources, oChangeContent.dataSource);
2823
+ return oManifest;
2824
+ }
2825
+ };
2826
+
2576
2827
  const regex$1 = new RegExp("^([a-zA-Z0-9]{2,3})(-[a-zA-Z0-9]{1,6})*$");
2577
2828
  const SetAch = {
2578
2829
  applyChange(oManifest, oChange) {
@@ -3379,6 +3630,7 @@ var FeLogger = BaseObject.extend("sap.suite.ui.generic.template.genericUtilities
3379
3630
  });
3380
3631
 
3381
3632
  var oLogger$2 = new FeLogger("manifestMerger.MergerUil").getLogger();
3633
+ var GLOBAL_MANIFEST_CHANGE_COMPONENT$1 = "sap.suite.ui.generic.template";
3382
3634
  var mergerUtil = {
3383
3635
  iterateAndFind: function iterateFind(oPages, sEntityKey, sPageComponent, sChildPageId, sParentKey) {
3384
3636
  var oPageStructure;
@@ -3421,12 +3673,12 @@ var mergerUtil = {
3421
3673
  if (!oChangeContent["parentPage"]) {
3422
3674
  throw new Error("Mandatory 'parentPage' parameter is not provided.");
3423
3675
  }
3424
- if (!oChangeContent.parentPage.entitySet) {
3425
- throw new Error("Mandatory 'parentPage.entitySet' parameter is not provided.");
3426
- }
3427
3676
  if (!oChangeContent.parentPage.component) {
3428
3677
  throw new Error("Mandatory 'parentPage.component' parameter is not provided.");
3429
3678
  }
3679
+ if (!oChangeContent.parentPage.entitySet && oChangeContent.parentPage.component !== GLOBAL_MANIFEST_CHANGE_COMPONENT$1) {
3680
+ throw new Error("Mandatory 'parentPage.entitySet' parameter is not provided.");
3681
+ }
3430
3682
  if (sMergerType === "ADD") {
3431
3683
  if (!oChangeContent.childPage.id) {
3432
3684
  throw new Error(" Add mandatory parameter 'childPage.id' ");
@@ -3457,7 +3709,7 @@ var mergerUtil = {
3457
3709
  if (!oEntityPropertyChange.operation || oEntityPropertyChange.operation !== "UPSERT") {
3458
3710
  throw new Error("Invalid change format: The mandatory 'operation' is not defined or is not valid type. Please define the mandatory property 'operation' with type 'UPSERT");
3459
3711
  }
3460
- if (!oEntityPropertyChange.propertyValue) {
3712
+ if (oEntityPropertyChange.propertyValue === undefined) {
3461
3713
  throw new Error("Invalid change format: The mandatory 'propertyValue' is not defined. Please define the mandatory property 'propertyValue'");
3462
3714
  }
3463
3715
  }
@@ -3497,6 +3749,7 @@ var addNewObjectPage = {
3497
3749
  };
3498
3750
 
3499
3751
  var oLogger = new FeLogger("manifestMerger.ChangePageConfiguration").getLogger();
3752
+ var GLOBAL_MANIFEST_CHANGE_COMPONENT = "sap.suite.ui.generic.template";
3500
3753
  var changePageConfiguration = {
3501
3754
  applyChange: function (oManifest, oChange) {
3502
3755
  oLogger.info("modifyPageConfiguration use case");
@@ -3504,27 +3757,37 @@ var changePageConfiguration = {
3504
3757
  mergerUtil.consistencyCheck(oChangeContent, "MODIFY");
3505
3758
  var sParentEntitySet = oChangeContent.parentPage.entitySet;
3506
3759
  var sParentComponent = oChangeContent.parentPage.component;
3507
- var oPageStructure = mergerUtil.iterateAndFind(oManifest["sap.ui.generic.app"], sParentEntitySet, sParentComponent);
3760
+ var oPageStructure;
3761
+ if (sParentComponent === GLOBAL_MANIFEST_CHANGE_COMPONENT) {
3762
+ oPageStructure = oManifest["sap.ui.generic.app"];
3763
+ } else {
3764
+ oPageStructure = mergerUtil.iterateAndFind(oManifest["sap.ui.generic.app"], sParentEntitySet, sParentComponent);
3765
+ }
3508
3766
  var oPropertyChange = oChangeContent.entityPropertyChange;
3509
- var aPropertyKeys = Object.keys(oPropertyChange.propertyValue);
3510
- aPropertyKeys.forEach(function (sCurrentKey) {
3767
+ if (typeof oPropertyChange.propertyValue !== "object" || oPropertyChange.propertyValue === null) {
3511
3768
  var aPropertyPath = oPropertyChange.propertyPath.split("/");
3512
- aPropertyPath.push(sCurrentKey);
3513
- var vVal = ObjectPath.get(aPropertyPath, oPageStructure);
3514
- if (vVal && typeof vVal === "object") {
3515
- var oPropertyPathContent = ObjectPath.create(aPropertyPath, oPageStructure);
3516
- Object.assign(oPropertyPathContent, oPropertyChange.propertyValue[sCurrentKey]);
3517
- } else {
3518
- ObjectPath.set(aPropertyPath, oPropertyChange.propertyValue[sCurrentKey], oPageStructure);
3519
- }
3520
- });
3769
+ ObjectPath.set(aPropertyPath, oPropertyChange.propertyValue, oPageStructure);
3770
+ } else {
3771
+ var aPropertyKeys = Object.keys(oPropertyChange.propertyValue);
3772
+ aPropertyKeys.forEach(function (sCurrentKey) {
3773
+ var aPropertyPath = oPropertyChange.propertyPath.split("/");
3774
+ aPropertyPath.push(sCurrentKey);
3775
+ var vVal = ObjectPath.get(aPropertyPath, oPageStructure);
3776
+ if (vVal && typeof vVal === "object") {
3777
+ var oPropertyPathContent = ObjectPath.create(aPropertyPath, oPageStructure);
3778
+ Object.assign(oPropertyPathContent, oPropertyChange.propertyValue[sCurrentKey]);
3779
+ } else {
3780
+ ObjectPath.set(aPropertyPath, oPropertyChange.propertyValue[sCurrentKey], oPageStructure);
3781
+ }
3782
+ });
3783
+ }
3521
3784
  return oManifest;
3522
3785
  }
3523
3786
  };
3524
3787
 
3525
- var _exports = {};
3788
+ var _exports$1 = {};
3526
3789
  let pageConfigurationChanges = {};
3527
- function applyChange(manifest, change) {
3790
+ function applyChange$1(manifest, change) {
3528
3791
  const changeContent = change.getContent();
3529
3792
  const pageId = changeContent === null || changeContent === void 0 ? void 0 : changeContent.page;
3530
3793
  const propertyChange = changeContent === null || changeContent === void 0 ? void 0 : changeContent.entityPropertyChange;
@@ -3532,21 +3795,21 @@ function applyChange(manifest, change) {
3532
3795
  Log.error("Change content is not a valid");
3533
3796
  return manifest;
3534
3797
  }
3535
- return changeConfiguration(manifest, pageId, propertyChange.propertyPath, propertyChange.propertyValue);
3798
+ return changeConfiguration$1(manifest, pageId, propertyChange.propertyPath, propertyChange.propertyValue);
3536
3799
  }
3537
- _exports.applyChange = applyChange;
3538
- function changeConfiguration(manifest, pageId, path, value, lateChange) {
3800
+ _exports$1.applyChange = applyChange$1;
3801
+ function changeConfiguration$1(manifest, pageId, path, value, lateChange) {
3539
3802
  const pageSAPfe = "sap.fe";
3540
- let propertyPath;
3803
+ let propertyPath = retrievePropertyPath(path);
3541
3804
  let pageSettings;
3542
3805
  if (pageId === pageSAPfe) {
3543
- propertyPath = [pageSAPfe, path];
3806
+ propertyPath = [pageSAPfe, ...propertyPath];
3544
3807
  pageSettings = manifest;
3545
3808
  } else {
3546
3809
  pageSettings = getPageSettings(manifest, pageId);
3547
- propertyPath = retrievePropertyPath(path);
3548
3810
  }
3549
3811
  if (pageSettings) {
3812
+ manageSpecificFormat(propertyPath, pageSettings);
3550
3813
  ObjectPath.set(propertyPath, value, pageSettings);
3551
3814
  if (lateChange) {
3552
3815
  pageConfigurationChanges[pageId] = pageConfigurationChanges[pageId] || [];
@@ -3557,7 +3820,16 @@ function changeConfiguration(manifest, pageId, path, value, lateChange) {
3557
3820
  }
3558
3821
  return manifest;
3559
3822
  }
3560
- _exports.changeConfiguration = changeConfiguration;
3823
+ _exports$1.changeConfiguration = changeConfiguration$1;
3824
+ function manageSpecificFormat(propertyPath, pageSettings) {
3825
+ if (propertyPath.length > 1) {
3826
+ for (let i = 0; i < propertyPath.length - 1; i++) {
3827
+ if (typeof ObjectPath.get(propertyPath.slice(0, i + 1), pageSettings) !== "object") {
3828
+ ObjectPath.set(propertyPath.slice(0, i + 1), {}, pageSettings);
3829
+ }
3830
+ }
3831
+ }
3832
+ }
3561
3833
  function retrievePropertyPath(path) {
3562
3834
  let propertyPath = path.split("/");
3563
3835
  if (propertyPath[0] === "controlConfiguration") {
@@ -3595,11 +3867,85 @@ function applyPageConfigurationChanges(manifest, viewData, appComponent, pageId)
3595
3867
  }
3596
3868
  return viewData;
3597
3869
  }
3598
- _exports.applyPageConfigurationChanges = applyPageConfigurationChanges;
3870
+ _exports$1.applyPageConfigurationChanges = applyPageConfigurationChanges;
3599
3871
  function cleanPageConfigurationChanges() {
3600
3872
  pageConfigurationChanges = {};
3601
3873
  }
3602
- _exports.cleanPageConfigurationChanges = cleanPageConfigurationChanges;
3874
+ _exports$1.cleanPageConfigurationChanges = cleanPageConfigurationChanges;
3875
+
3876
+ var _exports = {};
3877
+ function applyChange(manifest, change) {
3878
+ const changeContent = change.getContent();
3879
+ const sourcePage = changeContent === null || changeContent === void 0 ? void 0 : changeContent.sourcePage;
3880
+ const targetPage = changeContent === null || changeContent === void 0 ? void 0 : changeContent.targetPage;
3881
+ if (!(sourcePage !== null && sourcePage !== void 0 && sourcePage.id) || !(targetPage !== null && targetPage !== void 0 && targetPage.id)) {
3882
+ Log.error("Change content is not valid, missing source or target page ID.");
3883
+ return manifest;
3884
+ }
3885
+ return changeConfiguration(manifest, sourcePage, targetPage);
3886
+ }
3887
+ _exports.applyChange = applyChange;
3888
+ function changeConfiguration(manifest, sourcePage, targetPage) {
3889
+ var _manifest$sapUi, _manifest$sapUi$routi, _manifest$sapUi2, _manifest$sapUi2$rout, _sourcePageTarget$opt, _sourcePageTarget$opt2;
3890
+ if (!validateChange(manifest, sourcePage, targetPage)) {
3891
+ return manifest;
3892
+ }
3893
+ const targets = ((_manifest$sapUi = manifest["sap.ui5"]) === null || _manifest$sapUi === void 0 ? void 0 : (_manifest$sapUi$routi = _manifest$sapUi.routing) === null || _manifest$sapUi$routi === void 0 ? void 0 : _manifest$sapUi$routi.targets) ?? ({});
3894
+ targets[targetPage.id] = {
3895
+ type: targetPage.type,
3896
+ name: targetPage.name,
3897
+ options: {
3898
+ settings: targetPage.settings
3899
+ },
3900
+ id: targetPage.id
3901
+ };
3902
+ const routes = ((_manifest$sapUi2 = manifest["sap.ui5"]) === null || _manifest$sapUi2 === void 0 ? void 0 : (_manifest$sapUi2$rout = _manifest$sapUi2.routing) === null || _manifest$sapUi2$rout === void 0 ? void 0 : _manifest$sapUi2$rout.routes) ?? [];
3903
+ routes.push({
3904
+ pattern: targetPage.routePattern,
3905
+ name: targetPage.id,
3906
+ target: targetPage.id
3907
+ });
3908
+ const sourcePageTarget = targets[sourcePage.id];
3909
+ const sourcePageNavigation = ((_sourcePageTarget$opt = sourcePageTarget.options) === null || _sourcePageTarget$opt === void 0 ? void 0 : (_sourcePageTarget$opt2 = _sourcePageTarget$opt.settings) === null || _sourcePageTarget$opt2 === void 0 ? void 0 : _sourcePageTarget$opt2.navigation) ?? ({});
3910
+ sourcePageTarget.options.settings.navigation = {
3911
+ ...sourcePageNavigation,
3912
+ [sourcePage.navigationSource]: {
3913
+ detail: {
3914
+ route: targetPage.id
3915
+ }
3916
+ }
3917
+ };
3918
+ ObjectPath.set(["sap.ui5", "routing", "targets"], targets, manifest);
3919
+ ObjectPath.set(["sap.ui5", "routing", "routes"], routes, manifest);
3920
+ return manifest;
3921
+ }
3922
+ function validateChange(manifest, sourcePage, targetPage) {
3923
+ var _manifest$sapUi3, _manifest$sapUi3$rout, _manifest$sapUi4, _manifest$sapUi4$rout;
3924
+ const targets = ((_manifest$sapUi3 = manifest["sap.ui5"]) === null || _manifest$sapUi3 === void 0 ? void 0 : (_manifest$sapUi3$rout = _manifest$sapUi3.routing) === null || _manifest$sapUi3$rout === void 0 ? void 0 : _manifest$sapUi3$rout.targets) ?? ({});
3925
+ if (targets[targetPage.id]) {
3926
+ Log.error("Target page or route Id already exists in the manifest please check the target page Id in the manifest.");
3927
+ return false;
3928
+ }
3929
+ if (!targets[sourcePage.id]) {
3930
+ Log.error("Source page does not exist in the manifest targets please check the source page Id in the manifest.");
3931
+ return false;
3932
+ }
3933
+ if (!targets[sourcePage.id].name.startsWith("sap.fe")) {
3934
+ Log.error("Source page is not a Fiori elements application please check the source page name in the manifest.");
3935
+ return false;
3936
+ }
3937
+ if (targets[sourcePage.id].options.settings.navigation && targets[sourcePage.id].options.settings.navigation[sourcePage.navigationSource]) {
3938
+ Log.error("Source page already has target navigation please check the source page navigation in the manifest.");
3939
+ return false;
3940
+ }
3941
+ const routes = ((_manifest$sapUi4 = manifest["sap.ui5"]) === null || _manifest$sapUi4 === void 0 ? void 0 : (_manifest$sapUi4$rout = _manifest$sapUi4.routing) === null || _manifest$sapUi4$rout === void 0 ? void 0 : _manifest$sapUi4$rout.routes) ?? [];
3942
+ const sourcePageExists = routes.some(route => route.name === sourcePage.id);
3943
+ if (!sourcePageExists) {
3944
+ Log.error("Source page does not exist in the manifest routes please check the source page name in the manifest.");
3945
+ return false;
3946
+ }
3947
+ return true;
3948
+ }
3603
3949
 
3604
3950
  var Registration = {
3605
3951
  appdescr_ui5_addLibraries: () => Promise.resolve(AddLibrary),
@@ -3610,13 +3956,15 @@ var Registration = {
3610
3956
  appdescr_ovp_removeCard: () => Promise.resolve(DeleteCard),
3611
3957
  appdescr_ui_generic_app_addNewObjectPage: () => Promise.resolve(addNewObjectPage),
3612
3958
  appdescr_ui_generic_app_changePageConfiguration: () => Promise.resolve(changePageConfiguration),
3613
- appdescr_fe_changePageConfiguration: () => Promise.resolve(_exports)
3959
+ appdescr_fe_changePageConfiguration: () => Promise.resolve(_exports$1),
3960
+ appdescr_fe_addNewPage: () => Promise.resolve(_exports)
3614
3961
  };
3615
3962
 
3616
- var RegistrationBuild = {
3963
+ const RegistrationBuild = {
3617
3964
  appdescr_app_changeDataSource: () => Promise.resolve(ChangeDataSource),
3618
3965
  appdescr_ui5_addNewModelEnhanceWith: () => Promise.resolve(AddNewModelEnhanceWith),
3619
3966
  appdescr_ui5_addComponentUsages: () => Promise.resolve(AddComponentUsages),
3967
+ appdescr_ui5_changeModel: () => Promise.resolve(ChangeModel),
3620
3968
  appdescr_ui5_setMinUI5Version: () => Promise.resolve(SetMinUI5Version),
3621
3969
  appdescr_fiori_setRegistrationIds: () => Promise.resolve(SetRegistrationIds),
3622
3970
  appdescr_ui5_setFlexExtensionPointEnabled: () => Promise.resolve(SetFlexExtensionPointEnabled),
@@ -3626,13 +3974,506 @@ var RegistrationBuild = {
3626
3974
  appdescr_app_changeInbound: () => Promise.resolve(ChangeInbound),
3627
3975
  appdescr_app_changeOutbound: () => Promise.resolve(ChangeOutbound),
3628
3976
  appdescr_app_addNewInbound: () => Promise.resolve(AddNewInbound),
3977
+ appdescr_app_addNewOutbound: () => Promise.resolve(AddNewOutbound),
3978
+ appdescr_app_addNewDataSource: () => Promise.resolve(AddNewDataSource),
3629
3979
  appdescr_app_setAch: () => Promise.resolve(SetAch),
3630
3980
  appdescr_app_addTechnicalAttributes: () => Promise.resolve(AddTechnicalAttributes),
3631
3981
  appdescr_fiori_setAbstract: () => Promise.resolve(SetAbstract),
3632
3982
  appdescr_fiori_setCloudDevAdaptationStatus: () => Promise.resolve(SetCloudDevAdaptationStatus)
3633
3983
  };
3634
- var RegistrationCopy = Object.assign({}, Registration);
3635
- var RegistrationBuild$1 = Object.assign(RegistrationCopy, RegistrationBuild);
3984
+ var RegistrationBuild$1 = {
3985
+ ...Registration,
3986
+ ...RegistrationBuild
3987
+ };
3988
+
3989
+ var sDelimiters = "[=(),; \t\"']|%(09|20|22|27|28|29|2c|2C|3b|3B)", sSystemQueryOption = "\\$\\w+", sODataIdentifier = "[a-zA-Z_\\u0080-\\uFFFF][\\w\\u0080-\\uFFFF]*", sWhitespace = "(?:[ \\t]|%09|%20)", rRws = new RegExp(sWhitespace + "+", "g"), rNot = new RegExp("^not" + sWhitespace + "+"), sOperators = "(" + sWhitespace + "+)(and|eq|ge|gt|le|lt|ne|or)" + sWhitespace + "+", sGuid = "[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}", sStar = "(?:\\*|%2[aA])", sNamedPath = sODataIdentifier + "(?:[./]" + sODataIdentifier + ")*" + "(?:[./]" + sStar + "|/\\$ref|/\\$count)?", sStarPath = sStar + "(?:/\\$ref)?", sPathExpression = sNamedPath + "|" + sStarPath, sValueExpression = "(?:[-+:./\\w\"]|%2[bB]|%3[aA])+", rToken = new RegExp("^(?:" + sOperators + "|" + sDelimiters + "|(" + sGuid + ")|(" + sPathExpression + ")|(" + sValueExpression + ")|(" + sSystemQueryOption + "))"), rEscapeDigits = /^[0-9a-f]{2}$/i, mFunctions = {
3990
+ ceiling: {
3991
+ ambiguousParameters: true
3992
+ },
3993
+ concat: {
3994
+ type: "Edm.String"
3995
+ },
3996
+ contains: {
3997
+ type: "Edm.Boolean"
3998
+ },
3999
+ day: {
4000
+ type: "Edm.Int32",
4001
+ ambiguousParameters: true
4002
+ },
4003
+ endswith: {
4004
+ type: "Edm.Boolean"
4005
+ },
4006
+ floor: {
4007
+ ambiguousParameters: true
4008
+ },
4009
+ hour: {
4010
+ type: "Edm.Int32",
4011
+ ambiguousParameters: true
4012
+ },
4013
+ indexof: {
4014
+ type: "Edm.Int32"
4015
+ },
4016
+ length: {
4017
+ type: "Edm.Int32"
4018
+ },
4019
+ minute: {
4020
+ type: "Edm.Int32",
4021
+ ambiguousParameters: true
4022
+ },
4023
+ month: {
4024
+ type: "Edm.Int32",
4025
+ ambiguousParameters: true
4026
+ },
4027
+ round: {
4028
+ ambiguousParameters: true
4029
+ },
4030
+ second: {
4031
+ type: "Edm.Int32",
4032
+ ambiguousParameters: true
4033
+ },
4034
+ startswith: {
4035
+ type: "Edm.Boolean"
4036
+ },
4037
+ substring: {
4038
+ type: "Edm.String"
4039
+ },
4040
+ tolower: {
4041
+ type: "Edm.String"
4042
+ },
4043
+ toupper: {
4044
+ type: "Edm.String"
4045
+ },
4046
+ trim: {
4047
+ type: "Edm.String"
4048
+ },
4049
+ year: {
4050
+ type: "Edm.Int32",
4051
+ ambiguousParameters: true
4052
+ }
4053
+ }, mFilterParserSymbols = {
4054
+ "(": {
4055
+ lbp: 9,
4056
+ led: function (oToken, oLeft) {
4057
+ var oFunction, oParameter;
4058
+ if (oLeft.id !== "PATH") {
4059
+ this.error("Unexpected ", oToken);
4060
+ }
4061
+ oFunction = mFunctions[oLeft.value];
4062
+ if (!oFunction) {
4063
+ this.error("Unknown function ", oLeft);
4064
+ }
4065
+ oLeft.id = "FUNCTION";
4066
+ if (oFunction.type) {
4067
+ oLeft.type = oFunction.type;
4068
+ }
4069
+ oLeft.parameters = [];
4070
+ do {
4071
+ this.advanceBws();
4072
+ oParameter = this.expression(0);
4073
+ if (oFunction.ambiguousParameters) {
4074
+ oParameter.ambiguous = true;
4075
+ }
4076
+ oLeft.parameters.push(oParameter);
4077
+ this.advanceBws();
4078
+ } while (this.advanceIf(","));
4079
+ this.advanceBws();
4080
+ this.advance(")");
4081
+ return oLeft;
4082
+ },
4083
+ nud: function () {
4084
+ var oToken;
4085
+ this.advanceBws();
4086
+ oToken = this.expression(0);
4087
+ this.advanceBws();
4088
+ this.advance(")");
4089
+ return oToken;
4090
+ }
4091
+ },
4092
+ not: {
4093
+ lbp: 7,
4094
+ nud: function (oToken) {
4095
+ oToken.precedence = 7;
4096
+ oToken.right = this.expression(7);
4097
+ oToken.type = "Edm.Boolean";
4098
+ return oToken;
4099
+ }
4100
+ }
4101
+ };
4102
+ function addInfixOperator(sId, iLbp) {
4103
+ mFilterParserSymbols[sId] = {
4104
+ lbp: iLbp,
4105
+ led: function (oToken, oLeft) {
4106
+ oToken.type = "Edm.Boolean";
4107
+ oToken.precedence = iLbp;
4108
+ oToken.left = oLeft;
4109
+ oToken.right = this.expression(iLbp);
4110
+ return oToken;
4111
+ }
4112
+ };
4113
+ }
4114
+ function addLeafSymbol(sId) {
4115
+ mFilterParserSymbols[sId] = {
4116
+ lbp: 0,
4117
+ nud: function (oToken) {
4118
+ oToken.precedence = 99;
4119
+ return oToken;
4120
+ }
4121
+ };
4122
+ }
4123
+ addInfixOperator("and", 2);
4124
+ addInfixOperator("eq", 3);
4125
+ addInfixOperator("ge", 4);
4126
+ addInfixOperator("gt", 4);
4127
+ addInfixOperator("le", 4);
4128
+ addInfixOperator("lt", 4);
4129
+ addInfixOperator("ne", 3);
4130
+ addInfixOperator("or", 1);
4131
+ addLeafSymbol("PATH");
4132
+ addLeafSymbol("VALUE");
4133
+ function _Parser() {}
4134
+ _Parser.prototype.advance = function (sExpectedTokenId) {
4135
+ var oToken = this.current();
4136
+ if (sExpectedTokenId && (!oToken || oToken.id !== sExpectedTokenId)) {
4137
+ if (sExpectedTokenId === "OPTION") {
4138
+ sExpectedTokenId = "system query option";
4139
+ } else if (sExpectedTokenId.length === 1) {
4140
+ sExpectedTokenId = "'" + sExpectedTokenId + "'";
4141
+ }
4142
+ this.expected(sExpectedTokenId, oToken);
4143
+ }
4144
+ this.iCurrentToken += 1;
4145
+ return oToken;
4146
+ };
4147
+ _Parser.prototype.advanceIf = function (sExpectedTokenId) {
4148
+ var oToken = this.current();
4149
+ if (oToken && oToken.id === sExpectedTokenId) {
4150
+ this.iCurrentToken += 1;
4151
+ return true;
4152
+ }
4153
+ return false;
4154
+ };
4155
+ _Parser.prototype.current = function () {
4156
+ return this.aTokens[this.iCurrentToken];
4157
+ };
4158
+ _Parser.prototype.error = function (sMessage, oToken) {
4159
+ var sValue;
4160
+ if (oToken) {
4161
+ sValue = oToken.value;
4162
+ sMessage += "'" + (sValue === " " ? sValue : sValue.replace(rRws, "")) + "' at " + oToken.at;
4163
+ } else {
4164
+ sMessage += "end of input";
4165
+ }
4166
+ throw new SyntaxError(sMessage + ": " + this.sText);
4167
+ };
4168
+ _Parser.prototype.expected = function (sWhat, oToken) {
4169
+ this.error("Expected " + sWhat + " but instead saw ", oToken);
4170
+ };
4171
+ _Parser.prototype.finish = function () {
4172
+ if (this.iCurrentToken < this.aTokens.length) {
4173
+ this.expected("end of input", this.aTokens[this.iCurrentToken]);
4174
+ }
4175
+ };
4176
+ _Parser.prototype.init = function (sText) {
4177
+ this.sText = sText;
4178
+ this.aTokens = tokenize(sText);
4179
+ this.iCurrentToken = 0;
4180
+ };
4181
+ function _FilterParser() {
4182
+ _Parser.apply(this, arguments);
4183
+ }
4184
+ _FilterParser.prototype = Object.create(_Parser.prototype);
4185
+ _FilterParser.prototype.advanceBws = function () {
4186
+ var oToken;
4187
+ for (; ; ) {
4188
+ oToken = this.current();
4189
+ if (!oToken || oToken.id !== " " && oToken.id !== "\t") {
4190
+ return;
4191
+ }
4192
+ this.advance();
4193
+ }
4194
+ };
4195
+ _FilterParser.prototype.expression = function (iRbp) {
4196
+ var fnLeft, oLeft, oToken;
4197
+ oToken = this.advance();
4198
+ if (!oToken) {
4199
+ this.expected("expression");
4200
+ }
4201
+ fnLeft = this.getSymbolValue(oToken, "nud");
4202
+ if (!fnLeft) {
4203
+ this.expected("expression", oToken);
4204
+ }
4205
+ oLeft = fnLeft.call(this, oToken);
4206
+ oToken = this.current();
4207
+ while (oToken && this.getSymbolValue(oToken, "lbp", 0) > iRbp) {
4208
+ oLeft = this.getSymbolValue(oToken, "led").call(this, this.advance(), oLeft);
4209
+ oToken = this.current();
4210
+ }
4211
+ return oLeft;
4212
+ };
4213
+ _FilterParser.prototype.getSymbolValue = function (oToken, sWhat, vDefault) {
4214
+ var oSymbol = mFilterParserSymbols[oToken.id];
4215
+ return oSymbol && (sWhat in oSymbol) ? oSymbol[sWhat] : vDefault;
4216
+ };
4217
+ _FilterParser.prototype.parse = function (sFilter) {
4218
+ var oResult;
4219
+ this.init(sFilter);
4220
+ oResult = this.expression(0);
4221
+ this.finish();
4222
+ return oResult;
4223
+ };
4224
+ function _KeyPredicateParser() {
4225
+ _Parser.apply(this, arguments);
4226
+ }
4227
+ _KeyPredicateParser.prototype = Object.create(_Parser.prototype);
4228
+ _KeyPredicateParser.prototype.parse = function (sKeyPredicate) {
4229
+ var sKey, oKeyProperties = {}, sValue;
4230
+ this.init(sKeyPredicate);
4231
+ this.advance("(");
4232
+ if (this.current().id === "VALUE") {
4233
+ oKeyProperties[""] = this.advance().value;
4234
+ } else {
4235
+ do {
4236
+ sKey = this.advance("PATH").value;
4237
+ this.advance("=");
4238
+ sValue = this.advance("VALUE").value;
4239
+ oKeyProperties[sKey] = sValue;
4240
+ } while (this.advanceIf(","));
4241
+ }
4242
+ this.advance(")");
4243
+ this.finish();
4244
+ return oKeyProperties;
4245
+ };
4246
+ function _SystemQueryOptionParser() {
4247
+ _Parser.apply(this, arguments);
4248
+ }
4249
+ _SystemQueryOptionParser.prototype = Object.create(_Parser.prototype);
4250
+ _SystemQueryOptionParser.prototype.parse = function (sOption) {
4251
+ var oResult;
4252
+ this.init(sOption);
4253
+ oResult = this.parseSystemQueryOption();
4254
+ this.finish();
4255
+ return oResult;
4256
+ };
4257
+ _SystemQueryOptionParser.prototype.parseAnythingWithBrackets = function (oStartToken) {
4258
+ var sValue = "", oResult = {}, oToken, that = this;
4259
+ function brackets() {
4260
+ for (; ; ) {
4261
+ oToken = that.advance();
4262
+ if (!oToken || oToken.id === ";") {
4263
+ that.expected("')'", oToken);
4264
+ }
4265
+ sValue += oToken.value;
4266
+ if (oToken.id === ")") {
4267
+ return;
4268
+ }
4269
+ if (oToken.id === "(") {
4270
+ brackets();
4271
+ }
4272
+ }
4273
+ }
4274
+ this.advance("=");
4275
+ for (; ; ) {
4276
+ oToken = this.current();
4277
+ if (!oToken || oToken.id === ")" || oToken.id === ";") {
4278
+ break;
4279
+ }
4280
+ sValue += this.advance().value;
4281
+ if (oToken.id === "(") {
4282
+ brackets();
4283
+ }
4284
+ }
4285
+ if (!sValue) {
4286
+ this.expected("an option value", oToken);
4287
+ }
4288
+ oResult[oStartToken.value] = sValue;
4289
+ return oResult;
4290
+ };
4291
+ _SystemQueryOptionParser.prototype.parseExpand = function () {
4292
+ var oExpand = {}, sExpandPath, oQueryOption, sQueryOptionName, vValue;
4293
+ this.advance("=");
4294
+ do {
4295
+ vValue = null;
4296
+ sExpandPath = this.advance("PATH").value.replace(/%2a/i, "*");
4297
+ if (this.advanceIf("(")) {
4298
+ vValue = {};
4299
+ do {
4300
+ oQueryOption = this.parseSystemQueryOption();
4301
+ sQueryOptionName = Object.keys(oQueryOption)[0];
4302
+ vValue[sQueryOptionName] = oQueryOption[sQueryOptionName];
4303
+ } while (this.advanceIf(";"));
4304
+ this.advance(")");
4305
+ }
4306
+ oExpand[sExpandPath] = vValue;
4307
+ } while (this.advanceIf(","));
4308
+ return {
4309
+ $expand: oExpand
4310
+ };
4311
+ };
4312
+ _SystemQueryOptionParser.prototype.parseSelect = function () {
4313
+ var sPath, sPrefix, aSelect = [], oToken;
4314
+ this.advance("=");
4315
+ do {
4316
+ oToken = this.advance("PATH");
4317
+ sPath = oToken.value.replace(/%2a/i, "*");
4318
+ if (this.advanceIf("(")) {
4319
+ sPrefix = "(";
4320
+ do {
4321
+ sPath += sPrefix + this.advance("PATH").value;
4322
+ sPrefix = ",";
4323
+ } while (this.advanceIf(","));
4324
+ sPath += this.advance(")").value;
4325
+ }
4326
+ aSelect.push(sPath);
4327
+ } while (this.advanceIf(","));
4328
+ return {
4329
+ $select: aSelect
4330
+ };
4331
+ };
4332
+ _SystemQueryOptionParser.prototype.parseSystemQueryOption = function () {
4333
+ var oToken = this.advance("OPTION");
4334
+ switch (oToken.value) {
4335
+ case "$expand":
4336
+ return this.parseExpand();
4337
+ case "$select":
4338
+ return this.parseSelect();
4339
+ default:
4340
+ return this.parseAnythingWithBrackets(oToken);
4341
+ }
4342
+ };
4343
+ function unescape$1(sEscape) {
4344
+ return String.fromCharCode(parseInt(sEscape, 16));
4345
+ }
4346
+ function tokenizeSingleQuotedString(sNext, sOption, iAt) {
4347
+ var i;
4348
+ function nextChar(bConsume) {
4349
+ var c = sNext[i];
4350
+ if (c === "%" && sNext[i + 1] === "2" && sNext[i + 2] === "7") {
4351
+ c = "'";
4352
+ if (bConsume) {
4353
+ i += 2;
4354
+ }
4355
+ }
4356
+ if (bConsume) {
4357
+ i += 1;
4358
+ }
4359
+ return c;
4360
+ }
4361
+ for (i = 1; i < sNext.length; ) {
4362
+ if (nextChar(true) === "'") {
4363
+ if (nextChar(false) !== "'") {
4364
+ return sNext.slice(0, i);
4365
+ }
4366
+ nextChar(true);
4367
+ }
4368
+ }
4369
+ throw new SyntaxError("Unterminated string at " + iAt + ": " + sOption);
4370
+ }
4371
+ function tokenizeDoubleQuotedString(sNext, sOption, iAt) {
4372
+ var c, sEscape, bEscaping = false, i;
4373
+ for (i = 1; i < sNext.length; i += 1) {
4374
+ if (bEscaping) {
4375
+ bEscaping = false;
4376
+ } else {
4377
+ c = sNext[i];
4378
+ if (c === "%") {
4379
+ sEscape = sNext.slice(i + 1, i + 3);
4380
+ if (rEscapeDigits.test(sEscape)) {
4381
+ c = unescape$1(sEscape);
4382
+ i += 2;
4383
+ }
4384
+ }
4385
+ if (c === "\"") {
4386
+ return sNext.slice(0, i + 1);
4387
+ }
4388
+ bEscaping = c === "\\";
4389
+ }
4390
+ }
4391
+ throw new SyntaxError("Unterminated string at " + iAt + ": " + sOption);
4392
+ }
4393
+ function tokenize(sOption) {
4394
+ var iAt = 1, sId, aMatches, sNext = sOption, iOffset, oToken, aTokens = [], sValue;
4395
+ while (sNext.length) {
4396
+ aMatches = rToken.exec(sNext);
4397
+ iOffset = 0;
4398
+ if (aMatches) {
4399
+ sValue = aMatches[0];
4400
+ if (aMatches[7]) {
4401
+ sId = "OPTION";
4402
+ } else if (aMatches[6] || aMatches[4]) {
4403
+ sId = "VALUE";
4404
+ } else if (aMatches[5]) {
4405
+ sId = "PATH";
4406
+ if (sValue === "false" || sValue === "true" || sValue === "null") {
4407
+ sId = "VALUE";
4408
+ } else if (sValue === "not") {
4409
+ aMatches = rNot.exec(sNext);
4410
+ if (aMatches) {
4411
+ sId = "not";
4412
+ sValue = aMatches[0];
4413
+ }
4414
+ }
4415
+ } else if (aMatches[3]) {
4416
+ sId = unescape$1(aMatches[3]);
4417
+ } else if (aMatches[2]) {
4418
+ sId = aMatches[2];
4419
+ iOffset = aMatches[1].length;
4420
+ } else {
4421
+ sId = aMatches[0];
4422
+ }
4423
+ if (sId === "\"") {
4424
+ sId = "VALUE";
4425
+ sValue = tokenizeDoubleQuotedString(sNext, sOption, iAt);
4426
+ } else if (sId === "'") {
4427
+ sId = "VALUE";
4428
+ sValue = tokenizeSingleQuotedString(sNext, sOption, iAt);
4429
+ }
4430
+ oToken = {
4431
+ at: iAt + iOffset,
4432
+ id: sId,
4433
+ value: sValue
4434
+ };
4435
+ } else {
4436
+ throw new SyntaxError("Unknown character '" + sNext[0] + "' at " + iAt + ": " + sOption);
4437
+ }
4438
+ sNext = sNext.slice(sValue.length);
4439
+ iAt += sValue.length;
4440
+ aTokens.push(oToken);
4441
+ }
4442
+ return aTokens;
4443
+ }
4444
+ var _Parser$1 = {
4445
+ buildFilterString: function (oSyntaxTree) {
4446
+ function serialize(oNode, iParentPrecedence) {
4447
+ var sFilter;
4448
+ if (!oNode) {
4449
+ return "";
4450
+ }
4451
+ if (oNode.parameters) {
4452
+ sFilter = oNode.parameters.map(function (oParameter) {
4453
+ return serialize(oParameter, 0);
4454
+ }).join(",");
4455
+ return oNode.value + "(" + sFilter + ")";
4456
+ }
4457
+ sFilter = serialize(oNode.left, oNode.precedence) + oNode.value + serialize(oNode.right, oNode.precedence);
4458
+ if (oNode.precedence < iParentPrecedence) {
4459
+ sFilter = "(" + sFilter + ")";
4460
+ }
4461
+ return sFilter;
4462
+ }
4463
+ return serialize(oSyntaxTree, 0);
4464
+ },
4465
+ parseFilter: function (sFilter) {
4466
+ return new _FilterParser().parse(sFilter);
4467
+ },
4468
+ parseKeyPredicate: function (sKeyPredicate) {
4469
+ return new _KeyPredicateParser().parse(sKeyPredicate);
4470
+ },
4471
+ parseSystemQueryOption: function (sOption) {
4472
+ return new _SystemQueryOptionParser().parse(sOption);
4473
+ },
4474
+ sODataIdentifier: sODataIdentifier,
4475
+ sWhitespace: sWhitespace
4476
+ };
3636
4477
 
3637
4478
  var fnEqual = function (a, b, maxDepth, contains, depth) {
3638
4479
  if (typeof maxDepth == "boolean") {
@@ -3909,6 +4750,1068 @@ SyncPromise.resolve = function (vResult) {
3909
4750
  });
3910
4751
  };
3911
4752
 
4753
+ var FilterOperator = {
4754
+ EQ: "EQ",
4755
+ NE: "NE",
4756
+ LT: "LT",
4757
+ LE: "LE",
4758
+ GT: "GT",
4759
+ GE: "GE",
4760
+ BT: "BT",
4761
+ NB: "NB",
4762
+ Contains: "Contains",
4763
+ NotContains: "NotContains",
4764
+ StartsWith: "StartsWith",
4765
+ NotStartsWith: "NotStartsWith",
4766
+ EndsWith: "EndsWith",
4767
+ NotEndsWith: "NotEndsWith",
4768
+ All: "All",
4769
+ Any: "Any"
4770
+ };
4771
+
4772
+ class config {
4773
+ config = new Map();
4774
+ static get Type() {
4775
+ return {
4776
+ String: "string"
4777
+ }
4778
+ }
4779
+ static get({ name }) {
4780
+ return name === "sapUiLogLevel" ? "Error" : undefined;
4781
+ }
4782
+ static getWritableInstance() {
4783
+ return {
4784
+ get(obj) {
4785
+ config.get(obj.name);
4786
+ },
4787
+ set(name, obj) {
4788
+ config.set(name, obj);
4789
+ }
4790
+ }
4791
+ }
4792
+ }
4793
+
4794
+ class Eventing {
4795
+ #mEventRegistry = {};
4796
+ /**
4797
+ * Attaches an event handler to the event with the given identifier.
4798
+ *
4799
+ * @param {string}
4800
+ * sType The type of the event to listen for
4801
+ * @param {function}
4802
+ * fnFunction The handler function to call when the event occurs. The event
4803
+ * object ({@link module:sap/base/Event}) is provided as first argument of the handler. Handlers must not change
4804
+ * the content of the event.
4805
+ * @param {object}
4806
+ * [oData] An object that will be passed to the handler along with the event object when the event is fired
4807
+ * @since 1.120.0
4808
+ * @private
4809
+ * @ui5-restricted sap.ui.core sap/base/i18n
4810
+ */
4811
+ attachEvent(sType, fnFunction, oData) {
4812
+ assert(typeof (sType) === "string" && sType, "Eventing.attachEvent: sType must be a non-empty string");
4813
+ assert(typeof (fnFunction) === "function", "Eventing.attachEvent: fnFunction must be a function");
4814
+
4815
+ let aEventListeners = this.#mEventRegistry[sType];
4816
+ if ( !Array.isArray(aEventListeners) ) {
4817
+ aEventListeners = this.#mEventRegistry[sType] = [];
4818
+ }
4819
+
4820
+ aEventListeners.push({fnFunction: fnFunction, oData: oData});
4821
+ }
4822
+
4823
+ /**
4824
+ * Attaches an event handler, called one time only, to the event with the given identifier.
4825
+ *
4826
+ * When the event occurs, the handler function is called and the handler registration is automatically removed afterwards.
4827
+ *
4828
+ * @param {string}
4829
+ * sType The type of the event to listen for
4830
+ * @param {function}
4831
+ * fnFunction The handler function to call when the event occurs. The event
4832
+ * object ({@link module:sap/base/Event}) is provided as first argument of the handler. Handlers must not change
4833
+ * the content of the event.
4834
+ * @param {object}
4835
+ * [oData] An object that will be passed to the handler along with the event object when the event is fired
4836
+ * @since 1.120.0
4837
+ * @private
4838
+ * @ui5-restricted sap.ui.core sap/base/i18n
4839
+ */
4840
+ attachEventOnce(sType, fnFunction, oData) {
4841
+ const fnOnce = (oEvent) => {
4842
+ this.detachEvent(sType, fnOnce);
4843
+ fnFunction.call(null, oEvent); // needs to do the same resolution as in fireEvent
4844
+ };
4845
+ fnOnce.oOriginal = {
4846
+ fnFunction: fnFunction
4847
+ };
4848
+ this.attachEvent(sType, fnOnce, oData);
4849
+ }
4850
+
4851
+ /**
4852
+ * Removes a previously attached event handler from the event with the given identifier.
4853
+ *
4854
+ * The passed parameters must match those used for registration with {@link #attachEvent} beforehand.
4855
+ *
4856
+ * @param {string}
4857
+ * sType The type of the event to detach from
4858
+ * @param {function}
4859
+ * fnFunction The handler function to detach from the event
4860
+ * @since 1.120.0
4861
+ * @private
4862
+ * @ui5-restricted sap.ui.core sap/base/i18n
4863
+ */
4864
+ detachEvent(sType, fnFunction) {
4865
+ assert(typeof (sType) === "string" && sType, "Eventing.detachEvent: sType must be a non-empty string" );
4866
+ assert(typeof (fnFunction) === "function", "Eventing.detachEvent: fnFunction must be a function");
4867
+
4868
+ const aEventListeners = this.#mEventRegistry[sType];
4869
+ if ( !Array.isArray(aEventListeners) ) {
4870
+ return;
4871
+ }
4872
+
4873
+ let oFound;
4874
+
4875
+ for (let i = 0, iL = aEventListeners.length; i < iL; i++) {
4876
+ if (aEventListeners[i].fnFunction === fnFunction) {
4877
+ oFound = aEventListeners[i];
4878
+ aEventListeners.splice(i,1);
4879
+ break;
4880
+ }
4881
+ }
4882
+ // If no listener was found, look for original listeners of attachEventOnce
4883
+ if (!oFound) {
4884
+ for (let i = 0, iL = aEventListeners.length; i < iL; i++) {
4885
+ const oOriginal = aEventListeners[i].fnFunction.oOriginal;
4886
+ if (oOriginal && oOriginal.fnFunction === fnFunction) {
4887
+ aEventListeners.splice(i,1);
4888
+ break;
4889
+ }
4890
+ }
4891
+ }
4892
+ // If we just deleted the last registered EventHandler, remove the whole entry from our map.
4893
+ if (aEventListeners.length == 0) {
4894
+ delete this.#mEventRegistry[sType];
4895
+ }
4896
+ }
4897
+
4898
+ /**
4899
+ * Fires an {@link module:sap/base/Event event} with the given settings and notifies all attached event handlers.
4900
+ *
4901
+ * @param {string}
4902
+ * sType The type of the event to fire
4903
+ * @param {object}
4904
+ * [oParameters] Parameters which should be carried by the event
4905
+ * @since 1.120.0
4906
+ * @private
4907
+ * @ui5-restricted sap.ui.core sap/base/i18n
4908
+ */
4909
+ fireEvent(sType, oParameters) {
4910
+ let aEventListeners, oEvent, i, iL, oInfo;
4911
+
4912
+ aEventListeners = this.#mEventRegistry[sType];
4913
+
4914
+ if (Array.isArray(aEventListeners)) {
4915
+
4916
+ // avoid issues with 'concurrent modification' (e.g. if an event listener unregisters itself).
4917
+ aEventListeners = aEventListeners.slice();
4918
+ oEvent = new Event(sType, oParameters);
4919
+
4920
+ for (i = 0, iL = aEventListeners.length; i < iL; i++) {
4921
+ oInfo = aEventListeners[i];
4922
+ oInfo.fnFunction.call(null, oEvent);
4923
+ }
4924
+ }
4925
+ }
4926
+ }
4927
+
4928
+ class LanguageTag {
4929
+ /**
4930
+ * Get the language.
4931
+ *
4932
+ * Note that the case might differ from the original script tag
4933
+ * (Lower case is enforced as recommended by BCP47/ISO639).
4934
+ *
4935
+ * @type {string}
4936
+ * @public
4937
+ */
4938
+ language;
4939
+
4940
+ /**
4941
+ * Get the script or <code>null</code> if none was specified.
4942
+ *
4943
+ * Note that the case might differ from the original language tag
4944
+ * (Upper case first letter and lower case reminder enforced as
4945
+ * recommended by BCP47/ISO15924)
4946
+ *
4947
+ * @type {string|null}
4948
+ * @public
4949
+ */
4950
+ script;
4951
+
4952
+ /**
4953
+ * Get the region or <code>null</code> if none was specified.
4954
+ *
4955
+ * Note that the case might differ from the original script tag
4956
+ * (Upper case is enforced as recommended by BCP47/ISO3166-1).
4957
+ *
4958
+ * @type {string}
4959
+ * @public
4960
+ */
4961
+ region;
4962
+
4963
+ /**
4964
+ * Get the variants as a single string or <code>null</code>.
4965
+ *
4966
+ * Multiple variants are separated by a dash '-'.
4967
+ *
4968
+ * @type {string|null}
4969
+ * @public
4970
+ */
4971
+ variant;
4972
+
4973
+ /**
4974
+ * Get the variants as an array of individual variants.
4975
+ *
4976
+ * The separating dashes are not part of the result.
4977
+ * If there is no variant section in the language tag, an empty array is returned.
4978
+ *
4979
+ * @type {string[]}
4980
+ * @public
4981
+ */
4982
+ variantSubtags;
4983
+
4984
+ /**
4985
+ * Get the extension as a single string or <code>null</code>.
4986
+ *
4987
+ * The extension always consists of a singleton character (not 'x'),
4988
+ * a dash '-' and one or more extension token, each separated
4989
+ * again with a dash.
4990
+ *
4991
+ * @type {string|null}
4992
+ * @public
4993
+ */
4994
+ extension;
4995
+
4996
+ /**
4997
+ * Get the extensions as an array of tokens.
4998
+ *
4999
+ * The leading singleton and the separating dashes are not part of the result.
5000
+ * If there is no extensions section in the language tag, an empty array is returned.
5001
+ *
5002
+ * @type {string[]}
5003
+ * @public
5004
+ */
5005
+ extensionSubtags;
5006
+
5007
+ /**
5008
+ * Get the private use section or <code>null</code>.
5009
+ *
5010
+ * @type {string}
5011
+ */
5012
+ privateUse;
5013
+
5014
+ /**
5015
+ * Get the private use section as an array of tokens.
5016
+ *
5017
+ * The leading singleton and the separating dashes are not part of the result.
5018
+ * If there is no private use section in the language tag, an empty array is returned.
5019
+ *
5020
+ * @type {string[]}
5021
+ */
5022
+ privateUseSubtags;
5023
+
5024
+ constructor(sLanguageTag) {
5025
+ var aResult = rLanguageTag.exec(sLanguageTag.replace(/_/g, "-"));
5026
+ // If the given language tag string cannot be parsed by the regular expression above,
5027
+ // we should at least tell the developer why the Core fails to load.
5028
+ if (aResult === null ) {
5029
+ throw new TypeError("The given language tag '" + sLanguageTag + "' does not adhere to BCP-47.");
5030
+ }
5031
+ this.language = aResult[1] || null;
5032
+ this.script = aResult[2] || null;
5033
+ this.region = aResult[3] || null;
5034
+ this.variant = (aResult[4] && aResult[4].slice(1)) || null; // remove leading dash from capturing group
5035
+ this.variantSubtags = this.variant ? this.variant.split('-') : [];
5036
+ this.extension = (aResult[5] && aResult[5].slice(1)) || null; // remove leading dash from capturing group
5037
+ this.extensionSubtags = this.variant ? this.variant.split('-') : [];
5038
+ this.privateUse = aResult[6] || null;
5039
+ this.privateUseSubtags = this.privateUse ? this.privateUse.slice(2).split('-') : [];
5040
+ // convert subtags according to the BCP47 recommendations
5041
+ // - language: all lower case
5042
+ // - script: lower case with the first letter capitalized
5043
+ // - region: all upper case
5044
+ if ( this.language ) {
5045
+ this.language = this.language.toLowerCase();
5046
+ }
5047
+ if ( this.script ) {
5048
+ this.script = this.script.toLowerCase().replace(/^[a-z]/, function($) {
5049
+ return $.toUpperCase();
5050
+ });
5051
+ }
5052
+ if ( this.region ) {
5053
+ this.region = this.region.toUpperCase();
5054
+ }
5055
+ Object.freeze(this);
5056
+ }
5057
+ toString() {
5058
+ return this.#join(
5059
+ this.language,
5060
+ this.script,
5061
+ this.region,
5062
+ this.variant,
5063
+ this.extension,
5064
+ this.privateUse);
5065
+ }
5066
+ #join() {
5067
+ return Array.prototype.filter.call(arguments, Boolean).join("-");
5068
+ }
5069
+ }
5070
+
5071
+ let _fnRegisterEnum;
5072
+ const mEarlyRegistrations = new Map();
5073
+ var _EnumHelper = {
5074
+ inject: function (registerEnum) {
5075
+ if (!_fnRegisterEnum) {
5076
+ _fnRegisterEnum = registerEnum;
5077
+ mEarlyRegistrations.forEach((mEnumContent, sName) => {
5078
+ _fnRegisterEnum(sName, mEnumContent);
5079
+ });
5080
+ }
5081
+ },
5082
+ register: function (sName, mEnumContent) {
5083
+ if (_fnRegisterEnum) {
5084
+ _fnRegisterEnum(sName, mEnumContent);
5085
+ } else {
5086
+ mEarlyRegistrations.set(sName, mEnumContent);
5087
+ }
5088
+ }
5089
+ };
5090
+
5091
+ var CalendarType = {
5092
+ Gregorian: "Gregorian",
5093
+ Islamic: "Islamic",
5094
+ Japanese: "Japanese",
5095
+ Persian: "Persian",
5096
+ Buddhist: "Buddhist"
5097
+ };
5098
+ _EnumHelper.register("sap.base.i18n.date.CalendarType", CalendarType);
5099
+
5100
+ var TimezoneUtils = {};
5101
+ var sLocalTimezone = "";
5102
+ var aSupportedTimezoneIDs;
5103
+ var oIntlDateTimeFormatCache = {
5104
+ _oCache: new Map(),
5105
+ _iCacheLimit: 10,
5106
+ get: function (sTimezone) {
5107
+ var cacheEntry = this._oCache.get(sTimezone);
5108
+ if (cacheEntry) {
5109
+ return cacheEntry;
5110
+ }
5111
+ var oOptions = {
5112
+ hourCycle: "h23",
5113
+ hour: "2-digit",
5114
+ minute: "2-digit",
5115
+ second: "2-digit",
5116
+ fractionalSecondDigits: 3,
5117
+ day: "2-digit",
5118
+ month: "2-digit",
5119
+ year: "numeric",
5120
+ timeZone: sTimezone,
5121
+ timeZoneName: "short",
5122
+ era: "narrow",
5123
+ weekday: "short"
5124
+ };
5125
+ var oInstance = new Intl.DateTimeFormat("en-US", oOptions);
5126
+ if (this._oCache.size === this._iCacheLimit) {
5127
+ this._oCache = new Map();
5128
+ }
5129
+ this._oCache.set(sTimezone, oInstance);
5130
+ return oInstance;
5131
+ }
5132
+ };
5133
+ TimezoneUtils.isValidTimezone = function (sTimezone) {
5134
+ if (!sTimezone) {
5135
+ return false;
5136
+ }
5137
+ if (Intl.supportedValuesOf) {
5138
+ try {
5139
+ aSupportedTimezoneIDs = aSupportedTimezoneIDs || Intl.supportedValuesOf("timeZone");
5140
+ if (aSupportedTimezoneIDs.includes(sTimezone)) {
5141
+ return true;
5142
+ }
5143
+ } catch (oError) {
5144
+ aSupportedTimezoneIDs = [];
5145
+ }
5146
+ }
5147
+ try {
5148
+ oIntlDateTimeFormatCache.get(sTimezone);
5149
+ return true;
5150
+ } catch (oError) {
5151
+ return false;
5152
+ }
5153
+ };
5154
+ TimezoneUtils.convertToTimezone = function (oDate, sTargetTimezone) {
5155
+ var oFormatParts = this._getParts(oDate, sTargetTimezone);
5156
+ return TimezoneUtils._getDateFromParts(oFormatParts);
5157
+ };
5158
+ TimezoneUtils._getParts = function (oDate, sTargetTimezone) {
5159
+ var sKey, oPart, oDateParts = Object.create(null), oIntlDate = oIntlDateTimeFormatCache.get(sTargetTimezone), oParts = oIntlDate.formatToParts(new Date(oDate.getTime()));
5160
+ for (sKey in oParts) {
5161
+ oPart = oParts[sKey];
5162
+ if (oPart.type !== "literal") {
5163
+ oDateParts[oPart.type] = oPart.value;
5164
+ }
5165
+ }
5166
+ return oDateParts;
5167
+ };
5168
+ TimezoneUtils._getDateFromParts = function (oParts) {
5169
+ var oDate = new Date(0), iUTCYear = parseInt(oParts.year);
5170
+ if (oParts.era === "B") {
5171
+ iUTCYear = iUTCYear * -1 + 1;
5172
+ }
5173
+ oDate.setUTCFullYear(iUTCYear, parseInt(oParts.month) - 1, parseInt(oParts.day));
5174
+ oDate.setUTCHours(parseInt(oParts.hour), parseInt(oParts.minute), parseInt(oParts.second), parseInt(oParts.fractionalSecond || 0));
5175
+ return oDate;
5176
+ };
5177
+ TimezoneUtils.calculateOffset = function (oDate, sTimezoneSource) {
5178
+ const oDateInTimezone = TimezoneUtils.convertToTimezone(oDate, sTimezoneSource);
5179
+ const iGivenTimestamp = oDate.getTime();
5180
+ const iInitialOffset = iGivenTimestamp - oDateInTimezone.getTime();
5181
+ const oFirstGuess = new Date(iGivenTimestamp + iInitialOffset);
5182
+ const oFirstGuessInTimezone = TimezoneUtils.convertToTimezone(oFirstGuess, sTimezoneSource);
5183
+ const iFirstGuessInTimezoneTimestamp = oFirstGuessInTimezone.getTime();
5184
+ const iSecondOffset = oFirstGuess.getTime() - iFirstGuessInTimezoneTimestamp;
5185
+ let iTimezoneOffset = iSecondOffset;
5186
+ if (iInitialOffset !== iSecondOffset) {
5187
+ const oSecondGuess = new Date(iGivenTimestamp + iSecondOffset);
5188
+ const oSecondGuessInTimezone = TimezoneUtils.convertToTimezone(oSecondGuess, sTimezoneSource);
5189
+ const iSecondGuessInTimezoneTimestamp = oSecondGuessInTimezone.getTime();
5190
+ if (iSecondGuessInTimezoneTimestamp !== iGivenTimestamp && iFirstGuessInTimezoneTimestamp > iSecondGuessInTimezoneTimestamp) {
5191
+ iTimezoneOffset = iInitialOffset;
5192
+ }
5193
+ }
5194
+ return iTimezoneOffset / 1000;
5195
+ };
5196
+ TimezoneUtils.mCLDR2ABAPTimezones = {
5197
+ "America/Buenos_Aires": "America/Argentina/Buenos_Aires",
5198
+ "America/Catamarca": "America/Argentina/Catamarca",
5199
+ "America/Cordoba": "America/Argentina/Cordoba",
5200
+ "America/Jujuy": "America/Argentina/Jujuy",
5201
+ "America/Mendoza": "America/Argentina/Mendoza",
5202
+ "America/Indianapolis": "America/Indiana/Indianapolis",
5203
+ "America/Louisville": "America/Kentucky/Louisville",
5204
+ "Africa/Asmera": "Africa/Asmara",
5205
+ "Asia/Katmandu": "Asia/Kathmandu",
5206
+ "Asia/Calcutta": "Asia/Kolkata",
5207
+ "Atlantic/Faeroe": "Atlantic/Faroe",
5208
+ "Pacific/Ponape": "Pacific/Pohnpei",
5209
+ "Asia/Rangoon": "Asia/Yangon",
5210
+ "Pacific/Truk": "Pacific/Chuuk",
5211
+ "America/Godthab": "America/Nuuk",
5212
+ "Asia/Saigon": "Asia/Ho_Chi_Minh",
5213
+ "America/Coral_Harbour": "America/Atikokan"
5214
+ };
5215
+ TimezoneUtils.getLocalTimezone = function () {
5216
+ if (sLocalTimezone === "") {
5217
+ sLocalTimezone = new Intl.DateTimeFormat().resolvedOptions().timeZone;
5218
+ sLocalTimezone = TimezoneUtils.mCLDR2ABAPTimezones[sLocalTimezone] || sLocalTimezone;
5219
+ }
5220
+ return sLocalTimezone;
5221
+ };
5222
+ TimezoneUtils._clearLocalTimezoneCache = function () {
5223
+ sLocalTimezone = "";
5224
+ };
5225
+
5226
+ const oWritableConfig = config.getWritableInstance();
5227
+ let sLanguageSetByApi;
5228
+ const oEventing = new Eventing();
5229
+ let mChanges;
5230
+ let bLanguageWarningLogged = false;
5231
+ const _mPreferredCalendar = {
5232
+ "ar-SA": CalendarType.Islamic,
5233
+ "fa": CalendarType.Persian,
5234
+ "th": CalendarType.Buddhist,
5235
+ "default": CalendarType.Gregorian
5236
+ };
5237
+ const M_ABAP_LANGUAGE_TO_LOCALE = {
5238
+ "ZH": "zh-Hans",
5239
+ "ZF": "zh-Hant",
5240
+ "SH": "sr-Latn",
5241
+ "CT": "cnr",
5242
+ "6N": "en-GB",
5243
+ "1P": "pt-PT",
5244
+ "1X": "es-MX",
5245
+ "3F": "fr-CA",
5246
+ "1Q": "en-US-x-saptrc",
5247
+ "2Q": "en-US-x-sappsd",
5248
+ "3Q": "en-US-x-saprigi"
5249
+ };
5250
+ const M_ISO639_OLD_TO_NEW = {
5251
+ "iw": "he",
5252
+ "ji": "yi"
5253
+ };
5254
+ const M_LOCALE_TO_ABAP_LANGUAGE = (obj => {
5255
+ return Object.keys(obj).reduce((inv, key) => {
5256
+ inv[obj[key]] = key;
5257
+ return inv;
5258
+ }, {});
5259
+ })(M_ABAP_LANGUAGE_TO_LOCALE);
5260
+ function getPseudoLanguageTag(sPrivateUse) {
5261
+ let sPseudoLanguageTag;
5262
+ if (sPrivateUse) {
5263
+ const m = (/-(saptrc|sappsd|saprigi)(?:-|$)/i).exec(sPrivateUse);
5264
+ sPseudoLanguageTag = m && "en-US-x-" + m[1].toLowerCase();
5265
+ }
5266
+ return sPseudoLanguageTag;
5267
+ }
5268
+ function getDesigntimePropertyAsArray(sValue) {
5269
+ const m = (/\$([-a-z0-9A-Z._]+)(?::([^$]*))?\$/).exec(sValue);
5270
+ return m && m[2] ? m[2].split(/,/) : null;
5271
+ }
5272
+ const A_RTL_LOCALES = getDesigntimePropertyAsArray("$cldr-rtl-locales:ar,fa,he$") || [];
5273
+ const _coreI18nLocales = getDesigntimePropertyAsArray("$core-i18n-locales:,ar,bg,ca,cnr,cs,cy,da,de,el,en,en_GB,es,es_MX,et,fi,fr,fr_CA,hi,hr,hu,id,it,iw,ja,kk,ko,lt,lv,mk,ms,nl,no,pl,pt,pt_PT,ro,ru,sh,sk,sl,sr,sv,th,tr,uk,vi,zh_CN,zh_TW$");
5274
+ function fromSAPLogonLanguage(sSAPLogonLanguage) {
5275
+ let oLanguageTag;
5276
+ if (sSAPLogonLanguage && typeof sSAPLogonLanguage === "string") {
5277
+ sSAPLogonLanguage = M_ABAP_LANGUAGE_TO_LOCALE[sSAPLogonLanguage.toUpperCase()] || sSAPLogonLanguage;
5278
+ try {
5279
+ oLanguageTag = new LanguageTag(sSAPLogonLanguage);
5280
+ } catch (e) {}
5281
+ }
5282
+ return [oLanguageTag, sSAPLogonLanguage];
5283
+ }
5284
+ function createLanguageTag(sLanguage) {
5285
+ let oLanguageTag;
5286
+ if (sLanguage) {
5287
+ oLanguageTag = new LanguageTag(sLanguage);
5288
+ }
5289
+ return oLanguageTag;
5290
+ }
5291
+ function detectLanguage() {
5292
+ return globalThis.navigator ? globalThis.navigator.languages && globalThis.navigator.languages[0] || globalThis.navigator.language || "en" : new Intl.Collator().resolvedOptions().locale || "en";
5293
+ }
5294
+ function check(bCondition, sMessage) {
5295
+ if (!bCondition) {
5296
+ throw new TypeError(sMessage);
5297
+ }
5298
+ }
5299
+ function join() {
5300
+ return Array.prototype.filter.call(arguments, Boolean).join("-");
5301
+ }
5302
+ function checkTimezone(sTimezone) {
5303
+ const bIsValidTimezone = TimezoneUtils.isValidTimezone(sTimezone);
5304
+ if (!bIsValidTimezone) {
5305
+ Log.error("The provided timezone '" + sTimezone + "' is not a valid IANA timezone ID." + " Falling back to browser's local timezone '" + TimezoneUtils.getLocalTimezone() + "'.");
5306
+ }
5307
+ return bIsValidTimezone;
5308
+ }
5309
+ const Localization = {
5310
+ attachChange: function (fnFunction) {
5311
+ oEventing.attachEvent("change", fnFunction);
5312
+ },
5313
+ detachChange: function (fnFunction) {
5314
+ oEventing.detachEvent("change", fnFunction);
5315
+ },
5316
+ getActiveTerminologies: function () {
5317
+ return oWritableConfig.get({
5318
+ name: "sapUiActiveTerminologies",
5319
+ type: config.Type.StringArray,
5320
+ defaultValue: undefined,
5321
+ external: true
5322
+ });
5323
+ },
5324
+ getLanguage: function () {
5325
+ let oLanguageTag, sDerivedLanguage;
5326
+ if (sLanguageSetByApi) {
5327
+ return sLanguageSetByApi;
5328
+ }
5329
+ const sLanguage = oWritableConfig.get({
5330
+ name: "sapUiLanguage",
5331
+ type: config.Type.String,
5332
+ external: true
5333
+ });
5334
+ const sSapLocale = oWritableConfig.get({
5335
+ name: "sapLocale",
5336
+ type: config.Type.String,
5337
+ external: true
5338
+ });
5339
+ const sSapLanguage = oWritableConfig.get({
5340
+ name: "sapLanguage",
5341
+ type: config.Type.String,
5342
+ external: true
5343
+ });
5344
+ if (sSapLocale) {
5345
+ oLanguageTag = createLanguageTag(sSapLocale);
5346
+ sDerivedLanguage = sSapLocale;
5347
+ } else if (sSapLanguage) {
5348
+ if (!sLanguage && !bLanguageWarningLogged) {
5349
+ Log.warning("sap-language '" + sSapLanguage + "' is not a valid BCP47 language tag and will only be used as SAP logon language");
5350
+ bLanguageWarningLogged = true;
5351
+ }
5352
+ [oLanguageTag, sDerivedLanguage] = fromSAPLogonLanguage(sSapLanguage);
5353
+ }
5354
+ if (!oLanguageTag) {
5355
+ if (sLanguage) {
5356
+ oLanguageTag = createLanguageTag(sLanguage);
5357
+ sDerivedLanguage = sLanguage;
5358
+ } else {
5359
+ sDerivedLanguage = detectLanguage();
5360
+ oLanguageTag = createLanguageTag(sLanguage);
5361
+ }
5362
+ }
5363
+ return sDerivedLanguage;
5364
+ },
5365
+ getModernLanguage: function (sLanguage) {
5366
+ return M_ISO639_OLD_TO_NEW[sLanguage] || sLanguage;
5367
+ },
5368
+ setLanguage: function (sLanguage, sSAPLogonLanguage) {
5369
+ const oLanguageTag = createLanguageTag(sLanguage), bOldRTL = Localization.getRTL();
5370
+ check(oLanguageTag, "Localization.setLanguage: sLanguage must be a valid BCP47 language tag");
5371
+ check(sSAPLogonLanguage == null || typeof sSAPLogonLanguage === "string" && (/^[A-Z0-9]{2,2}$/i).test(sSAPLogonLanguage), "Localization.setLanguage: sSAPLogonLanguage must be null or be a string of length 2, consisting of digits and latin characters only");
5372
+ sSAPLogonLanguage = sSAPLogonLanguage || "";
5373
+ if (oLanguageTag.toString() != Localization.getLanguageTag().toString() || sSAPLogonLanguage !== oWritableConfig.get({
5374
+ name: "sapLanguage",
5375
+ type: config.Type.String,
5376
+ external: true
5377
+ })) {
5378
+ oWritableConfig.set("sapLanguage", sSAPLogonLanguage);
5379
+ sLanguageSetByApi = sLanguage;
5380
+ mChanges = {};
5381
+ mChanges.language = Localization.getLanguageTag().toString();
5382
+ const bRtl = Localization.getRTL();
5383
+ if (bOldRTL != bRtl) {
5384
+ mChanges.rtl = bRtl;
5385
+ }
5386
+ fireChange();
5387
+ }
5388
+ },
5389
+ getTimezone: function () {
5390
+ let sTimezone = oWritableConfig.get({
5391
+ name: "sapTimezone",
5392
+ type: config.Type.String,
5393
+ external: true,
5394
+ defaultValue: oWritableConfig.get({
5395
+ name: "sapUiTimezone",
5396
+ type: config.Type.String,
5397
+ external: true
5398
+ })
5399
+ });
5400
+ if (!sTimezone || !checkTimezone(sTimezone)) {
5401
+ sTimezone = TimezoneUtils.getLocalTimezone();
5402
+ }
5403
+ return sTimezone;
5404
+ },
5405
+ setTimezone: function (sTimezone) {
5406
+ check(sTimezone == null || typeof sTimezone === "string", "Localization.setTimezone: sTimezone must be null or be a string");
5407
+ const sCurrentTimezone = Localization.getTimezone();
5408
+ sTimezone = sTimezone === null || !checkTimezone(sTimezone) ? undefined : sTimezone;
5409
+ oWritableConfig.set("sapTimezone", sTimezone);
5410
+ if (Localization.getTimezone() !== sCurrentTimezone) {
5411
+ mChanges = {};
5412
+ mChanges.timezone = Localization.getTimezone();
5413
+ fireChange();
5414
+ }
5415
+ },
5416
+ getLanguageTag: function () {
5417
+ const oLanguageTag = new LanguageTag(Localization.getLanguage());
5418
+ const sLanguage = Localization.getModernLanguage(oLanguageTag.language);
5419
+ const sScript = oLanguageTag.script;
5420
+ let sLanguageTag = oLanguageTag.toString();
5421
+ if (sLanguage === "sr" && sScript === "Latn") {
5422
+ sLanguageTag = sLanguageTag.replace("sr-Latn", "sh");
5423
+ } else {
5424
+ sLanguageTag = sLanguageTag.replace(oLanguageTag.language, sLanguage);
5425
+ }
5426
+ return new LanguageTag(sLanguageTag);
5427
+ },
5428
+ getRTL: function () {
5429
+ return oWritableConfig.get({
5430
+ name: "sapRtl",
5431
+ type: config.Type.Boolean,
5432
+ external: true,
5433
+ defaultValue: oWritableConfig.get({
5434
+ name: "sapUiRtl",
5435
+ type: config.Type.Boolean,
5436
+ defaultValue: function () {
5437
+ return impliesRTL(Localization.getLanguageTag());
5438
+ },
5439
+ external: true
5440
+ })
5441
+ });
5442
+ },
5443
+ setRTL: function (bRTL) {
5444
+ check(bRTL === null || typeof bRTL === "boolean", "bRTL must be null or a boolean");
5445
+ bRTL = bRTL === null ? undefined : bRTL;
5446
+ const oldRTL = Localization.getRTL();
5447
+ oWritableConfig.set("sapRtl", bRTL);
5448
+ const bCurrentRTL = Localization.getRTL();
5449
+ if (oldRTL != bCurrentRTL) {
5450
+ mChanges = {};
5451
+ mChanges.rtl = bCurrentRTL;
5452
+ fireChange();
5453
+ }
5454
+ },
5455
+ _getSAPLogonLanguage: function (oLanguageTag) {
5456
+ let sLanguage = oLanguageTag.language || "";
5457
+ if (sLanguage.indexOf("-") >= 0) {
5458
+ sLanguage = sLanguage.slice(0, sLanguage.indexOf("-"));
5459
+ }
5460
+ sLanguage = Localization.getModernLanguage(sLanguage);
5461
+ if (sLanguage === "zh" && !oLanguageTag.script && oLanguageTag.region === "TW") {
5462
+ return "ZF";
5463
+ }
5464
+ return M_LOCALE_TO_ABAP_LANGUAGE[join(sLanguage, oLanguageTag.script)] || M_LOCALE_TO_ABAP_LANGUAGE[join(sLanguage, oLanguageTag.region)] || M_LOCALE_TO_ABAP_LANGUAGE[getPseudoLanguageTag(oLanguageTag.privateUse)] || sLanguage.toUpperCase();
5465
+ },
5466
+ getSAPLogonLanguage: function () {
5467
+ let oLanguageTag;
5468
+ const sLanguage = oWritableConfig.get({
5469
+ name: "sapLanguage",
5470
+ type: config.Type.String,
5471
+ external: true
5472
+ }).toUpperCase();
5473
+ try {
5474
+ [oLanguageTag] = fromSAPLogonLanguage(sLanguage);
5475
+ } catch (exc) {}
5476
+ if (sLanguage && !oLanguageTag) {
5477
+ Log.warning("sap-language '" + sLanguage + "' is not a valid BCP47 language tag and will only be used as SAP logon language");
5478
+ }
5479
+ return sLanguage || Localization._getSAPLogonLanguage(Localization.getLanguageTag());
5480
+ },
5481
+ getPreferredCalendarType: function () {
5482
+ const oLocale = Localization.getLanguageTag();
5483
+ return _mPreferredCalendar[oLocale.language + "-" + oLocale.region] || _mPreferredCalendar[oLocale.language] || _mPreferredCalendar["default"];
5484
+ },
5485
+ getLanguagesDeliveredWithCore: function () {
5486
+ return _coreI18nLocales;
5487
+ },
5488
+ getSupportedLanguages: function () {
5489
+ let aLangs = config.get({
5490
+ name: "sapUiXxSupportedLanguages",
5491
+ type: config.Type.StringArray,
5492
+ external: true
5493
+ });
5494
+ if (aLangs.length === 0 || aLangs.length === 1 && aLangs[0] === "*") {
5495
+ aLangs = [];
5496
+ } else if (aLangs.length === 1 && aLangs[0] === "default") {
5497
+ aLangs = this.getLanguagesDeliveredWithCore() || [];
5498
+ }
5499
+ return aLangs;
5500
+ }
5501
+ };
5502
+ function impliesRTL(oLanguageTag) {
5503
+ let sLanguage = oLanguageTag.language || "";
5504
+ sLanguage = Localization.getModernLanguage(oLanguageTag.language);
5505
+ const sRegion = oLanguageTag.region || "";
5506
+ if (sRegion && A_RTL_LOCALES.indexOf(sLanguage + "_" + sRegion) >= 0) {
5507
+ return true;
5508
+ }
5509
+ return A_RTL_LOCALES.indexOf(sLanguage) >= 0;
5510
+ }
5511
+ function fireChange() {
5512
+ oEventing.fireEvent("change", mChanges);
5513
+ mChanges = undefined;
5514
+ }
5515
+
5516
+ var Filter = BaseObject.extend("sap.ui.model.Filter", {
5517
+ constructor: function (vFilterInfo, vOperator, vValue1, vValue2) {
5518
+ BaseObject.call(this);
5519
+ if (typeof vFilterInfo === "object" && !Array.isArray(vFilterInfo)) {
5520
+ this.sPath = vFilterInfo.path;
5521
+ this.sOperator = vFilterInfo.operator;
5522
+ this.oValue1 = vFilterInfo.value1;
5523
+ this.oValue2 = vFilterInfo.value2;
5524
+ this.sVariable = vFilterInfo.variable;
5525
+ this.oCondition = vFilterInfo.condition;
5526
+ this.aFilters = vFilterInfo.filters || vFilterInfo.aFilters;
5527
+ this.bAnd = vFilterInfo.and || vFilterInfo.bAnd;
5528
+ this.fnTest = vFilterInfo.test;
5529
+ this.fnCompare = vFilterInfo.comparator;
5530
+ this.bCaseSensitive = vFilterInfo.caseSensitive;
5531
+ } else {
5532
+ if (Array.isArray(vFilterInfo)) {
5533
+ this.aFilters = vFilterInfo;
5534
+ } else {
5535
+ this.sPath = vFilterInfo;
5536
+ }
5537
+ if (typeof vOperator === "boolean") {
5538
+ this.bAnd = vOperator;
5539
+ } else if (typeof vOperator === "function") {
5540
+ this.fnTest = vOperator;
5541
+ } else {
5542
+ this.sOperator = vOperator;
5543
+ }
5544
+ this.oValue1 = vValue1;
5545
+ this.oValue2 = vValue2;
5546
+ if (this.sOperator === FilterOperator.Any || this.sOperator === FilterOperator.All) {
5547
+ throw new Error("The filter operators 'Any' and 'All' are only supported with the parameter object notation.");
5548
+ }
5549
+ }
5550
+ if (this.aFilters?.includes(Filter.NONE)) {
5551
+ throw new Error("Filter.NONE not allowed in multiple filter");
5552
+ } else if (this.oCondition && this.oCondition === Filter.NONE) {
5553
+ throw new Error("Filter.NONE not allowed as condition");
5554
+ }
5555
+ if (this.sOperator === FilterOperator.Any) {
5556
+ if (this.sVariable && this.oCondition) {
5557
+ this._checkLambdaArgumentTypes();
5558
+ } else if (!this.sVariable && !this.oCondition) ; else {
5559
+ throw new Error("When using the filter operator 'Any', a lambda variable and a condition have to be given or neither.");
5560
+ }
5561
+ } else if (this.sOperator === FilterOperator.All) {
5562
+ this._checkLambdaArgumentTypes();
5563
+ } else if (Array.isArray(this.aFilters) && !this.sPath && !this.sOperator && !this.oValue1 && !this.oValue2) {
5564
+ this._bMultiFilter = true;
5565
+ if (!this.aFilters.every(isFilter)) {
5566
+ Log.error("Filter in aggregation of multi filter has to be instance of" + " sap.ui.model.Filter");
5567
+ }
5568
+ } else if (!this.aFilters && this.sPath !== undefined && (this.sOperator && this.oValue1 !== undefined || this.fnTest)) {
5569
+ this._bMultiFilter = false;
5570
+ } else {
5571
+ Log.error("Wrong parameters defined for filter.");
5572
+ }
5573
+ this.sFractionalSeconds1 = undefined;
5574
+ this.sFractionalSeconds2 = undefined;
5575
+ }
5576
+ });
5577
+ Filter.NONE = new Filter({
5578
+ path: "/",
5579
+ test: () => false
5580
+ });
5581
+ Filter.checkFilterNone = function (vFilter) {
5582
+ if (Array.isArray(vFilter) && vFilter.length > 1 && vFilter.includes(Filter.NONE)) {
5583
+ throw new Error("Filter.NONE cannot be used together with other filters");
5584
+ }
5585
+ };
5586
+ Filter.prototype._checkLambdaArgumentTypes = function () {
5587
+ if (!this.sVariable || typeof this.sVariable !== "string") {
5588
+ throw new Error("When using the filter operators 'Any' or 'All', a string has to be given as argument 'variable'.");
5589
+ }
5590
+ if (!isFilter(this.oCondition)) {
5591
+ throw new Error("When using the filter operator 'Any' or 'All', a valid instance of sap.ui.model.Filter has to be given as argument 'condition'.");
5592
+ }
5593
+ };
5594
+ function isFilter(v) {
5595
+ return v instanceof Filter;
5596
+ }
5597
+ Filter.prototype.appendFractionalSeconds1 = function (sFractionalSeconds) {
5598
+ this.sFractionalSeconds1 = sFractionalSeconds;
5599
+ };
5600
+ Filter.prototype.appendFractionalSeconds2 = function (sFractionalSeconds) {
5601
+ this.sFractionalSeconds2 = sFractionalSeconds;
5602
+ };
5603
+ var Type = {
5604
+ Logical: "Logical",
5605
+ Binary: "Binary",
5606
+ Unary: "Unary",
5607
+ Lambda: "Lambda",
5608
+ Reference: "Reference",
5609
+ Literal: "Literal",
5610
+ Variable: "Variable",
5611
+ Call: "Call",
5612
+ Custom: "Custom"
5613
+ };
5614
+ var Op = {
5615
+ Equal: "==",
5616
+ NotEqual: "!=",
5617
+ LessThan: "<",
5618
+ GreaterThan: ">",
5619
+ LessThanOrEqual: "<=",
5620
+ GreaterThanOrEqual: ">=",
5621
+ And: "&&",
5622
+ Or: "||",
5623
+ Not: "!"
5624
+ };
5625
+ var Func = {
5626
+ Contains: "contains",
5627
+ StartsWith: "startswith",
5628
+ EndsWith: "endswith"
5629
+ };
5630
+ Filter.prototype.getAST = function (bIncludeOrigin) {
5631
+ var oResult, sOp, sOrigOp, oRef, oValue, oFromValue, oToValue, oVariable, oCondition;
5632
+ function logical(sOp, oLeft, oRight) {
5633
+ return {
5634
+ type: Type.Logical,
5635
+ op: sOp,
5636
+ left: oLeft,
5637
+ right: oRight
5638
+ };
5639
+ }
5640
+ function binary(sOp, oLeft, oRight) {
5641
+ return {
5642
+ type: Type.Binary,
5643
+ op: sOp,
5644
+ left: oLeft,
5645
+ right: oRight
5646
+ };
5647
+ }
5648
+ function unary(sOp, oArg) {
5649
+ return {
5650
+ type: Type.Unary,
5651
+ op: sOp,
5652
+ arg: oArg
5653
+ };
5654
+ }
5655
+ function lambda(sOp, oRef, oVariable, oCondition) {
5656
+ return {
5657
+ type: Type.Lambda,
5658
+ op: sOp,
5659
+ ref: oRef,
5660
+ variable: oVariable,
5661
+ condition: oCondition
5662
+ };
5663
+ }
5664
+ function reference(sPath) {
5665
+ return {
5666
+ type: Type.Reference,
5667
+ path: sPath
5668
+ };
5669
+ }
5670
+ function literal(vValue) {
5671
+ return {
5672
+ type: Type.Literal,
5673
+ value: vValue
5674
+ };
5675
+ }
5676
+ function variable(sName) {
5677
+ return {
5678
+ type: Type.Variable,
5679
+ name: sName
5680
+ };
5681
+ }
5682
+ function call(sName, aArguments) {
5683
+ return {
5684
+ type: Type.Call,
5685
+ name: sName,
5686
+ args: aArguments
5687
+ };
5688
+ }
5689
+ if (this.aFilters) {
5690
+ sOp = this.bAnd ? Op.And : Op.Or;
5691
+ sOrigOp = this.bAnd ? "AND" : "OR";
5692
+ oResult = this.aFilters[this.aFilters.length - 1].getAST(bIncludeOrigin);
5693
+ for (var i = this.aFilters.length - 2; i >= 0; i--) {
5694
+ oResult = logical(sOp, this.aFilters[i].getAST(bIncludeOrigin), oResult);
5695
+ }
5696
+ } else {
5697
+ sOp = this.sOperator;
5698
+ sOrigOp = this.sOperator;
5699
+ oRef = reference(this.sPath);
5700
+ oValue = literal(this.oValue1);
5701
+ switch (sOp) {
5702
+ case FilterOperator.EQ:
5703
+ oResult = binary(Op.Equal, oRef, oValue);
5704
+ break;
5705
+ case FilterOperator.NE:
5706
+ oResult = binary(Op.NotEqual, oRef, oValue);
5707
+ break;
5708
+ case FilterOperator.LT:
5709
+ oResult = binary(Op.LessThan, oRef, oValue);
5710
+ break;
5711
+ case FilterOperator.GT:
5712
+ oResult = binary(Op.GreaterThan, oRef, oValue);
5713
+ break;
5714
+ case FilterOperator.LE:
5715
+ oResult = binary(Op.LessThanOrEqual, oRef, oValue);
5716
+ break;
5717
+ case FilterOperator.GE:
5718
+ oResult = binary(Op.GreaterThanOrEqual, oRef, oValue);
5719
+ break;
5720
+ case FilterOperator.Contains:
5721
+ oResult = call(Func.Contains, [oRef, oValue]);
5722
+ break;
5723
+ case FilterOperator.StartsWith:
5724
+ oResult = call(Func.StartsWith, [oRef, oValue]);
5725
+ break;
5726
+ case FilterOperator.EndsWith:
5727
+ oResult = call(Func.EndsWith, [oRef, oValue]);
5728
+ break;
5729
+ case FilterOperator.NotContains:
5730
+ oResult = unary(Op.Not, call(Func.Contains, [oRef, oValue]));
5731
+ break;
5732
+ case FilterOperator.NotStartsWith:
5733
+ oResult = unary(Op.Not, call(Func.StartsWith, [oRef, oValue]));
5734
+ break;
5735
+ case FilterOperator.NotEndsWith:
5736
+ oResult = unary(Op.Not, call(Func.EndsWith, [oRef, oValue]));
5737
+ break;
5738
+ case FilterOperator.BT:
5739
+ oFromValue = oValue;
5740
+ oToValue = literal(this.oValue2);
5741
+ oResult = logical(Op.And, binary(Op.GreaterThanOrEqual, oRef, oFromValue), binary(Op.LessThanOrEqual, oRef, oToValue));
5742
+ break;
5743
+ case FilterOperator.NB:
5744
+ oFromValue = oValue;
5745
+ oToValue = literal(this.oValue2);
5746
+ oResult = logical(Op.Or, binary(Op.LessThan, oRef, oFromValue), binary(Op.GreaterThan, oRef, oToValue));
5747
+ break;
5748
+ case FilterOperator.Any:
5749
+ case FilterOperator.All:
5750
+ oVariable = variable(this.sVariable);
5751
+ oCondition = this.oCondition.getAST(bIncludeOrigin);
5752
+ oResult = lambda(sOp, oRef, oVariable, oCondition);
5753
+ break;
5754
+ default:
5755
+ throw new Error("Unknown operator: " + sOp);
5756
+ }
5757
+ }
5758
+ if (bIncludeOrigin && !oResult.origin) {
5759
+ oResult.origin = sOrigOp;
5760
+ }
5761
+ return oResult;
5762
+ };
5763
+ Filter.prototype.getComparator = function () {
5764
+ return this.fnCompare;
5765
+ };
5766
+ Filter.prototype.getCondition = function () {
5767
+ return this.oCondition;
5768
+ };
5769
+ Filter.prototype.getOperator = function () {
5770
+ return this.sOperator;
5771
+ };
5772
+ Filter.prototype.getPath = function () {
5773
+ return this.sPath;
5774
+ };
5775
+ Filter.prototype.getFilters = function () {
5776
+ return this.aFilters && this.aFilters.slice();
5777
+ };
5778
+ Filter.prototype.getTest = function () {
5779
+ return this.fnTest;
5780
+ };
5781
+ Filter.prototype.getValue1 = function () {
5782
+ return this.oValue1;
5783
+ };
5784
+ Filter.prototype.getValue2 = function () {
5785
+ return this.oValue2;
5786
+ };
5787
+ Filter.prototype.getVariable = function () {
5788
+ return this.sVariable;
5789
+ };
5790
+ Filter.prototype.isAnd = function () {
5791
+ return !!this.bAnd;
5792
+ };
5793
+ Filter.prototype.isCaseSensitive = function () {
5794
+ return this.bCaseSensitive;
5795
+ };
5796
+ Filter.defaultComparator = function (a, b) {
5797
+ if (a == b) {
5798
+ return 0;
5799
+ }
5800
+ if (a == null || b == null) {
5801
+ return NaN;
5802
+ }
5803
+ if (typeof a == "string" && typeof b == "string") {
5804
+ return a.localeCompare(b, Localization.getLanguageTag().toString());
5805
+ }
5806
+ if (a < b) {
5807
+ return -1;
5808
+ }
5809
+ if (a > b) {
5810
+ return 1;
5811
+ }
5812
+ return NaN;
5813
+ };
5814
+
3912
5815
  var rAmpersand = /&/g, rApplicationGroupID = /^\w+$/, sClassName$2 = "sap.ui.model.odata.v4.lib._Helper", rEquals = /\=/g, rEscapedCloseBracket = /%29/g, rEscapedOpenBracket = /%28/g, rEscapedTick = /%27/g, rGroupID = /^(\$auto(\.\w+)?|\$direct|\w+)$/, rHash = /#/g, rNotMetaContext = /\([^/]*|\/-?\d+/g, rPlus = /\+/g, rSingleQuote = /'/g, rSingleQuoteTwice = /''/g, rWhitespace = /\s+/g, _Helper;
3913
5816
  function preserveKeyPredicates(sUrl) {
3914
5817
  return sUrl.replace(rEscapedTick, "'").replace(rEscapedOpenBracket, "(").replace(rEscapedCloseBracket, ")");
@@ -4175,7 +6078,12 @@ _Helper = {
4175
6078
  createMissing: function (oObject, aSegments) {
4176
6079
  aSegments.reduce(function (oCurrent, sSegment, i) {
4177
6080
  if (!((sSegment in oCurrent))) {
4178
- oCurrent[sSegment] = i + 1 < aSegments.length ? {} : null;
6081
+ if (i + 1 < aSegments.length) {
6082
+ oCurrent[sSegment] = {};
6083
+ } else {
6084
+ oCurrent[sSegment] = undefined;
6085
+ oCurrent[sSegment + "@$ui5.noData"] = true;
6086
+ }
4179
6087
  }
4180
6088
  return oCurrent[sSegment];
4181
6089
  }, oObject);
@@ -4465,6 +6373,27 @@ _Helper = {
4465
6373
  getContentID: function (oMessage) {
4466
6374
  return _Helper.getAnnotation(oMessage, ".ContentID");
4467
6375
  },
6376
+ getFilterForPredicate: function (sPredicate, oEntityType, oMetaModel, sMetaPath, bIgnore$Key) {
6377
+ var aFilters, mValueByKeyOrAlias = _Parser$1.parseKeyPredicate(sPredicate);
6378
+ if (("" in mValueByKeyOrAlias)) {
6379
+ mValueByKeyOrAlias[oEntityType.$Key[0]] = mValueByKeyOrAlias[""];
6380
+ delete mValueByKeyOrAlias[""];
6381
+ }
6382
+ aFilters = (bIgnore$Key ? Object.keys(mValueByKeyOrAlias) : oEntityType.$Key).map(function (vKey) {
6383
+ var sKeyOrAlias, sKeyPath;
6384
+ if (typeof vKey === "string") {
6385
+ sKeyPath = sKeyOrAlias = vKey;
6386
+ } else {
6387
+ sKeyOrAlias = Object.keys(vKey)[0];
6388
+ sKeyPath = vKey[sKeyOrAlias];
6389
+ }
6390
+ return new Filter(sKeyPath, FilterOperator.EQ, _Helper.parseLiteral(decodeURIComponent(mValueByKeyOrAlias[sKeyOrAlias]), oMetaModel.getObject(sMetaPath + "/" + sKeyPath + "/$Type"), sKeyPath));
6391
+ });
6392
+ return aFilters.length === 1 ? aFilters[0] : new Filter({
6393
+ and: true,
6394
+ filters: aFilters
6395
+ });
6396
+ },
4468
6397
  getKeyFilter: function (oInstance, sMetaPath, mTypeForMetaPath, aKeyProperties) {
4469
6398
  var aFilters = [], sKey, mKey2Value = _Helper.getKeyProperties(oInstance, sMetaPath, mTypeForMetaPath, aKeyProperties);
4470
6399
  if (!mKey2Value) {
@@ -4616,6 +6545,9 @@ _Helper = {
4616
6545
  oSource = oSource[sSegment];
4617
6546
  oTarget = oTarget[sSegment];
4618
6547
  } else if (bMissing) {
6548
+ if (oSource[sSegment + "@$ui5.noData"]) {
6549
+ oTarget[sSegment + "@$ui5.noData"] = true;
6550
+ }
4619
6551
  oTarget[sSegment] = oSource[sSegment];
4620
6552
  }
4621
6553
  });
@@ -4760,8 +6692,10 @@ _Helper = {
4760
6692
  mergeQueryOptions: function (mQueryOptions, sOrderby, aFilters) {
4761
6693
  var mResult;
4762
6694
  function set(sProperty, sValue) {
4763
- if (sValue && (!mQueryOptions || mQueryOptions[sProperty] !== sValue)) {
4764
- mResult ??= mQueryOptions ? _Helper.clone(mQueryOptions) : {};
6695
+ if (sValue && mQueryOptions?.[sProperty] !== sValue) {
6696
+ mResult ??= {
6697
+ ...mQueryOptions
6698
+ };
4765
6699
  mResult[sProperty] = sValue;
4766
6700
  }
4767
6701
  }
@@ -4769,6 +6703,7 @@ _Helper = {
4769
6703
  if (aFilters) {
4770
6704
  set("$filter", aFilters[0]);
4771
6705
  set("$$filterBeforeAggregate", aFilters[1]);
6706
+ set("$$filterOnAggregate", aFilters[2]);
4772
6707
  }
4773
6708
  return mResult || mQueryOptions;
4774
6709
  },