@sap-ux/adp-tooling 0.18.90 → 0.18.92

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.
@@ -68,7 +68,7 @@ async function downloadZip(token, appHostId, uri) {
68
68
  */
69
69
  async function getHtml5RepoCredentials(spaceGuid, logger) {
70
70
  try {
71
- let serviceInfo = await (0, api_1.getServiceInstanceKeys)({
71
+ let serviceInfo = await (0, api_1.getOrCreateServiceInstanceKeys)({
72
72
  spaceGuids: [spaceGuid],
73
73
  planNames: ['app-runtime'],
74
74
  names: [HTML5_APPS_REPO_RUNTIME]
@@ -78,7 +78,7 @@ async function getHtml5RepoCredentials(spaceGuid, logger) {
78
78
  await (0, api_1.createServiceInstance)('app-runtime', HTML5_APPS_REPO_RUNTIME, serviceName, {
79
79
  logger
80
80
  });
81
- serviceInfo = await (0, api_1.getServiceInstanceKeys)({ names: [HTML5_APPS_REPO_RUNTIME] }, logger);
81
+ serviceInfo = await (0, api_1.getOrCreateServiceInstanceKeys)({ names: [HTML5_APPS_REPO_RUNTIME] }, logger);
82
82
  if (!serviceInfo?.serviceKeys?.length) {
83
83
  logger.debug((0, i18n_1.t)('error.noUaaCredentialsFoundForHtml5Repo'));
84
84
  throw new Error((0, i18n_1.t)('error.cannotFindHtml5RepoRuntime'));
@@ -10,6 +10,7 @@ interface AdjustMtaYamlParams {
10
10
  businessSolutionName: string;
11
11
  businessService: string;
12
12
  serviceKeys?: ServiceKeys[];
13
+ spaceGuid: string;
13
14
  }
14
15
  /**
15
16
  * Checks if the selected path is a MTA project.
@@ -49,7 +50,7 @@ export declare function getAppParamsFromUI5Yaml(projectPath: string): AppParamsE
49
50
  * @param {ToolsLogger} logger - The logger.
50
51
  * @returns {Promise<void>} The promise.
51
52
  */
52
- export declare function adjustMtaYaml({ projectPath, adpProjectName, appRouterType, businessSolutionName, businessService, serviceKeys }: AdjustMtaYamlParams, memFs: Editor, timestamp: string, templatePathOverwrite?: string, logger?: ToolsLogger): Promise<MtaYaml>;
53
+ export declare function adjustMtaYaml({ projectPath, adpProjectName, appRouterType, businessSolutionName, businessService, serviceKeys, spaceGuid }: AdjustMtaYamlParams, memFs: Editor, timestamp: string, templatePathOverwrite?: string, logger?: ToolsLogger): Promise<MtaYaml>;
53
54
  /**
54
55
  * Add fiori-tools-servestatic configuration to ui5.yaml and removes previously added configuration.
55
56
  *
@@ -418,7 +418,7 @@ function adjustMtaYamlFlpModule(yamlContent, projectName, businessService) {
418
418
  * @param {ToolsLogger} logger - The logger.
419
419
  * @returns {Promise<void>} The promise.
420
420
  */
421
- async function adjustMtaYaml({ projectPath, adpProjectName, appRouterType, businessSolutionName, businessService, serviceKeys }, memFs, timestamp, templatePathOverwrite, logger) {
421
+ async function adjustMtaYaml({ projectPath, adpProjectName, appRouterType, businessSolutionName, businessService, serviceKeys, spaceGuid }, memFs, timestamp, templatePathOverwrite, logger) {
422
422
  const mtaYamlPath = path.join(projectPath, 'mta.yaml');
423
423
  const loadedYamlContent = (0, yaml_loader_1.getYamlContent)(mtaYamlPath);
424
424
  const defaultYaml = {
@@ -446,7 +446,7 @@ async function adjustMtaYaml({ projectPath, adpProjectName, appRouterType, busin
446
446
  adjustMtaYamlOwnModule(yamlContent, adpProjectName);
447
447
  // should go last since it sorts the modules (workaround, should be removed after fixed in deployment module)
448
448
  adjustMtaYamlFlpModule(yamlContent, mtaProjectName, businessService);
449
- await (0, api_1.createServices)(yamlContent, initialServices, timestamp, templatePathOverwrite, logger);
449
+ await (0, api_1.createServices)(yamlContent, initialServices, timestamp, spaceGuid, templatePathOverwrite, logger);
450
450
  const updatedYamlContent = js_yaml_1.default.dump(yamlContent, {
451
451
  lineWidth: -1 // Disable line wrapping to keep URLs on single lines
452
452
  });
@@ -64,11 +64,12 @@ export declare function getServiceNameByTags(spaceGuid: string, tags: string[]):
64
64
  * @param {MtaYaml} yamlContent - The YAML content.
65
65
  * @param {string[]} initialServices - The initial services.
66
66
  * @param {string} timestamp - The timestamp.
67
+ * @param {string} spaceGuid - The space GUID.
67
68
  * @param {string} [templatePathOverwrite] - The template path overwrite.
68
69
  * @param {ToolsLogger} logger - The logger.
69
70
  * @returns {Promise<void>} The promise.
70
71
  */
71
- export declare function createServices(yamlContent: MtaYaml, initialServices: string[], timestamp: string, templatePathOverwrite?: string, logger?: ToolsLogger): Promise<void>;
72
+ export declare function createServices(yamlContent: MtaYaml, initialServices: string[], timestamp: string, spaceGuid: string, templatePathOverwrite?: string, logger?: ToolsLogger): Promise<void>;
72
73
  /**
73
74
  * Gets the service instance keys.
74
75
  *
@@ -76,7 +77,7 @@ export declare function createServices(yamlContent: MtaYaml, initialServices: st
76
77
  * @param {ToolsLogger} logger - The logger.
77
78
  * @returns {Promise<ServiceInfo | null>} The service instance keys.
78
79
  */
79
- export declare function getServiceInstanceKeys(serviceInstanceQuery: GetServiceInstanceParams, logger?: ToolsLogger): Promise<ServiceInfo | null>;
80
+ export declare function getOrCreateServiceInstanceKeys(serviceInstanceQuery: GetServiceInstanceParams, logger?: ToolsLogger): Promise<ServiceInfo | null>;
80
81
  /**
81
82
  * Gets the service instance keys.
82
83
  *
@@ -43,7 +43,7 @@ exports.getCfUi5AppInfo = getCfUi5AppInfo;
43
43
  exports.createServiceInstance = createServiceInstance;
44
44
  exports.getServiceNameByTags = getServiceNameByTags;
45
45
  exports.createServices = createServices;
46
- exports.getServiceInstanceKeys = getServiceInstanceKeys;
46
+ exports.getOrCreateServiceInstanceKeys = getOrCreateServiceInstanceKeys;
47
47
  exports.getOrCreateServiceKeys = getOrCreateServiceKeys;
48
48
  const fs = __importStar(require("node:fs"));
49
49
  const axios_1 = __importDefault(require("axios"));
@@ -67,7 +67,7 @@ const PARAM_MAP = new Map([
67
67
  * @returns {Promise<ServiceInfo | null>} The service info.
68
68
  */
69
69
  async function getBusinessServiceInfo(businessService, config, logger) {
70
- const serviceKeys = await getServiceInstanceKeys({
70
+ const serviceKeys = await getOrCreateServiceInstanceKeys({
71
71
  spaceGuids: [config.space.GUID],
72
72
  names: [businessService]
73
73
  }, logger);
@@ -190,7 +190,7 @@ async function createServiceInstance(plan, serviceInstanceName, serviceName, opt
190
190
  const { xsSecurityProjectName, templatePathOverwrite, logger } = options ?? {};
191
191
  try {
192
192
  logger?.log(`Creating service instance '${serviceInstanceName}' of service '${serviceName}' with '${plan}' plan`);
193
- const commandParameters = ['create-service', serviceName, plan, serviceInstanceName];
193
+ const commandParameters = ['create-service', serviceName, plan, serviceInstanceName, '--wait'];
194
194
  if (xsSecurityProjectName) {
195
195
  let xsSecurity = null;
196
196
  try {
@@ -207,7 +207,11 @@ async function createServiceInstance(plan, serviceInstanceName, serviceName, opt
207
207
  }
208
208
  commandParameters.push('-c', JSON.stringify(xsSecurity));
209
209
  }
210
- await cf_tools_1.Cli.execute(commandParameters);
210
+ const result = await cf_tools_1.Cli.execute(commandParameters);
211
+ if (result && result.exitCode !== 0) {
212
+ logger?.error(`Service creation failed: ${result.stderr || 'Unknown error'}`);
213
+ throw new Error(`Service creation failed with code ${result.exitCode}: ${result.stderr || ''}`);
214
+ }
211
215
  logger?.log(`Service instance '${serviceInstanceName}' created successfully`);
212
216
  }
213
217
  catch (e) {
@@ -233,11 +237,12 @@ async function getServiceNameByTags(spaceGuid, tags) {
233
237
  * @param {MtaYaml} yamlContent - The YAML content.
234
238
  * @param {string[]} initialServices - The initial services.
235
239
  * @param {string} timestamp - The timestamp.
240
+ * @param {string} spaceGuid - The space GUID.
236
241
  * @param {string} [templatePathOverwrite] - The template path overwrite.
237
242
  * @param {ToolsLogger} logger - The logger.
238
243
  * @returns {Promise<void>} The promise.
239
244
  */
240
- async function createServices(yamlContent, initialServices, timestamp, templatePathOverwrite, logger) {
245
+ async function createServices(yamlContent, initialServices, timestamp, spaceGuid, templatePathOverwrite, logger) {
241
246
  const excludeServices = new Set([...initialServices, 'portal', 'html5-apps-repo']);
242
247
  const xsSecurityProjectName = (0, project_1.getProjectNameForXsSecurity)(yamlContent, timestamp);
243
248
  for (const resource of yamlContent.resources ?? []) {
@@ -255,6 +260,10 @@ async function createServices(yamlContent, initialServices, timestamp, templateP
255
260
  logger
256
261
  });
257
262
  }
263
+ await getOrCreateServiceInstanceKeys({
264
+ spaceGuids: [spaceGuid],
265
+ names: [resource.parameters?.['service-name'] ?? '']
266
+ }, logger);
258
267
  }
259
268
  }
260
269
  }
@@ -265,7 +274,7 @@ async function createServices(yamlContent, initialServices, timestamp, templateP
265
274
  * @param {ToolsLogger} logger - The logger.
266
275
  * @returns {Promise<ServiceInfo | null>} The service instance keys.
267
276
  */
268
- async function getServiceInstanceKeys(serviceInstanceQuery, logger) {
277
+ async function getOrCreateServiceInstanceKeys(serviceInstanceQuery, logger) {
269
278
  try {
270
279
  const serviceInstances = await getServiceInstance(serviceInstanceQuery);
271
280
  if (serviceInstances?.length > 0) {
@@ -55,7 +55,7 @@ async function getServiceKeys(serviceInstanceGuid) {
55
55
  */
56
56
  async function createServiceKey(serviceInstanceName, serviceKeyName) {
57
57
  try {
58
- const cliResult = await cf_tools_1.Cli.execute(['create-service-key', serviceInstanceName, serviceKeyName], ENV);
58
+ const cliResult = await cf_tools_1.Cli.execute(['create-service-key', serviceInstanceName, serviceKeyName, '--wait'], ENV);
59
59
  if (cliResult.exitCode !== 0) {
60
60
  throw new Error(cliResult.stderr);
61
61
  }
package/dist/types.d.ts CHANGED
@@ -982,6 +982,10 @@ export interface CfAdpWriterConfig {
982
982
  * Business service instance keys.
983
983
  */
984
984
  serviceInfo?: ServiceInfo | null;
985
+ /**
986
+ * GUID of the BTP space.
987
+ */
988
+ spaceGuid: string;
985
989
  };
986
990
  project: {
987
991
  name: string;
@@ -1021,6 +1025,7 @@ export interface CreateCfConfigParams {
1021
1025
  packageJson: Package;
1022
1026
  toolsId: string;
1023
1027
  serviceInfo?: ServiceInfo | null;
1028
+ spaceGuid: string;
1024
1029
  }
1025
1030
  export declare const AppRouterType: {
1026
1031
  readonly MANAGED: "Managed HTML5 Application Runtime";
package/dist/writer/cf.js CHANGED
@@ -40,7 +40,8 @@ async function generateCf(basePath, config, logger, fs) {
40
40
  appRouterType: cf.approuter,
41
41
  businessSolutionName: cf.businessSolutionName ?? '',
42
42
  businessService: cf.businessService,
43
- serviceKeys: cf.serviceInfo?.serviceKeys
43
+ serviceKeys: cf.serviceInfo?.serviceKeys,
44
+ spaceGuid: cf.space.GUID
44
45
  }, fs, timestamp, config.options?.templatePathOverwrite, logger);
45
46
  if (fullConfig.app.i18nModels) {
46
47
  (0, i18n_1.writeI18nModels)(basePath, fullConfig.app.i18nModels, fs);
@@ -111,8 +112,9 @@ async function generateCfConfig(basePath, yamlPath, cfConfig, logger, fs) {
111
112
  if (!serviceInstanceName) {
112
113
  throw new Error('No serviceInstanceName found in app-variant-bundler-build configuration');
113
114
  }
114
- const serviceInfo = await (0, cf_1.getServiceInstanceKeys)({
115
- names: [serviceInstanceName]
115
+ const serviceInfo = await (0, cf_1.getOrCreateServiceInstanceKeys)({
116
+ names: [serviceInstanceName],
117
+ spaceGuids: [bundlerTask?.configuration?.space ?? '']
116
118
  }, logger);
117
119
  if (!serviceInfo || serviceInfo.serviceKeys.length === 0) {
118
120
  throw new Error(`No service keys found for service instance: ${serviceInstanceName}`);
@@ -1,5 +1,5 @@
1
1
  import type { Editor } from 'mem-fs-editor';
2
- import { type AdpWriterConfig, type TypesConfig, type CfAdpWriterConfig, type DescriptorVariant } from '../types';
2
+ import type { AdpWriterConfig, TypesConfig, CfAdpWriterConfig, DescriptorVariant } from '../types';
3
3
  import type { Package } from '@sap-ux/project-access';
4
4
  /**
5
5
  * Retrieves the package name and version from the package.json file located two levels up the directory tree.
@@ -125,7 +125,8 @@ function getCfConfig(params) {
125
125
  serviceInstanceGuid: params.serviceInstanceGuid,
126
126
  backendUrls: params.backendUrls,
127
127
  oauthPaths: params.oauthPaths,
128
- serviceInfo: params.serviceInfo
128
+ serviceInfo: params.serviceInfo,
129
+ spaceGuid: params.spaceGuid
129
130
  },
130
131
  project: {
131
132
  name: params.attributeAnswers.projectName,
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.90",
12
+ "version": "0.18.92",
13
13
  "license": "Apache-2.0",
14
14
  "author": "@SAP/ux-tools-team",
15
15
  "main": "dist/index.js",
@@ -28,7 +28,7 @@
28
28
  "adm-zip": "0.5.10",
29
29
  "axios": "1.13.5",
30
30
  "ejs": "3.1.10",
31
- "i18next": "25.8.12",
31
+ "i18next": "25.8.18",
32
32
  "inquirer": "8.2.7",
33
33
  "js-yaml": "4.1.1",
34
34
  "mem-fs": "2.1.0",
@@ -36,19 +36,19 @@
36
36
  "prompts": "2.4.2",
37
37
  "sanitize-filename": "1.6.3",
38
38
  "uuid": "11.1.0",
39
- "@sap-ux/axios-extension": "1.25.22",
40
- "@sap-ux/btp-utils": "1.1.9",
39
+ "@sap-ux/axios-extension": "1.25.23",
40
+ "@sap-ux/btp-utils": "1.1.10",
41
41
  "@sap-ux/i18n": "0.3.9",
42
- "@sap-ux/inquirer-common": "0.11.23",
42
+ "@sap-ux/inquirer-common": "0.11.24",
43
43
  "@sap-ux/logger": "0.8.2",
44
- "@sap-ux/nodejs-utils": "0.2.16",
45
- "@sap-ux/odata-service-writer": "0.30.0",
44
+ "@sap-ux/nodejs-utils": "0.2.17",
45
+ "@sap-ux/odata-service-writer": "0.30.1",
46
46
  "@sap-ux/project-access": "1.35.13",
47
- "@sap-ux/project-input-validator": "0.6.67",
48
- "@sap-ux/store": "1.5.9",
49
- "@sap-ux/system-access": "0.6.64",
47
+ "@sap-ux/project-input-validator": "0.6.68",
48
+ "@sap-ux/store": "1.5.10",
49
+ "@sap-ux/system-access": "0.6.65",
50
50
  "@sap-ux/ui5-config": "0.29.21",
51
- "@sap-ux/ui5-info": "0.13.14"
51
+ "@sap-ux/ui5-info": "0.13.15"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@types/adm-zip": "0.5.5",
@@ -65,10 +65,10 @@
65
65
  "cross-env": "^10.0.0",
66
66
  "dotenv": "17.3.1",
67
67
  "express": "4.22.1",
68
- "nock": "13.4.0",
68
+ "nock": "14.0.11",
69
69
  "rimraf": "6.1.3",
70
70
  "supertest": "7.2.2",
71
- "@sap-ux/store": "1.5.9"
71
+ "@sap-ux/store": "1.5.10"
72
72
  },
73
73
  "engines": {
74
74
  "node": ">=20.x"