control-freak-ide/server/nodejs/_build/di/extra/timestamp.js
plastic-hub-dev-node-saturn 538369cff7 latest
2021-05-12 18:35:18 +02:00

28 lines
905 B
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("../core");
/**
* Normalize the result { ok: 1, result: '', message: '' }
* @returns {(target:Object, propertyKey:(string|symbol), descriptor?:PropertyDescriptor)=>void}
*/
function timestamp() {
return core_1.decorateClassMember(new TimestampAttribute());
}
exports.timestamp = timestamp;
class TimestampAttribute {
constructor() { }
beforeDecorate(target, targetKey, descriptor) {
return true;
}
getInterceptor() {
return this;
}
intercept(invocation, parameters) {
const value = invocation.invoke(parameters);
// update timestamp field with current datetime
Reflect.set(invocation.target, 'timestamp', Date.now());
return value;
}
}
exports.TimestampAttribute = TimestampAttribute;
//# sourceMappingURL=timestamp.js.map