let model = new models.Model<Post>({
    name: 'posts',
    sync: getPost(123),
    streams: [postEvents, commentEvents],
});

// define mutation functions
function updatePost(post: Post) {
    return async function() {
        await fetch(`/posts/${post.id}`, {
            method: "PUT",
            body: JSON.stringify(post),
        });
    }
}
// register the mutations on the model
model.NewMutation(updatePost, {
    name: 'updatePost',
    stream: 'post',
    optimistic: function(post) {
        return post;
    }
});