(window.webpackJsonp=window.webpackJsonp||[]).push([[9],{14340:function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return s}));var o=r(1660);class s{async didCreate(){this.store=Object(o.getStore)("HistorySidebarStore"),this.store.setSearchQuery("")}beforeDestroy(){this.store=null,this.wsHistoryStore=null,this.subscription=null,this.currentWorkspace=null}}},24617:function(e,t,r){"use strict";r.r(t),function(e){r.d(t,"default",(function(){return a}));var o=r(1654),s=r(6974),n=r(5942),i=r(10191),c=r(24618);class a{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(s.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(o.transaction)((()=>{e.forEach(t,(t=>{if(!t)return;const{id:r,value:o,op:s}=t;switch(s){case"create":return this.wsHistoryStore.add(e.assign({id:r,workspace:this.currentWorkspace},o));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 Object(c.fetchMoreRunsInActiveWorkspace)()}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}}}.call(this,r(2751))},24618:function(e,t,r){"use strict";r.r(t),r.d(t,"fetchMoreRunsInActiveWorkspace",(function(){return b}));var o=r(2789),s=r.n(o),n=r(5948),i=r(6274),c=r(6275),a=r(5942),u=r(6435),l=r(6443),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(((o,a)=>{s.a.waterfall([o=>{n.default.remoteFetch(d,"find",{workspace:e,count:t,since_id:r}).then((e=>o(null,e))).catch((e=>o(e)))},(e,t)=>{const r=e.map((e=>e.id));u.default.getAll({id:r}).then((o=>{const s=o.map((e=>e.id)),n=r.filter((e=>-1===s.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):o()}))}))}({workspace:r,count:e,sinceLastRevisionId:t})))}}}]);