@sap-ux/adp-tooling 0.14.3 → 0.14.5

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.
@@ -23,6 +23,10 @@ export declare class AdpPreview {
23
23
  private readonly project;
24
24
  private readonly util;
25
25
  private readonly logger;
26
+ /**
27
+ * Instance of the ABAP provider
28
+ */
29
+ private provider;
26
30
  /**
27
31
  * Merged descriptor variant with reference app manifest
28
32
  */
@@ -16,6 +16,10 @@ class AdpPreview {
16
16
  project;
17
17
  util;
18
18
  logger;
19
+ /**
20
+ * Instance of the ABAP provider
21
+ */
22
+ provider;
19
23
  /**
20
24
  * Merged descriptor variant with reference app manifest
21
25
  */
@@ -95,13 +99,13 @@ class AdpPreview {
95
99
  */
96
100
  async init(descriptorVariant) {
97
101
  this.descriptorVariantId = descriptorVariant.id;
98
- const provider = await (0, system_access_1.createAbapServiceProvider)(this.config.target, { ignoreCertErrors: this.config.ignoreCertErrors }, true, this.logger);
99
- this.routesHandler = new routes_handler_1.default(this.project, this.util, provider, this.logger);
100
- this.lrep = provider.getLayeredRepository();
102
+ this.provider = await (0, system_access_1.createAbapServiceProvider)(this.config.target, { ignoreCertErrors: this.config.ignoreCertErrors }, true, this.logger);
103
+ this.routesHandler = new routes_handler_1.default(this.project, this.util, this.provider, this.logger);
104
+ this.lrep = this.provider.getLayeredRepository();
101
105
  // fetch a merged descriptor from the backend
102
106
  await this.lrep.getCsrfToken();
103
107
  // check if the project is an ABAP cloud project
104
- this.isCloud = await provider.isAbapCloud();
108
+ this.isCloud = await this.provider.isAbapCloud();
105
109
  await this.sync();
106
110
  return descriptorVariant.layer;
107
111
  }
@@ -212,7 +216,7 @@ class AdpPreview {
212
216
  await (0, change_handler_1.addControllerExtension)(this.util.getProject().getRootPath(), this.util.getProject().getSourcePath(), change, fs, logger);
213
217
  }
214
218
  if ((0, change_handler_1.isAddAnnotationChange)(change)) {
215
- await (0, change_handler_1.addAnnotationFile)(this.util.getProject().getSourcePath(), this.util.getProject().getRootPath(), change, fs, logger);
219
+ await (0, change_handler_1.addAnnotationFile)(this.util.getProject().getSourcePath(), this.util.getProject().getRootPath(), change, fs, logger, this.provider);
216
220
  }
217
221
  break;
218
222
  default:
@@ -1,6 +1,7 @@
1
1
  import type { Editor } from 'mem-fs-editor';
2
2
  import type { AddXMLChange, CommonChangeProperties, CodeExtChange, AnnotationFileChange, CommonAdditionalChangeInfoProperties } from '../types';
3
3
  import type { Logger } from '@sap-ux/logger';
4
+ import type { AbapServiceProvider } from '@sap-ux/axios-extension';
4
5
  /**
5
6
  * A mapping object that defines how to extract change content data from changes based on their type.
6
7
  */
@@ -72,6 +73,7 @@ export declare function addControllerExtension(rootPath: string, basePath: strin
72
73
  * @param {AnnotationFileChange} change - The change data, including the fragment path.
73
74
  * @param {Editor} fs - The mem-fs-editor instance.
74
75
  * @param {Logger} logger - The logging instance.
76
+ *@param {AbapServiceProvider} provider - abap provider.
75
77
  */
76
- export declare function addAnnotationFile(basePath: string, projectRoot: string, change: AnnotationFileChange, fs: Editor, logger: Logger): Promise<void>;
78
+ export declare function addAnnotationFile(basePath: string, projectRoot: string, change: AnnotationFileChange, fs: Editor, logger: Logger, provider: AbapServiceProvider): Promise<void>;
77
79
  //# sourceMappingURL=change-handler.d.ts.map
@@ -9,14 +9,13 @@ exports.addXmlFragment = addXmlFragment;
9
9
  exports.addControllerExtension = addControllerExtension;
10
10
  exports.addAnnotationFile = addAnnotationFile;
11
11
  const path_1 = require("path");
12
- const project_access_1 = require("@sap-ux/project-access");
13
12
  const ejs_1 = require("ejs");
14
13
  const crypto_1 = require("crypto");
15
14
  const manifest_service_1 = require("../base/abap/manifest-service");
16
15
  const helper_1 = require("../base/helper");
17
- const system_access_1 = require("@sap-ux/system-access");
18
16
  const odata_service_writer_1 = require("@sap-ux/odata-service-writer");
19
17
  const editors_1 = require("../writer/editors");
18
+ const project_access_1 = require("@sap-ux/project-access");
20
19
  const OBJECT_PAGE_CUSTOM_SECTION = 'OBJECT_PAGE_CUSTOM_SECTION';
21
20
  const CUSTOM_ACTION = 'CUSTOM_ACTION';
22
21
  const OBJECT_PAGE_HEADER_FIELD = 'OBJECT_PAGE_HEADER_FIELD';
@@ -273,15 +272,17 @@ async function addControllerExtension(rootPath, basePath, change, fs, logger) {
273
272
  * @param {AnnotationFileChange} change - The change data, including the fragment path.
274
273
  * @param {Editor} fs - The mem-fs-editor instance.
275
274
  * @param {Logger} logger - The logging instance.
275
+ *@param {AbapServiceProvider} provider - abap provider.
276
276
  */
277
- async function addAnnotationFile(basePath, projectRoot, change, fs, logger) {
277
+ async function addAnnotationFile(basePath, projectRoot, change, fs, logger, provider) {
278
278
  const { dataSourceId, annotations, dataSource } = change.content;
279
279
  const annotationDataSourceKey = annotations[0];
280
280
  const annotationUriSegments = dataSource[annotationDataSourceKey].uri.split('/');
281
281
  annotationUriSegments.shift();
282
282
  const fullPath = (0, path_1.join)(basePath, project_access_1.DirName.Changes, ...annotationUriSegments);
283
283
  try {
284
- const manifestService = await getManifestService(projectRoot, logger);
284
+ const variant = await (0, helper_1.getVariant)(basePath);
285
+ const manifestService = await manifest_service_1.ManifestService.initMergedManifest(provider, basePath, variant, logger);
285
286
  const metadata = await manifestService.getDataSourceMetadata(dataSourceId);
286
287
  const datasoruces = await manifestService.getManifestDataSources();
287
288
  const namespaces = (0, odata_service_writer_1.getAnnotationNamespaces)({ metadata });
@@ -301,17 +302,4 @@ async function addAnnotationFile(basePath, projectRoot, change, fs, logger) {
301
302
  throw new Error('Failed to create Local Annotation File' + error.message);
302
303
  }
303
304
  }
304
- /**
305
- * Returns manifest service.
306
- *
307
- * @param {string} basePath - The base path of the project.
308
- * @param {Logger} logger - The logging instance.
309
- * @returns Promise<ManifestService>
310
- */
311
- async function getManifestService(basePath, logger) {
312
- const variant = await (0, helper_1.getVariant)(basePath);
313
- const { target, ignoreCertErrors = false } = await (0, helper_1.getAdpConfig)(basePath, (0, path_1.join)(basePath, project_access_1.FileName.Ui5Yaml));
314
- const provider = await (0, system_access_1.createAbapServiceProvider)(target, { ignoreCertErrors }, true, logger);
315
- return await manifest_service_1.ManifestService.initMergedManifest(provider, basePath, variant, logger);
316
- }
317
305
  //# sourceMappingURL=change-handler.js.map
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "bugs": {
10
10
  "url": "https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Aadp-tooling"
11
11
  },
12
- "version": "0.14.3",
12
+ "version": "0.14.5",
13
13
  "license": "Apache-2.0",
14
14
  "author": "@SAP/ux-tools-team",
15
15
  "main": "dist/index.js",
@@ -32,13 +32,13 @@
32
32
  "prompts": "2.4.2",
33
33
  "sanitize-filename": "1.6.3",
34
34
  "uuid": "10.0.0",
35
- "@sap-ux/axios-extension": "1.21.0",
35
+ "@sap-ux/axios-extension": "1.21.1",
36
36
  "@sap-ux/btp-utils": "1.1.0",
37
37
  "@sap-ux/inquirer-common": "0.7.1",
38
38
  "@sap-ux/logger": "0.7.0",
39
39
  "@sap-ux/project-access": "1.30.1",
40
40
  "@sap-ux/project-input-validator": "0.6.1",
41
- "@sap-ux/system-access": "0.6.0",
41
+ "@sap-ux/system-access": "0.6.1",
42
42
  "@sap-ux/ui5-config": "0.28.1",
43
43
  "@sap-ux/odata-service-writer": "0.27.2",
44
44
  "@sap-ux/nodejs-utils": "0.2.0",