SAP-BTP-Spielwiese/app1/node_modules/@sap/audit-logging/lib/v2/DataModificationMessage.js
Markus Rettig 775ac7b58c completed step 3 from the tutorial
you must login with an BTP account in order to see the app
2024-02-08 16:13:36 +01:00

37 lines
1.4 KiB
JavaScript

'use strict';
var utils = require('../utils');
var common = require('./common');
var DataModificationBase = require('../base-messages/DataModificationBase');
module.exports = DataModificationMessage;
function DataModificationMessage(content, transport) {
DataModificationBase.call(this, content, transport);
}
require('util').inherits(DataModificationMessage, DataModificationBase);
DataModificationMessage.prototype.attribute = function (attribute) {
utils.validate.object(attribute, 'attribute');
utils.validate.notEmptyString(attribute.name, 'attribute name');
utils.validate.attributeName(this._content.attributes, attribute.name);
if (attribute.old !== undefined || attribute.new !== undefined) {
utils.validate.string(attribute.old, 'attribute old value');
utils.validate.string(attribute.new, 'attribute new value');
}
this._content.attributes.push(attribute);
return this;
};
DataModificationMessage.prototype._validateContent = function () {
DataModificationBase.prototype._validateContent.call(this);
utils.validate.provided(this._content['data_subject'], 'data-subject');
};
DataModificationMessage.prototype.dataSubject = common.dataSubject;
DataModificationMessage.prototype.logPrepare = common.logPrepare;
DataModificationMessage.prototype.logSuccess = common.logSuccess;
DataModificationMessage.prototype.logFailure = common.logFailure;