(window.webpackJsonp=window.webpackJsonp||[]).push([[9],{14540:function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return o}));var s=r(1662);class o{async didCreate(){this.store=Object(s.getStore)("HistorySidebarStore"),this.store.setSearchQuery("")}beforeDestroy(){this.store=null,this.wsHistoryStore=null,this.subscription=null,this.currentWorkspace=null}}},24803:function(e,t,r){"use strict";r.r(t),function(e){r.d(t,"default",(function(){return u}));var s=r(1656),o=r(6905),n=r(5929),i=r(10233),c=r(12679),a=r(24804);class u{async didCreate(){this.store=Object(n.getStore)("HistorySidebarStore"),this.store.setSearchQuery(""),this.wsHistoryStore=Object(n.getStore)("WebSocketHistoryStore"),this.currentWorkspace=Object(n.getStore)("ActiveWorkspaceStore").id,Object(n.getStore)("SyncStatusStore").onSyncAvailable({timeout:5e3}).then((()=>Object(o.fetchViewHistory)(this.currentWorkspace))).then((e=>e[this.currentWorkspace].allowed?i.default.subscribeToRealtimeEvents(this.currentWorkspace):Promise.resolve())).then((t=>{if(!t)return Promise.reject(new Error("Subscription not found"));this.subscription=t,this.subscription.subscribe((({data:t})=>{Object(s.transaction)((()=>{e.forEach(t,(t=>{if(!t)return;const{id:r,value:s,op:o}=t;switch(o){case"create":return this.wsHistoryStore.add(e.assign({id:r,workspace:this.currentWorkspace},s));case"delete":return this.wsHistoryStore.remove(r);case"deleteAll":return this.wsHistoryStore.removeAll()}}))}))}))})).catch((e=>{pm.logger.error("HistorySidebarController~didCreate: Error in subscribing to WebSocket history's realtime events",e)})),await c.default.subscribeSessionEvents(),await Object(a.fetchMoreRunsInActiveWorkspace)()}async beforeDestroy(){this.store=null,this.wsHistoryStore=null,this.subscription&&i.default.unsubscribeFromRealtimeEvents(this.currentWorkspace).catch((e=>pm.logger.error("WebSocketWorkbenchController~beforeDestroy: Error in unsubscribing from WebSocket history's realtime events",e))),this.subscription=null,this.currentWorkspace=null,await c.default.unsubscribeSessionEvents()}}}.call(this,r(2753))},24804:function(e,t,r){"use strict";r.r(t),r.d(t,"fetchMoreRunsInActiveWorkspace",(function(){return b}));var s=r(2790),o=r.n(s),n=r(5935),i=r(6199),c=r(6200),a=r(5929),u=r(6775),l=r(6352),h=r.n(l);const d="collectionrun";function b(e=20,t=0){return Promise.resolve(Object(a.getStore)("SyncStatusStore")).then((e=>e.onSyncAvailable())).then((()=>async function(){const e=h.a.get();return e?e.id:(pm.logger.error("WorkspaceSession not found in DB"),Promise.reject(Error("Runtime~getActiveWorkspace: WorkspaceSession not found in db")))}())).then((r=>function({workspace:e,count:t,sinceLastRevisionId:r}){return new Promise(((s,a)=>{o.a.waterfall([s=>{n.default.remoteFetch(d,"find",{workspace:e,count:t,since_id:r}).then((e=>s(null,e))).catch((e=>s(e)))},(e,t)=>{const r=e.map((e=>e.id));u.default.getAll({id:r}).then((s=>{const o=s.map((e=>e.id)),n=r.filter((e=>-1===o.indexOf(e))),i=e.filter((e=>-1!==n.indexOf(e.id)));t(null,i)})).catch((e=>t(e)))},(e,t)=>{t(null,e.map((e=>Object(i.default)(d,"import",{instance:e,modelId:e.id,owner:e.owner},{partial:!0}))))},(e,t)=>{const r=e.map((e=>Object(c.processIncomingChangeset)(e).catch((e=>{pm.logger.warn("RunnerRunStore~fetchMoreCollectionRuns: Could not create collection run",e)}))));return Promise.all(r).then((()=>t(null,e))).catch((e=>t(e)))}],(e=>{e?a(e):s()}))}))}({workspace:r,count:e,sinceLastRevisionId:t})))}}}]);