The issues that we have are referring to the change tracking; however the difference to be reflected in the change history is being estimated in the utilities of node_modules/@sap/cds/libx/_runtime/common/utils.
We have an app:
App annotation app\payment\downstreamPaymentProcessors\annotations.cds
Entity CDS db\payment\paymentRails\DownstreamPaymentProcessors.cds
UI service CDS srv\payment\paymentRails\ui-service-downstreamPaymentProcessors.cds
UI service provider srv\payment\paymentRails\ui-service-downstreamPaymentProcessors.ts
Entity DownstreamPaymentProcessors has compositions to two views:
@title : '{i18n>Integration}'
@changelog: [Integration.name]
Integration : Association to one Integrations;
@title : '{i18n>ActivationStatus}'
@changelog: [ActivationStatus.name]
ActivationStatus : Association to one codelists.PaymentProcessorActivationStatusCodes;
callbackSupported : Boolean;
NetworkMappings : Composition of many DownstreamPaymentProcessorNetworkMappings
on NetworkMappings.contextObjectId = $self.ID;
CryptocurrencyMappings : Composition of many DownstreamPaymentProcessorCryptocurrencyMappings
on CryptocurrencyMappings.contextObjectId = $self.ID;
}
entity DownstreamPaymentProcessorNetworkMappings as
select from GeneralMappings {
*,
Network : Association to one Networks on Network.ID = sourceObjectId,
}
where
contextEntityType.code = 'PAYMENT_PROCESSOR'
and sourceEntityType.code = 'NETWORK';
entity DownstreamPaymentProcessorCryptocurrencyMappings as
select from GeneralMappings {
*,
Cryptocurrency : Association to one Cryptocurrencies on Cryptocurrency.ID = sourceObjectId,
}
where
contextEntityType.code = 'PAYMENT_PROCESSOR'
and sourceEntityType.code = 'CRYPTOCURRENCY';
These Mappings entities are also annotated for change tracking.
Although UI service entity is declared as draft enabled, all DB operations during SAVE event are fulfilled explicitly via wrapper service (srv\payment\wrapper\wrapper-service.cds).
The issue with the change history is:
Whenever a UI change is done on mappings (for example a new mapping is added) then the mappings which have existed so far are shown as if they were deleted (although they are not):
I tested also an alternative way and removed calling DB operations during SAVE – i.e. let drafts to be activated per standard draft handling (I did it in the branch mappings-change-history).
Then I saw that unlike the previous solution node_modules/@sap/cds/libx/_runtime/common/utils/comparejason.js did not get any old value to compare with the new one. Then mappings were marked with _op: 'create' – as if they were new.
Additional issue:
For the entity DownstreamPaymentProcessor some fields are shown as updated in every change log, although they were not changed:
Could you please help? We think that the issues began after upgrading the CDS version to CDS8 (we have 8.4.2 now).
Kind regards,
Elena Gurevitch
Hello colleagues!
We are working on the project https://github.tools.sap/erp4sme/crypto-for-business.
The issues that we have are referring to the change tracking; however the difference to be reflected in the change history is being estimated in the utilities of node_modules/@sap/cds/libx/_runtime/common/utils.
We have an app:
App annotation app\payment\downstreamPaymentProcessors\annotations.cds Entity CDS db\payment\paymentRails\DownstreamPaymentProcessors.cds UI service CDS srv\payment\paymentRails\ui-service-downstreamPaymentProcessors.cds UI service provider srv\payment\paymentRails\ui-service-downstreamPaymentProcessors.ts
Entity DownstreamPaymentProcessors has compositions to two views:
entity DownstreamPaymentProcessors : cuid, managed { @changelog @title : '{i18n>Name}' name : String;
} entity DownstreamPaymentProcessorNetworkMappings as select from GeneralMappings { *, Network : Association to one Networks on Network.ID = sourceObjectId, } where contextEntityType.code = 'PAYMENT_PROCESSOR' and sourceEntityType.code = 'NETWORK';
entity DownstreamPaymentProcessorCryptocurrencyMappings as select from GeneralMappings { *, Cryptocurrency : Association to one Cryptocurrencies on Cryptocurrency.ID = sourceObjectId, } where contextEntityType.code = 'PAYMENT_PROCESSOR' and sourceEntityType.code = 'CRYPTOCURRENCY';
These Mappings entities are also annotated for change tracking.
Although UI service entity is declared as draft enabled, all DB operations during SAVE event are fulfilled explicitly via wrapper service (srv\payment\wrapper\wrapper-service.cds).
Whenever a UI change is done on mappings (for example a new mapping is added) then the mappings which have existed so far are shown as if they were deleted (although they are not):
I saw: In node_modules/@sap/cds/libx/_runtime/common/utils/comparejason.js the function _addToBeDeletedEntriesToResult set _op: 'delete' on the mappings.
Could you please help? We think that the issues began after upgrading the CDS version to CDS8 (we have 8.4.2 now). Kind regards, Elena Gurevitch