@sap-ux/adp-tooling 0.18.9 → 0.18.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.
@@ -17,9 +17,9 @@ interface InboundChange extends ManifestChangeProperties {
17
17
  * @param {ManifestChangeProperties} change - The annotation data change that will be written.
18
18
  * @param {Editor} fs - The `mem-fs-editor` instance used for file operations.
19
19
  * @param {string} templatesPath - The path to the templates used for generating changes.
20
- * @returns {void}
20
+ * @returns {Promise<void>}
21
21
  */
22
- export declare function writeAnnotationChange(projectPath: string, timestamp: number, annotation: AnnotationsData['annotation'], change: ManifestChangeProperties | undefined, fs: Editor, templatesPath?: string): void;
22
+ export declare function writeAnnotationChange(projectPath: string, timestamp: number, annotation: AnnotationsData['annotation'], change: ManifestChangeProperties | undefined, fs: Editor, templatesPath?: string): Promise<void>;
23
23
  /**
24
24
  * Writes a given change object to a file within a specified folder in the project's 'changes' directory.
25
25
  * If an additional subdirectory is specified, the change file is written there.
@@ -28,9 +28,9 @@ export declare function writeAnnotationChange(projectPath: string, timestamp: nu
28
28
  * @param {ManifestChangeProperties} change - The change data to be written to the file.
29
29
  * @param {Editor} fs - The `mem-fs-editor` instance used for file operations.
30
30
  * @param {string} [dir] - An optional subdirectory within the 'changes' directory where the file will be written.
31
- * @returns {void}
31
+ * @returns {Promise<void>}
32
32
  */
33
- export declare function writeChangeToFolder(projectPath: string, change: ManifestChangeProperties, fs: Editor, dir?: string): void;
33
+ export declare function writeChangeToFolder(projectPath: string, change: ManifestChangeProperties, fs: Editor, dir?: string): Promise<void>;
34
34
  /**
35
35
  * Writes a given change object to a specific file path. The change data is stringified to JSON format before
36
36
  * writing. This function is used to directly write changes to a file, without specifying a directory.
@@ -80,10 +80,11 @@ export declare function getChangesByType(projectPath: string, changeType: Change
80
80
  *
81
81
  * @param {string} projectPath - The root path of the project.
82
82
  * @param {string} inboundId - The inbound ID to search for within change files.
83
+ * @param {Editor} fs - The `mem-fs-editor` instance used for file operations.
83
84
  * @returns {InboundChangeData} An object containing the file path and the change object with the matching inbound ID.
84
85
  * @throws {Error} Throws an error if the change file cannot be read or if there's an issue accessing the directory.
85
86
  */
86
- export declare function findChangeWithInboundId(projectPath: string, inboundId: string): InboundChangeData;
87
+ export declare function findChangeWithInboundId(projectPath: string, inboundId: string, fs: Editor): Promise<InboundChangeData>;
87
88
  /**
88
89
  * Constructs a generic change object based on provided parameters.
89
90
  *
@@ -25,11 +25,12 @@ const ejs_1 = require("ejs");
25
25
  * @param {ManifestChangeProperties} change - The annotation data change that will be written.
26
26
  * @param {Editor} fs - The `mem-fs-editor` instance used for file operations.
27
27
  * @param {string} templatesPath - The path to the templates used for generating changes.
28
- * @returns {void}
28
+ * @returns {Promise<void>}
29
29
  */
30
- function writeAnnotationChange(projectPath, timestamp, annotation, change, fs, templatesPath) {
30
+ async function writeAnnotationChange(projectPath, timestamp, annotation, change, fs, templatesPath) {
31
31
  try {
32
- const changesFolderPath = node_path_1.default.join(projectPath, project_access_1.DirName.Webapp, project_access_1.DirName.Changes);
32
+ const webappPath = await (0, project_access_1.getWebappPath)(projectPath, fs);
33
+ const changesFolderPath = node_path_1.default.join(webappPath, project_access_1.DirName.Changes);
33
34
  const annotationsFolderPath = node_path_1.default.join(changesFolderPath, project_access_1.DirName.Annotations);
34
35
  if (change) {
35
36
  const changeFileName = `${change.fileName}.change`;
@@ -68,11 +69,12 @@ function writeAnnotationChange(projectPath, timestamp, annotation, change, fs, t
68
69
  * @param {ManifestChangeProperties} change - The change data to be written to the file.
69
70
  * @param {Editor} fs - The `mem-fs-editor` instance used for file operations.
70
71
  * @param {string} [dir] - An optional subdirectory within the 'changes' directory where the file will be written.
71
- * @returns {void}
72
+ * @returns {Promise<void>}
72
73
  */
73
- function writeChangeToFolder(projectPath, change, fs, dir = '') {
74
+ async function writeChangeToFolder(projectPath, change, fs, dir = '') {
74
75
  try {
75
- let targetFolderPath = node_path_1.default.join(projectPath, project_access_1.DirName.Webapp, project_access_1.DirName.Changes);
76
+ const webappPath = await (0, project_access_1.getWebappPath)(projectPath, fs);
77
+ let targetFolderPath = node_path_1.default.join(webappPath, project_access_1.DirName.Changes);
76
78
  if (dir) {
77
79
  targetFolderPath = node_path_1.default.join(targetFolderPath, dir);
78
80
  }
@@ -179,13 +181,15 @@ function getChangesByType(projectPath, changeType, subDir) {
179
181
  *
180
182
  * @param {string} projectPath - The root path of the project.
181
183
  * @param {string} inboundId - The inbound ID to search for within change files.
184
+ * @param {Editor} fs - The `mem-fs-editor` instance used for file operations.
182
185
  * @returns {InboundChangeData} An object containing the file path and the change object with the matching inbound ID.
183
186
  * @throws {Error} Throws an error if the change file cannot be read or if there's an issue accessing the directory.
184
187
  */
185
- function findChangeWithInboundId(projectPath, inboundId) {
188
+ async function findChangeWithInboundId(projectPath, inboundId, fs) {
186
189
  let changeObj;
187
190
  let filePath = '';
188
- const pathToInboundChangeFiles = node_path_1.default.join(projectPath, project_access_1.DirName.Webapp, project_access_1.DirName.Changes);
191
+ const webappPath = await (0, project_access_1.getWebappPath)(projectPath, fs);
192
+ const pathToInboundChangeFiles = node_path_1.default.join(webappPath, project_access_1.DirName.Changes);
189
193
  if (!(0, node_fs_1.existsSync)(pathToInboundChangeFiles)) {
190
194
  return {
191
195
  filePath,
@@ -107,7 +107,7 @@ class AnnotationsWriter {
107
107
  if (data.isCommand) {
108
108
  change = (0, change_utils_1.getChange)(variant, timestamp, content, "appdescr_app_addAnnotationsToOData" /* ChangeType.ADD_ANNOTATIONS_TO_ODATA */);
109
109
  }
110
- (0, change_utils_1.writeAnnotationChange)(this.projectPath, timestamp, data.annotation, change, this.fs, this.templatesPath);
110
+ await (0, change_utils_1.writeAnnotationChange)(this.projectPath, timestamp, data.annotation, change, this.fs, this.templatesPath);
111
111
  }
112
112
  }
113
113
  exports.AnnotationsWriter = AnnotationsWriter;
@@ -62,14 +62,14 @@ class ComponentUsagesWriter {
62
62
  const componentUsagesContent = this.constructContent(data);
63
63
  const timestamp = Date.now();
64
64
  const compUsagesChange = (0, change_utils_1.getChange)(data.variant, timestamp, componentUsagesContent, "appdescr_ui5_addComponentUsages" /* ChangeType.ADD_COMPONENT_USAGES */);
65
- (0, change_utils_1.writeChangeToFolder)(this.projectPath, compUsagesChange, this.fs);
65
+ await (0, change_utils_1.writeChangeToFolder)(this.projectPath, compUsagesChange, this.fs);
66
66
  if (!('library' in data)) {
67
67
  return;
68
68
  }
69
69
  const libRefContent = this.constructLibContent(data);
70
70
  const libTimestamp = timestamp + 1;
71
71
  const refLibChange = (0, change_utils_1.getChange)(data.variant, libTimestamp, libRefContent, "appdescr_ui5_addLibraries" /* ChangeType.ADD_LIBRARY_REFERENCE */);
72
- (0, change_utils_1.writeChangeToFolder)(this.projectPath, refLibChange, this.fs);
72
+ await (0, change_utils_1.writeChangeToFolder)(this.projectPath, refLibChange, this.fs);
73
73
  }
74
74
  }
75
75
  exports.ComponentUsagesWriter = ComponentUsagesWriter;
@@ -57,12 +57,12 @@ class DataSourceWriter {
57
57
  const timestamp = Date.now();
58
58
  const content = this.constructContent(id, uri, maxAge);
59
59
  const change = (0, change_utils_1.getChange)(variant, timestamp, content, "appdescr_app_changeDataSource" /* ChangeType.CHANGE_DATA_SOURCE */);
60
- (0, change_utils_1.writeChangeToFolder)(this.projectPath, change, this.fs);
60
+ await (0, change_utils_1.writeChangeToFolder)(this.projectPath, change, this.fs);
61
61
  if (annotationId && annotationUri) {
62
62
  const annotationContent = this.constructContent(annotationId, annotationUri);
63
63
  const annotationTs = timestamp + 1;
64
64
  const annotationChange = (0, change_utils_1.getChange)(variant, annotationTs, annotationContent, "appdescr_app_changeDataSource" /* ChangeType.CHANGE_DATA_SOURCE */);
65
- (0, change_utils_1.writeChangeToFolder)(this.projectPath, annotationChange, this.fs);
65
+ await (0, change_utils_1.writeChangeToFolder)(this.projectPath, annotationChange, this.fs);
66
66
  }
67
67
  }
68
68
  }
@@ -68,12 +68,12 @@ class InboundWriter {
68
68
  * @returns {Promise<void>} A promise that resolves when the change writing process is completed.
69
69
  */
70
70
  async write(data) {
71
- const { changeWithInboundId, filePath } = (0, change_utils_1.findChangeWithInboundId)(this.projectPath, data.inboundId);
71
+ const { changeWithInboundId, filePath } = await (0, change_utils_1.findChangeWithInboundId)(this.projectPath, data.inboundId, this.fs);
72
72
  const timestamp = Date.now();
73
73
  if (!changeWithInboundId) {
74
74
  const content = this.constructContent(data);
75
75
  const change = (0, change_utils_1.getChange)(data.variant, timestamp, content, "appdescr_app_changeInbound" /* ChangeType.CHANGE_INBOUND */);
76
- (0, change_utils_1.writeChangeToFolder)(this.projectPath, change, this.fs);
76
+ await (0, change_utils_1.writeChangeToFolder)(this.projectPath, change, this.fs);
77
77
  }
78
78
  else {
79
79
  if (changeWithInboundId.content) {
@@ -66,7 +66,7 @@ class NewModelWriter {
66
66
  const timestamp = Date.now();
67
67
  const content = this.constructContent(data);
68
68
  const change = (0, change_utils_1.getChange)(data.variant, timestamp, content, "appdescr_ui5_addNewModel" /* ChangeType.ADD_NEW_MODEL */);
69
- (0, change_utils_1.writeChangeToFolder)(this.projectPath, change, this.fs);
69
+ await (0, change_utils_1.writeChangeToFolder)(this.projectPath, change, this.fs);
70
70
  }
71
71
  }
72
72
  exports.NewModelWriter = NewModelWriter;
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.9",
12
+ "version": "0.18.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.24.3",
40
40
  "@sap-ux/btp-utils": "1.1.5",
41
41
  "@sap-ux/i18n": "0.3.5",
42
- "@sap-ux/inquirer-common": "0.9.7",
42
+ "@sap-ux/inquirer-common": "0.9.8",
43
43
  "@sap-ux/logger": "0.7.1",
44
44
  "@sap-ux/nodejs-utils": "0.2.8",
45
- "@sap-ux/odata-service-writer": "0.27.31",
46
- "@sap-ux/project-access": "1.32.10",
47
- "@sap-ux/project-input-validator": "0.6.32",
45
+ "@sap-ux/odata-service-writer": "0.27.32",
46
+ "@sap-ux/project-access": "1.32.11",
47
+ "@sap-ux/project-input-validator": "0.6.33",
48
48
  "@sap-ux/store": "1.3.3",
49
49
  "@sap-ux/system-access": "0.6.29",
50
50
  "@sap-ux/ui5-config": "0.29.10",