@sap-ux/adp-tooling 0.15.4 → 0.15.6
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.
- package/dist/base/change-utils.d.ts +2 -1
- package/dist/base/change-utils.js +5 -2
- package/dist/base/helper.js +3 -31
- package/dist/writer/changes/writer-factory.d.ts +2 -1
- package/dist/writer/changes/writer-factory.js +5 -1
- package/dist/writer/changes/writers/annotations-writer.d.ts +5 -3
- package/dist/writer/changes/writers/annotations-writer.js +5 -2
- package/dist/writer/editors.d.ts +2 -1
- package/dist/writer/editors.js +3 -2
- package/package.json +2 -2
|
@@ -16,9 +16,10 @@ interface InboundChange extends ManifestChangeProperties {
|
|
|
16
16
|
* @param {AnnotationsData} annotation - The annotation data.
|
|
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
|
+
* @param {string} templatesPath - The path to the templates used for generating changes.
|
|
19
20
|
* @returns {void}
|
|
20
21
|
*/
|
|
21
|
-
export declare function writeAnnotationChange(projectPath: string, timestamp: number, annotation: AnnotationsData['annotation'], change: ManifestChangeProperties | undefined, fs: Editor): void;
|
|
22
|
+
export declare function writeAnnotationChange(projectPath: string, timestamp: number, annotation: AnnotationsData['annotation'], change: ManifestChangeProperties | undefined, fs: Editor, templatesPath?: string): void;
|
|
22
23
|
/**
|
|
23
24
|
* Writes a given change object to a file within a specified folder in the project's 'changes' directory.
|
|
24
25
|
* If an additional subdirectory is specified, the change file is written there.
|
|
@@ -24,9 +24,10 @@ const ejs_1 = require("ejs");
|
|
|
24
24
|
* @param {AnnotationsData} annotation - The annotation data.
|
|
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
|
+
* @param {string} templatesPath - The path to the templates used for generating changes.
|
|
27
28
|
* @returns {void}
|
|
28
29
|
*/
|
|
29
|
-
function writeAnnotationChange(projectPath, timestamp, annotation, change, fs) {
|
|
30
|
+
function writeAnnotationChange(projectPath, timestamp, annotation, change, fs, templatesPath) {
|
|
30
31
|
try {
|
|
31
32
|
const changesFolderPath = path_1.default.join(projectPath, project_access_1.DirName.Webapp, project_access_1.DirName.Changes);
|
|
32
33
|
const annotationsFolderPath = path_1.default.join(changesFolderPath, project_access_1.DirName.Annotations);
|
|
@@ -36,7 +37,9 @@ function writeAnnotationChange(projectPath, timestamp, annotation, change, fs) {
|
|
|
36
37
|
writeChangeToFile(changeFilePath, change, fs);
|
|
37
38
|
}
|
|
38
39
|
if (!annotation.filePath) {
|
|
39
|
-
const annotationsTemplate =
|
|
40
|
+
const annotationsTemplate = templatesPath
|
|
41
|
+
? path_1.default.join(templatesPath, 'changes', "annotation.xml" /* TemplateFileName.Annotation */)
|
|
42
|
+
: path_1.default.join(__dirname, '..', '..', 'templates', 'changes', "annotation.xml" /* TemplateFileName.Annotation */);
|
|
40
43
|
const { namespaces, serviceUrl } = annotation;
|
|
41
44
|
const schemaNamespace = `local_${timestamp}`;
|
|
42
45
|
(0, ejs_1.renderFile)(annotationsTemplate, { namespaces, path: serviceUrl, schemaNamespace }, {}, (err, str) => {
|
package/dist/base/helper.js
CHANGED
|
@@ -140,45 +140,17 @@ function filterAndMapInboundsToManifest(inbounds) {
|
|
|
140
140
|
return undefined;
|
|
141
141
|
}
|
|
142
142
|
const filteredInbounds = inbounds.reduce((acc, inbound) => {
|
|
143
|
-
// Skip if hideLauncher is
|
|
144
|
-
if (!inbound?.content || inbound.content.hideLauncher
|
|
143
|
+
// Skip if hideLauncher is true
|
|
144
|
+
if (!inbound?.content || inbound.content.hideLauncher === true) {
|
|
145
145
|
return acc;
|
|
146
146
|
}
|
|
147
|
-
const { semanticObject, action
|
|
147
|
+
const { semanticObject, action } = inbound.content;
|
|
148
148
|
if (semanticObject && action) {
|
|
149
149
|
const key = `${semanticObject}-${action}`;
|
|
150
|
-
// Temporary filtration of parameters to avoid issues with merged manifest until release of ABAP Platform Cloud 2508
|
|
151
|
-
if (signature?.parameters) {
|
|
152
|
-
filterIboundsParameters(signature);
|
|
153
|
-
}
|
|
154
150
|
acc[key] = inbound.content;
|
|
155
151
|
}
|
|
156
152
|
return acc;
|
|
157
153
|
}, {});
|
|
158
154
|
return Object.keys(filteredInbounds).length === 0 ? undefined : filteredInbounds;
|
|
159
155
|
}
|
|
160
|
-
/**
|
|
161
|
-
* Filters parameters of the inbound signature to remove invalid or incomplete entries.
|
|
162
|
-
*
|
|
163
|
-
* @param {ManifestNamespace.SignatureDef} inboundSinature - The inbound signature definition to filter.
|
|
164
|
-
*/
|
|
165
|
-
function filterIboundsParameters(inboundSinature) {
|
|
166
|
-
Object.keys(inboundSinature.parameters).forEach((paramKey) => {
|
|
167
|
-
const param = inboundSinature.parameters[paramKey];
|
|
168
|
-
if (param.defaultValue && (!param.defaultValue.format || !param.defaultValue.value)) {
|
|
169
|
-
delete inboundSinature.parameters[paramKey];
|
|
170
|
-
return;
|
|
171
|
-
}
|
|
172
|
-
if (param.filter && !param.filter.format) {
|
|
173
|
-
delete inboundSinature.parameters[paramKey].filter;
|
|
174
|
-
}
|
|
175
|
-
if (param.launcherValue) {
|
|
176
|
-
Object.keys(param.launcherValue).forEach((launcherKey) => {
|
|
177
|
-
if (launcherKey !== 'value') {
|
|
178
|
-
delete param.launcherValue[launcherKey];
|
|
179
|
-
}
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
156
|
//# sourceMappingURL=helper.js.map
|
|
@@ -12,9 +12,10 @@ export declare class WriterFactory {
|
|
|
12
12
|
* @param type - The type of the change which will be handled by the writer.
|
|
13
13
|
* @param fs - The filesystem editor instance.
|
|
14
14
|
* @param projectPath - The path to the project for which the writer is created.
|
|
15
|
+
* @param templatesPath - The path to the templates used for generating changes.
|
|
15
16
|
* @returns An instance of the writer associated with the specified generator type.
|
|
16
17
|
* @throws If the specified generator type is not supported.
|
|
17
18
|
*/
|
|
18
|
-
static createWriter<T extends ChangeType>(type: T, fs: Editor, projectPath: string): IWriterData<T>;
|
|
19
|
+
static createWriter<T extends ChangeType>(type: T, fs: Editor, projectPath: string, templatesPath?: string): IWriterData<T>;
|
|
19
20
|
}
|
|
20
21
|
//# sourceMappingURL=writer-factory.d.ts.map
|
|
@@ -20,14 +20,18 @@ class WriterFactory {
|
|
|
20
20
|
* @param type - The type of the change which will be handled by the writer.
|
|
21
21
|
* @param fs - The filesystem editor instance.
|
|
22
22
|
* @param projectPath - The path to the project for which the writer is created.
|
|
23
|
+
* @param templatesPath - The path to the templates used for generating changes.
|
|
23
24
|
* @returns An instance of the writer associated with the specified generator type.
|
|
24
25
|
* @throws If the specified generator type is not supported.
|
|
25
26
|
*/
|
|
26
|
-
static createWriter(type, fs, projectPath) {
|
|
27
|
+
static createWriter(type, fs, projectPath, templatesPath) {
|
|
27
28
|
const WriterClass = this.writers.get(type);
|
|
28
29
|
if (!WriterClass) {
|
|
29
30
|
throw new Error(`Unsupported generator type: ${type}`);
|
|
30
31
|
}
|
|
32
|
+
if (type === "appdescr_app_addAnnotationsToOData" /* ChangeType.ADD_ANNOTATIONS_TO_ODATA */) {
|
|
33
|
+
return new WriterClass(fs, projectPath, templatesPath);
|
|
34
|
+
}
|
|
31
35
|
return new WriterClass(fs, projectPath);
|
|
32
36
|
}
|
|
33
37
|
}
|
|
@@ -4,13 +4,15 @@ import { type IWriter, type AnnotationsData } from '../../../types';
|
|
|
4
4
|
* Handles the creation and writing of annotations data changes for a project.
|
|
5
5
|
*/
|
|
6
6
|
export declare class AnnotationsWriter implements IWriter<AnnotationsData> {
|
|
7
|
-
private fs;
|
|
8
|
-
private projectPath;
|
|
7
|
+
private readonly fs;
|
|
8
|
+
private readonly projectPath;
|
|
9
|
+
private readonly templatesPath?;
|
|
9
10
|
/**
|
|
10
11
|
* @param {Editor} fs - The filesystem editor instance.
|
|
11
12
|
* @param {string} projectPath - The root path of the project.
|
|
13
|
+
* @param {string} templatesPath - The path to the templates used for generating changes.
|
|
12
14
|
*/
|
|
13
|
-
constructor(fs: Editor, projectPath: string);
|
|
15
|
+
constructor(fs: Editor, projectPath: string, templatesPath?: string | undefined);
|
|
14
16
|
/**
|
|
15
17
|
* Constructs the content for an annotation change based on provided data.
|
|
16
18
|
*
|
|
@@ -42,13 +42,16 @@ const change_utils_1 = require("../../../base/change-utils");
|
|
|
42
42
|
class AnnotationsWriter {
|
|
43
43
|
fs;
|
|
44
44
|
projectPath;
|
|
45
|
+
templatesPath;
|
|
45
46
|
/**
|
|
46
47
|
* @param {Editor} fs - The filesystem editor instance.
|
|
47
48
|
* @param {string} projectPath - The root path of the project.
|
|
49
|
+
* @param {string} templatesPath - The path to the templates used for generating changes.
|
|
48
50
|
*/
|
|
49
|
-
constructor(fs, projectPath) {
|
|
51
|
+
constructor(fs, projectPath, templatesPath) {
|
|
50
52
|
this.fs = fs;
|
|
51
53
|
this.projectPath = projectPath;
|
|
54
|
+
this.templatesPath = templatesPath;
|
|
52
55
|
}
|
|
53
56
|
/**
|
|
54
57
|
* Constructs the content for an annotation change based on provided data.
|
|
@@ -104,7 +107,7 @@ class AnnotationsWriter {
|
|
|
104
107
|
if (data.isCommand) {
|
|
105
108
|
change = (0, change_utils_1.getChange)(variant, timestamp, content, "appdescr_app_addAnnotationsToOData" /* ChangeType.ADD_ANNOTATIONS_TO_ODATA */);
|
|
106
109
|
}
|
|
107
|
-
(0, change_utils_1.writeAnnotationChange)(this.projectPath, timestamp, data.annotation, change, this.fs);
|
|
110
|
+
(0, change_utils_1.writeAnnotationChange)(this.projectPath, timestamp, data.annotation, change, this.fs, this.templatesPath);
|
|
108
111
|
}
|
|
109
112
|
}
|
|
110
113
|
exports.AnnotationsWriter = AnnotationsWriter;
|
package/dist/writer/editors.d.ts
CHANGED
|
@@ -11,8 +11,9 @@ import type { GeneratorData, ChangeType } from '../types';
|
|
|
11
11
|
* @param {T} type - The type of generator.
|
|
12
12
|
* @param {GeneratorData<T>} data - The data specific to the type of generator, containing information necessary for making changes.
|
|
13
13
|
* @param {Editor | null} [fs] - The `mem-fs-editor` instance used for file operations.
|
|
14
|
+
* @param {string} templatesPath - The path to the templates used for generating changes.
|
|
14
15
|
* @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.
|
|
15
16
|
* @template T - A type parameter extending `ChangeType`, ensuring the function handles a defined set of generator types.
|
|
16
17
|
*/
|
|
17
|
-
export declare function generateChange<T extends ChangeType>(projectPath: string, type: T, data: GeneratorData<T>, fs?: Editor | null): Promise<Editor>;
|
|
18
|
+
export declare function generateChange<T extends ChangeType>(projectPath: string, type: T, data: GeneratorData<T>, fs?: Editor | null, templatesPath?: string): Promise<Editor>;
|
|
18
19
|
//# sourceMappingURL=editors.d.ts.map
|
package/dist/writer/editors.js
CHANGED
|
@@ -15,14 +15,15 @@ const writer_factory_1 = require("./changes/writer-factory");
|
|
|
15
15
|
* @param {T} type - The type of generator.
|
|
16
16
|
* @param {GeneratorData<T>} data - The data specific to the type of generator, containing information necessary for making changes.
|
|
17
17
|
* @param {Editor | null} [fs] - The `mem-fs-editor` instance used for file operations.
|
|
18
|
+
* @param {string} templatesPath - The path to the templates used for generating changes.
|
|
18
19
|
* @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.
|
|
19
20
|
* @template T - A type parameter extending `ChangeType`, ensuring the function handles a defined set of generator types.
|
|
20
21
|
*/
|
|
21
|
-
async function generateChange(projectPath, type, data, fs = null) {
|
|
22
|
+
async function generateChange(projectPath, type, data, fs = null, templatesPath) {
|
|
22
23
|
if (!fs) {
|
|
23
24
|
fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
|
|
24
25
|
}
|
|
25
|
-
const writer = writer_factory_1.WriterFactory.createWriter(type, fs, projectPath);
|
|
26
|
+
const writer = writer_factory_1.WriterFactory.createWriter(type, fs, projectPath, templatesPath);
|
|
26
27
|
await writer.write(data);
|
|
27
28
|
return fs;
|
|
28
29
|
}
|
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.15.
|
|
12
|
+
"version": "0.15.6",
|
|
13
13
|
"license": "Apache-2.0",
|
|
14
14
|
"author": "@SAP/ux-tools-team",
|
|
15
15
|
"main": "dist/index.js",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"format": "prettier --write '**/*.{js,json,ts,yaml,yml}' --ignore-path ../../.prettierignore",
|
|
76
76
|
"lint": "eslint . --ext .ts",
|
|
77
77
|
"lint:fix": "eslint . --ext .ts --fix",
|
|
78
|
-
"test": "cross-env FIORI_TOOLS_DISABLE_SECURE_STORE=true jest --ci --forceExit --detectOpenHandles --colors --
|
|
78
|
+
"test": "cross-env FIORI_TOOLS_DISABLE_SECURE_STORE=true jest --ci --forceExit --detectOpenHandles --colors --testPathPatterns=test/unit",
|
|
79
79
|
"test-u": "cross-env FIORI_TOOLS_DISABLE_SECURE_STORE=true jest --ci --forceExit --detectOpenHandles --colors -u",
|
|
80
80
|
"link": "pnpm link --global",
|
|
81
81
|
"unlink": "pnpm unlink --global"
|