@ui5/task-adaptation 1.3.0 → 1.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,7 +2,13 @@
2
2
  All notable changes to this project will be documented in this file.
3
3
  This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
4
4
 
5
- A list of unreleased changes can be found [here](https://github.com/SAP/ui5-task-adaptation/compare/v1.3.0...HEAD).
5
+ A list of unreleased changes can be found [here](https://github.com/SAP/ui5-task-adaptation/compare/v1.3.2...HEAD).
6
+
7
+ <a name="v1.3.2"></a>
8
+ ## [v1.3.2] - 2024-06-04
9
+
10
+ <a name="v1.3.1"></a>
11
+ ## [v1.3.1] - 2024-06-04
6
12
 
7
13
  <a name="v1.3.0"></a>
8
14
  ## [v1.3.0] - 2024-03-22
@@ -88,6 +94,8 @@ A list of unreleased changes can be found [here](https://github.com/SAP/ui5-task
88
94
  <a name="v1.0.0"></a>
89
95
  ## v1.0.0 - 2020-12-09
90
96
 
97
+ [v1.3.2]: https://github.com/SAP/ui5-task-adaptation/compare/v1.3.1...v1.3.2
98
+ [v1.3.1]: https://github.com/SAP/ui5-task-adaptation/compare/v1.3.0...v1.3.1
91
99
  [v1.3.0]: https://github.com/SAP/ui5-task-adaptation/compare/v1.2.0...v1.3.0
92
100
  [v1.2.0]: https://github.com/SAP/ui5-task-adaptation/compare/v1.1.3...v1.2.0
93
101
  [v1.1.3]: https://github.com/SAP/ui5-task-adaptation/compare/v1.1.2...v1.1.3
package/dist/bundle.js CHANGED
@@ -2135,7 +2135,7 @@ function Version(vMajor, iMinor, iPatch, sSuffix) {
2135
2135
  this.getSuffix = function () {
2136
2136
  return sSuffix;
2137
2137
  };
2138
- this.compareTo = function () {
2138
+ this.compareTo = function (vOtherMajor, iOtherMinor, iOtherPatch, sOtherSuffix) {
2139
2139
  var vOther = Version.apply(window, arguments);
2140
2140
  return vMajor - vOther.getMajor() || iMinor - vOther.getMinor() || iPatch - vOther.getPatch() || (sSuffix < vOther.getSuffix() ? -1 : sSuffix === vOther.getSuffix() ? 0 : 1);
2141
2141
  };
@@ -2146,10 +2146,41 @@ Version.prototype.inRange = function (vMin, vMax) {
2146
2146
 
2147
2147
  var SetMinUI5Version = {
2148
2148
  applyChange(oManifest, oChange) {
2149
- var vCurrentVersion = new Version(oManifest["sap.ui5"].dependencies.minUI5Version);
2150
- if (vCurrentVersion.compareTo(oChange.getContent().minUI5Version) <= 0) {
2151
- oManifest["sap.ui5"].dependencies.minUI5Version = oChange.getContent().minUI5Version;
2149
+ var aChangeMinUI5Version = oChange.getContent().minUI5Version;
2150
+ if (!aChangeMinUI5Version) {
2151
+ throw new Error("No minUI5Version in change content provided");
2152
2152
  }
2153
+ if (typeof aChangeMinUI5Version === "string") {
2154
+ aChangeMinUI5Version = [aChangeMinUI5Version];
2155
+ }
2156
+ const mChangeMinUi5Version = {};
2157
+ aChangeMinUI5Version.forEach(function (changeMinUI5Version) {
2158
+ const oVersion = new Version(changeMinUI5Version);
2159
+ if (mChangeMinUi5Version[oVersion.getMajor()]) {
2160
+ throw new Error("Each major version can only be provided once in minUI5Version of change content");
2161
+ }
2162
+ mChangeMinUi5Version[oVersion.getMajor()] = [changeMinUI5Version, oVersion];
2163
+ });
2164
+ var {minUI5Version: aMinUI5Version} = oManifest["sap.ui5"].dependencies;
2165
+ if (!aMinUI5Version) {
2166
+ throw new Error("sap.ui5/dependencies/minUI5Version missing in base manifest");
2167
+ }
2168
+ if (typeof aMinUI5Version === "string") {
2169
+ aMinUI5Version = [aMinUI5Version];
2170
+ }
2171
+ aMinUI5Version = aMinUI5Version.map(function (sCurrMinUI5Version) {
2172
+ const oCurrMinUI5Version = new Version(sCurrMinUI5Version);
2173
+ const aChangeVersionForMajor = mChangeMinUi5Version[oCurrMinUI5Version.getMajor()];
2174
+ if (!aChangeVersionForMajor) {
2175
+ return null;
2176
+ }
2177
+ const [sChangeMinUI5VersionForMajor, oChangeMinUI5VersionForMajor] = aChangeVersionForMajor;
2178
+ return oCurrMinUI5Version.compareTo(oChangeMinUI5VersionForMajor) <= 0 ? sChangeMinUI5VersionForMajor : sCurrMinUI5Version;
2179
+ }).filter(sMinVersion => sMinVersion);
2180
+ if (aMinUI5Version.length === 0) {
2181
+ throw new Error("Upgrade/Downgrade for different major version not possible");
2182
+ }
2183
+ oManifest["sap.ui5"].dependencies.minUI5Version = aMinUI5Version.length === 1 ? aMinUI5Version[0] : aMinUI5Version;
2153
2184
  return oManifest;
2154
2185
  }
2155
2186
  };
@@ -2862,15 +2893,13 @@ function isFunction(obj) {
2862
2893
  var Metadata = function (sClassName, oClassInfo) {
2863
2894
  fnAssert(typeof sClassName === "string" && sClassName, "Metadata: sClassName must be a non-empty string");
2864
2895
  fnAssert(typeof oClassInfo === "object", "Metadata: oClassInfo must be empty or an object");
2865
- (() => {
2866
- if (!oClassInfo || typeof oClassInfo.metadata !== "object") {
2867
- oClassInfo = {
2868
- metadata: oClassInfo || ({}),
2869
- constructor: ObjectPath.get(sClassName)
2870
- };
2871
- oClassInfo.metadata.__version = 1;
2872
- }
2873
- })();
2896
+ if (!oClassInfo || typeof oClassInfo.metadata !== "object") {
2897
+ oClassInfo = {
2898
+ metadata: oClassInfo || ({}),
2899
+ constructor: ObjectPath.get(sClassName)
2900
+ };
2901
+ oClassInfo.metadata.__version = 1;
2902
+ }
2874
2903
  oClassInfo.metadata ??= {};
2875
2904
  oClassInfo.metadata.__version = oClassInfo.metadata.__version || 2;
2876
2905
  if (!isFunction(oClassInfo.constructor)) {
@@ -3029,6 +3058,14 @@ Metadata.prototype.addPublicMethods = function (sMethod) {
3029
3058
  Array.prototype.push.apply(this._aAllPublicMethods, aNames);
3030
3059
  this._bInterfacesUnique = false;
3031
3060
  };
3061
+ Metadata.prototype.getStaticProperty = function (sStaticName) {
3062
+ let oMetadata = this;
3063
+ while (oMetadata && !((sStaticName in oMetadata.getClass()))) {
3064
+ oMetadata = oMetadata.getParent();
3065
+ }
3066
+ const oClass = oMetadata?.getClass();
3067
+ return oClass?.[sStaticName];
3068
+ };
3032
3069
  Metadata.createClass = function (fnBaseClass, sClassName, oClassInfo, FNMetaImpl) {
3033
3070
  if (typeof fnBaseClass === "string") {
3034
3071
  FNMetaImpl = oClassInfo;
@@ -3787,7 +3824,7 @@ _Helper = {
3787
3824
  }
3788
3825
  },
3789
3826
  addToSelect: function (mQueryOptions, aSelectPaths) {
3790
- mQueryOptions.$select = mQueryOptions.$select || [];
3827
+ mQueryOptions.$select ??= [];
3791
3828
  aSelectPaths.forEach(function (sPath) {
3792
3829
  if (!mQueryOptions.$select.includes(sPath)) {
3793
3830
  mQueryOptions.$select.push(sPath);
@@ -3822,7 +3859,7 @@ _Helper = {
3822
3859
  _Helper.addToSelect(mAggregatedQueryOptions, mQueryOptions.$select);
3823
3860
  }
3824
3861
  if (mQueryOptions.$expand) {
3825
- mAggregatedQueryOptions.$expand = mAggregatedQueryOptions.$expand || ({});
3862
+ mAggregatedQueryOptions.$expand ??= {};
3826
3863
  Object.keys(mQueryOptions.$expand).forEach(function (sPath) {
3827
3864
  if (mAggregatedQueryOptions.$expand[sPath]) {
3828
3865
  _Helper.aggregateExpandSelect(mAggregatedQueryOptions.$expand[sPath], mQueryOptions.$expand[sPath]);
@@ -3882,7 +3919,7 @@ _Helper = {
3882
3919
  if (oSubSelect[sSegment] === true) {
3883
3920
  return true;
3884
3921
  }
3885
- oSubSelect = oSubSelect[sSegment] = oSubSelect[sSegment] || ({});
3922
+ oSubSelect = oSubSelect[sSegment] ??= {};
3886
3923
  });
3887
3924
  });
3888
3925
  return oSelect;
@@ -3954,9 +3991,7 @@ _Helper = {
3954
3991
  oResult.message = "Network error";
3955
3992
  return oResult;
3956
3993
  }
3957
- if (sContentType) {
3958
- sContentType = sContentType.split(";")[0];
3959
- }
3994
+ sContentType &&= sContentType.split(";")[0];
3960
3995
  if (jqXHR.status === 412) {
3961
3996
  sPreference = jqXHR.getResponseHeader("Preference-Applied");
3962
3997
  if (sPreference && sPreference.replace(rWhitespace, "") === "handling=strict") {
@@ -4028,9 +4063,7 @@ _Helper = {
4028
4063
  Object.defineProperty(oTechnicalDetails, "originalMessage", {
4029
4064
  enumerable: true,
4030
4065
  get: function () {
4031
- if (!oClonedMessage) {
4032
- oClonedMessage = _Helper.publicClone(oOriginalMessage);
4033
- }
4066
+ oClonedMessage ??= _Helper.publicClone(oOriginalMessage);
4034
4067
  return oClonedMessage;
4035
4068
  }
4036
4069
  });
@@ -4064,11 +4097,9 @@ _Helper = {
4064
4097
  if (oError.strictHandlingFailed) {
4065
4098
  oClone.strictHandlingFailed = true;
4066
4099
  }
4067
- if (oClone.error.details) {
4068
- oClone.error.details = oClone.error.details.filter(function (oDetail, j) {
4069
- return isRelevant(oDetail, aDetailContentIDs[j]);
4070
- });
4071
- }
4100
+ oClone.error.details &&= oClone.error.details.filter(function (oDetail, j) {
4101
+ return isRelevant(oDetail, aDetailContentIDs[j]);
4102
+ });
4072
4103
  return oClone;
4073
4104
  });
4074
4105
  },
@@ -4316,7 +4347,7 @@ _Helper = {
4316
4347
  },
4317
4348
  getKeyProperties: function (oInstance, sMetaPath, mTypeForMetaPath, aKeyProperties, bReturnAlias) {
4318
4349
  var bFailed, mKey2Value = {};
4319
- aKeyProperties = aKeyProperties || mTypeForMetaPath[sMetaPath].$Key;
4350
+ aKeyProperties ??= mTypeForMetaPath[sMetaPath].$Key;
4320
4351
  bFailed = aKeyProperties.some(function (vKey) {
4321
4352
  var sKey, sKeyPath, oObject, sPropertyName, aSegments, oType, vValue;
4322
4353
  if (typeof vKey === "string") {
@@ -4381,7 +4412,7 @@ _Helper = {
4381
4412
  sPath = _Helper.getMetaPath(sPath);
4382
4413
  if (sPath) {
4383
4414
  sPath.split("/").some(function (sSegment) {
4384
- mQueryOptions = mQueryOptions && mQueryOptions.$expand && mQueryOptions.$expand[sSegment];
4415
+ mQueryOptions &&= mQueryOptions.$expand && mQueryOptions.$expand[sSegment];
4385
4416
  if (!mQueryOptions || mQueryOptions === true) {
4386
4417
  mQueryOptions = {};
4387
4418
  return true;
@@ -4582,9 +4613,7 @@ _Helper = {
4582
4613
  var mResult;
4583
4614
  function set(sProperty, sValue) {
4584
4615
  if (sValue && (!mQueryOptions || mQueryOptions[sProperty] !== sValue)) {
4585
- if (!mResult) {
4586
- mResult = mQueryOptions ? _Helper.clone(mQueryOptions) : {};
4587
- }
4616
+ mResult ??= mQueryOptions ? _Helper.clone(mQueryOptions) : {};
4588
4617
  mResult[sProperty] = sValue;
4589
4618
  }
4590
4619
  }
@@ -4737,9 +4766,7 @@ _Helper = {
4737
4766
  },
4738
4767
  setPrivateAnnotation: function (oObject, sAnnotation, vValue) {
4739
4768
  var oPrivateNamespace = oObject["@$ui5._"];
4740
- if (!oPrivateNamespace) {
4741
- oPrivateNamespace = oObject["@$ui5._"] = {};
4742
- }
4769
+ oPrivateNamespace ??= oObject["@$ui5._"] = {};
4743
4770
  oPrivateNamespace[sAnnotation] = vValue;
4744
4771
  },
4745
4772
  stripPathPrefix: function (sPrefix, aPaths) {
@@ -4929,7 +4956,7 @@ _Helper = {
4929
4956
  return oTarget;
4930
4957
  }
4931
4958
  Object.keys(vSelect).forEach(function (sProperty) {
4932
- if (!((sProperty in oTarget)) && sProperty !== "*") {
4959
+ if (oTarget[sProperty] === undefined && sProperty !== "*") {
4933
4960
  oTarget[sProperty + "@$ui5.noData"] = true;
4934
4961
  _Helper.fireChange(mChangeListeners, _Helper.buildPath(sPath, sProperty), undefined, true);
4935
4962
  }
@@ -4969,7 +4996,7 @@ _Helper = {
4969
4996
  mQueryOptionsForPathPrefix.$expand = {};
4970
4997
  if (i === aMetaPathSegments.length - 1) {
4971
4998
  mChildQueryOptions = Object.assign({}, mChildQueryOptions);
4972
- mChildQueryOptions.$select = mChildQueryOptions.$select && mChildQueryOptions.$select.slice();
4999
+ mChildQueryOptions.$select &&= mChildQueryOptions.$select.slice();
4973
5000
  }
4974
5001
  mQueryOptionsForPathPrefix = mQueryOptionsForPathPrefix.$expand[sExpandSelectPath] = i === aMetaPathSegments.length - 1 ? mChildQueryOptions : {};
4975
5002
  _Helper.selectKeyProperties(mQueryOptionsForPathPrefix, fnFetchMetadata(sPropertyMetaPath + "/").getResult());
@@ -5114,16 +5141,12 @@ _MetadataConverter.prototype.getInlineAnnotationValue = function (oElement) {
5114
5141
  };
5115
5142
  _MetadataConverter.prototype.getOrCreateArray = function (oParent, sProperty) {
5116
5143
  var oResult = oParent[sProperty];
5117
- if (!oResult) {
5118
- oResult = oParent[sProperty] = [];
5119
- }
5144
+ oResult ??= oParent[sProperty] = [];
5120
5145
  return oResult;
5121
5146
  };
5122
5147
  _MetadataConverter.prototype.getOrCreateObject = function (oParent, sProperty) {
5123
5148
  var oResult = oParent[sProperty];
5124
- if (!oResult) {
5125
- oResult = oParent[sProperty] = {};
5126
- }
5149
+ oResult ??= oParent[sProperty] = {};
5127
5150
  return oResult;
5128
5151
  };
5129
5152
  _MetadataConverter.prototype.postProcessAnnotation = function (oElement, aResult) {
@@ -6432,7 +6455,7 @@ _V2MetadataConverter.prototype.updateNavigationPropertiesAndCreateBindings = fun
6432
6455
  function createNavigationPropertyBinding(oAssociationSetFrom, oAssociationSetTo) {
6433
6456
  var oEntitySet = oEntityContainer[oAssociationSetFrom.entitySetName], oToRole = oAssociation.roles[oAssociationSetTo.roleName];
6434
6457
  if (oToRole.propertyName) {
6435
- oEntitySet.$NavigationPropertyBinding = oEntitySet.$NavigationPropertyBinding || ({});
6458
+ oEntitySet.$NavigationPropertyBinding ??= {};
6436
6459
  oEntitySet.$NavigationPropertyBinding[oToRole.propertyName] = oAssociationSetTo.entitySetName;
6437
6460
  }
6438
6461
  }
package/dist/index.js CHANGED
@@ -10,7 +10,7 @@ import { determineProcessor } from "./processors/processor.js";
10
10
  export default ({ workspace, options, taskUtil }) => {
11
11
  dotenv.config();
12
12
  async function process(workspace, taskUtil) {
13
- await logBuilderVersion();
13
+ logBuilderVersion();
14
14
  logBetaUsage();
15
15
  const processor = determineProcessor(options.configuration);
16
16
  const appVariantResources = await AppVariantManager.getAppVariantResourcesToProcess(workspace);
@@ -8,6 +8,6 @@ export declare function insertInArray<T>(array: T[], index: number, insert: T):
8
8
  export declare function writeTempAnnotations({ writeTempFiles }: IConfiguration, name: string, language: Language, content: string): void;
9
9
  export declare function removePropertiesExtension(filePath: string): string;
10
10
  export declare function traverse(json: any, paths: string[], callback: (json: any, key: string | number, paths: string[]) => void): void;
11
- export declare function logBuilderVersion(): Promise<void>;
12
- export declare function logBetaUsage(): Promise<void>;
11
+ export declare function logBuilderVersion(): void;
12
+ export declare function logBetaUsage(): void;
13
13
  export declare function getUniqueName(existingNames: string[], template: string): string;
@@ -1,6 +1,8 @@
1
1
  import * as Log from "@ui5/logger";
2
2
  import * as fs from "fs";
3
+ import { fileURLToPath } from "url";
3
4
  import { posix as path } from "path";
5
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
4
6
  const log = Log.getLogger("rollup-plugin-ui5-resolve-task-adaptation");
5
7
  export function dotToUnderscore(value) {
6
8
  return value.replace(/\./g, "_");
@@ -91,17 +93,17 @@ export function traverse(json, paths, callback) {
91
93
  }
92
94
  }
93
95
  }
94
- export async function logBuilderVersion() {
96
+ export function logBuilderVersion() {
95
97
  try {
96
- // @ts-ignore
97
- const packageJSON = await import("../../package.json");
98
- log.info(`Running app-variant-bundler-build with version ${packageJSON.version}`);
98
+ const packageJson = fs.readFileSync(path.join(__dirname, "../../package.json"), { encoding: "utf-8" });
99
+ const packageJsonVersion = JSON.parse(packageJson).version;
100
+ log.info(`Running app-variant-bundler-build with version ${packageJsonVersion}`);
99
101
  }
100
102
  catch (e) {
101
103
  // do nothing
102
104
  }
103
105
  }
104
- export async function logBetaUsage() {
106
+ export function logBetaUsage() {
105
107
  log.info("Beta features enabled");
106
108
  }
107
109
  export function getUniqueName(existingNames, template) {
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@ui5/task-adaptation",
3
- "version": "1.3.0",
3
+ "version": "1.3.2",
4
4
  "description": "Custom task for ui5-builder which allows building UI5 Flexibility Adaptation Projects for SAP BTP, Cloud Foundry environment",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
7
  "test": "npm run lint && npm run build && npm run coverage",
8
8
  "lint": "npx eslint ./src",
9
- "dev": "UI5_LOG_LVL=error mocha --no-timeouts --no-warnings --experimental-loader=tsx --loader=esmock 'test/**/*.spec.ts'",
10
- "perf": "UI5_LOG_LVL=error mocha --no-timeouts --no-warnings --experimental-loader=tsx --loader=esmock 'test/**/*.perf.ts'",
9
+ "dev": "UI5_LOG_LVL=error mocha --no-timeouts --no-warnings --import=tsx --loader=esmock 'test/**/*.spec.ts'",
10
+ "perf": "UI5_LOG_LVL=error mocha --no-timeouts --no-warnings --import=tsx --loader=esmock 'test/**/*.perf.ts'",
11
11
  "coverage": "npx c8 npm run dev",
12
- "preversion": "npm test",
12
+ "preversion": "npm run build",
13
13
  "version": "git-chglog --next-tag v$npm_package_version -o CHANGELOG.md && git add CHANGELOG.md",
14
14
  "prepublishOnly": "git push --follow-tags",
15
15
  "release-note": "git-chglog -c .chglog/release-config.yml v$npm_package_version",
@@ -113,8 +113,5 @@
113
113
  "lines": 85
114
114
  },
115
115
  "types": "dist/index.d.ts",
116
- "type": "module",
117
- "engines": {
118
- "node": "18.14.2"
119
- }
116
+ "type": "module"
120
117
  }