UNPKG

@gmetrixr/rjson

Version:
47 lines (46 loc) 2.03 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const r_1 = require("../../../r"); /** * Changes the phrases property in speech element into items */ class Migration { execute(projectJson) { const projectF = r_1.r.record(projectJson); projectF.getRecords(r_1.RT.scene).forEach(scene => { const sceneF = r_1.r.record(scene); sceneF.getAllDeepChildren(r_1.RT.element).forEach(e => { if (e.props.element_type === "pano") { switch (e.props.pano_type) { case "video": e.props.element_type = "pano_video"; break; //some older "pano" elements dont have the pano_type property hence we default to pano_image case "image": default: e.props.element_type = "pano_image"; break; } delete e.props.pano_type; //Run this loop only to find out connections for this particular element id //and that too only in this scene sceneF.getRecords(r_1.RT.rule).forEach(rule => { r_1.r.record(rule).getRecords(r_1.RT.when_event).forEach(we => { if (we.props.co_id === e.id) { we.props.co_type = e.props.element_type; } }); r_1.r.record(rule).getRecords(r_1.RT.then_action).forEach(ta => { if (ta.props.co_id === e.id) { ta.props.co_type = e.props.element_type; } }); }); } }); }); projectF.set(r_1.rtp.project.version, 107); } } const migration = new Migration(); exports.default = migration;