@sap-ux/odata-service-writer 0.26.2 → 0.26.3
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/data/annotations.d.ts +8 -0
- package/dist/data/annotations.js +16 -2
- package/dist/update.js +2 -0
- package/package.json +1 -1
|
@@ -30,6 +30,14 @@ export declare function removeAnnotationsFromCDSFiles(annotations: CdsAnnotation
|
|
|
30
30
|
* @param {OdataService} service - the OData service instance with EDMX type
|
|
31
31
|
*/
|
|
32
32
|
export declare function writeLocalServiceAnnotationXMLFiles(fs: Editor, basePath: string, webappPath: string, templateRoot: string, service: EdmxOdataService): Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
* Writes local copy of metadata.xml.
|
|
35
|
+
*
|
|
36
|
+
* @param {Editor} fs - the memfs editor instance
|
|
37
|
+
* @param {string} webappPath - the webapp path of an existing UI5 application
|
|
38
|
+
* @param {OdataService} service - the OData service instance with EDMX type
|
|
39
|
+
*/
|
|
40
|
+
export declare function writeMetadata(fs: Editor, webappPath: string, service: EdmxOdataService): Promise<void>;
|
|
33
41
|
/**
|
|
34
42
|
* Removes annotation XML files for EDMX annotations.
|
|
35
43
|
*
|
package/dist/data/annotations.js
CHANGED
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.updateCdsFilesWithAnnotations = updateCdsFilesWithAnnotations;
|
|
7
7
|
exports.removeAnnotationsFromCDSFiles = removeAnnotationsFromCDSFiles;
|
|
8
8
|
exports.writeLocalServiceAnnotationXMLFiles = writeLocalServiceAnnotationXMLFiles;
|
|
9
|
+
exports.writeMetadata = writeMetadata;
|
|
9
10
|
exports.removeRemoteServiceAnnotationXmlFiles = removeRemoteServiceAnnotationXmlFiles;
|
|
10
11
|
exports.writeRemoteServiceAnnotationXmlFiles = writeRemoteServiceAnnotationXmlFiles;
|
|
11
12
|
exports.getAnnotationNamespaces = getAnnotationNamespaces;
|
|
@@ -147,14 +148,27 @@ async function removeAnnotationsFromCDSFiles(annotations, fs) {
|
|
|
147
148
|
* @param {OdataService} service - the OData service instance with EDMX type
|
|
148
149
|
*/
|
|
149
150
|
async function writeLocalServiceAnnotationXMLFiles(fs, basePath, webappPath, templateRoot, service) {
|
|
150
|
-
//
|
|
151
|
-
fs
|
|
151
|
+
// Write metadata.xml file
|
|
152
|
+
await writeMetadata(fs, webappPath, service);
|
|
152
153
|
// Adds local annotations to datasources section of manifest.json and writes the annotations file
|
|
153
154
|
if (service.localAnnotationsName) {
|
|
154
155
|
const namespaces = getAnnotationNamespaces(service);
|
|
155
156
|
fs.copyTpl((0, path_1.join)(templateRoot, 'add', 'annotation.xml'), (0, path_1.join)(basePath, 'webapp', 'annotations', `${service.localAnnotationsName}.xml`), { ...service, namespaces });
|
|
156
157
|
}
|
|
157
158
|
}
|
|
159
|
+
/**
|
|
160
|
+
* Writes local copy of metadata.xml.
|
|
161
|
+
*
|
|
162
|
+
* @param {Editor} fs - the memfs editor instance
|
|
163
|
+
* @param {string} webappPath - the webapp path of an existing UI5 application
|
|
164
|
+
* @param {OdataService} service - the OData service instance with EDMX type
|
|
165
|
+
*/
|
|
166
|
+
async function writeMetadata(fs, webappPath, service) {
|
|
167
|
+
if (service.metadata) {
|
|
168
|
+
// mainService should be used in case there is no name defined for service
|
|
169
|
+
fs.write((0, path_1.join)(webappPath, 'localService', service.name ?? 'mainService', 'metadata.xml'), (0, prettify_xml_1.default)(service.metadata, { indent: 4 }));
|
|
170
|
+
}
|
|
171
|
+
}
|
|
158
172
|
/**
|
|
159
173
|
* Removes annotation XML files for EDMX annotations.
|
|
160
174
|
*
|
package/dist/update.js
CHANGED
|
@@ -151,6 +151,8 @@ async function updateServicesData(basePath, paths, service, fs) {
|
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
|
+
// Write metadata.xml file
|
|
155
|
+
await (0, annotations_1.writeMetadata)(fs, webappPath, service);
|
|
154
156
|
}
|
|
155
157
|
// Write new annotations files
|
|
156
158
|
(0, annotations_1.writeRemoteServiceAnnotationXmlFiles)(fs, basePath, service.name ?? 'mainService', service.annotations);
|
package/package.json
CHANGED