@sap-ux/adp-tooling 0.9.7 → 0.9.8

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.
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getGenericChange = exports.findChangeWithInboundId = exports.getParsedPropertyValue = exports.parseStringToObject = exports.writeChangeToFile = exports.writeChangeToFolder = exports.writeAnnotationChange = void 0;
7
7
  const path_1 = __importDefault(require("path"));
8
8
  const fs_1 = require("fs");
9
+ const project_access_1 = require("@sap-ux/project-access");
9
10
  /**
10
11
  * Writes annotation changes to the specified project path using the provided `mem-fs-editor` instance.
11
12
  *
@@ -20,9 +21,9 @@ function writeAnnotationChange(projectPath, data, change, fs) {
20
21
  try {
21
22
  const { timestamp, annotation } = data;
22
23
  const changeFileName = `id_${timestamp}_addAnnotationsToOData.change`;
23
- const changesFolderPath = path_1.default.join(projectPath, "webapp" /* FolderTypes.WEBAPP */, "changes" /* FolderTypes.CHANGES */);
24
- const changeFilePath = path_1.default.join(changesFolderPath, "manifest" /* FolderTypes.MANIFEST */, changeFileName);
25
- const annotationsFolderPath = path_1.default.join(changesFolderPath, "annotations" /* FolderTypes.ANNOTATIONS */);
24
+ const changesFolderPath = path_1.default.join(projectPath, project_access_1.DirName.Webapp, project_access_1.DirName.Changes);
25
+ const changeFilePath = path_1.default.join(changesFolderPath, project_access_1.DirName.Manifest, changeFileName);
26
+ const annotationsFolderPath = path_1.default.join(changesFolderPath, project_access_1.DirName.Annotations);
26
27
  writeChangeToFile(changeFilePath, change, fs);
