@ui5/task-adaptation 1.6.5-rc.1 → 1.6.5-rc.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,10 @@
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.6.5-rc.1...HEAD).
5
+ A list of unreleased changes can be found [here](https://github.com/SAP/ui5-task-adaptation/compare/v1.6.5-rc.2...HEAD).
6
+
7
+ <a name="v1.6.5-rc.2"></a>
8
+ ## [v1.6.5-rc.2] - 2026-04-14
6
9
 
7
10
  <a name="v1.6.5-rc.1"></a>
8
11
  ## [v1.6.5-rc.1] - 2026-04-13
@@ -185,6 +188,7 @@ A list of unreleased changes can be found [here](https://github.com/SAP/ui5-task
185
188
  <a name="v1.0.0"></a>
186
189
  ## v1.0.0 - 2020-12-09
187
190
 
191
+ [v1.6.5-rc.2]: https://github.com/SAP/ui5-task-adaptation/compare/v1.6.5-rc.1...v1.6.5-rc.2
188
192
  [v1.6.5-rc.1]: https://github.com/SAP/ui5-task-adaptation/compare/v1.6.4-rc.3...v1.6.5-rc.1
189
193
  [v1.6.4-rc.3]: https://github.com/SAP/ui5-task-adaptation/compare/v1.6.4-rc.2...v1.6.4-rc.3
190
194
  [v1.6.4-rc.2]: https://github.com/SAP/ui5-task-adaptation/compare/v1.6.4-rc.1...v1.6.4-rc.2
@@ -62,18 +62,21 @@ export default class AppVariant {
62
62
  }
63
63
  ;
64
64
  getProcessedManifestChanges() {
65
- // Order: manifest changes first, then *.change files
65
+ // Order: manifest changes first, then *.change files sorted by creation ASC
66
66
  const manifestChanges = structuredClone(this.content) ?? [];
67
+ const changeFileChanges = [];
67
68
  this.files.forEach((content, filename) => {
68
69
  if (filename.endsWith(CHANGES_EXT)) {
69
70
  const change = JSON.parse(content);
70
71
  if (isManifestChange(filename, content)) {
71
72
  const { newFilename } = moveFile(filename, content, this.prefix, this.id);
72
73
  this.updateRelativePaths(change, newFilename);
73
- manifestChanges.push(change);
74
+ changeFileChanges.push(change);
74
75
  }
75
76
  }
76
77
  });
78
+ changeFileChanges.sort(FilesUtil.sortByTimeStamp);
79
+ manifestChanges.push(...changeFileChanges);
77
80
  if (this.layer) {
78
81
  manifestChanges.forEach(change => change.layer = this.layer ?? change.layer);
79
82
  }
@@ -5,19 +5,47 @@ import AbapRepository from "./repositories/abapRepository.js";
5
5
  import HTML5Repository from "./repositories/html5Repository.js";
6
6
  import LocalRepository from "./repositories/localRepository.js";
7
7
  import AbapAnnotationManager from "./annotations/abapAnnotationManager.js";
8
- import LocalAnnotationManager from "./annotations/localAnnotationManager.js";
9
- import { validateObject } from "./util/commonUtil.js";
10
8
  import CFAnnotationManager from "./annotations/cfAnnotationManager.js";
9
+ import CFValidator from "./util/validator/cfValidator.js";
10
+ import AbapValidator from "./util/validator/abapValidator.js";
11
+ import { isOneOf } from "./util/validator/validator.js";
12
+ import { LANDSCAPE_TYPES } from "./model/configuration.js";
13
+ import { getLogger } from "@ui5/logger";
14
+ import LocalAnnotationManager from "./annotations/localAnnotationManager.js";
15
+ const log = getLogger("@ui5/task-adaptation::LandscapeConfiguration");
11
16
  export function initialize(configuration) {
12
- validateObject(configuration, ["type"], "should be specified in ui5.yaml configuration: 'cf' or 'abap'");
13
- const repository = getRepository(configuration);
14
- const annotationManager = getAnnotationManager(configuration, repository);
17
+ const type = getTypeByConfiguration(configuration);
18
+ const enhancedConfig = { ...configuration, type };
19
+ const repository = getRepository(enhancedConfig);
20
+ const annotationManager = getAnnotationManager(enhancedConfig, repository);
15
21
  return {
16
- adapter: getAdapter(configuration, annotationManager),
22
+ adapter: getAdapter(enhancedConfig, annotationManager),
17
23
  repository,
18
24
  annotationManager
19
25
  };
20
26
  }
27
+ function getTypeByConfiguration(configuration) {
28
+ const validators = [
29
+ new CFValidator(),
30
+ new AbapValidator(),
31
+ ];
32
+ if (isOneOf(LANDSCAPE_TYPES, configuration.type)) {
33
+ return configuration.type;
34
+ }
35
+ else {
36
+ log.warn("Deprecated behavior: type is not specified or invalid. Should be either 'cf' or 'abap'. Trying to detect the type based on provided configuration");
37
+ for (const validator of validators) {
38
+ try {
39
+ validator.validateConfiguration(configuration);
40
+ return validator.type;
41
+ }
42
+ catch (_error) {
43
+ // Continue to the next validator if validation fails
44
+ }
45
+ }
46
+ throw new Error("'type' should be specified in ui5.yaml configuration: 'cf' or 'abap'");
47
+ }
48
+ }
21
49
  function getAdapter(configuration, annotationManager) {
22
50
  if (isPreview(configuration)) {
23
51
  return new PreviewAdapter(configuration);
@@ -8,8 +8,8 @@ export interface IConfiguration {
8
8
  org?: string;
9
9
  sapCloudService?: string;
10
10
  destination?: string;
11
- type?: "cf" | "abap";
12
- mode?: "preview" | "local" | "default";
11
+ type?: LandscapeType;
12
+ mode?: LandscapeMode;
13
13
  languages?: any[] | undefined;
14
14
  enableAnnotationCache?: boolean;
15
15
  enableBetaFeatures?: boolean;
@@ -18,6 +18,10 @@ export interface IConfiguration {
18
18
  serviceInstanceName?: string;
19
19
  adpDir?: string;
20
20
  }
21
+ export declare const LANDSCAPE_TYPES: readonly ["cf", "abap"];
22
+ export type LandscapeType = typeof LANDSCAPE_TYPES[number];
23
+ export declare const LANDSCAPE_MODES: readonly ["preview", "local", "default"];
24
+ export type LandscapeMode = typeof LANDSCAPE_MODES[number];
21
25
  export interface IAbapTargetMeta {
22
26
  name?: string;
23
27
  ignoreCertErrors?: boolean;
@@ -1,2 +1,3 @@
1
- export {};
1
+ export const LANDSCAPE_TYPES = ["cf", "abap"];
2
+ export const LANDSCAPE_MODES = ["preview", "local", "default"];
2
3
  //# sourceMappingURL=configuration.js.map
@@ -61,6 +61,7 @@ export interface IChange {
61
61
  layer?: string;
62
62
  content?: IChangeContent;
63
63
  filename: string;
64
+ creation: string;
64
65
  }
65
66
  export interface IChangeText {
66
67
  i18n: string;
@@ -2,6 +2,6 @@ import type { AbapServiceProvider } from "@sap-ux/axios-extension";
2
2
  import { IConfiguration } from "../model/types.js";
3
3
  export default class AbapProvider {
4
4
  private provider;
5
+ private abapValidator;
5
6
  get({ target, destination }: IConfiguration): Promise<AbapServiceProvider>;
6
- private static validateAndGetAbapTarget;
7
7
  }
@@ -1,14 +1,14 @@
1
1
  import { createAbapServiceProvider } from "@sap-ux/system-access";
2
- import BtpUtils from "@sap-ux/btp-utils";
3
2
  import { getLogger } from "@ui5/logger";
4
- import { validateObject } from "../util/commonUtil.js";
3
+ import AbapValidator from "../util/validator/abapValidator.js";
5
4
  const log = getLogger("@ui5/task-adaptation::AbapProvider");
6
5
  log.debug = (message) => log.verbose(message);
7
6
  export default class AbapProvider {
8
7
  provider = null;
8
+ abapValidator = new AbapValidator();
9
9
  async get({ target, destination }) {
10
10
  if (!this.provider) {
11
- const abapTarget = AbapProvider.validateAndGetAbapTarget(target, destination);
11
+ const abapTarget = this.abapValidator.validateAndGetAbapTarget(target, destination);
12
12
  if (abapTarget) {
13
13
  this.provider = await createAbapServiceProvider(abapTarget, { ignoreCertErrors: abapTarget.ignoreCertErrors }, true, log);
14
14
  }
@@ -18,20 +18,5 @@ export default class AbapProvider {
18
18
  }
19
19
  return this.provider;
20
20
  }
21
- static validateAndGetAbapTarget(target, destination) {
22
- if (target) {
23
- // if target configuration appears, we validate that it should be
24
- // either target/destination for BAS or target/url for IDE we're
25
- // trying to detect is it destination for BAS or url for IDE
26
- const abapTargetProperties = BtpUtils.isAppStudio() ? ["destination"] : ["url"];
27
- validateObject(target, abapTargetProperties, "should be specified in ui5.yaml configuration/target");
28
- return target;
29
- }
30
- else if (destination) {
31
- log.warn("Destination is deprecated, use target/destination configuration instead");
32
- return { destination };
33
- }
34
- throw new Error("Target should be specified in ui5.yaml configuration to connect the ABAP system");
35
- }
36
21
  }
37
22
  //# sourceMappingURL=abapProvider.js.map
@@ -3,6 +3,7 @@ import IRepository from "./repository.js";
3
3
  import { IAppVariantIdHierarchyItem } from "../model/appVariantIdHierarchyItem.js";
4
4
  export default class HTML5Repository implements IRepository {
5
5
  private configuration;
6
+ private validator;
6
7
  constructor(configuration: IConfiguration);
7
8
  getAppVariantIdHierarchy(appId: string): Promise<IAppVariantIdHierarchyItem[]>;
8
9
  fetch(_repoName: string, _cachebusterToken: string): Promise<Map<string, string>>;
@@ -9,13 +9,14 @@ import RequestUtil from "../util/requestUtil.js";
9
9
  import { getLogger } from "@ui5/logger";
10
10
  import { unzipZipEntries } from "../util/zipUtil.js";
11
11
  import { cached } from "../cache/cacheHolder.js";
12
- import { validateConfiguration } from "../util/commonUtil.js";
12
+ import CFValidator from "../util/validator/cfValidator.js";
13
13
  const log = getLogger("@ui5/task-adaptation::HTML5Repository");
14
14
  export default class HTML5Repository {
15
15
  configuration;
16
+ validator = new CFValidator();
16
17
  constructor(configuration) {
17
18
  this.configuration = configuration;
18
- validateConfiguration(configuration, ["appHostId", "appName", "appVersion"]);
19
+ this.validator.validateConfiguration(configuration);
19
20
  }
20
21
  async getAppVariantIdHierarchy(appId) {
21
22
  const metadata = await this.getMetadata();
@@ -1,5 +1,7 @@
1
+ import { IChange } from "../model/types.js";
1
2
  export default class FilesUtil {
2
3
  static filter(files: ReadonlyMap<string, string>): ReadonlyMap<string, string>;
4
+ static sortByTimeStamp(a: IChange, b: IChange): number;
3
5
  /**
4
6
  * 1p. i18n.properties are not renamed and property keys are ignored during
5
7
  * the renaming across the files.
@@ -23,6 +23,13 @@ export default class FilesUtil {
23
23
  });
24
24
  return result;
25
25
  }
26
+ static sortByTimeStamp(a, b) {
27
+ if (a.creation < b.creation)
28
+ return -1;
29
+ if (a.creation > b.creation)
30
+ return 1;
31
+ return 0;
32
+ }
26
33
  /**
27
34
  * 1p. i18n.properties are not renamed and property keys are ignored during
28
35
  * the renaming across the files.
@@ -0,0 +1,8 @@
1
+ import { AbapTarget } from "@sap-ux/system-access";
2
+ import { IAbapTargetMeta, IConfiguration, LandscapeType } from "../../model/configuration.js";
3
+ import IValidator from "./validator.js";
4
+ export default class AbapValidator implements IValidator {
5
+ type: LandscapeType;
6
+ validateAndGetAbapTarget(target: AbapTarget & IAbapTargetMeta | undefined, destination: string | undefined): AbapTarget & IAbapTargetMeta;
7
+ validateConfiguration({ target, destination }: IConfiguration): void;
8
+ }
@@ -0,0 +1,26 @@
1
+ import { validateObject } from "../commonUtil.js";
2
+ import BtpUtils from "@sap-ux/btp-utils";
3
+ import { getLogger } from "@ui5/logger";
4
+ const log = getLogger("@ui5/task-adaptation::AbapValidator");
5
+ export default class AbapValidator {
6
+ type = "abap";
7
+ validateAndGetAbapTarget(target, destination) {
8
+ if (target) {
9
+ // if target configuration appears, we validate that it should be
10
+ // either target/destination for BAS or target/url for IDE we're
11
+ // trying to detect is it destination for BAS or url for IDE
12
+ const abapTargetProperties = BtpUtils.isAppStudio() ? ["destination"] : ["url"];
13
+ validateObject(target, abapTargetProperties, "should be specified in ui5.yaml configuration/target");
14
+ return target;
15
+ }
16
+ else if (destination) {
17
+ log.warn("Destination is deprecated, use target/destination configuration instead");
18
+ return { destination };
19
+ }
20
+ throw new Error("Target should be specified in ui5.yaml configuration to connect the ABAP system");
21
+ }
22
+ validateConfiguration({ target, destination }) {
23
+ this.validateAndGetAbapTarget(target, destination);
24
+ }
25
+ }
26
+ //# sourceMappingURL=abapValidator.js.map
@@ -0,0 +1,6 @@
1
+ import { IConfiguration, LandscapeType } from "../../model/configuration.js";
2
+ import IValidator from "./validator.js";
3
+ export default class CFValidator implements IValidator {
4
+ type: LandscapeType;
5
+ validateConfiguration(configuration: IConfiguration): void;
6
+ }
@@ -0,0 +1,8 @@
1
+ import { validateConfiguration } from "../commonUtil.js";
2
+ export default class CFValidator {
3
+ type = "cf";
4
+ validateConfiguration(configuration) {
5
+ validateConfiguration(configuration, ["appHostId", "appName", "appVersion"]);
6
+ }
7
+ }
8
+ //# sourceMappingURL=cfValidator.js.map
@@ -0,0 +1,6 @@
1
+ import { IConfiguration, LandscapeType } from "../../model/configuration.js";
2
+ export default interface IValidator {
3
+ type: LandscapeType;
4
+ validateConfiguration(configuration: IConfiguration): void;
5
+ }
6
+ export declare function isOneOf<T extends readonly unknown[]>(values: T, value: unknown): value is T[number];
@@ -0,0 +1,4 @@
1
+ export function isOneOf(values, value) {
2
+ return values.includes(value);
3
+ }
4
+ //# sourceMappingURL=validator.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ui5/task-adaptation",
3
- "version": "1.6.5-rc.1",
3
+ "version": "1.6.5-rc.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": {