@sap-ux/adp-tooling 0.12.76 → 0.12.78
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 +96 -0
- package/dist/base/abap/manifest-service.js +187 -0
- package/dist/base/change-utils.js +8 -1
- package/dist/base/helper.d.ts +10 -0
- package/dist/base/helper.js +27 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/prompts/add-annotations-to-odata/index.js +1 -1
- package/dist/translations/adp-tooling.i18n.json +1 -1
- package/dist/types.d.ts +5 -0
- package/package.json +6 -6
- package/templates/changes/annotation.xml +3 -0
- package/dist/base/abap.d.ts +0 -24
- package/dist/base/abap.js +0 -55
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import type { Manifest, ManifestNamespace } from '@sap-ux/project-access';
|
|
2
|
+
import type { ToolsLogger } from '@sap-ux/logger';
|
|
3
|
+
import type { AdpPreviewConfig, DescriptorVariant } from '../../types';
|
|
4
|
+
type DataSources = Record<string, ManifestNamespace.DataSource>;
|
|
5
|
+
/**
|
|
6
|
+
* Service class for handling operations related to the manifest of a UI5 application.
|
|
7
|
+
* The class supports operations for both base and merged manifests.
|
|
8
|
+
* It provides methods to fetch the manifest, data sources and metadata of a data source.
|
|
9
|
+
*
|
|
10
|
+
*/
|
|
11
|
+
export declare class ManifestService {
|
|
12
|
+
private readonly provider;
|
|
13
|
+
private readonly logger;
|
|
14
|
+
private manifest;
|
|
15
|
+
private appInfo;
|
|
16
|
+
/**
|
|
17
|
+
* Private constructor to initialize the ManifestService.
|
|
18
|
+
*
|
|
19
|
+
* @param provider - The ABAP service provider.
|
|
20
|
+
* @param logger - The logger instance.
|
|
21
|
+
*/
|
|
22
|
+
private constructor();
|
|
23
|
+
/**
|
|
24
|
+
* Initializes the ManifestService with the given ADP configuration and logger.
|
|
25
|
+
*
|
|
26
|
+
* @param adpConfig - The ADP preview configuration.
|
|
27
|
+
* @param logger - The logger instance.
|
|
28
|
+
* @returns A promise that resolves to an instance of ManifestService.
|
|
29
|
+
*/
|
|
30
|
+
private static init;
|
|
31
|
+
/**
|
|
32
|
+
* Creates an instance of the ManifestService and fetches the base manifest of the application.
|
|
33
|
+
*
|
|
34
|
+
* @param appId - The application ID.
|
|
35
|
+
* @param adpConfig - The ADP preview configuration.
|
|
36
|
+
* @param logger - The logger instance.
|
|
37
|
+
* @returns A promise that resolves to an instance of ManifestService.
|
|
38
|
+
*/
|
|
39
|
+
static initBaseManifest(appId: string, adpConfig: AdpPreviewConfig, logger: ToolsLogger): Promise<ManifestService>;
|
|
40
|
+
/**
|
|
41
|
+
* Creates an instance of the ManifestService and fetches the merged manifest of the application.
|
|
42
|
+
*
|
|
43
|
+
* @param basePath - The base path of the application.
|
|
44
|
+
* @param variant - The descriptor variant.
|
|
45
|
+
* @param adpConfig - The ADP preview configuration.
|
|
46
|
+
* @param logger - The logger instance.
|
|
47
|
+
* @returns A promise that resolves to an instance of ManifestService.
|
|
48
|
+
*/
|
|
49
|
+
static initMergedManifest(basePath: string, variant: DescriptorVariant, adpConfig: AdpPreviewConfig, logger: ToolsLogger): Promise<ManifestService>;
|
|
50
|
+
/**
|
|
51
|
+
* Fetches the base manifest for a given application ID.
|
|
52
|
+
*
|
|
53
|
+
* @param appId - The application ID.
|
|
54
|
+
* @returns A promise that resolves when the base manifest is fetched.
|
|
55
|
+
* @throws Error if the manifest URL is not found or fetching/parsing fails.
|
|
56
|
+
*/
|
|
57
|
+
private fetchBaseManifest;
|
|
58
|
+
/**
|
|
59
|
+
* Fetches the application information for a given application ID.
|
|
60
|
+
*
|
|
61
|
+
* @param appId - The application ID.
|
|
62
|
+
* @returns A promise that resolves when the application information is fetched.
|
|
63
|
+
*/
|
|
64
|
+
private fetchAppInfo;
|
|
65
|
+
/**
|
|
66
|
+
* Returns the manifest fetched by the service during initialization.
|
|
67
|
+
*
|
|
68
|
+
* @returns The current manifest.
|
|
69
|
+
*/
|
|
70
|
+
getManifest(): Manifest;
|
|
71
|
+
/**
|
|
72
|
+
* Fetches the merged manifest for a given application.
|
|
73
|
+
*
|
|
74
|
+
* @param basePath - The base path of the application.
|
|
75
|
+
* @param descriptorVariantId - The descriptor variant ID.
|
|
76
|
+
* @returns A promise that resolves to the merged manifest.
|
|
77
|
+
*/
|
|
78
|
+
private fetchMergedManifest;
|
|
79
|
+
/**
|
|
80
|
+
* Returns the data sources from the manifest.
|
|
81
|
+
*
|
|
82
|
+
* @returns The data sources from the manifest.
|
|
83
|
+
* @throws Error if no data sources are found in the manifest.
|
|
84
|
+
*/
|
|
85
|
+
getManifestDataSources(): DataSources;
|
|
86
|
+
/**
|
|
87
|
+
* Returns the metadata of a data source.
|
|
88
|
+
*
|
|
89
|
+
* @param dataSourceId - The ID of the data source.
|
|
90
|
+
* @returns A promise that resolves to the metadata of the data source.
|
|
91
|
+
* @throws Error if no metadata path is found in the manifest or fetching fails.
|
|
92
|
+
*/
|
|
93
|
+
getDataSourceMetadata(dataSourceId: string): Promise<string>;
|
|
94
|
+
}
|
|
95
|
+
export {};
|
|
96
|
+
//# sourceMappingURL=manifest-service.d.ts.map
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ManifestService = void 0;
|
|
7
|
+
const adm_zip_1 = __importDefault(require("adm-zip"));
|
|
8
|
+
const axios_extension_1 = require("@sap-ux/axios-extension");
|
|
9
|
+
const system_access_1 = require("@sap-ux/system-access");
|
|
10
|
+
const helper_1 = require("../helper");
|
|
11
|
+
/**
|
|
12
|
+
* Service class for handling operations related to the manifest of a UI5 application.
|
|
13
|
+
* The class supports operations for both base and merged manifests.
|
|
14
|
+
* It provides methods to fetch the manifest, data sources and metadata of a data source.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
class ManifestService {
|
|
18
|
+
provider;
|
|
19
|
+
logger;
|
|
20
|
+
manifest;
|
|
21
|
+
appInfo;
|
|
22
|
+
/**
|
|
23
|
+
* Private constructor to initialize the ManifestService.
|
|
24
|
+
*
|
|
25
|
+
* @param provider - The ABAP service provider.
|
|
26
|
+
* @param logger - The logger instance.
|
|
27
|
+
*/
|
|
28
|
+
constructor(provider, logger) {
|
|
29
|
+
this.provider = provider;
|
|
30
|
+
this.logger = logger;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Initializes the ManifestService with the given ADP configuration and logger.
|
|
34
|
+
*
|
|
35
|
+
* @param adpConfig - The ADP preview configuration.
|
|
36
|
+
* @param logger - The logger instance.
|
|
37
|
+
* @returns A promise that resolves to an instance of ManifestService.
|
|
38
|
+
*/
|
|
39
|
+
static async init(adpConfig, logger) {
|
|
40
|
+
const provider = await (0, system_access_1.createAbapServiceProvider)(adpConfig.target, {
|
|
41
|
+
ignoreCertErrors: adpConfig.ignoreCertErrors ?? false
|
|
42
|
+
}, true, logger);
|
|
43
|
+
return new ManifestService(provider, logger);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Creates an instance of the ManifestService and fetches the base manifest of the application.
|
|
47
|
+
*
|
|
48
|
+
* @param appId - The application ID.
|
|
49
|
+
* @param adpConfig - The ADP preview configuration.
|
|
50
|
+
* @param logger - The logger instance.
|
|
51
|
+
* @returns A promise that resolves to an instance of ManifestService.
|
|
52
|
+
*/
|
|
53
|
+
static async initBaseManifest(appId, adpConfig, logger) {
|
|
54
|
+
const manifestService = await this.init(adpConfig, logger);
|
|
55
|
+
await manifestService.fetchBaseManifest(appId);
|
|
56
|
+
return manifestService;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Creates an instance of the ManifestService and fetches the merged manifest of the application.
|
|
60
|
+
*
|
|
61
|
+
* @param basePath - The base path of the application.
|
|
62
|
+
* @param variant - The descriptor variant.
|
|
63
|
+
* @param adpConfig - The ADP preview configuration.
|
|
64
|
+
* @param logger - The logger instance.
|
|
65
|
+
* @returns A promise that resolves to an instance of ManifestService.
|
|
66
|
+
*/
|
|
67
|
+
static async initMergedManifest(basePath, variant, adpConfig, logger) {
|
|
68
|
+
const manifestService = await this.init(adpConfig, logger);
|
|
69
|
+
await manifestService.fetchMergedManifest(basePath, variant.id);
|
|
70
|
+
await manifestService.fetchAppInfo(variant.reference);
|
|
71
|
+
return manifestService;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Fetches the base manifest for a given application ID.
|
|
75
|
+
*
|
|
76
|
+
* @param appId - The application ID.
|
|
77
|
+
* @returns A promise that resolves when the base manifest is fetched.
|
|
78
|
+
* @throws Error if the manifest URL is not found or fetching/parsing fails.
|
|
79
|
+
*/
|
|
80
|
+
async fetchBaseManifest(appId) {
|
|
81
|
+
await this.fetchAppInfo(appId);
|
|
82
|
+
const manifestUrl = this.appInfo.manifestUrl ?? this.appInfo.manifest;
|
|
83
|
+
if (!manifestUrl) {
|
|
84
|
+
throw new Error('Manifest URL not found');
|
|
85
|
+
}
|
|
86
|
+
try {
|
|
87
|
+
const response = await this.provider.get(manifestUrl);
|
|
88
|
+
this.manifest = JSON.parse(response.data);
|
|
89
|
+
}
|
|
90
|
+
catch (error) {
|
|
91
|
+
if ((0, axios_extension_1.isAxiosError)(error)) {
|
|
92
|
+
this.logger.error('Manifest fetching failed');
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
this.logger.error('Manifest parsing error: Manifest is not in expected format.');
|
|
96
|
+
}
|
|
97
|
+
this.logger.debug(error);
|
|
98
|
+
throw error;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Fetches the application information for a given application ID.
|
|
103
|
+
*
|
|
104
|
+
* @param appId - The application ID.
|
|
105
|
+
* @returns A promise that resolves when the application information is fetched.
|
|
106
|
+
*/
|
|
107
|
+
async fetchAppInfo(appId) {
|
|
108
|
+
this.appInfo = (await this.provider.getAppIndex().getAppInfo(appId))[appId];
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Returns the manifest fetched by the service during initialization.
|
|
112
|
+
*
|
|
113
|
+
* @returns The current manifest.
|
|
114
|
+
*/
|
|
115
|
+
getManifest() {
|
|
116
|
+
return this.manifest;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Fetches the merged manifest for a given application.
|
|
120
|
+
*
|
|
121
|
+
* @param basePath - The base path of the application.
|
|
122
|
+
* @param descriptorVariantId - The descriptor variant ID.
|
|
123
|
+
* @returns A promise that resolves to the merged manifest.
|
|
124
|
+
*/
|
|
125
|
+
async fetchMergedManifest(basePath, descriptorVariantId) {
|
|
126
|
+
const zip = new adm_zip_1.default();
|
|
127
|
+
const files = (0, helper_1.getWebappFiles)(basePath);
|
|
128
|
+
for (const file of files) {
|
|
129
|
+
zip.addFile(file.relativePath, Buffer.from(file.content, 'utf-8'));
|
|
130
|
+
}
|
|
131
|
+
const buffer = zip.toBuffer();
|
|
132
|
+
const lrep = this.provider.getLayeredRepository();
|
|
133
|
+
await lrep.getCsrfToken();
|
|
134
|
+
const response = await lrep.mergeAppDescriptorVariant(buffer);
|
|
135
|
+
this.manifest = response[descriptorVariantId].manifest;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Returns the data sources from the manifest.
|
|
139
|
+
*
|
|
140
|
+
* @returns The data sources from the manifest.
|
|
141
|
+
* @throws Error if no data sources are found in the manifest.
|
|
142
|
+
*/
|
|
143
|
+
getManifestDataSources() {
|
|
144
|
+
const dataSources = this.manifest['sap.app'].dataSources;
|
|
145
|
+
if (!dataSources) {
|
|
146
|
+
throw new Error('No data sources found in the manifest');
|
|
147
|
+
}
|
|
148
|
+
return dataSources;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Returns the metadata of a data source.
|
|
152
|
+
*
|
|
153
|
+
* @param dataSourceId - The ID of the data source.
|
|
154
|
+
* @returns A promise that resolves to the metadata of the data source.
|
|
155
|
+
* @throws Error if no metadata path is found in the manifest or fetching fails.
|
|
156
|
+
*/
|
|
157
|
+
async getDataSourceMetadata(dataSourceId) {
|
|
158
|
+
const dataSource = this.manifest?.['sap.app']?.dataSources?.[dataSourceId];
|
|
159
|
+
if (!dataSource) {
|
|
160
|
+
throw new Error('No metadata path found in the manifest');
|
|
161
|
+
}
|
|
162
|
+
const baseUrl = new URL(this.appInfo.url, this.provider.defaults.baseURL);
|
|
163
|
+
const metadataUrl = new URL(`${dataSource.uri}$metadata`, baseUrl.toString());
|
|
164
|
+
try {
|
|
165
|
+
const response = await this.provider.get(metadataUrl.toString());
|
|
166
|
+
return response.data;
|
|
167
|
+
}
|
|
168
|
+
catch (error) {
|
|
169
|
+
if (dataSource?.settings?.localUri) {
|
|
170
|
+
this.logger.warn('Metadata fetching failed. Fallback to local metadata');
|
|
171
|
+
try {
|
|
172
|
+
const fallbackUrl = new URL(dataSource?.settings.localUri, `${baseUrl.toString().endsWith('/') ? baseUrl.toString() : baseUrl.toString() + '/'}`);
|
|
173
|
+
const response = await this.provider.get(fallbackUrl.toString());
|
|
174
|
+
return response.data;
|
|
175
|
+
}
|
|
176
|
+
catch (fallbackError) {
|
|
177
|
+
this.logger.error('Local metadata fallback fetching failed');
|
|
178
|
+
throw fallbackError;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
this.logger.error('Metadata fetching failed');
|
|
182
|
+
throw error;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
exports.ManifestService = ManifestService;
|
|
187
|
+
//# sourceMappingURL=manifest-service.js.map
|
|
@@ -14,6 +14,7 @@ exports.getChange = getChange;
|
|
|
14
14
|
const path_1 = __importDefault(require("path"));
|
|
15
15
|
const fs_1 = require("fs");
|
|
16
16
|
const project_access_1 = require("@sap-ux/project-access");
|
|
17
|
+
const ejs_1 = require("ejs");
|
|
17
18
|
/**
|
|
18
19
|
* Writes annotation changes to the specified project path using the provided `mem-fs-editor` instance.
|
|
19
20
|
*
|
|
@@ -33,7 +34,13 @@ function writeAnnotationChange(projectPath, timestamp, annotation, change, fs) {
|
|
|
33
34
|
writeChangeToFile(changeFilePath, change, fs);
|
|
34
35
|
if (!annotation.filePath) {
|
|
35
36
|
const annotationsTemplate = path_1.default.join(__dirname, '..', '..', 'templates', 'changes', "annotation.xml" /* TemplateFileName.Annotation */);
|
|
36
|
-
|
|
37
|
+
const { namespaces, serviceUrl } = annotation;
|
|
38
|
+
(0, ejs_1.renderFile)(annotationsTemplate, { namespaces, path: serviceUrl }, {}, (err, str) => {
|
|
39
|
+
if (err) {
|
|
40
|
+
throw new Error('Error rendering template: ' + err.message);
|
|
41
|
+
}
|
|
42
|
+
fs.write(path_1.default.join(annotationsFolderPath, annotation.fileName ?? ''), str);
|
|
43
|
+
});
|
|
37
44
|
}
|
|
38
45
|
else {
|
|
39
46
|
const selectedDir = path_1.default.dirname(annotation.filePath);
|
package/dist/base/helper.d.ts
CHANGED
|
@@ -14,4 +14,14 @@ export declare function getVariant(basePath: string): DescriptorVariant;
|
|
|
14
14
|
* @returns {Promise<AdpPreviewConfig>} the adp configuration
|
|
15
15
|
*/
|
|
16
16
|
export declare function getAdpConfig(basePath: string, yamlPath: string): Promise<AdpPreviewConfig>;
|
|
17
|
+
/**
|
|
18
|
+
* Get all files in the webapp folder.
|
|
19
|
+
*
|
|
20
|
+
* @param {string} basePath - The path to the adaptation project.
|
|
21
|
+
* @returns {Array<{ relativePath: string; content: string }>} The files in the webapp folder.
|
|
22
|
+
*/
|
|
23
|
+
export declare function getWebappFiles(basePath: string): {
|
|
24
|
+
relativePath: string;
|
|
25
|
+
content: string;
|
|
26
|
+
}[];
|
|
17
27
|
//# sourceMappingURL=helper.d.ts.map
|
package/dist/base/helper.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getVariant = getVariant;
|
|
4
4
|
exports.getAdpConfig = getAdpConfig;
|
|
5
|
+
exports.getWebappFiles = getWebappFiles;
|
|
5
6
|
const fs_1 = require("fs");
|
|
6
7
|
const path_1 = require("path");
|
|
7
8
|
const ui5_config_1 = require("@sap-ux/ui5-config");
|
|
@@ -32,4 +33,30 @@ async function getAdpConfig(basePath, yamlPath) {
|
|
|
32
33
|
}
|
|
33
34
|
return adp;
|
|
34
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Get all files in the webapp folder.
|
|
38
|
+
*
|
|
39
|
+
* @param {string} basePath - The path to the adaptation project.
|
|
40
|
+
* @returns {Array<{ relativePath: string; content: string }>} The files in the webapp folder.
|
|
41
|
+
*/
|
|
42
|
+
function getWebappFiles(basePath) {
|
|
43
|
+
const dir = (0, path_1.join)(basePath, 'webapp');
|
|
44
|
+
const files = [];
|
|
45
|
+
const getFilesRecursivelySync = (directory) => {
|
|
46
|
+
const dirents = (0, fs_1.readdirSync)(directory, { withFileTypes: true });
|
|
47
|
+
for (const dirent of dirents) {
|
|
48
|
+
const fullPath = (0, path_1.join)(directory, dirent.name);
|
|
49
|
+
if (dirent.isFile()) {
|
|
50
|
+
const content = (0, fs_1.readFileSync)(fullPath, 'utf-8');
|
|
51
|
+
const relativePath = (0, path_1.relative)(dir, fullPath);
|
|
52
|
+
files.push({ relativePath, content });
|
|
53
|
+
}
|
|
54
|
+
else if (dirent.isDirectory()) {
|
|
55
|
+
getFilesRecursivelySync(fullPath);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
getFilesRecursivelySync(dir);
|
|
60
|
+
return files;
|
|
61
|
+
}
|
|
35
62
|
//# sourceMappingURL=helper.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export * from './types';
|
|
2
2
|
export * from './prompts';
|
|
3
3
|
export * from './base/cf';
|
|
4
|
-
export * from './base/abap';
|
|
4
|
+
export * from './base/abap/manifest-service';
|
|
5
5
|
export * from './base/helper';
|
|
6
6
|
export * from './preview/adp-preview';
|
|
7
7
|
export { generate, migrate } from './writer';
|
package/dist/index.js
CHANGED
|
@@ -18,7 +18,7 @@ exports.promptGeneratorInput = exports.generateChange = exports.migrate = export
|
|
|
18
18
|
__exportStar(require("./types"), exports);
|
|
19
19
|
__exportStar(require("./prompts"), exports);
|
|
20
20
|
__exportStar(require("./base/cf"), exports);
|
|
21
|
-
__exportStar(require("./base/abap"), exports);
|
|
21
|
+
__exportStar(require("./base/abap/manifest-service"), exports);
|
|
22
22
|
__exportStar(require("./base/helper"), exports);
|
|
23
23
|
__exportStar(require("./preview/adp-preview"), exports);
|
|
24
24
|
var writer_1 = require("./writer");
|
|
@@ -17,7 +17,7 @@ function getPrompts(basePath, dataSources) {
|
|
|
17
17
|
const dataSourceIds = Object.keys((0, project_access_1.filterDataSourcesByType)(dataSources, 'OData'));
|
|
18
18
|
const annotationFileSelectOptions = [
|
|
19
19
|
{ name: (0, i18n_1.t)('choices.annotationFile.selectFromWorkspace'), value: 1 /* AnnotationFileSelectType.ExistingFile */ },
|
|
20
|
-
{ name: (0, i18n_1.t)('choices.annotationFile.
|
|
20
|
+
{ name: (0, i18n_1.t)('choices.annotationFile.createTemplateFile'), value: 2 /* AnnotationFileSelectType.NewEmptyFile */ }
|
|
21
21
|
];
|
|
22
22
|
return [
|
|
23
23
|
{
|
package/dist/types.d.ts
CHANGED
|
@@ -261,6 +261,11 @@ export interface AnnotationsData {
|
|
|
261
261
|
dataSource: string;
|
|
262
262
|
/** Optional path to the annotation file. */
|
|
263
263
|
filePath?: string;
|
|
264
|
+
namespaces?: {
|
|
265
|
+
namespace: string;
|
|
266
|
+
alias: string;
|
|
267
|
+
}[];
|
|
268
|
+
serviceUrl?: string;
|
|
264
269
|
};
|
|
265
270
|
}
|
|
266
271
|
export declare const enum AnnotationFileSelectType {
|
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.12.
|
|
12
|
+
"version": "0.12.78",
|
|
13
13
|
"license": "Apache-2.0",
|
|
14
14
|
"author": "@SAP/ux-tools-team",
|
|
15
15
|
"main": "dist/index.js",
|
|
@@ -32,14 +32,14 @@
|
|
|
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.17.
|
|
35
|
+
"@sap-ux/axios-extension": "1.17.3",
|
|
36
36
|
"@sap-ux/btp-utils": "0.16.0",
|
|
37
|
-
"@sap-ux/inquirer-common": "0.5.
|
|
37
|
+
"@sap-ux/inquirer-common": "0.5.1",
|
|
38
38
|
"@sap-ux/logger": "0.6.0",
|
|
39
|
-
"@sap-ux/project-access": "1.28.
|
|
39
|
+
"@sap-ux/project-access": "1.28.7",
|
|
40
40
|
"@sap-ux/project-input-validator": "0.3.3",
|
|
41
|
-
"@sap-ux/system-access": "0.5.
|
|
42
|
-
"@sap-ux/ui5-config": "0.25.
|
|
41
|
+
"@sap-ux/system-access": "0.5.18",
|
|
42
|
+
"@sap-ux/ui5-config": "0.25.2"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@types/adm-zip": "0.5.5",
|
|
@@ -7,6 +7,9 @@
|
|
|
7
7
|
</edmx:Reference>
|
|
8
8
|
<edmx:Reference Uri="https://sap.github.io/odata-vocabularies/vocabularies/Communication.xml">
|
|
9
9
|
<edmx:Include Namespace="com.sap.vocabularies.Communication.v1" Alias="Communication"/>
|
|
10
|
+
</edmx:Reference>
|
|
11
|
+
<edmx:Reference Uri="<%- path %>$metadata"><% namespaces.forEach(function(namespace){ %>
|
|
12
|
+
<edmx:Include Namespace="<%- namespace.namespace %>"<% if (namespace.alias) { %> Alias="<%- namespace.alias %>"<% } %>/><% }); %>
|
|
10
13
|
</edmx:Reference>
|
|
11
14
|
<edmx:DataServices>
|
|
12
15
|
<Schema xmlns="http://docs.oasis-open.org/odata/ns/edm" Namespace="local">
|
package/dist/base/abap.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { Manifest, ManifestNamespace } from '@sap-ux/project-access';
|
|
2
|
-
import type { ToolsLogger } from '@sap-ux/logger';
|
|
3
|
-
import type { AdpPreviewConfig } from '../types';
|
|
4
|
-
/**
|
|
5
|
-
* Get the application manifest.
|
|
6
|
-
*
|
|
7
|
-
* @param {string} appId - The application id.
|
|
8
|
-
* @param {AdpPreviewConfig} adpConfig - The ADP configuration.
|
|
9
|
-
* @param {ToolsLogger} logger - The logger.
|
|
10
|
-
* @returns {Promise<Manifest>} The manifest.
|
|
11
|
-
*/
|
|
12
|
-
export declare function getManifest(appId: string, adpConfig: AdpPreviewConfig, logger: ToolsLogger): Promise<Manifest>;
|
|
13
|
-
type DataSources = Record<string, ManifestNamespace.DataSource>;
|
|
14
|
-
/**
|
|
15
|
-
* Returns the adaptation project configuration, throws an error if not found.
|
|
16
|
-
*
|
|
17
|
-
* @param {string} reference - The base application id.
|
|
18
|
-
* @param {AdpPreviewConfig} adpConfig - The adaptation project configuration.
|
|
19
|
-
* @param {ToolsLogger} logger - The logger.
|
|
20
|
-
* @returns {Promise<DataSources>} data sources from base application manifest
|
|
21
|
-
*/
|
|
22
|
-
export declare function getManifestDataSources(reference: string, adpConfig: AdpPreviewConfig, logger: ToolsLogger): Promise<DataSources>;
|
|
23
|
-
export {};
|
|
24
|
-
//# sourceMappingURL=abap.d.ts.map
|
package/dist/base/abap.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getManifest = getManifest;
|
|
4
|
-
exports.getManifestDataSources = getManifestDataSources;
|
|
5
|
-
const system_access_1 = require("@sap-ux/system-access");
|
|
6
|
-
const axios_extension_1 = require("@sap-ux/axios-extension");
|
|
7
|
-
/**
|
|
8
|
-
* Get the application manifest.
|
|
9
|
-
*
|
|
10
|
-
* @param {string} appId - The application id.
|
|
11
|
-
* @param {AdpPreviewConfig} adpConfig - The ADP configuration.
|
|
12
|
-
* @param {ToolsLogger} logger - The logger.
|
|
13
|
-
* @returns {Promise<Manifest>} The manifest.
|
|
14
|
-
*/
|
|
15
|
-
async function getManifest(appId, adpConfig, logger) {
|
|
16
|
-
const provider = await (0, system_access_1.createAbapServiceProvider)(adpConfig.target, {
|
|
17
|
-
ignoreCertErrors: adpConfig.ignoreCertErrors ?? false
|
|
18
|
-
}, true, logger);
|
|
19
|
-
const appInfo = (await provider.getAppIndex().getAppInfo(appId))[appId];
|
|
20
|
-
const manifestUrl = appInfo.manifestUrl ?? appInfo.manifest;
|
|
21
|
-
if (!manifestUrl) {
|
|
22
|
-
throw new Error('Manifest URL not found');
|
|
23
|
-
}
|
|
24
|
-
try {
|
|
25
|
-
const response = await provider.get(manifestUrl);
|
|
26
|
-
return JSON.parse(response.data);
|
|
27
|
-
}
|
|
28
|
-
catch (error) {
|
|
29
|
-
if ((0, axios_extension_1.isAxiosError)(error)) {
|
|
30
|
-
logger.error('Manifest fetching failed');
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
logger.error('Manifest parsing error: Manifest is not in expected format.');
|
|
34
|
-
}
|
|
35
|
-
logger.debug(error);
|
|
36
|
-
throw error;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Returns the adaptation project configuration, throws an error if not found.
|
|
41
|
-
*
|
|
42
|
-
* @param {string} reference - The base application id.
|
|
43
|
-
* @param {AdpPreviewConfig} adpConfig - The adaptation project configuration.
|
|
44
|
-
* @param {ToolsLogger} logger - The logger.
|
|
45
|
-
* @returns {Promise<DataSources>} data sources from base application manifest
|
|
46
|
-
*/
|
|
47
|
-
async function getManifestDataSources(reference, adpConfig, logger) {
|
|
48
|
-
const manifest = await exports.getManifest(reference, adpConfig, logger);
|
|
49
|
-
const dataSources = manifest['sap.app'].dataSources;
|
|
50
|
-
if (!dataSources) {
|
|
51
|
-
throw new Error('No data sources found in the manifest');
|
|
52
|
-
}
|
|
53
|
-
return dataSources;
|
|
54
|
-
}
|
|
55
|
-
//# sourceMappingURL=abap.js.map
|