From dd28bd04f68de4e3416bb9f5e81478d8424ace7c Mon Sep 17 00:00:00 2001 From: Uwe Klinger Date: Wed, 9 Jun 2021 07:44:18 +0200 Subject: [PATCH] Minor cleanups --- suppliers/monkey-patch.js | 41 ------------------- suppliers/server.js | 6 --- .../srv/external/API_BUSINESS_PARTNER.js | 1 - suppliers/srv/mashup.cds | 4 +- 4 files changed, 2 insertions(+), 50 deletions(-) delete mode 100644 suppliers/monkey-patch.js diff --git a/suppliers/monkey-patch.js b/suppliers/monkey-patch.js deleted file mode 100644 index 0696705d..00000000 --- a/suppliers/monkey-patch.js +++ /dev/null @@ -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); - } - } -}; - -*/ \ No newline at end of file diff --git a/suppliers/server.js b/suppliers/server.js index ed3ff51e..2e8cbb64 100644 --- a/suppliers/server.js +++ b/suppliers/server.js @@ -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 diff --git a/suppliers/srv/external/API_BUSINESS_PARTNER.js b/suppliers/srv/external/API_BUSINESS_PARTNER.js index d770c612..0121884d 100644 --- a/suppliers/srv/external/API_BUSINESS_PARTNER.js +++ b/suppliers/srv/external/API_BUSINESS_PARTNER.js @@ -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 }); }); }); diff --git a/suppliers/srv/mashup.cds b/suppliers/srv/mashup.cds index 89729536..b31ce5c9 100644 --- a/suppliers/srv/mashup.cds +++ b/suppliers/srv/mashup.cds @@ -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); }