@sap-ux/adp-tooling 0.19.10 → 1.0.0

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.
Files changed (147) hide show
  1. package/dist/abap/client.d.ts +1 -1
  2. package/dist/abap/client.js +8 -13
  3. package/dist/abap/config.js +5 -8
  4. package/dist/abap/index.d.ts +3 -3
  5. package/dist/abap/index.js +3 -19
  6. package/dist/abap/provider.js +5 -8
  7. package/dist/base/abap/manifest-service.d.ts +1 -1
  8. package/dist/base/abap/manifest-service.js +9 -18
  9. package/dist/base/cf.js +8 -11
  10. package/dist/base/change-utils.d.ts +1 -1
  11. package/dist/base/change-utils.js +49 -62
  12. package/dist/base/constants/index.js +12 -15
  13. package/dist/base/credentials.d.ts +2 -2
  14. package/dist/base/credentials.js +6 -9
  15. package/dist/base/helper.d.ts +1 -1
  16. package/dist/base/helper.js +40 -57
  17. package/dist/base/project-builder.js +3 -6
  18. package/dist/base/prompt.d.ts +1 -1
  19. package/dist/base/prompt.js +19 -25
  20. package/dist/btp/api.d.ts +1 -1
  21. package/dist/btp/api.js +10 -18
  22. package/dist/btp/index.d.ts +1 -1
  23. package/dist/btp/index.js +1 -17
  24. package/dist/cf/app/discovery.d.ts +1 -1
  25. package/dist/cf/app/discovery.js +11 -18
  26. package/dist/cf/app/html5-repo.d.ts +1 -1
  27. package/dist/cf/app/html5-repo.js +24 -32
  28. package/dist/cf/app/index.d.ts +2 -2
  29. package/dist/cf/app/index.js +2 -18
  30. package/dist/cf/core/auth.d.ts +1 -1
  31. package/dist/cf/core/auth.js +4 -8
  32. package/dist/cf/core/config.d.ts +1 -1
  33. package/dist/cf/core/config.js +9 -15
  34. package/dist/cf/core/index.d.ts +2 -2
  35. package/dist/cf/core/index.js +2 -18
  36. package/dist/cf/deploy.d.ts +1 -1
  37. package/dist/cf/deploy.js +33 -44
  38. package/dist/cf/index.d.ts +6 -6
  39. package/dist/cf/index.js +6 -22
  40. package/dist/cf/project/index.d.ts +3 -3
  41. package/dist/cf/project/index.js +3 -19
  42. package/dist/cf/project/mta.d.ts +1 -1
  43. package/dist/cf/project/mta.js +23 -66
  44. package/dist/cf/project/yaml-loader.d.ts +1 -1
  45. package/dist/cf/project/yaml-loader.js +8 -16
  46. package/dist/cf/project/yaml.d.ts +2 -2
  47. package/dist/cf/project/yaml.js +28 -72
  48. package/dist/cf/services/api.d.ts +1 -1
  49. package/dist/cf/services/api.js +46 -93
  50. package/dist/cf/services/cli.d.ts +1 -1
  51. package/dist/cf/services/cli.js +31 -42
  52. package/dist/cf/services/destinations.js +12 -48
  53. package/dist/cf/services/index.d.ts +5 -5
  54. package/dist/cf/services/index.js +5 -21
  55. package/dist/cf/services/manifest.d.ts +1 -1
  56. package/dist/cf/services/manifest.js +9 -13
  57. package/dist/cf/services/ssh.js +14 -22
  58. package/dist/cf/utils/index.d.ts +1 -1
  59. package/dist/cf/utils/index.js +1 -17
  60. package/dist/cf/utils/validation.d.ts +1 -1
  61. package/dist/cf/utils/validation.js +12 -18
  62. package/dist/common/flp-parameters.d.ts +1 -1
  63. package/dist/common/flp-parameters.js +1 -4
  64. package/dist/common/index.d.ts +1 -1
  65. package/dist/common/index.js +1 -17
  66. package/dist/i18n.js +8 -16
  67. package/dist/index.d.ts +23 -23
  68. package/dist/index.js +23 -46
  69. package/dist/preview/adp-preview.d.ts +1 -1
  70. package/dist/preview/adp-preview.js +41 -39
  71. package/dist/preview/change-handler.d.ts +1 -1
  72. package/dist/preview/change-handler.js +51 -59
  73. package/dist/preview/descriptor-change-handler.d.ts +1 -1
  74. package/dist/preview/descriptor-change-handler.js +18 -21
  75. package/dist/preview/ovp-routes-handler.js +11 -13
  76. package/dist/preview/routes-handler.js +36 -71
  77. package/dist/preview/utils.d.ts +1 -1
  78. package/dist/preview/utils.js +5 -8
  79. package/dist/prompts/add-annotations-to-odata/index.d.ts +1 -1
  80. package/dist/prompts/add-annotations-to-odata/index.js +24 -26
  81. package/dist/prompts/add-component-usages/index.d.ts +1 -1
  82. package/dist/prompts/add-component-usages/index.js +41 -43
  83. package/dist/prompts/add-new-model/index.d.ts +1 -1
  84. package/dist/prompts/add-new-model/index.js +75 -80
  85. package/dist/prompts/change-data-source/index.d.ts +1 -1
  86. package/dist/prompts/change-data-source/index.js +19 -22
  87. package/dist/prompts/change-inbound/index.d.ts +1 -1
  88. package/dist/prompts/change-inbound/index.js +11 -14
  89. package/dist/prompts/index.d.ts +5 -5
  90. package/dist/prompts/index.js +5 -15
  91. package/dist/source/applications.d.ts +2 -2
  92. package/dist/source/applications.js +7 -11
  93. package/dist/source/index.d.ts +3 -3
  94. package/dist/source/index.js +3 -19
  95. package/dist/source/manifest.d.ts +1 -1
  96. package/dist/source/manifest.js +15 -25
  97. package/dist/source/systems.d.ts +1 -1
  98. package/dist/source/systems.js +20 -27
  99. package/dist/types.d.ts +1 -1
  100. package/dist/types.js +64 -17
  101. package/dist/ui5/fetch.d.ts +1 -1
  102. package/dist/ui5/fetch.js +8 -12
  103. package/dist/ui5/format.d.ts +1 -1
  104. package/dist/ui5/format.js +17 -29
  105. package/dist/ui5/index.d.ts +4 -4
  106. package/dist/ui5/index.js +4 -20
  107. package/dist/ui5/network.d.ts +1 -1
  108. package/dist/ui5/network.js +1 -4
  109. package/dist/ui5/validator.js +14 -20
  110. package/dist/ui5/version-info.d.ts +1 -1
  111. package/dist/ui5/version-info.js +25 -36
  112. package/dist/writer/cf.d.ts +1 -1
  113. package/dist/writer/cf.js +35 -43
  114. package/dist/writer/changes/writer-factory.d.ts +2 -2
  115. package/dist/writer/changes/writer-factory.js +10 -13
  116. package/dist/writer/changes/writers/annotations-writer.d.ts +1 -1
  117. package/dist/writer/changes/writers/annotations-writer.js +11 -46
  118. package/dist/writer/changes/writers/component-usages-writer.d.ts +1 -1
  119. package/dist/writer/changes/writers/component-usages-writer.js +9 -12
  120. package/dist/writer/changes/writers/data-source-writer.d.ts +1 -1
  121. package/dist/writer/changes/writers/data-source-writer.js +7 -10
  122. package/dist/writer/changes/writers/inbound-writer.d.ts +1 -1
  123. package/dist/writer/changes/writers/inbound-writer.js +10 -13
  124. package/dist/writer/changes/writers/index.d.ts +5 -5
  125. package/dist/writer/changes/writers/index.js +5 -21
  126. package/dist/writer/changes/writers/new-model-writer.d.ts +1 -1
  127. package/dist/writer/changes/writers/new-model-writer.js +16 -20
  128. package/dist/writer/editors.d.ts +1 -1
  129. package/dist/writer/editors.js +6 -9
  130. package/dist/writer/i18n/index.d.ts +1 -1
  131. package/dist/writer/i18n/index.js +13 -17
  132. package/dist/writer/i18n/key-user-translations.js +9 -14
  133. package/dist/writer/inbound-navigation.d.ts +1 -1
  134. package/dist/writer/inbound-navigation.js +18 -27
  135. package/dist/writer/index.d.ts +1 -1
  136. package/dist/writer/index.js +36 -37
  137. package/dist/writer/manifest/descriptor-content.d.ts +2 -2
  138. package/dist/writer/manifest/descriptor-content.js +9 -15
  139. package/dist/writer/manifest/index.d.ts +1 -1
  140. package/dist/writer/manifest/index.js +1 -17
  141. package/dist/writer/options.d.ts +1 -1
  142. package/dist/writer/options.js +16 -27
  143. package/dist/writer/project-utils.d.ts +1 -1
  144. package/dist/writer/project-utils.js +49 -57
  145. package/dist/writer/writer-config.d.ts +2 -2
  146. package/dist/writer/writer-config.js +25 -30
  147. package/package.json +19 -17
