UNPKG

stitch-ui

Version:

41 lines (37 loc) 928 B
import { Record, List, Map } from "immutable"; import Pipeline from "./Pipeline"; import PipelineStage from "./PipelineStage"; export default class IncomingWebhook extends Record({ _id: undefined, options: Map(), pipeline: new Pipeline(), output: "", name: "New Webhook", respondResult: false, dirty: false }) { toRaw() { const out = { _id: this._id, name: this.name, respondResult: this.respondResult, options: this.options, output: this.output, pipeline: this.pipeline.toRaw().pipeline }; return out; } static fromRaw(raw) { return new IncomingWebhook({ _id: raw._id, name: raw.name, pipeline: new Pipeline({ output: raw.output, stages: new List(raw.pipeline.map(s => new PipelineStage(s))) }), options: new Map(raw.options), respondResult: raw.respondResult, output: raw.output }); } }