@trusthab/composable-resources
Version:
migrating https://github.com/knetikmedia/hab-api/tree/integration/app/resources/composable
58 lines (50 loc) • 1.04 kB
JavaScript
const composer = require('../mixin_loader');
module.exports = (App) => {
const { underscore } = require('inflected');
class LogItemResource {
static mixins() {
return [
// Functionality
'Validatable',
'Templatable',
// ORMish
'Persistable',
'CloudWatchPersistence'
];
}
static fields() {
return {
source: {
weight: 1,
type: 'text'
},
severity: {
weight: 2,
type: 'text'
},
timestamp: {
weight: 3,
type: 'text'
},
request_id: {
weight: 5,
type: 'text',
or: ['null'],
get_method: 'getRequestId'
},
message: {
weight: 6,
type: 'text'
},
meta: {
weight: 7,
type: 'object'
}
};
}
getRequestId() {
return this._delegate.request_id || App.request_id;
}
}
return composer(LogItemResource, App);
};