@@ -1,11 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DataSourceWriter = void 0;
4
- const change_utils_1 = require("../../../base/change-utils");
1
+ import { ChangeType } from '../../../types.js';
2
+ import { getChange, writeChangeToFolder } from '../../../base/change-utils.js';
5
3
  /**
6
4
  * Handles the creation and writing of data source data changes for a project.
7
5
  */
8
- class DataSourceWriter {
6
+ export class DataSourceWriter {
9
7
  fs;
10
8
  projectPath;
11
9
  /**
@@ -56,15 +54,14 @@ class DataSourceWriter {
56
54
  const annotationId = dataSources[id].settings?.annotations?.[0];
57
55
  const timestamp = Date.now();
58
56
  const content = this.constructContent(id, uri, maxAge);
59
- const change = (0, change_utils_1.getChange)(variant, timestamp, content, "appdescr_app_changeDataSource" /* ChangeType.CHANGE_DATA_SOURCE */);
60
- await (0, change_utils_1.writeChangeToFolder)(this.projectPath, change, this.fs);
57
+ const change = getChange(variant, timestamp, content, ChangeType.CHANGE_DATA_SOURCE);
58
+ await writeChangeToFolder(this.projectPath, change, this.fs);
61
59
  if (annotationId && annotationUri) {
62
60
  const annotationContent = this.constructContent(annotationId, annotationUri);
63
61
  const annotationTs = timestamp + 1;
64
- const annotationChange = (0, change_utils_1.getChange)(variant, annotationTs, annotationContent, "appdescr_app_changeDataSource" /* ChangeType.CHANGE_DATA_SOURCE */);
65
- await (0, change_utils_1.writeChangeToFolder)(this.projectPath, annotationChange, this.fs);
62
+ const annotationChange = getChange(variant, annotationTs, annotationContent, ChangeType.CHANGE_DATA_SOURCE);
63
+ await writeChangeToFolder(this.projectPath, annotationChange, this.fs);
66
64
  }
67
65
  }
