@sap-ux/adp-tooling 0.16.9 → 0.16.11
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/cf/app/html5-repo.js +4 -1
- package/dist/cf/project/yaml.d.ts +1 -2
- package/dist/cf/project/yaml.js +2 -2
- package/dist/cf/services/api.d.ts +21 -17
- package/dist/cf/services/api.js +34 -27
- package/dist/writer/cf.js +1 -2
- package/package.json +5 -5
|
@@ -74,7 +74,10 @@ async function getHtml5RepoCredentials(spaceGuid, logger) {
|
|
|
74
74
|
names: [HTML5_APPS_REPO_RUNTIME]
|
|
75
75
|
}, logger);
|
|
76
76
|
if (!serviceKeys?.credentials?.length) {
|
|
77
|
-
await (0, api_1.
|
|
77
|
+
const serviceName = await (0, api_1.getServiceNameByTags)(spaceGuid, ['html5-apps-repo-rt']);
|
|
78
|
+
await (0, api_1.createServiceInstance)('app-runtime', HTML5_APPS_REPO_RUNTIME, serviceName, {
|
|
79
|
+
logger
|
|
80
|
+
});
|
|
78
81
|
serviceKeys = await (0, api_1.getServiceInstanceKeys)({ names: [HTML5_APPS_REPO_RUNTIME] }, logger);
|
|
79
82
|
if (!serviceKeys?.credentials?.length) {
|
|
80
83
|
logger.debug((0, i18n_1.t)('error.noUaaCredentialsFoundForHtml5Repo'));
|
|
@@ -8,7 +8,6 @@ interface AdjustMtaYamlParams {
|
|
|
8
8
|
appRouterType: AppRouterType;
|
|
9
9
|
businessSolutionName: string;
|
|
10
10
|
businessService: string;
|
|
11
|
-
spaceGuid: string;
|
|
12
11
|
}
|
|
13
12
|
/**
|
|
14
13
|
* Checks if the selected path is a MTA project.
|
|
@@ -47,6 +46,6 @@ export declare function getAppParamsFromUI5Yaml(projectPath: string): AppParamsE
|
|
|
47
46
|
* @param {ToolsLogger} logger - The logger.
|
|
48
47
|
* @returns {Promise<void>} The promise.
|
|
49
48
|
*/
|
|
50
|
-
export declare function adjustMtaYaml({ projectPath, moduleName, appRouterType, businessSolutionName, businessService
|
|
49
|
+
export declare function adjustMtaYaml({ projectPath, moduleName, appRouterType, businessSolutionName, businessService }: AdjustMtaYamlParams, memFs: Editor, templatePathOverwrite?: string, logger?: ToolsLogger): Promise<void>;
|
|
51
50
|
export {};
|
|
52
51
|
//# sourceMappingURL=yaml.d.ts.map
|
package/dist/cf/project/yaml.js
CHANGED
|
@@ -400,7 +400,7 @@ function adjustMtaYamlFlpModule(yamlContent, projectName, businessService) {
|
|
|
400
400
|
* @param {ToolsLogger} logger - The logger.
|
|
401
401
|
* @returns {Promise<void>} The promise.
|
|
402
402
|
*/
|
|
403
|
-
async function adjustMtaYaml({ projectPath, moduleName, appRouterType, businessSolutionName, businessService
|
|
403
|
+
async function adjustMtaYaml({ projectPath, moduleName, appRouterType, businessSolutionName, businessService }, memFs, templatePathOverwrite, logger) {
|
|
404
404
|
const timestamp = Date.now().toString();
|
|
405
405
|
const mtaYamlPath = path.join(projectPath, 'mta.yaml');
|
|
406
406
|
const loadedYamlContent = (0, yaml_loader_1.getYamlContent)(mtaYamlPath);
|
|
@@ -429,7 +429,7 @@ async function adjustMtaYaml({ projectPath, moduleName, appRouterType, businessS
|
|
|
429
429
|
adjustMtaYamlOwnModule(yamlContent, moduleName);
|
|
430
430
|
// should go last since it sorts the modules (workaround, should be removed after fixed in deployment module)
|
|
431
431
|
adjustMtaYamlFlpModule(yamlContent, projectName, businessService);
|
|
432
|
-
await (0, api_1.createServices)(
|
|
432
|
+
await (0, api_1.createServices)(yamlContent, initialServices, timestamp, templatePathOverwrite, logger);
|
|
433
433
|
const updatedYamlContent = js_yaml_1.default.dump(yamlContent);
|
|
434
434
|
memFs.write(mtaYamlPath, updatedYamlContent);
|
|
435
435
|
logger?.debug(`Adjusted MTA YAML for project ${projectPath}`);
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import type { ToolsLogger } from '@sap-ux/logger';
|
|
2
2
|
import type { CfConfig, CFApp, RequestArguments, ServiceKeys, GetServiceInstanceParams, MtaYaml } from '../../types';
|
|
3
|
+
interface CreateServiceOptions {
|
|
4
|
+
xsSecurityProjectName?: string;
|
|
5
|
+
templatePathOverwrite?: string;
|
|
6
|
+
logger?: ToolsLogger;
|
|
7
|
+
}
|
|
3
8
|
/**
|
|
4
9
|
* Get the business service keys.
|
|
5
10
|
*
|
|
@@ -26,36 +31,34 @@ export declare function getFDCRequestArguments(cfConfig: CfConfig): RequestArgum
|
|
|
26
31
|
*/
|
|
27
32
|
export declare function getFDCApps(appHostIds: string[], cfConfig: CfConfig, logger: ToolsLogger): Promise<CFApp[]>;
|
|
28
33
|
/**
|
|
29
|
-
* Creates a service.
|
|
34
|
+
* Creates a service instance.
|
|
30
35
|
*
|
|
31
|
-
* @param {string}
|
|
32
|
-
* @param {string} plan - The plan.
|
|
36
|
+
* @param {string} plan - The service plan.
|
|
33
37
|
* @param {string} serviceInstanceName - The service instance name.
|
|
34
|
-
* @param {string
|
|
35
|
-
* @param {
|
|
36
|
-
* @
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
*
|
|
38
|
+
* @param {string} serviceName - The service name.
|
|
39
|
+
* @param {CreateServiceOptions} [options] - Additional options.
|
|
40
|
+
* @returns {Promise<void>} The promise.
|
|
41
|
+
*/
|
|
42
|
+
export declare function createServiceInstance(plan: string, serviceInstanceName: string, serviceName: string, options?: CreateServiceOptions): Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* Gets the service name by tags.
|
|
45
|
+
*
|
|
46
|
+
* @param {string} spaceGuid - The space GUID.
|
|
47
|
+
* @param {string[]} tags - The service tags for discovery.
|
|
48
|
+
* @returns {Promise<string>} The service name.
|
|
41
49
|
*/
|
|
42
|
-
export declare function
|
|
43
|
-
filePath: string | null;
|
|
44
|
-
xsappname?: string;
|
|
45
|
-
}, templatePathOverwrite?: string, logger?: ToolsLogger): Promise<void>;
|
|
50
|
+
export declare function getServiceNameByTags(spaceGuid: string, tags: string[]): Promise<string>;
|
|
46
51
|
/**
|
|
47
52
|
* Creates the services.
|
|
48
53
|
*
|
|
49
|
-
* @param {string} projectPath - The project path.
|
|
50
54
|
* @param {MtaYaml} yamlContent - The YAML content.
|
|
51
55
|
* @param {string[]} initialServices - The initial services.
|
|
52
56
|
* @param {string} timestamp - The timestamp.
|
|
53
|
-
* @param {string} spaceGuid - The space GUID.
|
|
54
57
|
* @param {string} [templatePathOverwrite] - The template path overwrite.
|
|
55
58
|
* @param {ToolsLogger} logger - The logger.
|
|
56
59
|
* @returns {Promise<void>} The promise.
|
|
57
60
|
*/
|
|
58
|
-
export declare function createServices(
|
|
61
|
+
export declare function createServices(yamlContent: MtaYaml, initialServices: string[], timestamp: string, templatePathOverwrite?: string, logger?: ToolsLogger): Promise<void>;
|
|
59
62
|
/**
|
|
60
63
|
* Gets the service instance keys.
|
|
61
64
|
*
|
|
@@ -64,4 +67,5 @@ export declare function createServices(projectPath: string, yamlContent: MtaYaml
|
|
|
64
67
|
* @returns {Promise<ServiceKeys | null>} The service instance keys.
|
|
65
68
|
*/
|
|
66
69
|
export declare function getServiceInstanceKeys(serviceInstanceQuery: GetServiceInstanceParams, logger: ToolsLogger): Promise<ServiceKeys | null>;
|
|
70
|
+
export {};
|
|
67
71
|
//# sourceMappingURL=api.d.ts.map
|
package/dist/cf/services/api.js
CHANGED
|
@@ -39,7 +39,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
39
39
|
exports.getBusinessServiceKeys = getBusinessServiceKeys;
|
|
40
40
|
exports.getFDCRequestArguments = getFDCRequestArguments;
|
|
41
41
|
exports.getFDCApps = getFDCApps;
|
|
42
|
-
exports.
|
|
42
|
+
exports.createServiceInstance = createServiceInstance;
|
|
43
|
+
exports.getServiceNameByTags = getServiceNameByTags;
|
|
43
44
|
exports.createServices = createServices;
|
|
44
45
|
exports.getServiceInstanceKeys = getServiceInstanceKeys;
|
|
45
46
|
const fs = __importStar(require("node:fs"));
|
|
@@ -141,30 +142,20 @@ async function getFDCApps(appHostIds, cfConfig, logger) {
|
|
|
141
142
|
}
|
|
142
143
|
}
|
|
143
144
|
/**
|
|
144
|
-
* Creates a service.
|
|
145
|
+
* Creates a service instance.
|
|
145
146
|
*
|
|
146
|
-
* @param {string}
|
|
147
|
-
* @param {string} plan - The plan.
|
|
147
|
+
* @param {string} plan - The service plan.
|
|
148
148
|
* @param {string} serviceInstanceName - The service instance name.
|
|
149
|
-
* @param {string
|
|
150
|
-
* @param {
|
|
151
|
-
* @
|
|
152
|
-
* @param {string | null} security.filePath - The security file path.
|
|
153
|
-
* @param {string} [security.xsappname] - The XS app name.
|
|
154
|
-
* @param {string} [templatePathOverwrite] - The template path overwrite.
|
|
155
|
-
* @param {ToolsLogger} [logger] - The logger.
|
|
149
|
+
* @param {string} serviceName - The service name.
|
|
150
|
+
* @param {CreateServiceOptions} [options] - Additional options.
|
|
151
|
+
* @returns {Promise<void>} The promise.
|
|
156
152
|
*/
|
|
157
|
-
async function
|
|
153
|
+
async function createServiceInstance(plan, serviceInstanceName, serviceName, options) {
|
|
154
|
+
const { xsSecurityProjectName, templatePathOverwrite, logger } = options ?? {};
|
|
158
155
|
try {
|
|
159
|
-
const { filePath, xsappname } = security ?? {};
|
|
160
|
-
if (!serviceName) {
|
|
161
|
-
const json = await (0, cli_1.requestCfApi)(`/v3/service_offerings?per_page=1000&space_guids=${spaceGuid}`);
|
|
162
|
-
const serviceOffering = json?.resources?.find((resource) => resource.tags && tags.every((tag) => resource.tags?.includes(tag)));
|
|
163
|
-
serviceName = serviceOffering?.name;
|
|
164
|
-
}
|
|
165
156
|
logger?.log(`Creating service instance '${serviceInstanceName}' of service '${serviceName}' with '${plan}' plan`);
|
|
166
|
-
const commandParameters = ['create-service', serviceName
|
|
167
|
-
if (
|
|
157
|
+
const commandParameters = ['create-service', serviceName, plan, serviceInstanceName];
|
|
158
|
+
if (xsSecurityProjectName) {
|
|
168
159
|
let xsSecurity = null;
|
|
169
160
|
try {
|
|
170
161
|
const baseTmplPath = path.join(__dirname, '../../../templates');
|
|
@@ -172,7 +163,7 @@ async function createService(spaceGuid, plan, serviceInstanceName, tags, service
|
|
|
172
163
|
const filePath = path.resolve(templatePath, 'cf/xs-security.json');
|
|
173
164
|
const xsContent = fs.readFileSync(filePath, 'utf-8');
|
|
174
165
|
xsSecurity = JSON.parse(xsContent);
|
|
175
|
-
xsSecurity.xsappname =
|
|
166
|
+
xsSecurity.xsappname = xsSecurityProjectName;
|
|
176
167
|
}
|
|
177
168
|
catch (err) {
|
|
178
169
|
logger?.error(`Failed to parse xs-security.json file: ${err}`);
|
|
@@ -188,29 +179,45 @@ async function createService(spaceGuid, plan, serviceInstanceName, tags, service
|
|
|
188
179
|
throw new Error((0, i18n_1.t)('error.failedToCreateServiceInstance', { serviceInstanceName, error: e.message }));
|
|
189
180
|
}
|
|
190
181
|
}
|
|
182
|
+
/**
|
|
183
|
+
* Gets the service name by tags.
|
|
184
|
+
*
|
|
185
|
+
* @param {string} spaceGuid - The space GUID.
|
|
186
|
+
* @param {string[]} tags - The service tags for discovery.
|
|
187
|
+
* @returns {Promise<string>} The service name.
|
|
188
|
+
*/
|
|
189
|
+
async function getServiceNameByTags(spaceGuid, tags) {
|
|
190
|
+
const json = await (0, cli_1.requestCfApi)(`/v3/service_offerings?per_page=1000&space_guids=${spaceGuid}`);
|
|
191
|
+
const serviceOffering = json?.resources?.find((resource) => resource.tags && tags.every((tag) => resource.tags?.includes(tag)));
|
|
192
|
+
return serviceOffering?.name ?? '';
|
|
193
|
+
}
|
|
191
194
|
/**
|
|
192
195
|
* Creates the services.
|
|
193
196
|
*
|
|
194
|
-
* @param {string} projectPath - The project path.
|
|
195
197
|
* @param {MtaYaml} yamlContent - The YAML content.
|
|
196
198
|
* @param {string[]} initialServices - The initial services.
|
|
197
199
|
* @param {string} timestamp - The timestamp.
|
|
198
|
-
* @param {string} spaceGuid - The space GUID.
|
|
199
200
|
* @param {string} [templatePathOverwrite] - The template path overwrite.
|
|
200
201
|
* @param {ToolsLogger} logger - The logger.
|
|
201
202
|
* @returns {Promise<void>} The promise.
|
|
202
203
|
*/
|
|
203
|
-
async function createServices(
|
|
204
|
+
async function createServices(yamlContent, initialServices, timestamp, templatePathOverwrite, logger) {
|
|
204
205
|
const excludeServices = new Set([...initialServices, 'portal', 'html5-apps-repo']);
|
|
205
|
-
const xsSecurityPath = path.join(projectPath, 'xs-security.json');
|
|
206
206
|
const xsSecurityProjectName = (0, project_1.getProjectNameForXsSecurity)(yamlContent, timestamp);
|
|
207
207
|
for (const resource of yamlContent.resources ?? []) {
|
|
208
208
|
if (!excludeServices.has(resource?.parameters?.service ?? '')) {
|
|
209
209
|
if (resource?.parameters?.service === 'xsuaa') {
|
|
210
|
-
await
|
|
210
|
+
await createServiceInstance(resource.parameters['service-plan'] ?? '', resource.parameters['service-name'] ?? '', resource.parameters.service, {
|
|
211
|
+
xsSecurityProjectName,
|
|
212
|
+
templatePathOverwrite,
|
|
213
|
+
logger
|
|
214
|
+
});
|
|
211
215
|
}
|
|
212
216
|
else {
|
|
213
|
-
await
|
|
217
|
+
await createServiceInstance(resource.parameters['service-plan'] ?? '', resource.parameters['service-name'] ?? '', resource.parameters.service ?? '', {
|
|
218
|
+
templatePathOverwrite,
|
|
219
|
+
logger
|
|
220
|
+
});
|
|
214
221
|
}
|
|
215
222
|
}
|
|
216
223
|
}
|
package/dist/writer/cf.js
CHANGED
|
@@ -28,8 +28,7 @@ async function generateCf(basePath, config, logger, fs) {
|
|
|
28
28
|
moduleName: app.id,
|
|
29
29
|
appRouterType: cf.approuter,
|
|
30
30
|
businessSolutionName: cf.businessSolutionName ?? '',
|
|
31
|
-
businessService: cf.businessService
|
|
32
|
-
spaceGuid: cf.space.GUID
|
|
31
|
+
businessService: cf.businessService
|
|
33
32
|
}, fs, config.options?.templatePathOverwrite, logger);
|
|
34
33
|
if (fullConfig.app.i18nModels) {
|
|
35
34
|
(0, i18n_1.writeI18nModels)(basePath, fullConfig.app.i18nModels, fs);
|
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.16.
|
|
12
|
+
"version": "0.16.11",
|
|
13
13
|
"license": "Apache-2.0",
|
|
14
14
|
"author": "@SAP/ux-tools-team",
|
|
15
15
|
"main": "dist/index.js",
|
|
@@ -39,12 +39,12 @@
|
|
|
39
39
|
"@sap-ux/axios-extension": "1.23.0",
|
|
40
40
|
"@sap-ux/btp-utils": "1.1.4",
|
|
41
41
|
"@sap-ux/i18n": "0.3.4",
|
|
42
|
-
"@sap-ux/inquirer-common": "0.8.
|
|
42
|
+
"@sap-ux/inquirer-common": "0.8.5",
|
|
43
43
|
"@sap-ux/logger": "0.7.0",
|
|
44
44
|
"@sap-ux/nodejs-utils": "0.2.7",
|
|
45
|
-
"@sap-ux/odata-service-writer": "0.27.
|
|
46
|
-
"@sap-ux/project-access": "1.32.
|
|
47
|
-
"@sap-ux/project-input-validator": "0.6.
|
|
45
|
+
"@sap-ux/odata-service-writer": "0.27.27",
|
|
46
|
+
"@sap-ux/project-access": "1.32.6",
|
|
47
|
+
"@sap-ux/project-input-validator": "0.6.28",
|
|
48
48
|
"@sap-ux/store": "1.2.1",
|
|
49
49
|
"@sap-ux/system-access": "0.6.21",
|
|
50
50
|
"@sap-ux/ui5-config": "0.29.8",
|