@sap-ux/adp-tooling 0.10.23 → 0.11.1

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.
@@ -1,4 +1,4 @@
1
- import type { AdpWriterConfig } from '../types';
1
+ import type { CustomConfig, AdpWriterConfig } from '../types';
2
2
  import type { AbapTarget } from '@sap-ux/system-access';
3
3
  import type { Logger } from '@sap-ux/logger';
4
4
  import type { UI5FlexLayer } from '@sap-ux/project-access';
@@ -32,5 +32,6 @@ export declare function promptTarget(defaults: PromptDefaults, logger: Logger):
32
32
  apps: AppIndex;
33
33
  layer: UI5FlexLayer;
34
34
  target: AbapTarget;
35
+ customConfig: CustomConfig;
35
36
  }>;
36
37
  //# sourceMappingURL=prompt.d.ts.map
@@ -27,7 +27,7 @@ function promptGeneratorInput(defaults, logger) {
27
27
  var _a;
28
28
  return __awaiter(this, void 0, void 0, function* () {
29
29
  defaults = defaults !== null && defaults !== void 0 ? defaults : {};
30
- const { target, apps, layer } = yield promptTarget(defaults, logger);
30
+ const { target, apps, layer, customConfig } = yield promptTarget(defaults, logger);
31
31
  const app = yield (0, prompts_1.default)([
32
32
  {
33
33
  type: 'autocomplete',
@@ -99,7 +99,8 @@ function promptGeneratorInput(defaults, logger) {
99
99
  app: Object.assign(Object.assign({}, app), { layer }),
100
100
  target,
101
101
  options,
102
- deploy
102
+ deploy,
103
+ customConfig
103
104
  };
104
105
  });
105
106
  }
@@ -167,6 +168,7 @@ exports.promptTarget = promptTarget;
167
168
  * @returns app index and layer
168
169
  */
169
170
  function fetchSystemInformation(target, ignoreCertErrors, logger) {
171
+ var _a;
170
172
  return __awaiter(this, void 0, void 0, function* () {
171
173
  const provider = yield (0, system_access_1.createAbapServiceProvider)(target, {
172
174
  ignoreCertErrors
@@ -174,14 +176,24 @@ function fetchSystemInformation(target, ignoreCertErrors, logger) {
174
176
  logger.info('Fetching system information...');
175
177
  const ato = yield provider.getAtoInfo();
176
178
  const layer = ato.tenantType === 'SAP' ? 'VENDOR' : 'CUSTOMER_BASE';
179
+ const customConfig = {
180
+ adp: {
181
+ environment: (_a = ato.operationsType) !== null && _a !== void 0 ? _a : 'P',
182
+ safeMode: true
183
+ }
184
+ };
177
185
  logger.info(`Target layer: ${layer}`);
178
186
  logger.info('Fetching list of available applications... (it can take a moment)');
179
187
  const appIndex = provider.getAppIndex();
180
- const apps = yield appIndex.search({
188
+ const searchParams = {
181
189
  'sap.ui/technology': 'UI5',
182
190
  'sap.app/type': 'application'
183
- }, ['sap.app/id', 'sap.app/title', 'sap.fiori/registrationIds']);
184
- return { apps, layer };
191
+ };
192
+ if (customConfig.adp.environment === 'C') {
193
+ searchParams['sap.fiori/cloudDevAdaptationStatus'] = 'released';
194
+ }
195
+ const apps = yield appIndex.search(searchParams, ['sap.app/id', 'sap.app/title', 'sap.fiori/registrationIds']);
196
+ return { apps, layer, customConfig };
185
197
  });
186
198
  }
187
199
  //# sourceMappingURL=prompt.js.map
package/dist/types.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import type { UI5FlexLayer } from '@sap-ux/project-access';
2
2
  import type { DestinationAbapTarget, UrlAbapTarget } from '@sap-ux/system-access';
3
- import type { Adp } from '@sap-ux/ui5-config';
4
- import type { Editor } from 'mem-fs-editor';
3
+ import type { Adp, BspApp } from '@sap-ux/ui5-config';
5
4
  import type { OperationsType } from '@sap-ux/axios-extension';
5
+ import type { Editor } from 'mem-fs-editor';
6
6
  export interface DescriptorVariant {
7
7
  layer: UI5FlexLayer;
8
8
  reference: string;
@@ -21,13 +21,26 @@ export interface AdpPreviewConfig {
21
21
  */
22
22
  ignoreCertErrors?: boolean;
23
23
  }
24
+ export interface OnpremApp {
25
+ /** Application variant id. */
26
+ id: string;
27
+ /** Reference associated with the ID of the base application. */
28
+ reference: string;
29
+ layer?: UI5FlexLayer;
30
+ title?: string;
31
+ /** Optional: Application variant change content. */
32
+ content?: Content[];
33
+ }
34
+ export interface CloudApp extends OnpremApp {
35
+ /** bspName associated with the ABAP Cloud repository name of the base application. */
36
+ bspName: string;
37
+ /** Cloud app active languages. */
38
+ languages: Language[];
39
+ }
40
+ export type App = OnpremApp | CloudApp;
41
+ export type DeployConfig = Adp | BspApp;
24
42
  export interface AdpWriterConfig {
25
- app: {
26
- id: string;
27
- reference: string;
28
- layer?: UI5FlexLayer;
29
- title?: string;
30
- };
43
+ app: App;
31
44
  target: AbapTarget;
32
45
  ui5?: {
33
46
  minVersion?: string;
@@ -38,11 +51,12 @@ export interface AdpWriterConfig {
38
51
  name?: string;
39
52
  description?: string;
40
53
  };
41
- customConfig?: AdpCustomConfig;
54
+ flp?: FlpConfig;
55
+ customConfig?: CustomConfig;
42
56
  /**
43
57
  * Optional: configuration for deployment to ABAP
44
58
  */
45
- deploy?: Adp;
59
+ deploy?: DeployConfig;
46
60
  options?: {
47
61
  /**
48
62
  * Optional: if set to true then the generated project will be recognized by the SAP Fiori tools
@@ -50,6 +64,36 @@ export interface AdpWriterConfig {
50
64
  fioriTools?: boolean;
51
65
  };
52
66
  }
67
+ export interface ChangeInboundNavigation {
68
+ /** Identifier for the inbound navigation. */
69
+ inboundId: string;
70
+ /** Title associated with the inbound navigation. */
71
+ title?: string;
72
+ /** Subtitle associated with the inbound navigation. */
73
+ subTitle?: string;
74
+ }
75
+ export interface NewInboundNavigation {
76
+ /** Represent business entities that reflect a specific scenario. */
77
+ semanticObject: string;
78
+ /** Operations which can be performed on a semantic object. */
79
+ action: string;
80
+ additionalParameters?: object;
81
+ /** Title associated with the inbound navigation. */
82
+ title: string;
83
+ /** Optional: Subtitle associated with the inbound navigation. */
84
+ subTitle?: string;
85
+ }
86
+ export interface InternalInboundNavigation extends NewInboundNavigation {
87
+ /** Identifier for the inbound navigation. */
88
+ inboundId: string;
89
+ /** Flag indicating if the new inbound navigation should be added. */
90
+ addInboundId: boolean;
91
+ }
92
+ export type FlpConfig = ChangeInboundNavigation | NewInboundNavigation;
93
+ export interface Language {
94
+ sap: string;
95
+ i18n: string;
96
+ }
53
97
  export interface ManifestAppdescr {
54
98
  fileName: string;
55
99
  layer: string;
@@ -312,11 +356,55 @@ export interface AdpProjectData {
312
356
  reference: string;
313
357
  id: string;
314
358
  }
315
- export interface AdpCustomConfig {
359
+ export interface CustomConfig {
316
360
  adp: {
317
361
  safeMode: boolean;
318
362
  environment: OperationsType;
319
363
  };
320
364
  }
365
+ export interface InboundChangeContentAddInboundId {
366
+ inbound: {
367
+ [inboundId: string]: AddInboundModel;
368
+ };
369
+ }
370
+ export interface AddInboundModel {
371
+ /** Represent business entities that reflect a specific scenario. */
372
+ semanticObject: string;
373
+ /** Operations which can be performed on a semantic object. */
374
+ action: string;
375
+ /** Title associated with the inbound navigation data. */
376
+ title: string;
377
+ /** Optional: Subtitle associated with the inbound navigation data. */
378
+ subTitle?: string;
379
+ signature: AddInboundSignitureModel;
380
+ }
381
+ export interface AddInboundSignitureModel {
382
+ parameters: InboundParameters;
383
+ additionalParameters: string;
384
+ }
385
+ export interface InboundParameters {
386
+ 'sap-appvar-id'?: object;
387
+ 'sap-priority'?: object;
388
+ }
389
+ export interface InboundChange {
390
+ inbound: {
391
+ [key: string]: {
392
+ /** Represent business entities that reflect a specific scenario. */
393
+ semanticObject: string;
394
+ /** Operations which can be performed on a semantic object. */
395
+ action: string;
396
+ /** Icon associated with the inbound navigation data. */
397
+ icon: string;
398
+ /** Title associated with the inbound navigation data. */
399
+ title: string;
400
+ /** Subtitle associated with the inbound navigation data. */
401
+ subTitle: string;
402
+ signature: {
403
+ parameters: object | string;
404
+ additionalParameters: 'allowed';
405
+ };
406
+ };
407
+ };
408
+ }
321
409
  export {};
322
410
  //# sourceMappingURL=types.d.ts.map
@@ -9,11 +9,11 @@ export declare class WriterFactory {
9
9
  /**
10
10
  * Creates an instance of a writer based on the specified generator type.
11
11
  *
12
- * @param {T} type - The type of the change which will be handled by the writer.
13
- * @param {Editor} fs - The filesystem editor instance.
14
- * @param {string} projectPath - The path to the project for which the writer is created.
15
- * @returns {IWriterData<T>} An instance of the writer associated with the specified generator type.
16
- * @throws {Error} If the specified generator type is not supported.
12
+ * @param type - The type of the change which will be handled by the writer.
13
+ * @param fs - The filesystem editor instance.
14
+ * @param projectPath - The path to the project for which the writer is created.
15
+ * @returns An instance of the writer associated with the specified generator type.
16
+ * @throws If the specified generator type is not supported.
17
17
  */
18
18
  static createWriter<T extends ChangeType>(type: T, fs: Editor, projectPath: string): IWriterData<T>;
19
19
  }
@@ -9,11 +9,11 @@ class WriterFactory {
9
9
  /**
10
10
  * Creates an instance of a writer based on the specified generator type.
11
11
  *
12
- * @param {T} type - The type of the change which will be handled by the writer.
13
- * @param {Editor} fs - The filesystem editor instance.
14
- * @param {string} projectPath - The path to the project for which the writer is created.
15
- * @returns {IWriterData<T>} An instance of the writer associated with the specified generator type.
16
- * @throws {Error} If the specified generator type is not supported.
12
+ * @param type - The type of the change which will be handled by the writer.
13
+ * @param fs - The filesystem editor instance.
14
+ * @param projectPath - The path to the project for which the writer is created.
15
+ * @returns An instance of the writer associated with the specified generator type.
16
+ * @throws If the specified generator type is not supported.
17
17
  */
18
18
  static createWriter(type, fs, projectPath) {
19
19
  const WriterClass = this.writers.get(type);
@@ -1,4 +1,4 @@
1
- import type { Editor } from 'mem-fs-editor';
1
+ import { type Editor } from 'mem-fs-editor';
2
2
  import type { AdpWriterConfig } from '../types';
3
3
  /**
4
4
  * Writes the adp-project template to the mem-fs-editor instance.
@@ -13,6 +13,7 @@ exports.migrate = exports.generate = void 0;
13
13
  const path_1 = require("path");
14
14
  const mem_fs_1 = require("mem-fs");
15
15
  const mem_fs_editor_1 = require("mem-fs-editor");
16
+ const options_1 = require("./options");
16
17
  const project_utils_1 = require("./project-utils");
17
18
  const tmplPath = (0, path_1.join)(__dirname, '../../templates/project');
18
19
  /**
@@ -30,6 +31,7 @@ function setDefaults(config) {
30
31
  ui5: Object.assign({}, config.ui5),
31
32
  deploy: config.deploy ? Object.assign({}, config.deploy) : undefined,
32
33
  options: Object.assign({}, config.options),
34
+ flp: config.flp ? Object.assign({}, config.flp) : undefined,
33
35
  customConfig: config.customConfig ? Object.assign({}, config.customConfig) : undefined
34
36
  };
35
37
  (_a = (_f = configWithDefaults.app).title) !== null && _a !== void 0 ? _a : (_f.title = `Adaptation of ${config.app.reference}`);
@@ -37,6 +39,10 @@ function setDefaults(config) {
37
39
  (_c = configWithDefaults.package) !== null && _c !== void 0 ? _c : (configWithDefaults.package = config.package ? Object.assign({}, config.package) : {});
38
40
  (_d = (_h = configWithDefaults.package).name) !== null && _d !== void 0 ? _d : (_h.name = config.app.id.toLowerCase().replace(/\./g, '-'));
39
41
  (_e = (_j = configWithDefaults.package).description) !== null && _e !== void 0 ? _e : (_j.description = configWithDefaults.app.title);
42
+ if (configWithDefaults.flp && !configWithDefaults.flp.inboundId) {
43
+ configWithDefaults.flp.addInboundId = true;
44
+ configWithDefaults.flp.inboundId = `${configWithDefaults.app.id}.InboundID`;
45
+ }
40
46
  return configWithDefaults;
41
47
  }
42
48
  /**
@@ -48,11 +54,15 @@ function setDefaults(config) {
48
54
  * @returns the updated memfs editor instance
49
55
  */
50
56
  function generate(basePath, config, fs) {
57
+ var _a;
51
58
  return __awaiter(this, void 0, void 0, function* () {
52
59
  if (!fs) {
53
60
  fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
54
61
  }
55
62
  const fullConfig = setDefaults(config);
63
+ if (((_a = fullConfig.customConfig) === null || _a === void 0 ? void 0 : _a.adp.environment) === 'C' && fullConfig.flp) {
64
+ (0, options_1.enhanceManifestChangeContentWithFlpConfig)(fullConfig.flp, fullConfig.app.id, fullConfig.app.content);
65
+ }
56
66
  (0, project_utils_1.writeTemplateToFolder)((0, path_1.join)(tmplPath, '**/*.*'), (0, path_1.join)(basePath), fullConfig, fs);
57
67
  yield (0, project_utils_1.writeUI5DeployYaml)(basePath, fullConfig, fs);
58
68
  yield (0, project_utils_1.writeUI5Yaml)(basePath, fullConfig, fs);
@@ -1,5 +1,5 @@
1
1
  import type { UI5Config } from '@sap-ux/ui5-config';
2
- import type { AdpCustomConfig, AdpWriterConfig } from '../types';
2
+ import type { CustomConfig, AdpWriterConfig, Content, CloudApp, InternalInboundNavigation } from '../types';
3
3
  /**
4
4
  * Generate the configuration for the middlewares required for the ui5.yaml.
5
5
  *
@@ -7,6 +7,22 @@ import type { AdpCustomConfig, AdpWriterConfig } from '../types';
7
7
  * @param config full project configuration
8
8
  */
9
9
  export declare function enhanceUI5Yaml(ui5Config: UI5Config, config: AdpWriterConfig): void;
10
+ /**
11
+ * Generate the configuration for the custom tasks required for the ui5.yaml.
12
+ *
13
+ * @param ui5Config configuration representing the ui5.yaml
14
+ * @param config full project configuration
15
+ */
16
+ export declare function enhanceUI5YamlWithCustomTask(ui5Config: UI5Config, config: AdpWriterConfig & {
17
+ app: CloudApp;
18
+ }): void;
19
+ /**
20
+ * Generate custom configuration required for the ui5.yaml.
21
+ *
22
+ * @param ui5Config configuration representing the ui5.yaml
23
+ * @param config full project configuration
24
+ */
25
+ export declare function enhanceUI5YamlWithCustomConfig(ui5Config: UI5Config, config?: CustomConfig): void;
10
26
  /**
11
27
  * Writer configuration with deploy configuration.
12
28
  */
@@ -28,11 +44,12 @@ export declare function hasDeployConfig(config: AdpWriterConfig): config is AdpW
28
44
  */
29
45
  export declare function enhanceUI5DeployYaml(ui5Config: UI5Config, config: AdpWriterConfigWithDeploy): void;
30
46
  /**
31
- * Generate custom configuration required for the ui5.yaml.
47
+ * Generate Inbound change content required for manifest.appdescriptor.
32
48
  *
33
- * @param ui5Config configuration representing the ui5.yaml
34
- * @param config full project configuration
49
+ * @param flpConfiguration FLP cloud project configuration
50
+ * @param appId Application variant id
51
+ * @param manifestChangeContent Application variant change content
35
52
  */
36
- export declare function enhanceUI5YamlWithCustomConfig(ui5Config: UI5Config, config?: AdpCustomConfig): void;
53
+ export declare function enhanceManifestChangeContentWithFlpConfig(flpConfiguration: InternalInboundNavigation, appId: string, manifestChangeContent?: Content[]): void;
37
54
  export {};
38
55
  //# sourceMappingURL=options.d.ts.map
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.enhanceUI5YamlWithCustomConfig = exports.enhanceUI5DeployYaml = exports.hasDeployConfig = exports.enhanceUI5Yaml = void 0;
3
+ exports.enhanceManifestChangeContentWithFlpConfig = exports.enhanceUI5DeployYaml = exports.hasDeployConfig = exports.enhanceUI5YamlWithCustomConfig = exports.enhanceUI5YamlWithCustomTask = exports.enhanceUI5Yaml = void 0;
4
4
  /**
5
5
  * Generate the configuration for the middlewares required for the ui5.yaml.
6
6
  *
@@ -9,11 +9,39 @@ exports.enhanceUI5YamlWithCustomConfig = exports.enhanceUI5DeployYaml = exports.
9
9
  */
10
10
  function enhanceUI5Yaml(ui5Config, config) {
11
11
  var _a;
12
- const middlewares = ((_a = config.options) === null || _a === void 0 ? void 0 : _a.fioriTools) ? getFioriToolsMiddlwares(config) : getOpenSourceMiddlewares(config);
13
12
  ui5Config.setConfiguration({ propertiesFileSourceEncoding: 'UTF-8' });
14
- ui5Config.addCustomMiddleware(middlewares);
13
+ if ((_a = config.options) === null || _a === void 0 ? void 0 : _a.fioriTools) {
14
+ addFioriToolsMiddlwares(ui5Config, config);
15
+ }
16
+ else {
17
+ addOpenSourceMiddlewares(ui5Config, config);
18
+ }
15
19
  }
16
20
  exports.enhanceUI5Yaml = enhanceUI5Yaml;
21
+ /**
22
+ * Generate the configuration for the custom tasks required for the ui5.yaml.
23
+ *
24
+ * @param ui5Config configuration representing the ui5.yaml
25
+ * @param config full project configuration
26
+ */
27
+ function enhanceUI5YamlWithCustomTask(ui5Config, config) {
28
+ const tasks = getAdpCloudCustomTasks(config);
29
+ ui5Config.addCustomTasks(tasks);
30
+ }
31
+ exports.enhanceUI5YamlWithCustomTask = enhanceUI5YamlWithCustomTask;
32
+ /**
33
+ * Generate custom configuration required for the ui5.yaml.
34
+ *
35
+ * @param ui5Config configuration representing the ui5.yaml
36
+ * @param config full project configuration
37
+ */
38
+ function enhanceUI5YamlWithCustomConfig(ui5Config, config) {
39
+ if (config === null || config === void 0 ? void 0 : config.adp) {
40
+ const { safeMode } = config.adp;
41
+ ui5Config.addCustomConfiguration('adp', { safeMode });
42
+ }
43
+ }
44
+ exports.enhanceUI5YamlWithCustomConfig = enhanceUI5YamlWithCustomConfig;
17
45
  /**
18
46
  * Checks if a writer config has a deploy configuration.
19
47
  *
@@ -35,37 +63,19 @@ function enhanceUI5DeployYaml(ui5Config, config) {
35
63
  ui5Config.addAbapDeployTask(config.target, config.deploy, ((_a = config.options) === null || _a === void 0 ? void 0 : _a.fioriTools) === true);
36
64
  }
37
65
  exports.enhanceUI5DeployYaml = enhanceUI5DeployYaml;
38
- /**
39
- * Generate custom configuration required for the ui5.yaml.
40
- *
41
- * @param ui5Config configuration representing the ui5.yaml
42
- * @param config full project configuration
43
- */
44
- function enhanceUI5YamlWithCustomConfig(ui5Config, config) {
45
- if (config === null || config === void 0 ? void 0 : config.adp) {
46
- const { safeMode } = config.adp;
47
- ui5Config.addCustomConfiguration('adp', { safeMode });
48
- }
49
- }
50
- exports.enhanceUI5YamlWithCustomConfig = enhanceUI5YamlWithCustomConfig;
51
66
  /**
52
67
  * Get a list of required middlewares using the Fiori tools.
53
68
  *
69
+ * @param ui5Config configuration representing the ui5.yaml
54
70
  * @param config full project configuration
55
- * @returns list of required middlewares.
56
71
  */
57
- function getFioriToolsMiddlwares(config) {
72
+ function addFioriToolsMiddlwares(ui5Config, config) {
58
73
  var _a, _b, _c, _d;
59
- return [
60
- {
61
- name: 'fiori-tools-appreload',
62
- afterMiddleware: 'compression',
63
- configuration: {
64
- port: 35729,
65
- path: 'webapp',
66
- delay: 300,
67
- }
68
- },
74
+ const backendConfig = Object.assign({}, config.target);
75
+ (_a = backendConfig.url) !== null && _a !== void 0 ? _a : (backendConfig.url = 'https://REQUIRED_FOR_VSCODE.example');
76
+ backendConfig.path = '/sap';
77
+ ui5Config.addFioriToolsAppReloadMiddleware();
78
+ ui5Config.addCustomMiddleware([
69
79
  {
70
80
  name: 'fiori-tools-preview',
71
81
  afterMiddleware: 'fiori-tools-appreload',
@@ -75,39 +85,31 @@ function getFioriToolsMiddlwares(config) {
75
85
  ignoreCertErrors: false
76
86
  }
77
87
  }
78
- },
79
- {
80
- name: 'fiori-tools-proxy',
81
- afterMiddleware: 'fiori-tools-preview',
82
- configuration: {
83
- ignoreCertErrors: false,
84
- ui5: {
85
- version: (_b = (_a = config === null || config === void 0 ? void 0 : config.ui5) === null || _a === void 0 ? void 0 : _a.minVersion) !== null && _b !== void 0 ? _b : '', //default to latest if version is not set
86
- path: ['/resources', '/test-resources'],
87
- url: (_d = (_c = config === null || config === void 0 ? void 0 : config.ui5) === null || _c === void 0 ? void 0 : _c.frameworkUrl) !== null && _d !== void 0 ? _d : 'https://ui5.sap.com'
88
- },
89
- backend: [
90
- Object.assign(Object.assign({}, config.target), { path: '/sap' })
91
- ]
92
- }
93
88
  }
94
- ];
89
+ ]);
90
+ ui5Config.addFioriToolsProxydMiddleware({
91
+ ui5: {
92
+ url: (_b = config === null || config === void 0 ? void 0 : config.ui5) === null || _b === void 0 ? void 0 : _b.frameworkUrl,
93
+ version: (_d = (_c = config === null || config === void 0 ? void 0 : config.ui5) === null || _c === void 0 ? void 0 : _c.minVersion) !== null && _d !== void 0 ? _d : '' //default to latest if version is not set
94
+ },
95
+ backend: [backendConfig]
96
+ });
95
97
  }
96
98
  /**
97
99
  * Get a list of required middlewares using the open source middlewares.
98
100
  *
101
+ * @param ui5Config configuration representing the ui5.yaml
99
102
  * @param config full project configuration
100
- * @returns list of required middlewares.
101
103
  */
102
- function getOpenSourceMiddlewares(config) {
103
- return [
104
+ function addOpenSourceMiddlewares(ui5Config, config) {
105
+ ui5Config.addCustomMiddleware([
104
106
  {
105
107
  name: 'reload-middleware',
106
108
  afterMiddleware: 'compression',
107
109
  configuration: {
108
110
  port: 35729,
109
111
  path: 'webapp',
110
- delay: 300,
112
+ delay: 300
111
113
  }
112
114
  },
113
115
  {
@@ -142,6 +144,141 @@ function getOpenSourceMiddlewares(config) {
142
144
  }
143
145
  }
144
146
  }
147
+ ]);
148
+ }
149
+ /**
150
+ * Get a list of required custom tasks for Cloud application.
151
+ *
152
+ * @param config full project configuration
153
+ * @returns list of required tasks.
154
+ */
155
+ function getAdpCloudCustomTasks(config) {
156
+ var _a, _b, _c, _d;
157
+ return [
158
+ {
159
+ name: 'app-variant-bundler-build',
160
+ beforeTask: 'escapeNonAsciiCharacters',
161
+ configuration: {
162
+ type: 'abap',
163
+ destination: (_a = config.target) === null || _a === void 0 ? void 0 : _a.destination,
164
+ appName: (_b = config === null || config === void 0 ? void 0 : config.app) === null || _b === void 0 ? void 0 : _b.bspName,
165
+ languages: (_d = (_c = config === null || config === void 0 ? void 0 : config.app) === null || _c === void 0 ? void 0 : _c.languages) === null || _d === void 0 ? void 0 : _d.map((language) => {
166
+ return {
167
+ sap: language.sap,
168
+ i18n: language.i18n
169
+ };
170
+ })
171
+ }
172
+ }
145
173
  ];
146
174
  }
175
+ /**
176
+ * Get a Inbound change content with provided inboundId.
177
+ *
178
+ * @param flpConfiguration FLP cloud project configuration
179
+ * @param appId application id
180
+ * @returns Inbound change content.
181
+ */
182
+ function getInboundChangeContentWithExistingInboundId(flpConfiguration, appId) {
183
+ const inboundContent = {
184
+ inboundId: flpConfiguration.inboundId,
185
+ entityPropertyChange: [
186
+ {
187
+ propertyPath: 'title',
188
+ operation: 'UPSERT',
189
+ propertyValue: `{{${appId}_sap.app.crossNavigation.inbounds.${flpConfiguration.inboundId}.title}}`
190
+ }
191
+ ]
192
+ };
193
+ if (flpConfiguration.subTitle) {
194
+ inboundContent.entityPropertyChange.push({
195
+ propertyPath: 'subTitle',
196
+ operation: 'UPSERT',
197
+ propertyValue: `{{${appId}_sap.app.crossNavigation.inbounds.${flpConfiguration.inboundId}.subTitle}}`
198
+ });
199
+ }
200
+ inboundContent.entityPropertyChange.push({
201
+ propertyPath: 'signature/parameters/sap-appvar-id',
202
+ operation: 'UPSERT',
203
+ propertyValue: {
204
+ required: true,
205
+ filter: {
206
+ value: appId,
207
+ format: 'plain'
208
+ },
209
+ launcherValue: {
210
+ value: appId
211
+ }
212
+ }
213
+ });
214
+ return inboundContent;
215
+ }
216
+ /**
217
+ * Get a Inbound change content without provided inboundId.
218
+ *
219
+ * @param flpConfiguration FLP cloud project configuration
220
+ * @param appId application id
221
+ * @returns Inbound change content.
222
+ */
223
+ function getInboundChangeContentWithNewInboundID(flpConfiguration, appId) {
224
+ var _a;
225
+ const content = {
226
+ inbound: {
227
+ [flpConfiguration.inboundId]: {
228
+ action: flpConfiguration.action,
229
+ semanticObject: flpConfiguration.semanticObject,
230
+ title: `{{${appId}_sap.app.crossNavigation.inbounds.${flpConfiguration.inboundId}.title}}`,
231
+ signature: {
232
+ additionalParameters: 'allowed',
233
+ parameters: (_a = flpConfiguration.additionalParameters) !== null && _a !== void 0 ? _a : {}
234
+ }
235
+ }
236
+ }
237
+ };
238
+ if (flpConfiguration.subTitle) {
239
+ content.inbound[flpConfiguration.inboundId].subTitle = `{{${appId}_sap.app.crossNavigation.inbounds.${flpConfiguration.inboundId}.subTitle}}`;
240
+ }
241
+ content.inbound[flpConfiguration.inboundId].signature.parameters['sap-appvar-id'] = {
242
+ required: true,
243
+ filter: {
244
+ value: appId,
245
+ format: 'plain'
246
+ },
247
+ launcherValue: {
248
+ value: appId
249
+ }
250
+ };
251
+ return content;
252
+ }
253
+ /**
254
+ * Generate Inbound change content required for manifest.appdescriptor.
255
+ *
256
+ * @param flpConfiguration FLP cloud project configuration
257
+ * @param appId Application variant id
258
+ * @param manifestChangeContent Application variant change content
259
+ */
260
+ function enhanceManifestChangeContentWithFlpConfig(flpConfiguration, appId, manifestChangeContent = []) {
261
+ const inboundChangeContent = flpConfiguration.addInboundId
262
+ ? getInboundChangeContentWithNewInboundID(flpConfiguration, appId)
263
+ : getInboundChangeContentWithExistingInboundId(flpConfiguration, appId);
264
+ if (inboundChangeContent) {
265
+ const addInboundChange = {
266
+ changeType: flpConfiguration.addInboundId ? 'appdescr_app_addNewInbound' : 'appdescr_app_changeInbound',
267
+ content: inboundChangeContent,
268
+ texts: {
269
+ 'i18n': 'i18n/i18n.properties'
270
+ }
271
+ };
272
+ const removeOtherInboundsChange = {
273
+ changeType: 'appdescr_app_removeAllInboundsExceptOne',
274
+ content: {
275
+ 'inboundId': flpConfiguration.inboundId
276
+ },
277
+ texts: {}
278
+ };
279
+ manifestChangeContent.push(addInboundChange);
280
+ manifestChangeContent.push(removeOtherInboundsChange);
281
+ }
282
+ }
283
+ exports.enhanceManifestChangeContentWithFlpConfig = enhanceManifestChangeContentWithFlpConfig;
147
284
  //# sourceMappingURL=options.js.map
@@ -1,11 +1,11 @@
1
1
  import type { Editor } from 'mem-fs-editor';
2
- import { AdpWriterConfig } from '../types';
2
+ import type { AdpWriterConfig } from '../types';
3
3
  /**
4
4
  * Writes a given project template files within a specified folder in the project directory.
5
5
  *
6
6
  * @param {string} templatePath - The root path of the project template.
7
7
  * @param {string} projectPath - The root path of the project.
8
- * @param {CfModuleData | AdpWriterConfig} data - The data to be populated in the template file.
8
+ * @param {AdpWriterConfig} data - The data to be populated in the template file.
9
9
  * @param {Editor} fs - The `mem-fs-editor` instance used for file operations.
10
10
  * @returns {void}
11
11
  */
@@ -18,7 +18,7 @@ const ui5_config_1 = require("@sap-ux/ui5-config");
18
18
  *
19
19
  * @param {string} templatePath - The root path of the project template.
20
20
  * @param {string} projectPath - The root path of the project.
21
- * @param {CfModuleData | AdpWriterConfig} data - The data to be populated in the template file.
21
+ * @param {AdpWriterConfig} data - The data to be populated in the template file.
22
22
  * @param {Editor} fs - The `mem-fs-editor` instance used for file operations.
23
23
  * @returns {void}
24
24
  */
@@ -43,6 +43,7 @@ exports.writeTemplateToFolder = writeTemplateToFolder;
43
43
  * @returns {void}
44
44
  */
45
45
  function writeUI5Yaml(projectPath, data, fs) {
46
+ var _a, _b;
46
47
  return __awaiter(this, void 0, void 0, function* () {
47
48
  try {
48
49
  const ui5ConfigPath = (0, path_1.join)(projectPath, 'ui5.yaml');
@@ -50,6 +51,9 @@ function writeUI5Yaml(projectPath, data, fs) {
50
51
  const ui5Config = yield ui5_config_1.UI5Config.newInstance(baseUi5ConfigContent);
51
52
  (0, options_1.enhanceUI5Yaml)(ui5Config, data);
52
53
  (0, options_1.enhanceUI5YamlWithCustomConfig)(ui5Config, data === null || data === void 0 ? void 0 : data.customConfig);
54
+ if (((_b = (_a = data.customConfig) === null || _a === void 0 ? void 0 : _a.adp) === null || _b === void 0 ? void 0 : _b.environment) === 'C') {
55
+ (0, options_1.enhanceUI5YamlWithCustomTask)(ui5Config, data);
56
+ }
53
57
  fs.write(ui5ConfigPath, ui5Config.toString());
54
58
  }
55
59
  catch (e) {
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.10.23",
12
+ "version": "0.11.1",
13
13
  "license": "Apache-2.0",
14
14
  "author": "@SAP/ux-tools-team",
15
15
  "main": "dist/index.js",
@@ -30,10 +30,10 @@
30
30
  "prompts": "2.4.2",
31
31
  "adm-zip": "0.5.10",
32
32
  "@sap-ux/axios-extension": "1.13.1",
33
- "@sap-ux/project-access": "1.22.0",
33
+ "@sap-ux/project-access": "1.22.1",
34
34
  "@sap-ux/logger": "0.5.1",
35
- "@sap-ux/system-access": "0.4.0",
36
- "@sap-ux/ui5-config": "0.22.7",
35
+ "@sap-ux/system-access": "0.4.1",
36
+ "@sap-ux/ui5-config": "0.22.8",
37
37
  "@sap-ux/btp-utils": "0.14.4"
38
38
  },
39
39
  "devDependencies": {
@@ -10,17 +10,19 @@
10
10
  ],
11
11
  "dependencies": {},
12
12
  "devDependencies": {
13
- <%if (locals.options?.fioriTools) {%>"@sap/ux-ui5-tooling": "^1.11.4"<%} else {%>"@sap-ux/backend-proxy-middleware": "^0.7.5",
13
+ <%if (locals.options?.fioriTools) {%>"@sap/ux-ui5-tooling": "1"<%} else {%>"@sap-ux/backend-proxy-middleware": "^0.7.5",
14
14
  "@sap-ux/preview-middleware": "^0.11.1",
15
15
  "@sap-ux/ui5-proxy-middleware": "^1.3.0",
16
16
  "@sap-ux/deploy-tooling": "^0.11.7"<%}%>,
17
- "@ui5/cli": "^3.9.1"
17
+ "@ui5/task-adaptation": "^1.3.0",
18
+ "@ui5/cli": "^3.9.2"
18
19
  },
19
20
  "scripts": {
20
21
  "build": "ui5 build --exclude-task generateFlexChangesBundle generateComponentPreload minify --clean-dest",
21
22
  "start": "<%= locals.options?.fioriTools ? 'fiori run' : 'ui5 serve' %> --open /test/flp.html#app-preview",
22
23
  "start-editor": "<%= locals.options?.fioriTools ? 'fiori run' : 'ui5 serve' %> --open /test/adaptation-editor.html"<%if (locals.deploy) {%>,
23
24
  "deploy": "ui5 build --config ui5-deploy.yaml --exclude-task <%= locals.options?.fioriTools ? 'deploy-to-abap' : 'abap-deploy-task' %> generateFlexChangesBundle generateComponentPreload --clean-dest && <%= locals.options?.fioriTools ? 'fiori deploy' : 'deploy' %> --config ui5-deploy.yaml",
24
- "undeploy": "<%= locals.options?.fioriTools ? 'fiori undeploy' : 'undeploy' %> --config ui5-deploy.yaml --lrep \"apps/<%= app.reference %>/appVariants/<%= app.id %>/\""<%}%>
25
+ "undeploy": "<%= locals.options?.fioriTools ? 'fiori undeploy' : 'undeploy' %> --config ui5-deploy.yaml --lrep \"apps/<%= app.reference %>/appVariants/<%= app.id %>/\"",
26
+ "deploy-test": "npm run build && fiori deploy --config ui5-deploy.yaml --testMode true"<%}%>
25
27
  }
26
28
  }
@@ -2,5 +2,5 @@
2
2
 
3
3
  specVersion: "3.0"
4
4
  metadata:
5
- name: <%- app.id %>
6
- type: application
5
+ name: <%- package.name %>
6
+ type: application
@@ -3,4 +3,10 @@
3
3
  #Texts for manifest.json
4
4
 
5
5
  #XTIT: Application name
6
- <%- app.id %>_sap.app.title=<%- app.title %>
6
+ <%- app.id %>_sap.app.title=<%- app.title %>
7
+ <% if (customConfig?.adp.environment === "C" && flp) { %>
8
+ # FLP Configuration
9
+
10
+ <%= app.id %>_sap.app.crossNavigation.inbounds.<%= flp.inboundId %>.title=<%= flp.title %><% if (flp.subTitle) { %>
11
+ <%= app.id %>_sap.app.crossNavigation.inbounds.<%= flp.inboundId %>.subTitle=<%= flp.subTitle %><% } %>
12
+ <% } %>
@@ -7,6 +7,9 @@
7
7
  "namespace": "apps/<%- app.reference %>/appVariants/<%- app.id %>/",
8
8
  "version": "0.1.0",
9
9
  "content": [
10
+ <%if(app.content){-%><% for(let change of app.content){-%>
11
+ <%- JSON.stringify(change, undefined, 4) %><%-","%>
12
+ <%}-%><%}-%>
10
13
  {
11
14
  "changeType": "appdescr_app_setTitle",
12
15
  "content": {},