Minor cleanups
This commit is contained in:
@@ -1,41 +0,0 @@
|
||||
const deploy = require("@sap/cds/lib/deploy");
|
||||
|
||||
// TODO: https://github.wdf.sap.corp/cdx/cds/pull/1949
|
||||
|
||||
/*
|
||||
const DEBUG = (...args) => console.log(...args);
|
||||
|
||||
deploy.exclude_external_entities_in = function (csn, _bound) {
|
||||
// NOSONAR
|
||||
for (let [each, { service = each, model, credentials }] of Object.entries(
|
||||
cds.requires
|
||||
)) {
|
||||
if (!model) continue; //> not for internal services like cds.requires.odata
|
||||
if (_bound && !credentials) continue;
|
||||
DEBUG && DEBUG("excluding external entities for", service, "...");
|
||||
const prefix = service + ".";
|
||||
for (let each in csn.definitions) {
|
||||
if (each.startsWith(prefix)) {
|
||||
DEBUG && DEBUG("excluding external entity", each);
|
||||
_exclude(each);
|
||||
}
|
||||
}
|
||||
}
|
||||
return csn;
|
||||
|
||||
function _exclude(each) {
|
||||
const def = csn.definitions[each];
|
||||
if (def.kind !== "entity") return;
|
||||
def["@cds.persistence.skip"] = true;
|
||||
// propagate to all views...
|
||||
for (let other in csn.definitions) {
|
||||
const d = csn.definitions[other];
|
||||
// do not exclude replica table
|
||||
if (d["@cds.persistence.table"] === true) continue;
|
||||
const p = (d.query && d.query.SELECT) || d.projection;
|
||||
if (p && p.from.ref && p.from.ref[0] === each) _exclude(other);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
*/
|
||||
@@ -1,9 +1,3 @@
|
||||
const cds = require ('@sap/cds')
|
||||
|
||||
console.log("serverjs")
|
||||
|
||||
require('./monkey-patch');
|
||||
|
||||
cds.once('served', require('./srv/mashup'))
|
||||
|
||||
module.exports = cds.server
|
||||
|
||||
@@ -5,7 +5,6 @@ module.exports = cds.service.impl(function () {
|
||||
|
||||
// https://api.sap.com/event/SAPS4HANACloudBusinessEvents_BusinessPartner/resource
|
||||
this.after('UPDATE', A_BusinessPartner, async data => {
|
||||
console.log(`>>> BusinessPartner updated ${data.BusinessPartner}`);
|
||||
await this.emit("BusinessPartner.Changed", { BusinessPartner: data.BusinessPartner });
|
||||
});
|
||||
});
|
||||
|
||||
@@ -77,9 +77,9 @@ extend projection CatalogService.ListOfBooks with {
|
||||
supplier.name as supplier
|
||||
}
|
||||
|
||||
// Extend S4 service with not modelled event
|
||||
// Extend S4 service with an event (events are not included in EDMX files)
|
||||
extend service S4 {
|
||||
@topic: 'BusinessPartner/Changed'
|
||||
@type: 'sap.s4.beh.businesspartner.v1.BusinessPartner.Changed.v1'
|
||||
event BusinessPartner.Changed {
|
||||
BusinessPartner: String(10);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user