@sap-ux/odata-service-writer 0.27.2 → 0.27.4
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/manifest.js +4 -2
- package/dist/index.js +2 -2
- package/dist/update.d.ts +2 -1
- package/dist/update.js +19 -16
- package/package.json +1 -1
package/dist/data/manifest.js
CHANGED
|
@@ -290,13 +290,15 @@ async function addMultipleServiceSupportToManifest(webappPath, manifest, fs) {
|
|
|
290
290
|
const dataSources = manifest?.['sap.app']?.dataSources;
|
|
291
291
|
for (const dataSourceKey in dataSources) {
|
|
292
292
|
const dataSource = dataSources[dataSourceKey];
|
|
293
|
-
if (dataSource.type === 'OData') {
|
|
293
|
+
if (dataSource && dataSource.type === 'OData') {
|
|
294
294
|
convertSingleService(webappPath, dataSourceKey, dataSource, fs);
|
|
295
295
|
const annotations = dataSource.settings?.annotations;
|
|
296
296
|
if (annotations) {
|
|
297
297
|
annotations.forEach((annotationName) => {
|
|
298
298
|
const annotationDataSource = dataSources[annotationName];
|
|
299
|
-
|
|
299
|
+
if (annotationDataSource) {
|
|
300
|
+
convertSingleService(webappPath, dataSourceKey, annotationDataSource, fs);
|
|
301
|
+
}
|
|
300
302
|
});
|
|
301
303
|
}
|
|
302
304
|
}
|
package/dist/index.js
CHANGED
|
@@ -113,8 +113,8 @@ async function update(basePath, service, fs, updateMiddlewares = true) {
|
|
|
113
113
|
const isServiceTypeEdmx = service.type === types_1.ServiceType.EDMX;
|
|
114
114
|
await (0, manifest_1.updateManifest)(basePath, service, fs, true);
|
|
115
115
|
// Dont extend/update backend and mockserver middlewares if service type is CDS
|
|
116
|
-
if (isServiceTypeEdmx
|
|
117
|
-
await (0, update_1.updateServicesData)(basePath, paths, service, fs);
|
|
116
|
+
if (isServiceTypeEdmx) {
|
|
117
|
+
await (0, update_1.updateServicesData)(basePath, paths, service, fs, updateMiddlewares);
|
|
118
118
|
}
|
|
119
119
|
return fs;
|
|
120
120
|
}
|
package/dist/update.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export declare function addServicesData(basePath: string, paths: ProjectPaths, t
|
|
|
20
20
|
* @param {ProjectPaths} paths - paths to the project files (package.json, ui5.yaml, ui5-local.yaml and ui5-mock.yaml)
|
|
21
21
|
* @param {EdmxOdataService} service - the OData service instance
|
|
22
22
|
* @param {Editor} fs - the memfs editor instance
|
|
23
|
+
* @param {boolean} updateMiddlewares - whether the YAML files for the service (mock-server and fiori-tools-proxy middlewares) should be updated
|
|
23
24
|
*/
|
|
24
|
-
export declare function updateServicesData(basePath: string, paths: ProjectPaths, service: EdmxOdataService, fs: Editor): Promise<void>;
|
|
25
|
+
export declare function updateServicesData(basePath: string, paths: ProjectPaths, service: EdmxOdataService, fs: Editor, updateMiddlewares: boolean): Promise<void>;
|
|
25
26
|
//# sourceMappingURL=update.d.ts.map
|
package/dist/update.js
CHANGED
|
@@ -104,7 +104,7 @@ async function addServicesData(basePath, paths, templateRoot, service, fs) {
|
|
|
104
104
|
}
|
|
105
105
|
await (0, annotations_1.writeLocalServiceAnnotationXMLFiles)(fs, webappPath, templateRoot, service);
|
|
106
106
|
}
|
|
107
|
-
// service update should not
|
|
107
|
+
// Service is being added - update the package.json update as well, service update should not run the updates of the package.json
|
|
108
108
|
if (paths.packageJson && paths.ui5Yaml) {
|
|
109
109
|
(0, package_1.updatePackageJson)(paths.packageJson, fs, !!service.metadata);
|
|
110
110
|
}
|
|
@@ -121,26 +121,29 @@ async function addServicesData(basePath, paths, templateRoot, service, fs) {
|
|
|
121
121
|
* @param {ProjectPaths} paths - paths to the project files (package.json, ui5.yaml, ui5-local.yaml and ui5-mock.yaml)
|
|
122
122
|
* @param {EdmxOdataService} service - the OData service instance
|
|
123
123
|
* @param {Editor} fs - the memfs editor instance
|
|
124
|
+
* @param {boolean} updateMiddlewares - whether the YAML files for the service (mock-server and fiori-tools-proxy middlewares) should be updated
|
|
124
125
|
*/
|
|
125
|
-
async function updateServicesData(basePath, paths, service, fs) {
|
|
126
|
+
async function updateServicesData(basePath, paths, service, fs, updateMiddlewares) {
|
|
126
127
|
let ui5Config;
|
|
127
128
|
let ui5LocalConfig;
|
|
128
129
|
let ui5MockConfig;
|
|
129
|
-
if (
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
130
|
+
if (updateMiddlewares) {
|
|
131
|
+
if (paths.ui5Yaml) {
|
|
132
|
+
ui5Config = await ui5_config_1.UI5Config.newInstance(fs.read(paths.ui5Yaml));
|
|
133
|
+
// Update ui5.yaml with backend middleware
|
|
134
|
+
extendBackendMiddleware(fs, service, ui5Config, paths.ui5Yaml, true);
|
|
135
|
+
}
|
|
136
|
+
// Update ui5-local.yaml with backend middleware
|
|
137
|
+
if (paths.ui5LocalYaml) {
|
|
138
|
+
ui5LocalConfig = await ui5_config_1.UI5Config.newInstance(fs.read(paths.ui5LocalYaml));
|
|
139
|
+
extendBackendMiddleware(fs, service, ui5LocalConfig, paths.ui5LocalYaml, true);
|
|
140
|
+
}
|
|
138
141
|
}
|
|
139
142
|
// For update, updatable files should already exist
|
|
140
143
|
if (service.metadata) {
|
|
141
144
|
const webappPath = await (0, project_access_1.getWebappPath)(basePath, fs);
|
|
142
145
|
// Generate mockserver only when ui5-mock.yaml already exists
|
|
143
|
-
if (paths.ui5MockYaml && paths.ui5Yaml && ui5Config) {
|
|
146
|
+
if (paths.ui5MockYaml && paths.ui5Yaml && ui5Config && updateMiddlewares) {
|
|
144
147
|
const config = {
|
|
145
148
|
webappPath: webappPath,
|
|
146
149
|
// Since ui5-mock.yaml already exists, set 'skip' to skip package.json file updates
|
|
@@ -161,14 +164,14 @@ async function updateServicesData(basePath, paths, service, fs) {
|
|
|
161
164
|
ui5MockConfig = await ui5_config_1.UI5Config.newInstance(fs.read(paths.ui5MockYaml));
|
|
162
165
|
extendBackendMiddleware(fs, service, ui5MockConfig, paths.ui5MockYaml, true);
|
|
163
166
|
}
|
|
164
|
-
if (paths.ui5LocalYaml && ui5LocalConfig) {
|
|
165
|
-
// write ui5 local yaml if service type is not CDS
|
|
166
|
-
fs.write(paths.ui5LocalYaml, ui5LocalConfig.toString());
|
|
167
|
-
}
|
|
168
167
|
}
|
|
169
168
|
// Write metadata.xml file
|
|
170
169
|
await (0, annotations_1.writeMetadata)(fs, webappPath, service);
|
|
171
170
|
}
|
|
171
|
+
if (paths.ui5LocalYaml && ui5LocalConfig) {
|
|
172
|
+
// write ui5 local yaml if service type is not CDS
|
|
173
|
+
fs.write(paths.ui5LocalYaml, ui5LocalConfig.toString());
|
|
174
|
+
}
|
|
172
175
|
// Write new annotations files
|
|
173
176
|
await (0, annotations_1.writeRemoteServiceAnnotationXmlFiles)(fs, basePath, service.name ?? 'mainService', service.annotations);
|
|
174
177
|
}
|
package/package.json
CHANGED