68
66
  }
69
- exports.DataSourceWriter = DataSourceWriter;
70
67
  //# sourceMappingURL=data-source-writer.js.map
@@ -1,5 +1,5 @@
1
1
  import type { Editor } from 'mem-fs-editor';
2
- import type { IWriter, InboundData } from '../../../types';
2
+ import type { IWriter, InboundData } from '../../../types.js';
3
3
  /**
4
4
  * Handles the creation and writing of inbound data changes for a project.
5
5
  */
@@ -1,11 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.InboundWriter = void 0;
4
- const change_utils_1 = require("../../../base/change-utils");
1
+ import { ChangeType } from '../../../types.js';
2
+ import { getParsedPropertyValue, findChangeWithInboundId, getChange, writeChangeToFolder, writeChangeToFile } from '../../../base/change-utils.js';
5
3
  /**
6
4
  * Handles the creation and writing of inbound data changes for a project.
7
5
  */
8
- class InboundWriter {
6
+ export class InboundWriter {
9
7
  fs;
10
8
  projectPath;
11
9
  /**
@@ -43,21 +41,21 @@ class InboundWriter {
43
41
  content.entityPropertyChange.push({
44
42
  propertyPath: 'title',
45
43
  operation: 'UPSERT',
46
- propertyValue: (0, change_utils_1.getParsedPropertyValue)(title)
44
+ propertyValue: getParsedPropertyValue(title)
47
45
  });
48
46
  }
49
47
  if (subtitle) {
50
48
  content.entityPropertyChange.push({
51
49
  propertyPath: 'subTitle',
52
50
  operation: 'UPSERT',
53
- propertyValue: (0, change_utils_1.getParsedPropertyValue)(subtitle)
51
+ propertyValue: getParsedPropertyValue(subtitle)
54
52
  });
55
53
  }
56
54
  if (icon) {
57
55
  content.entityPropertyChange.push({
58
56
  propertyPath: 'icon',
59
57
  operation: 'UPSERT',
60
- propertyValue: (0, change_utils_1.getParsedPropertyValue)(icon)
58
+ propertyValue: getParsedPropertyValue(icon)
61
59
  });
62
60
  }
63
61
  }
@@ -68,20 +66,19 @@ class InboundWriter {
68
66
  * @returns {Promise<void>} A promise that resolves when the change writing process is completed.
69
67
  */
70
68
  async write(data) {
71
- const { changeWithInboundId, filePath } = await (0, change_utils_1.findChangeWithInboundId)(this.projectPath, data.inboundId, this.fs);
69
+ const { changeWithInboundId, filePath } = await findChangeWithInboundId(this.projectPath, data.inboundId, this.fs);
72
70
  const timestamp = Date.now();
73
71
  if (!changeWithInboundId) {
74
72
  const content = this.constructContent(data);
75
- const change = (0, change_utils_1.getChange)(data.variant, timestamp, content, "appdescr_app_changeInbound" /* ChangeType.CHANGE_INBOUND */);
76
- await (0, change_utils_1.writeChangeToFolder)(this.projectPath, change, this.fs);
73
+ const change = getChange(data.variant, timestamp, content, ChangeType.CHANGE_INBOUND);
74
+ await writeChangeToFolder(this.projectPath, change, this.fs);
77
75
  }
78
76
  else {
79
77
  if (changeWithInboundId.content) {
80
78
  this.getEnhancedContent(data, changeWithInboundId.content);
81
79
  }
82
- (0, change_utils_1.writeChangeToFile)(filePath, changeWithInboundId, this.fs);
80
+ writeChangeToFile(filePath, changeWithInboundId, this.fs);
83
81
  }
84
82
  }
85
83
  }
86
- exports.InboundWriter = InboundWriter;
87
84
  //# sourceMappingURL=inbound-writer.js.map
@@ -1,6 +1,6 @@
1
- export * from './annotations-writer';
2
- export * from './component-usages-writer';
3
- export * from './data-source-writer';
4
- export * from './inbound-writer';
5
- export * from './new-model-writer';
1
+ export * from './annotations-writer.js';
2
+ export * from './component-usages-writer.js';
3
+ export * from './data-source-writer.js';
4
+ export * from './inbound-writer.js';
5
+ export * from './new-model-writer.js';
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -1,22 +1,6 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./annotations-writer"), exports);
18
- __exportStar(require("./component-usages-writer"), exports);
19
- __exportStar(require("./data-source-writer"), exports);
20
- __exportStar(require("./inbound-writer"), exports);
21
- __exportStar(require("./new-model-writer"), exports);
1
+ export * from './annotations-writer.js';
2
+ export * from './component-usages-writer.js';
3
+ export * from './data-source-writer.js';
4
+ export * from './inbound-writer.js';
5
+ export * from './new-model-writer.js';
22
6
  //# sourceMappingURL=index.js.map
@@ -1,5 +1,5 @@
1
1
  import type { Editor } from 'mem-fs-editor';
2
- import type { IWriter, NewModelData } from '../../../types';
2
+ import type { IWriter, NewModelData } from '../../../types.js';
3
3
  /**
4
4
  * Handles the creation and writing of new sapui5 model data changes for a project.
5
5
  */
@@ -1,16 +1,13 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NewModelWriter = void 0;
4
- const node_path_1 = require("node:path");
5
- const logger_1 = require("@sap-ux/logger");
6
- const types_1 = require("../../../types");
7
- const change_utils_1 = require("../../../base/change-utils");
8
- const yaml_1 = require("../../../cf/project/yaml");
9
- const ssh_1 = require("../../../cf/services/ssh");
1
+ import { join, dirname } from 'node:path';
2
+ import { ToolsLogger } from '@sap-ux/logger';
3
+ import { ChangeType, ServiceType } from '../../../types.js';
4
+ import { parseStringToObject, getChange, writeChangeToFolder } from '../../../base/change-utils.js';
5
+ import { addConnectivityServiceToMta } from '../../../cf/project/yaml.js';
6
+ import { ensureTunnelAppExists, DEFAULT_TUNNEL_APP_NAME } from '../../../cf/services/ssh.js';
10
7
  /**
11
8
  * Handles the creation and writing of new sapui5 model data changes for a project.
12
9
  */
13
- class NewModelWriter {
10
+ export class NewModelWriter {
14
11
  fs;
15
12
  projectPath;
16
13
  /**
@@ -29,7 +26,7 @@ class NewModelWriter {
29
26
  */
30
27
  constructContent(data) {
31
28
  const { service, isCloudFoundry, serviceType } = data;
32
- const isHttp = serviceType === types_1.ServiceType.HTTP;
29
+ const isHttp = serviceType === ServiceType.HTTP;
33
30
  const uri = isCloudFoundry ? `${service.name.replaceAll('.', '/')}${service.uri}` : service.uri;
34
31
  const dataSourceEntry = {
35
32
  uri,
@@ -48,7 +45,7 @@ class NewModelWriter {
48
45
  content.model = {
49
46
  [service.modelName]: {
50
47
  dataSource: service.name,
51
- ...(service.modelSettings?.length ? { settings: (0, change_utils_1.parseStringToObject)(service.modelSettings) } : {})
48
+ ...(service.modelSettings?.length ? { settings: parseStringToObject(service.modelSettings) } : {})
52
49
  }
53
50
  };
54
51
  }
@@ -62,7 +59,7 @@ class NewModelWriter {
62
59
  type: 'ODataAnnotation'
63
60
  };
64
61
  if (annotation.settings && annotation.settings.length !== 0) {
65
- content.dataSource[annotation.dataSourceName].settings = (0, change_utils_1.parseStringToObject)(annotation.settings);
62
+ content.dataSource[annotation.dataSourceName].settings = parseStringToObject(annotation.settings);
66
63
  }
67
64
  }
68
65
  return content;
@@ -75,16 +72,16 @@ class NewModelWriter {
75
72
  */
76
73
  async write(data) {
77
74
  const timestamp = Date.now();
78
- const isHttp = data.serviceType === types_1.ServiceType.HTTP;
75
+ const isHttp = data.serviceType === ServiceType.HTTP;
79
76
  const content = this.constructContent(data);
80
- const change = (0, change_utils_1.getChange)(data.variant, timestamp, content, isHttp ? "appdescr_app_addNewDataSource" /* ChangeType.ADD_NEW_DATA_SOURCE */ : "appdescr_ui5_addNewModel" /* ChangeType.ADD_NEW_MODEL */);
81
- await (0, change_utils_1.writeChangeToFolder)(this.projectPath, change, this.fs);
77
+ const change = getChange(data.variant, timestamp, content, isHttp ? ChangeType.ADD_NEW_DATA_SOURCE : ChangeType.ADD_NEW_MODEL);
78
+ await writeChangeToFolder(this.projectPath, change, this.fs);
82
79
  if (data.isCloudFoundry) {
83
80
  this.writeXsAppRoute(data);
84
81
  }
85
82
  if (data.isOnPremiseDestination) {
86
- await (0, yaml_1.addConnectivityServiceToMta)((0, node_path_1.dirname)(this.projectPath), this.fs);
87
- await (0, ssh_1.ensureTunnelAppExists)(ssh_1.DEFAULT_TUNNEL_APP_NAME, data.logger ?? new logger_1.ToolsLogger());
83
+ await addConnectivityServiceToMta(dirname(this.projectPath), this.fs);
84
+ await ensureTunnelAppExists(DEFAULT_TUNNEL_APP_NAME, data.logger ?? new ToolsLogger());
88
85
  }
89
86
  }
90
87
  /**
@@ -94,7 +91,7 @@ class NewModelWriter {
94
91
  * @param {NewModelData} data - The new model data containing service name, URI and destination name.
95
92
  */
96
93
  writeXsAppRoute(data) {
97
- const xsAppPath = (0, node_path_1.join)(this.projectPath, 'webapp', 'xs-app.json');
94
+ const xsAppPath = join(this.projectPath, 'webapp', 'xs-app.json');
98
95
  const source = `^/${data.service.name.replaceAll('.', '/')}${data.service.uri}(.*)`;
99
96
  const newRoute = {
100
97
  source,
@@ -106,5 +103,4 @@ class NewModelWriter {
106
103
  this.fs.writeJSON(xsAppPath, existing);
107
104
  }
108
105
  }
109
- exports.NewModelWriter = NewModelWriter;
110
106
  //# sourceMappingURL=new-model-writer.js.map
@@ -1,5 +1,5 @@
1
1
  import { type Editor } from 'mem-fs-editor';
2
- import type { GeneratorData, ChangeType } from '../types';
2
+ import type { GeneratorData, ChangeType } from '../types.js';
3
3
  /**
4
4
  * Generates and applies changes to a project based on a specified generator type.
5
5
  *
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.generateChange = generateChange;
4
- const mem_fs_1 = require("mem-fs");
5
- const mem_fs_editor_1 = require("mem-fs-editor");
6
- const writer_factory_1 = require("./changes/writer-factory");
1
+ import { create as createStorage } from 'mem-fs';
2
+ import { create } from 'mem-fs-editor';
3
+ import { WriterFactory } from './changes/writer-factory.js';
7
4
  /**
8
5
  * Generates and applies changes to a project based on a specified generator type.
9
6
  *
@@ -19,11 +16,11 @@ const writer_factory_1 = require("./changes/writer-factory");
19
16
  * @returns {Promise<Editor>} A promise that resolves to the mem-fs editor instance used for making changes, allowing for further operations or committing changes to disk.
20
17
  * @template T - A type parameter extending `ChangeType`, ensuring the function handles a defined set of generator types.
21
18
  */
22
- async function generateChange(projectPath, type, data, fs = null, templatesPath) {
19
+ export async function generateChange(projectPath, type, data, fs = null, templatesPath) {
23
20
  if (!fs) {
24
- fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
21
+ fs = create(createStorage());
25
22
  }
26
- const writer = writer_factory_1.WriterFactory.createWriter(type, fs, projectPath, templatesPath);
23
+ const writer = WriterFactory.createWriter(type, fs, projectPath, templatesPath);
27
24
  await writer.write(data);
28
25
  return fs;
29
26
  }
@@ -1,6 +1,6 @@
1
1
  import type { Editor } from 'mem-fs-editor';
2
2
  import type { Manifest } from '@sap-ux/project-access';
3
- import { FlexLayer, type ResourceModel, type SapModel } from '../../types';
3
+ import { FlexLayer, type ResourceModel, type SapModel } from '../../types.js';
4
4
  /**
5
5
  * Generates an internationalization description string for a specific layer within an application.
6
6
  *
@@ -1,11 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getI18nDescription = getI18nDescription;
4
- exports.writeI18nModels = writeI18nModels;
5
- exports.extractResourceModelPath = extractResourceModelPath;
6
- exports.getI18nModels = getI18nModels;
7
- const uuid_1 = require("uuid");
8
- const __1 = require("../..");
1
+ import { v4 as uuidv4 } from 'uuid';
2
+ import { RESOURCE_BUNDLE_TEXT, TRANSLATION_UUID_TEXT, BASE_I18N_DESCRIPTION, MAIN_I18N_PATH } from '../../index.js';
3
+ import { FlexLayer } from '../../types.js';
9
4
  /**
10
5
  * Generates an internationalization description string for a specific layer within an application.
11
6
  *
@@ -13,10 +8,10 @@ const __1 = require("../..");
13
8
  * @param {string} [appTitle] - The title of the application used in generating the i18n description.
14
9
  * @returns {string} The internationalization description string.
15
10
  */
16
- function getI18nDescription(layer, appTitle) {
17
- return layer === "CUSTOMER_BASE" /* FlexLayer.CUSTOMER_BASE */
18
- ? __1.BASE_I18N_DESCRIPTION
19
- : __1.BASE_I18N_DESCRIPTION + __1.RESOURCE_BUNDLE_TEXT + appTitle + __1.TRANSLATION_UUID_TEXT + (0, uuid_1.v4)();
11
+ export function getI18nDescription(layer, appTitle) {
12
+ return layer === FlexLayer.CUSTOMER_BASE
13
+ ? BASE_I18N_DESCRIPTION
14
+ : BASE_I18N_DESCRIPTION + RESOURCE_BUNDLE_TEXT + appTitle + TRANSLATION_UUID_TEXT + uuidv4();
20
15
  }
21
16
  /**
22
17
  * Writes internationalization (i18n) model files to the specified paths within the project structure.
@@ -32,12 +27,12 @@ function getI18nDescription(layer, appTitle) {
32
27
  * - Models are written only if they have content and do not match the main i18n path.
33
28
  * - The file path for each model is constructed using the provided base path and model's specified path.
34
29
  */
35
- function writeI18nModels(basePath, i18nModels, fs) {
30
+ export function writeI18nModels(basePath, i18nModels, fs) {
36
31
  if (!i18nModels?.length) {
37
32
  return;
38
33
  }
39
34
  for (const { key, path, content } of i18nModels) {
40
- const isMainFile = key === 'i18n' || path === __1.MAIN_I18N_PATH;
35
+ const isMainFile = key === 'i18n' || path === MAIN_I18N_PATH;
41
36
  if (!isMainFile && content) {
42
37
  const i18nPath = `${basePath}/webapp/${path}`;
43
38
  fs.write(i18nPath, content);
@@ -52,7 +47,7 @@ function writeI18nModels(basePath, i18nModels, fs) {
52
47
  * @param {string} appId - Application ID.
53
48
  * @returns {string} The calculated resource model path.
54
49
  */
55
- function extractResourceModelPath(ui5Model, modelObjectKey, appId) {
50
+ export function extractResourceModelPath(ui5Model, modelObjectKey, appId) {
56
51
  let resourceModelPath = '';
57
52
  if (ui5Model?.uri) {
58
53
  resourceModelPath = ui5Model.uri;
@@ -79,12 +74,13 @@ function extractResourceModelPath(ui5Model, modelObjectKey, appId) {
79
74
  * @param {string} [title] - The application title.
80
75
  * @returns {ResourceModel[] | undefined} An array of resource models or undefined if no models meet the criteria.
81
76
  */
82
- function getI18nModels(manifest, layer, id, title) {
77
+ export function getI18nModels(manifest, layer, id, title) {
83
78
  if (!manifest) {
84
79
  return undefined;
85
80
  }
86
81
  const models = manifest['sap.ui5']?.models ?? {};
87
- return Object.entries(models).reduce((acc, [key, ui5Model]) => {
82
+ return Object.entries(models).reduce((acc, [key, value]) => {
83
+ const ui5Model = value;
88
84
  if (ui5Model?.type === 'sap.ui.model.resource.ResourceModel') {
89
85
  const content = getI18nDescription(layer, title);
90
86
  const path = extractResourceModelPath(ui5Model, key, id);
@@ -1,11 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.normalizeLanguageForI18n = normalizeLanguageForI18n;
4
- exports.replaceTextsWithI18nBindings = replaceTextsWithI18nBindings;
5
- exports.writeKeyUserTranslations = writeKeyUserTranslations;
6
- const node_path_1 = require("node:path");
7
- const project_access_1 = require("@sap-ux/project-access");
8
- const i18n_1 = require("@sap-ux/i18n");
1
+ import { join } from 'node:path';
2
+ import { getWebappPath } from '@sap-ux/project-access';
3
+ import { createPropertiesI18nEntries } from '@sap-ux/i18n';
9
4
  /**
10
5
  * Old-to-new ISO 639 language code mappings. Safety net for legacy systems that may still return deprecated codes.
11
6
  * Source: sap/base/i18n/Localization.js M_ISO639_OLD_TO_NEW
@@ -24,7 +19,7 @@ const M_ISO639_OLD_TO_NEW = {
24
19
  * @param lang - Language key from the backend response (e.g., '', 'en', 'iw', 'pt-BR', 'zh-Hans').
25
20
  * @returns The normalized locale suffix for .properties file naming (e.g., '', 'en', 'he', 'pt_BR', 'zh_Hans').
26
21
  */
27
- function normalizeLanguageForI18n(lang) {
22
+ export function normalizeLanguageForI18n(lang) {
28
23
  if (!lang) {
29
24
  return '';
30
25
  }
@@ -55,7 +50,7 @@ function normalizeLanguageForI18n(lang) {
55
50
  * @param fileName - The file name of the change, used as key prefix.
56
51
  * @returns The modified texts object with i18n bindings replacing values.
57
52
  */
58
- function replaceTextsWithI18nBindings(contentTexts, fileName) {
53
+ export function replaceTextsWithI18nBindings(contentTexts, fileName) {
59
54
  const result = {};
60
55
  for (const textId of Object.keys(contentTexts)) {
61
56
  const entry = { ...contentTexts[textId] };
@@ -74,8 +69,8 @@ function replaceTextsWithI18nBindings(contentTexts, fileName) {
74
69
  * @param topLevelTexts - The top-level `texts` object from the API response entry.
75
70
  * @param fs - The `mem-fs-editor` instance used for file operations.
76
71
  */
77
- async function writeKeyUserTranslations(projectPath, fileName, topLevelTexts, fs) {
78
- const webappPath = await (0, project_access_1.getWebappPath)(projectPath, fs);
72
+ export async function writeKeyUserTranslations(projectPath, fileName, topLevelTexts, fs) {
73
+ const webappPath = await getWebappPath(projectPath, fs);
79
74
  const entriesByLanguage = {};
80
75
  for (const textId of Object.keys(topLevelTexts)) {
81
76
  const textEntry = topLevelTexts[textId];
@@ -102,8 +97,8 @@ async function writeKeyUserTranslations(projectPath, fileName, topLevelTexts, fs
102
97
  }
103
98
  for (const lang of Object.keys(entriesByLanguage)) {
104
99
  const propertiesFileName = lang ? `i18n_${lang}.properties` : 'i18n.properties';
105
- const i18nFilePath = (0, node_path_1.join)(webappPath, 'i18n', propertiesFileName);
106
- await (0, i18n_1.createPropertiesI18nEntries)(i18nFilePath, entriesByLanguage[lang], undefined, fs);
100
+ const i18nFilePath = join(webappPath, 'i18n', propertiesFileName);
101
+ await createPropertiesI18nEntries(i18nFilePath, entriesByLanguage[lang], undefined, fs);
107
102
  }
108
103
  }
109
104
  //# sourceMappingURL=key-user-translations.js.map
@@ -1,6 +1,6 @@
1
1
  import { type Editor } from 'mem-fs-editor';
2
2
  import { type NewI18nEntry } from '@sap-ux/i18n';
3
- import type { InternalInboundNavigation, DescriptorVariantContent } from '../types';
3
+ import type { InternalInboundNavigation, DescriptorVariantContent } from '../types.js';
4
4
  /**
5
5
  * Generates and writes the inbound configuration to the manifest.appdescr_variant file.
6
6
  *
@@ -1,18 +1,9 @@
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.generateInboundConfig = generateInboundConfig;
7
- exports.getFlpI18nKeys = getFlpI18nKeys;
8
- exports.updateI18n = updateI18n;
9
- exports.removeInboundChangeTypes = removeInboundChangeTypes;
10
- const node_path_1 = __importDefault(require("node:path"));
11
- const mem_fs_1 = require("mem-fs");
12
- const mem_fs_editor_1 = require("mem-fs-editor");
13
- const i18n_1 = require("@sap-ux/i18n");
14
- const __1 = require("../");
15
- const options_1 = require("./options");
1
+ import path from 'node:path';
2
+ import { create as createStorage } from 'mem-fs';
3
+ import { create } from 'mem-fs-editor';
4
+ import { SapShortTextType, removeAndCreateI18nEntries } from '@sap-ux/i18n';
5
+ import { getVariant, updateVariant } from '../index.js';
6
+ import { enhanceManifestChangeContentWithFlpConfig as enhanceInboundConfig } from './options.js';
16
7
  /**
17
8
  * Generates and writes the inbound configuration to the manifest.appdescr_variant file.
18
9
  *
@@ -21,11 +12,11 @@ const options_1 = require("./options");
21
12
  * @param fs - Optional mem-fs editor instance.
22
13
  * @returns The mem-fs editor instance.
23
14
  */
24
- async function generateInboundConfig(basePath, configs, fs) {
15
+ export async function generateInboundConfig(basePath, configs, fs) {
25
16
  if (!fs) {
26
- fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
17
+ fs = create(createStorage());
27
18
  }
28
- const variant = await (0, __1.getVariant)(basePath, fs);
19
+ const variant = await getVariant(basePath, fs);
29
20
  variant.content = removeInboundChangeTypes(variant.content);
30
21
  // Set default inbound IDs if missing
31
22
  for (const config of configs) {
@@ -33,8 +24,8 @@ async function generateInboundConfig(basePath, configs, fs) {
33
24
  config.inboundId = `${variant.id}.InboundID`;
34
25
  }
35
26
  }
36
- (0, options_1.enhanceManifestChangeContentWithFlpConfig)(configs, variant.id, variant.content);
37
- await (0, __1.updateVariant)(basePath, variant, fs);
27
+ enhanceInboundConfig(configs, variant.id, variant.content);
28
+ await updateVariant(basePath, variant, fs);
38
29
  await updateI18n(basePath, variant.id, configs, fs);
39
30
  return fs;
40
31
  }
@@ -45,19 +36,19 @@ async function generateInboundConfig(basePath, configs, fs) {
45
36
  * @param {string} appId - The application ID for creating unique i18n keys.
46
37
  * @returns {NewI18nEntry[]} An array of new i18n entries to be added or updated.
47
38
  */
48
- function getFlpI18nKeys(config, appId) {
39
+ export function getFlpI18nKeys(config, appId) {
49
40
  const newEntries = [];
50
41
  const baseKey = `${appId}_sap.app.crossNavigation.inbounds.${config.inboundId}`;
51
42
  newEntries.push({
52
43
  key: `${baseKey}.title`,
53
44
  value: config.title,
54
- annotation: { textType: i18n_1.SapShortTextType.TableTitle, note: 'Fiori Launchpad Tile Title' }
45
+ annotation: { textType: SapShortTextType.TableTitle, note: 'Fiori Launchpad Tile Title' }
55
46
  });
56
47
  if (config?.subTitle) {
57
48
  newEntries.push({
58
49
  key: `${baseKey}.subTitle`,
59
50
  value: config.subTitle,
60
- annotation: { textType: i18n_1.SapShortTextType.TableTitle, note: 'Fiori Launchpad Tile Subtitle' }
51
+ annotation: { textType: SapShortTextType.TableTitle, note: 'Fiori Launchpad Tile Subtitle' }
61
52
  });
62
53
  }
63
54
  return newEntries;
@@ -71,14 +62,14 @@ function getFlpI18nKeys(config, appId) {
71
62
  * @param {Editor} fs - The mem-fs editor instance for file operations.
72
63
  * @returns {Promise<void>} A promise that resolves when the i18n file is updated.
73
64
  */
74
- async function updateI18n(basePath, appId, configs, fs) {
65
+ export async function updateI18n(basePath, appId, configs, fs) {
75
66
  let newEntries = [];
76
67
  for (const config of configs) {
77
68
  newEntries = newEntries.concat(getFlpI18nKeys(config, appId));
78
69
  }
79
- const i18nPath = node_path_1.default.join(basePath, 'webapp', 'i18n', 'i18n.properties');
70
+ const i18nPath = path.join(basePath, 'webapp', 'i18n', 'i18n.properties');
80
71
  const keysToRemove = [`${appId}_sap.app.crossNavigation.inbounds`];
81
- await (0, i18n_1.removeAndCreateI18nEntries)(i18nPath, newEntries, keysToRemove, basePath, fs);
72
+ await removeAndCreateI18nEntries(i18nPath, newEntries, keysToRemove, basePath, fs);
82
73
  }
83
74
  /**
84
75
  * Removes elements with changeType 'appdescr_app_addNewInbound', 'appdescr_app_removeAllInboundsExceptOne',
@@ -89,7 +80,7 @@ async function updateI18n(basePath, appId, configs, fs) {
89
80
  * @param content The array of manifest change objects.
90
81
  * @returns A new array with the specified elements removed.
91
82
  */
92
- function removeInboundChangeTypes(content) {
83
+ export function removeInboundChangeTypes(content) {
93
84
  return content.filter((item) => item.changeType !== 'appdescr_app_addNewInbound' &&
94
85
  item.changeType !== 'appdescr_app_changeInbound' &&
95
86
  item.changeType !== 'appdescr_app_removeAllInboundsExceptOne' &&
@@ -1,5 +1,5 @@
1
1
  import { type Editor } from 'mem-fs-editor';
2
- import { type AdpWriterConfig } from '../types';
2
+ import { type AdpWriterConfig } from '../types.js';
3
3
  /**
4
4
  * Writes the adp-project template to the mem-fs-editor instance.
5
5
  *