@ui5/task-adaptation 1.3.3 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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.3.3...HEAD).
5
+ A list of unreleased changes can be found [here](https://github.com/SAP/ui5-task-adaptation/compare/v1.4.0...HEAD).
6
+
7
+ <a name="v1.4.0"></a>
8
+ ## [v1.4.0] - 2024-09-25
6
9
 
7
10
  <a name="v1.3.3"></a>
8
11
  ## [v1.3.3] - 2024-09-11
@@ -97,6 +100,7 @@ A list of unreleased changes can be found [here](https://github.com/SAP/ui5-task
97
100
  <a name="v1.0.0"></a>
98
101
  ## v1.0.0 - 2020-12-09
99
102
 
103
+ [v1.4.0]: https://github.com/SAP/ui5-task-adaptation/compare/v1.3.3...v1.4.0
100
104
  [v1.3.3]: https://github.com/SAP/ui5-task-adaptation/compare/v1.3.2...v1.3.3
101
105
  [v1.3.2]: https://github.com/SAP/ui5-task-adaptation/compare/v1.3.1...v1.3.2
102
106
  [v1.3.1]: https://github.com/SAP/ui5-task-adaptation/compare/v1.3.0...v1.3.1
package/README.md CHANGED
@@ -8,15 +8,18 @@ A custom task for [ui5-builder](https://github.com/SAP/ui5-builder) that allows
8
8
 
9
9
  ### Configuration
10
10
  #### ABAP Connection
11
- The following connection configuration format is used to connect to ABAP repository on SAP BAS and IDE:
11
+ The following connection configuration format is used to connect to ABAP repository in IDE:
12
12
  ```yaml
13
- connections:
14
- - url: example.com,
15
- authenticationType: basic | reentranceTicket,
16
- ignoreCertErrors: true | false
17
- - destination: abc
13
+ target:
14
+ url: example.com,
15
+ authenticationType: basic | reentranceTicket,
16
+ ignoreCertErrors: true | false
17
+ ```
18
+ and in SAP Business Application Studio:
19
+ ```yaml
20
+ target:
21
+ destination: abc
18
22
  ```
19
- In case multiple connection configuration are present, then the current environment configuration will be used. For example in above case `destination` for SAP BAS or `url` for IDE will be automaticaly used.
20
23
  OnPremise ABAP repository requires `authenticationType: basic`, credentials should be provided in project root `.env` file:
21
24
  ```
22
25
  FIORI_TOOLS_USER=<username>
@@ -26,7 +26,8 @@ function retryOnError(maxRetries) {
26
26
  retries++;
27
27
  }
28
28
  else {
29
- throw new Error(`Failed to fetch annotation by '${args[0]}': ${error.message}`);
29
+ const message = error?.response?.data ?? error.message;
30
+ throw new Error(`Failed to fetch annotation by '${args[0]}': ${message}`);
30
31
  }
31
32
  }
32
33
  }
@@ -13,7 +13,7 @@ export interface IConfiguration {
13
13
  enableAnnotationCache?: boolean;
14
14
  enableBetaFeatures?: boolean;
15
15
  writeTempFiles?: any;
16
- connections?: (AbapTarget & IAbapTargetMeta)[];
16
+ target?: AbapTarget & IAbapTargetMeta;
17
17
  }
18
18
  export interface IAbapTargetMeta {
19
19
  name?: string;
@@ -2,8 +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
- get({ connections, destination }: IConfiguration): Promise<AbapServiceProvider>;
6
- private static validateAndGetTargetConfiguration;
7
- private static validateConnectionConfiguration;
8
- private createProvider;
5
+ get({ target, destination }: IConfiguration): Promise<AbapServiceProvider>;
6
+ private static validateAndGetAbapTarget;
9
7
  }
@@ -3,67 +3,35 @@ import BtpUtils from "@sap-ux/btp-utils";
3
3
  import { getLogger } from "@ui5/logger";
4
4
  import { validateObject } from "../util/commonUtil.js";
5
5
  const log = getLogger("@ui5/task-adaptation::AbapProvider");
6
+ log.debug = (message) => log.verbose(message);
6
7
  export default class AbapProvider {
7
8
  provider = null;
8
- async get({ connections, destination }) {
9
+ async get({ target, destination }) {
9
10
  if (!this.provider) {
10
- AbapProvider.validateConnectionConfiguration(connections, destination);
11
- // we try to detect is it either destination for BAS or url for IDE
12
- let targetConfiguration = AbapProvider.validateAndGetTargetConfiguration(connections);
13
- if (targetConfiguration) {
14
- this.provider = await this.createProvider(targetConfiguration);
15
- }
16
- else if (destination) {
17
- // still if no suitable connections found, we assume that it's
18
- // old config with destination
19
- this.provider = await this.createProvider({ destination });
20
- }
21
- else {
22
- // if no suitible configs found - throw error
23
- const environment = BtpUtils.isAppStudio() ? "SAP Business Application Studio" : "local IDE";
24
- throw new Error(`ABAP connection configuration for ${environment} is not provided`);
11
+ const abapTarget = AbapProvider.validateAndGetAbapTarget(target, destination);
12
+ if (abapTarget) {
13
+ this.provider = await createAbapServiceProvider(abapTarget, { ignoreCertErrors: abapTarget.ignoreCertErrors }, true, log);
25
14
  }
26
15
  }
27
- return this.provider;
28
- }
29
- static validateAndGetTargetConfiguration(connections) {
30
- // we're trying to detect is it destination for BAS or url for IDE
31
- const abapTargetProperties = BtpUtils.isAppStudio() ? ["destination"] : ["url"];
32
- if (connections) {
33
- for (const connection of connections) {
34
- try {
35
- validateObject(connection, abapTargetProperties, "should be specified in ui5.yaml configuration/target");
36
- }
37
- catch (error) {
38
- continue;
39
- }
40
- return connection;
41
- }
16
+ if (!this.provider) {
17
+ throw new Error("Target should be specified in ui5.yaml configuration to connect the ABAP system");
42
18
  }
19
+ return this.provider;
43
20
  }
44
- static validateConnectionConfiguration(connections, destination) {
45
- // then abap connection config either old destination propery, or new
46
- // connections/destination for BAS or connections/url for IDE
47
- if (!connections && !destination) {
48
- throw new Error("ABAP connections should be specified in ui5.yaml configuration");
49
- }
50
- if (destination) {
51
- log.warn("Deprecated, use connections/destination configuration instead, see README.md");
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;
52
29
  }
53
- // if connections configuration appears, we validate that it should be
54
- // either connections/destination for BAS or connections/url for IDE
55
- if (connections && !AbapProvider.validateAndGetTargetConfiguration(connections)) {
56
- throw new Error("ABAP connection settings should be specified in ui5.yaml configuration");
30
+ else if (destination) {
31
+ log.warn("Destination is deprecated, use target/destination configuration instead");
32
+ return { destination };
57
33
  }
58
- // no connections and destination the same time to avoid ambiguity
59
- if (connections && destination) {
60
- throw new Error("Either destination or connections should be presented in configuration, not both");
61
- }
62
- }
63
- createProvider(abapTarget) {
64
- // createAbapServiceProvider requires log.debug, which is not implemented in ui5 logger.
65
- log.debug = (message) => log.verbose(message);
66
- return createAbapServiceProvider(abapTarget, { ignoreCertErrors: abapTarget.ignoreCertErrors }, true, log);
34
+ throw new Error("Target should be specified in ui5.yaml configuration to connect the ABAP system");
67
35
  }
68
36
  }
69
37
  //# sourceMappingURL=abapProvider.js.map
@@ -1,4 +1,3 @@
1
- /// <reference path="../../types/ui5.d.ts" />
2
1
  import * as Resource from "@ui5/fs/Resource";
3
2
  import { IAppVariantInfo } from "../model/types.js";
4
3
  type Resource = typeof Resource;
@@ -1,2 +1 @@
1
- /// <reference types="node" />
2
1
  export declare function unzipZipEntries(zip: Buffer): Promise<Map<string, string>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ui5/task-adaptation",
3
- "version": "1.3.3",
3
+ "version": "1.4.0",
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": {
@@ -33,13 +33,13 @@
33
33
  "author": "SAP SE",
34
34
  "license": "Apache-2.0",
35
35
  "dependencies": {
36
- "@sap-ux/axios-extension": "^1.13.1",
37
- "@sap-ux/btp-utils": "^0.14.4",
38
- "@sap-ux/store": "^0.6.0",
39
- "@sap-ux/system-access": "^0.4.2",
36
+ "@sap-ux/axios-extension": "^1.16.6",
37
+ "@sap-ux/btp-utils": "^0.15.2",
38
+ "@sap-ux/store": "^0.9.1",
39
+ "@sap-ux/system-access": "^0.5.11",
40
40
  "@sap/cf-tools": "^3.2.0",
41
- "@ui5/fs": "^3.0.5",
42
- "@ui5/logger": "^3.0.0",
41
+ "@ui5/fs": "^4.0.1",
42
+ "@ui5/logger": "^4.0.1",
43
43
  "adm-zip": "^0.5.5",
44
44
  "axios": "^1.6.2",
45
45
  "crc": "^4.3.2",
@@ -61,7 +61,7 @@
61
61
  "@types/mocha": "^9.1.0",
62
62
  "@types/semver": "^7.3.8",
63
63
  "@types/sinon": "^10.0.16",
64
- "@ui5/project": "^3.9.0",
64
+ "@ui5/project": "^4.0.3",
65
65
  "amdextract": "^3.0.0",
66
66
  "builtin-modules": "^3.2.0",
67
67
  "c8": "^9.1.0",
@@ -80,7 +80,7 @@
80
80
  "nyc": "^15.1.0",
81
81
  "rollup": "^4.9.6",
82
82
  "semver": "^7.3.5",
83
- "sinon": "^17.0.1",
83
+ "sinon": "^18.0.1",
84
84
  "source-map-support": "^0.5.19",
85
85
  "tsx": "^4.7.1",
86
86
  "typescript": "^5.4.2",