27
28
  if (!annotation.filePath) {
28
29
  fs.write(path_1.default.join(annotationsFolderPath, (_a = annotation.fileName) !== null && _a !== void 0 ? _a : ''), '');
@@ -53,7 +54,7 @@ exports.writeAnnotationChange = writeAnnotationChange;
53
54
  */
54
55
  function writeChangeToFolder(projectPath, change, fileName, fs, dir = '') {
55
56
  try {
56
- let targetFolderPath = path_1.default.join(projectPath, "webapp" /* FolderTypes.WEBAPP */, "changes" /* FolderTypes.CHANGES */);
57
+ let targetFolderPath = path_1.default.join(projectPath, project_access_1.DirName.Webapp, project_access_1.DirName.Changes);
57
58
  if (dir) {
58
59
  targetFolderPath = path_1.default.join(targetFolderPath, dir);
59
60
  }
@@ -129,7 +130,7 @@ function findChangeWithInboundId(projectPath, inboundId) {
129
130
  var _a;
130
131
  let changeObj;
131
132
  let filePath = '';
132
- const pathToInboundChangeFiles = path_1.default.join(projectPath, "webapp" /* FolderTypes.WEBAPP */, "changes" /* FolderTypes.CHANGES */, "manifest" /* FolderTypes.MANIFEST */);
133
+ const pathToInboundChangeFiles = path_1.default.join(projectPath, project_access_1.DirName.Webapp, project_access_1.DirName.Changes, project_access_1.DirName.Manifest);
133
134
  if (!(0, fs_1.existsSync)(pathToInboundChangeFiles)) {
134
135
  return {
135
136
  filePath,
@@ -172,7 +173,7 @@ function getGenericChange(data, content, changeType) {
172
173
  const fileName = `id_${timestamp}`;
173
174
  return {
174
175
  fileName,
175
- namespace: path_1.default.posix.join(projectData.namespace, "changes" /* FolderTypes.CHANGES */),
176
+ namespace: path_1.default.posix.join(projectData.namespace, project_access_1.DirName.Changes),
176
177
  layer: projectData.layer,
177
178
  fileType: 'change',
178
179
  creation: new Date(timestamp).toISOString(),
@@ -40,6 +40,7 @@ const os = __importStar(require("os"));
40
40
  const path = __importStar(require("path"));
41
41
  const ejs_1 = require("ejs");
42
42
  const sanitize_filename_1 = __importDefault(require("sanitize-filename"));
43
+ const project_access_1 = require("@sap-ux/project-access");
43
44
  /**
44
45
  * @description Handles API Routes
45
46
  */
@@ -95,7 +96,7 @@ class RoutesHandler {
95
96
  this.logger.debug('Bad request. Fragment name was not provided!');
96
97
  return;
97
98
  }
98
- const fullPath = path.join(sourcePath, "changes" /* FolderTypes.CHANGES */, "fragments" /* FolderTypes.FRAGMENTS */);
99
+ const fullPath = path.join(sourcePath, project_access_1.DirName.Changes, project_access_1.DirName.Fragments);
99
100
  const filePath = path.join(fullPath, `${fragmentName}.fragment.xml`);
100
101
  if (!fs.existsSync(fullPath)) {
101
102
  fs.mkdirSync(fullPath, { recursive: true });
@@ -161,7 +162,7 @@ class RoutesHandler {
161
162
  const project = this.util.getProject();
162
163
  const sourcePath = project.getSourcePath();
163
164
  const projectName = project.getName();
164
- const getPath = (projectPath, fileName, folder = "coding" /* FolderTypes.CODING */) => path.join(projectPath, "changes" /* FolderTypes.CHANGES */, folder, fileName).split(path.sep).join(path.posix.sep);
165
+ const getPath = (projectPath, fileName, folder = project_access_1.DirName.Coding) => path.join(projectPath, project_access_1.DirName.Changes, folder, fileName).split(path.sep).join(path.posix.sep);
165
166
  for (const file of codeExtFiles) {
166
167
  const fileStr = yield file.getString();
167
168
  const change = JSON.parse(fileStr);
@@ -211,7 +212,7 @@ class RoutesHandler {
211
212
  this.logger.debug('Bad request. Controller extension name was not provided!');
212
213
  return;
213
214
  }
214
- const fullPath = path.join(sourcePath, "changes" /* FolderTypes.CHANGES */, "coding" /* FolderTypes.CODING */);
215
+ const fullPath = path.join(sourcePath, project_access_1.DirName.Changes, project_access_1.DirName.Coding);
215
216
  const filePath = path.join(fullPath, `${controllerExtName}.js`);
216
217
  if (!fs.existsSync(fullPath)) {
217
218
  fs.mkdirSync(fullPath, { recursive: true });
package/dist/types.d.ts CHANGED
@@ -117,14 +117,6 @@ export interface CodeExtChange extends CommonChangeProperties {
117
117
  controllerName: string;
118
118
  };
119
119
  }
120
- export declare const enum FolderTypes {
121
- CHANGES = "changes",
122
- FRAGMENTS = "fragments",
123
- CODING = "coding",
124
- MANIFEST = "manifest",
125
- ANNOTATIONS = "annotations",
126
- WEBAPP = "webapp"
127
- }
128
120
  export declare const enum TemplateFileName {
129
121
  Fragment = "fragment.xml",
130
122
  Controller = "controller.ejs"
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.ComponentUsagesWriter = void 0;
13
+ const project_access_1 = require("@sap-ux/project-access");
13
14
  const change_utils_1 = require("../../../base/change-utils");
14
15
  /**
15
16
  * Handles the creation and writing of component usages data changes for a project.
@@ -74,11 +75,11 @@ class ComponentUsagesWriter {
74
75
  const libRefContent = this.constructLibContent(data);
75
76
  const shouldAddLibRef = libRefContent !== undefined;
76
77
  const compUsagesChange = (0, change_utils_1.getGenericChange)(data, componentUsagesContent, "appdescr_ui5_addComponentUsages" /* ChangeType.ADD_COMPONENT_USAGES */);
77
- (0, change_utils_1.writeChangeToFolder)(this.projectPath, compUsagesChange, `id_${data.timestamp}_addComponentUsages.change`, this.fs, "manifest" /* FolderTypes.MANIFEST */);
78
+ (0, change_utils_1.writeChangeToFolder)(this.projectPath, compUsagesChange, `id_${data.timestamp}_addComponentUsages.change`, this.fs, project_access_1.DirName.Manifest);
78
79
  if (shouldAddLibRef) {
79
80
  data.timestamp += 1;
80
81
  const refLibChange = (0, change_utils_1.getGenericChange)(data, libRefContent, "appdescr_ui5_addLibraries" /* ChangeType.ADD_LIBRARY_REFERENCE */);
81
- (0, change_utils_1.writeChangeToFolder)(this.projectPath, refLibChange, `id_${data.timestamp}_addLibraries.change`, this.fs, "manifest" /* FolderTypes.MANIFEST */);
82
+ (0, change_utils_1.writeChangeToFolder)(this.projectPath, refLibChange, `id_${data.timestamp}_addLibraries.change`, this.fs, project_access_1.DirName.Manifest);
82
83
  }
83
84
  });
84
85
  }
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.DataSourceWriter = void 0;
13
+ const project_access_1 = require("@sap-ux/project-access");
13
14
  const change_utils_1 = require("../../../base/change-utils");
14
15
  /**
15
16
  * Handles the creation and writing of data source data changes for a project.
@@ -62,13 +63,13 @@ class DataSourceWriter {
62
63
  const { dataSourcesDictionary, service } = data;
63
64
  const content = this.constructContent(service.name, service.uri, service.maxAge);
64
65
  const change = (0, change_utils_1.getGenericChange)(data, content, "appdescr_app_changeDataSource" /* ChangeType.CHANGE_DATA_SOURCE */);
65
- (0, change_utils_1.writeChangeToFolder)(this.projectPath, change, `id_${data.timestamp}_changeDataSource.change`, this.fs, "manifest" /* FolderTypes.MANIFEST */);
66
+ (0, change_utils_1.writeChangeToFolder)(this.projectPath, change, `id_${data.timestamp}_changeDataSource.change`, this.fs, project_access_1.DirName.Manifest);
66
67
  const shouldAddAnnotation = service.annotationUri && service.annotationUri.length > 0;
67
68
  if (shouldAddAnnotation) {
68
69
  data.timestamp += 1;
69
70
  const annotationContent = this.constructContent(dataSourcesDictionary[service.name], service.annotationUri);
70
71
  const annotationChange = (0, change_utils_1.getGenericChange)(data, annotationContent, "appdescr_app_changeDataSource" /* ChangeType.CHANGE_DATA_SOURCE */);
71
- (0, change_utils_1.writeChangeToFolder)(this.projectPath, annotationChange, `id_${data.timestamp}_changeDataSource.change`, this.fs, "manifest" /* FolderTypes.MANIFEST */);
72
+ (0, change_utils_1.writeChangeToFolder)(this.projectPath, annotationChange, `id_${data.timestamp}_changeDataSource.change`, this.fs, project_access_1.DirName.Manifest);
72
73
  }
73
74
  });
74
75
  }
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.InboundWriter = void 0;
13
+ const project_access_1 = require("@sap-ux/project-access");
13
14
  const change_utils_1 = require("../../../base/change-utils");
14
15
  /**
15
16
  * Handles the creation and writing of inbound data changes for a project.
@@ -96,7 +97,7 @@ class InboundWriter {
96
97
  if (!changeWithInboundId) {
97
98
  const content = this.constructContent(answers);
98
99
  const change = (0, change_utils_1.getGenericChange)(data, content, "appdescr_app_changeInbound" /* ChangeType.CHANGE_INBOUND */);
99
- (0, change_utils_1.writeChangeToFolder)(this.projectPath, change, `id_${data.timestamp}_changeInbound.change`, this.fs, "manifest" /* FolderTypes.MANIFEST */);
100
+ (0, change_utils_1.writeChangeToFolder)(this.projectPath, change, `id_${data.timestamp}_changeInbound.change`, this.fs, project_access_1.DirName.Manifest);
100
101
  }
101
102
  else {
102
103
  if (changeWithInboundId.content) {
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.NewModelWriter = void 0;
13
+ const project_access_1 = require("@sap-ux/project-access");
13
14
  const change_utils_1 = require("../../../base/change-utils");
14
15
  /**
15
16
  * Handles the creation and writing of new sapui5 model data changes for a project.
@@ -71,7 +72,7 @@ class NewModelWriter {
71
72
  return __awaiter(this, void 0, void 0, function* () {
72
73
  const content = this.constructContent(data);
73
74
  const change = (0, change_utils_1.getGenericChange)(data, content, "appdescr_ui5_addNewModel" /* ChangeType.ADD_NEW_MODEL */);
74
- (0, change_utils_1.writeChangeToFolder)(this.projectPath, change, `id_${data.timestamp}_addNewModel.change`, this.fs, "manifest" /* FolderTypes.MANIFEST */);
75
+ (0, change_utils_1.writeChangeToFolder)(this.projectPath, change, `id_${data.timestamp}_addNewModel.change`, this.fs, project_access_1.DirName.Manifest);
75
76
  });
76
77
  }
77
78
  }
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.9.7",
12
+ "version": "0.9.8",
13
13
  "license": "Apache-2.0",
14
14
  "author": "@SAP/ux-tools-team",
15
15
  "main": "dist/index.js",
@@ -30,6 +30,7 @@
30
30
  "prompts": "2.4.2",
31
31
  "adm-zip": "0.5.10",
32
32
  "@sap-ux/axios-extension": "1.11.4",
33
+ "@sap-ux/project-access": "1.19.6",
33
34
  "@sap-ux/logger": "0.5.1",
34
35
  "@sap-ux/system-access": "0.3.18",
35
36
  "@sap-ux/ui5-config": "0.22.1"
@@ -47,7 +48,6 @@
47
48
  "nock": "13.4.0",
48
49
  "rimraf": "5.0.5",
49
50
  "supertest": "6.3.3",
50
- "@sap-ux/project-access": "1.19.5",
51
51
  "@sap-ux/store": "0.5.0"
52
52
  },
53
53
  "engines": {