@flowfuse/flowfuse
Version:
An open source low-code development platform
22 lines (21 loc) • 636 B
JavaScript
module.exports = {
clean: function (app, topic) {
const result = topic.toJSON()
const cleaned = {
id: result.hashid,
topic: result.topic,
metadata: result.metadata || { },
inferredSchema: result.inferredSchema ? JSON.parse(result.inferredSchema) : undefined,
timestamp: Date.parse(result.updatedAt)
}
return cleaned
},
cleanList: function (app, list) {
const filtered = []
list.topics.forEach(t => {
filtered.push(this.clean(app, t))
})
list.topics = filtered
return list
}
}