@sap-ux/adp-tooling 0.18.94 → 0.18.95
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/base/abap/manifest-service.d.ts +2 -3
- package/dist/cf/project/yaml.js +1 -1
- package/dist/cf/services/index.d.ts +1 -0
- package/dist/cf/services/index.js +1 -0
- package/dist/cf/services/manifest.d.ts +52 -0
- package/dist/cf/services/manifest.js +84 -0
- package/dist/translations/adp-tooling.i18n.json +2 -1
- package/dist/types.d.ts +26 -0
- package/package.json +1 -1
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { ToolsLogger } from '@sap-ux/logger';
|
|
2
2
|
import type { Manifest, ManifestNamespace } from '@sap-ux/project-access';
|
|
3
3
|
import { type AbapServiceProvider } from '@sap-ux/axios-extension';
|
|
4
|
-
import type { DescriptorVariant } from '../../types';
|
|
5
|
-
export type DataSources = Record<string, ManifestNamespace.DataSource>;
|
|
4
|
+
import type { DescriptorVariant, IManifestService, DataSources } from '../../types';
|
|
6
5
|
/**
|
|
7
6
|
* Retrieves the inbound navigation configurations from the project's manifest.
|
|
8
7
|
*
|
|
@@ -23,7 +22,7 @@ export declare function getRegistrationIdFromManifest(manifest: Manifest): strin
|
|
|
23
22
|
* It provides methods to fetch the manifest, data sources and metadata of a data source.
|
|
24
23
|
*
|
|
25
24
|
*/
|
|
26
|
-
export declare class ManifestService {
|
|
25
|
+
export declare class ManifestService implements IManifestService {
|
|
27
26
|
private readonly provider;
|
|
28
27
|
private readonly logger;
|
|
29
28
|
private manifest;
|
package/dist/cf/project/yaml.js
CHANGED
|
@@ -105,7 +105,7 @@ function getAppParamsFromUI5Yaml(projectPath) {
|
|
|
105
105
|
const appConfiguration = parsedYaml?.builder?.customTasks?.[0]?.configuration;
|
|
106
106
|
const appParams = {
|
|
107
107
|
appHostId: appConfiguration?.appHostId || '',
|
|
108
|
-
appName: appConfiguration?.
|
|
108
|
+
appName: appConfiguration?.appName || '',
|
|
109
109
|
appVersion: appConfiguration?.appVersion || '',
|
|
110
110
|
spaceGuid: appConfiguration?.space || ''
|
|
111
111
|
};
|
|
@@ -16,4 +16,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./api"), exports);
|
|
18
18
|
__exportStar(require("./cli"), exports);
|
|
19
|
+
__exportStar(require("./manifest"), exports);
|
|
19
20
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { ToolsLogger } from '@sap-ux/logger';
|
|
2
|
+
import type { Manifest } from '@sap-ux/project-access';
|
|
3
|
+
import type { IManifestService, DataSources } from '../../types';
|
|
4
|
+
/**
|
|
5
|
+
* Service class for handling operations related to the manifest of a CF-deployed UI5 application.
|
|
6
|
+
* Extends the ABAP {@link ManifestService} API, but retrieves the manifest from the local
|
|
7
|
+
* build output (`dist/`)
|
|
8
|
+
*
|
|
9
|
+
* The build is triggered automatically during initialization so that the `dist/` folder
|
|
10
|
+
* contains the latest merged manifest before it is read.
|
|
11
|
+
*/
|
|
12
|
+
export declare class ManifestServiceCF implements IManifestService {
|
|
13
|
+
private readonly logger;
|
|
14
|
+
private manifest;
|
|
15
|
+
/**
|
|
16
|
+
* Private constructor to initialize the ManifestServiceCF.
|
|
17
|
+
*
|
|
18
|
+
* @param logger - The logger instance.
|
|
19
|
+
*/
|
|
20
|
+
private constructor();
|
|
21
|
+
/**
|
|
22
|
+
* Creates an instance of the ManifestServiceCF by building the project and
|
|
23
|
+
* reading the manifest from the `dist/` folder.
|
|
24
|
+
*
|
|
25
|
+
* @param projectPath - The path to the adaptation project.
|
|
26
|
+
* @param logger - The logger instance.
|
|
27
|
+
* @returns A promise that resolves to an instance of ManifestServiceCF.
|
|
28
|
+
*/
|
|
29
|
+
static init(projectPath: string, logger: ToolsLogger): Promise<ManifestServiceCF>;
|
|
30
|
+
/**
|
|
31
|
+
* Returns the manifest read from the build output during initialization.
|
|
32
|
+
*
|
|
33
|
+
* @returns The current manifest.
|
|
34
|
+
*/
|
|
35
|
+
getManifest(): Manifest;
|
|
36
|
+
/**
|
|
37
|
+
* Returns the data sources from the manifest.
|
|
38
|
+
*
|
|
39
|
+
* @returns The data sources from the manifest.
|
|
40
|
+
* @throws Error if no data sources are found in the manifest.
|
|
41
|
+
*/
|
|
42
|
+
getManifestDataSources(): DataSources;
|
|
43
|
+
/**
|
|
44
|
+
* Metadata fetching is not supported for CF projects because there is no ABAP service provider
|
|
45
|
+
* to proxy the OData metadata request. Consumers should handle this gracefully.
|
|
46
|
+
*
|
|
47
|
+
* @param _dataSourceId - The ID of the data source (unused).
|
|
48
|
+
* @throws Error indicating metadata fetching is not supported for CF projects.
|
|
49
|
+
*/
|
|
50
|
+
getDataSourceMetadata(_dataSourceId: string): Promise<string>;
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=manifest.d.ts.map
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ManifestServiceCF = void 0;
|
|
4
|
+
const node_fs_1 = require("node:fs");
|
|
5
|
+
const node_path_1 = require("node:path");
|
|
6
|
+
const project_builder_1 = require("../../base/project-builder");
|
|
7
|
+
const i18n_1 = require("../../i18n");
|
|
8
|
+
/** Default build output folder used by CF ADP projects. */
|
|
9
|
+
const CF_BUILD_PATH = 'dist';
|
|
10
|
+
/**
|
|
11
|
+
* Service class for handling operations related to the manifest of a CF-deployed UI5 application.
|
|
12
|
+
* Extends the ABAP {@link ManifestService} API, but retrieves the manifest from the local
|
|
13
|
+
* build output (`dist/`)
|
|
14
|
+
*
|
|
15
|
+
* The build is triggered automatically during initialization so that the `dist/` folder
|
|
16
|
+
* contains the latest merged manifest before it is read.
|
|
17
|
+
*/
|
|
18
|
+
class ManifestServiceCF {
|
|
19
|
+
logger;
|
|
20
|
+
manifest;
|
|
21
|
+
/**
|
|
22
|
+
* Private constructor to initialize the ManifestServiceCF.
|
|
23
|
+
*
|
|
24
|
+
* @param logger - The logger instance.
|
|
25
|
+
*/
|
|
26
|
+
constructor(logger) {
|
|
27
|
+
this.logger = logger;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Creates an instance of the ManifestServiceCF by building the project and
|
|
31
|
+
* reading the manifest from the `dist/` folder.
|
|
32
|
+
*
|
|
33
|
+
* @param projectPath - The path to the adaptation project.
|
|
34
|
+
* @param logger - The logger instance.
|
|
35
|
+
* @returns A promise that resolves to an instance of ManifestServiceCF.
|
|
36
|
+
*/
|
|
37
|
+
static async init(projectPath, logger) {
|
|
38
|
+
const service = new ManifestServiceCF(logger);
|
|
39
|
+
logger.debug('Triggering project build to generate dist folder');
|
|
40
|
+
await (0, project_builder_1.runBuild)(projectPath, { ADP_BUILDER_MODE: 'preview' });
|
|
41
|
+
const manifestPath = (0, node_path_1.join)(projectPath, CF_BUILD_PATH, 'manifest.json');
|
|
42
|
+
logger.debug(`Reading manifest from '${manifestPath}'`);
|
|
43
|
+
const manifestContent = (0, node_fs_1.readFileSync)(manifestPath, 'utf-8');
|
|
44
|
+
service.manifest = JSON.parse(manifestContent);
|
|
45
|
+
logger.debug('Manifest successfully read from dist folder');
|
|
46
|
+
return service;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Returns the manifest read from the build output during initialization.
|
|
50
|
+
*
|
|
51
|
+
* @returns The current manifest.
|
|
52
|
+
*/
|
|
53
|
+
getManifest() {
|
|
54
|
+
return this.manifest;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Returns the data sources from the manifest.
|
|
58
|
+
*
|
|
59
|
+
* @returns The data sources from the manifest.
|
|
60
|
+
* @throws Error if no data sources are found in the manifest.
|
|
61
|
+
*/
|
|
62
|
+
getManifestDataSources() {
|
|
63
|
+
const dataSources = this.manifest['sap.app'].dataSources;
|
|
64
|
+
if (!dataSources) {
|
|
65
|
+
throw new Error('No data sources found in the manifest');
|
|
66
|
+
}
|
|
67
|
+
this.logger.debug(`Found ${Object.keys(dataSources).length} data source(s) in manifest`);
|
|
68
|
+
return dataSources;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Metadata fetching is not supported for CF projects because there is no ABAP service provider
|
|
72
|
+
* to proxy the OData metadata request. Consumers should handle this gracefully.
|
|
73
|
+
*
|
|
74
|
+
* @param _dataSourceId - The ID of the data source (unused).
|
|
75
|
+
* @throws Error indicating metadata fetching is not supported for CF projects.
|
|
76
|
+
*/
|
|
77
|
+
async getDataSourceMetadata(_dataSourceId) {
|
|
78
|
+
const message = (0, i18n_1.t)('error.metadataFetchingNotSupportedForCF');
|
|
79
|
+
this.logger.warn(message);
|
|
80
|
+
throw new Error(message);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
exports.ManifestServiceCF = ManifestServiceCF;
|
|
84
|
+
//# sourceMappingURL=manifest.js.map
|
|
@@ -111,7 +111,8 @@
|
|
|
111
111
|
"xsAppJsonNotFound": "The xs-app.json file was not found in any of the expected locations: {{paths}}",
|
|
112
112
|
"noServiceInstanceNameFound": "No serviceInstanceName found in the app-variant-bundler-build configuration",
|
|
113
113
|
"noServiceKeysFoundForInstance": "No service keys found for service instance: {{serviceInstanceName}}",
|
|
114
|
-
"couldNotFetchServiceKeys": "
|
|
114
|
+
"couldNotFetchServiceKeys": "Cannot fetch the service keys. Error: {{error}}",
|
|
115
|
+
"metadataFetchingNotSupportedForCF": "Metadata fetching is not supported for Cloud Foundry projects."
|
|
115
116
|
},
|
|
116
117
|
"choices": {
|
|
117
118
|
"true": "true",
|
package/dist/types.d.ts
CHANGED
|
@@ -7,6 +7,32 @@ import type { Destination } from '@sap-ux/btp-utils';
|
|
|
7
7
|
import type { YUIQuestion } from '@sap-ux/inquirer-common';
|
|
8
8
|
import type AdmZip from 'adm-zip';
|
|
9
9
|
import type { SupportedProject } from './source';
|
|
10
|
+
export type DataSources = Record<string, ManifestNamespace.DataSource>;
|
|
11
|
+
/**
|
|
12
|
+
* Common interface for manifest services (ABAP and CF).
|
|
13
|
+
* Consumers should program against this interface to support both environments.
|
|
14
|
+
*/
|
|
15
|
+
export interface IManifestService {
|
|
16
|
+
/**
|
|
17
|
+
* Returns the manifest.
|
|
18
|
+
*
|
|
19
|
+
* @returns The manifest.
|
|
20
|
+
*/
|
|
21
|
+
getManifest(): Manifest;
|
|
22
|
+
/**
|
|
23
|
+
* Returns the data sources from the manifest.
|
|
24
|
+
*
|
|
25
|
+
* @returns The data sources from the manifest.
|
|
26
|
+
*/
|
|
27
|
+
getManifestDataSources(): DataSources;
|
|
28
|
+
/**
|
|
29
|
+
* Returns the metadata of a data source.
|
|
30
|
+
*
|
|
31
|
+
* @param dataSourceId - The ID of the data source.
|
|
32
|
+
* @returns A promise that resolves to the metadata of the data source.
|
|
33
|
+
*/
|
|
34
|
+
getDataSourceMetadata(dataSourceId: string): Promise<string>;
|
|
35
|
+
}
|
|
10
36
|
export interface DescriptorVariant {
|
|
11
37
|
layer: UI5FlexLayer;
|
|
12
38
|
reference: string;
|
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.18.
|
|
12
|
+
"version": "0.18.95",
|
|
13
13
|
"license": "Apache-2.0",
|
|
14
14
|
"author": "@SAP/ux-tools-team",
|
|
15
15
|
"main": "dist/index.js",
|