The frontend/UI server, written in JS using the MarkoJS library
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
const {query} = require("../client")
class Change { /** * @param {string} id * @param {string} model * @param {string} op * @param {string} author * @param {Date | string | number} date * @param {{model:string,id:string}[]} keys ' * @param {{type:string, [x:string]:any}[]} objects */ constructor(id, model, op, author, date, keys, objects) { this.id = id this.model = model this.op = op this.author = author this.date = date this.keys = keys this.objects = objects }
static fromData(data) { return new Change(data.id, data.model, data.op, data.author, data.date, data.keys, data.objects) } }
class ChangesAPI { /** * Call `channels(filter)` query * * @param {{limit:int, keys: {model:string,id:string}[]}} filter * @returns {Promise<Change[]>} */ list(filter = null) { return query(`
query ListChanges($filter:ChangesFilter) { changes(filter:$filter) { id model op author date keys { model id } objects { type: __typename ...on Character { id name }
...on Chapter { id title }
...on Story { id name }
...on Post { id time nick }
...on Comment { chapterId characterName } } } } `, {filter}).then(({changes}) => {
return changes.map(d => Change.fromData(d)) }) } }
module.exports = { Change, changesApi: new ChangesAPI }
|