@corva/ui 0.27.0-6 → 0.27.0-7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import t from"@babel/runtime/helpers/defineProperty";import"../../../constants/completion.js";import"../../../constants/alerts.js";import{get as r,sortBy as e,omit as n}from"lodash";import a from"@babel/runtime/helpers/slicedToArray";import"../../../constants/goals.js";import"../../../constants/segment.js";import"../../../constants/apps.js";import"../../../constants/drillstring.js";import{DRILLING_WELL_SUMMARY as s,COMPLETION_WELL_SUMMARY as c,DRILLOUT_WELL_SUMMARY as i}from"../../../constants/wellSummary.js";import{RIG_ACTIVITY_COLORS as o}from"../../../constants/rigActivity.js";import u from"@babel/runtime/regenerator";import p from"@babel/runtime/helpers/asyncToGenerator";import{useState as l,useEffect as f}from"react";import{getAppStorage as m}from"../../../clients/jsonApi/index.js";function h(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),e.push.apply(e,n)}return e}function d(r){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?h(Object(n),!0).forEach((function(e){t(r,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(n)):h(Object(n)).forEach((function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(n,t))}))}return r}function v(t){return b.apply(this,arguments)}function b(){return(b=p(u.mark((function t(e){var n,a;return u.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Promise.all(e.map(function(){var t=p(u.mark((function t(e){var n;return u.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,m("corva","activities.summary-continuous",e,{fields:["data.activities","data.start_timestamp","data.end_timestamp"].join(","),limit:1,query:"{timestamp#lte#".concat(Math.floor(Date.now()/1e3),"}"),sort:"{timestamp:-1}"});case 3:return n=t.sent,t.abrupt("return",(r(n,"0.data.activities")||[]).map((function(t){return d(d({},t),{},{duration:(t.day||0)+(t.night||0),color:o[t.name]})})));case 7:t.prev=7,t.t0=t.catch(0),console.error(t.t0);case 10:return t.abrupt("return",[]);case 11:case"end":return t.stop()}}),t,null,[[0,7]])})));return function(r){return t.apply(this,arguments)}}()));case 2:return n=t.sent,a={},n.forEach((function(t,r){a[e[r]]=t})),t.abrupt("return",a);case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function y(t,r,e,n){return g.apply(this,arguments)}function g(){return(g=p(u.mark((function t(a,s,c,i){var o,p;return u.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,m("corva",s,a,{aggregate:JSON.stringify([{$match:{asset_id:a,timestamp:{$lte:c,$gte:c-86400}}},{$project:{_id:-1,stage_number:1,data:1,timestamp:1}},{$group:{_id:"$stage_number",timestamp:{$first:"$timestamp"},stage_number:{$last:"$stage_number"},first_data:{$first:"$data"},last_data:{$last:"$data"}}}])});case 3:return o=t.sent,p=0,e(o,"timestamp").forEach((function(t,e){if(0===e){var a=n(r(t,"first_data"),i),s=n(r(t,"last_data"),i);Object.keys(s).forEach((function(t){p+=s[t]-(a[t]||0)}))}else{var c=n(r(t,"last_data"),i);Object.keys(c).forEach((function(t){p+=c[t]}))}})),t.abrupt("return",p);case 9:t.prev=9,t.t0=t.catch(0),console.error(t.t0);case 12:return t.abrupt("return",0);case 13:case"end":return t.stop()}}),t,null,[[0,9]])})))).apply(this,arguments)}function w(t){return j.apply(this,arguments)}function j(){return(j=p(u.mark((function t(e){var n,s;return u.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Promise.all(e.map(function(){var t=p(u.mark((function t(e){var n,s,c,i,o,p,l,f,h,d,v;return u.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.t0=Promise,t.next=4,m("corva","completion.wits",e,{limit:1,fields:"timestamp"});case 4:return t.t1=t.sent,t.next=7,m("corva","wireline.wits",e,{limit:1,fields:"timestamp"});case 7:return t.t2=t.sent,t.t3=[t.t1,t.t2],t.next=11,t.t0.all.call(t.t0,t.t3);case 11:if(n=t.sent,s=a(n,2),c=s[0],i=s[1],o=r(c,"0.timestamp"),p=r(i,"0.timestamp"),l=null,o&&p?l=o>p?o:p:o?l=o:p&&(l=p),l){t.next=21;break}return t.abrupt("return",[]);case 21:return t.next=23,Promise.all([y(e,"completion.activity.summary-stage",l,["activities"]),y(e,"wireline.activity.summary-stage",l,["durations"])]);case 23:return f=t.sent,h=a(f,2),d=h[0],v=h[1],t.abrupt("return",[{name:"frac",duration:d,color:"#7177FF"},{name:"wireline",duration:v,color:"#FF9C00"}]);case 30:t.prev=30,t.t4=t.catch(0),console.error(t.t4);case 33:return t.abrupt("return",[]);case 34:case"end":return t.stop()}}),t,null,[[0,30]])})));return function(r){return t.apply(this,arguments)}}()));case 2:return n=t.sent,s={},n.forEach((function(t,r){s[e[r]]=t})),t.abrupt("return",s);case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function x(t,r){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=l(!0),o=a(n,2),h=o[0],b=o[1],y=l({}),g=a(y,2),j=g[0],x=g[1],O=l(!0),_=a(O,2),$=_[0],k=_[1],P=l({}),E=a(P,2),S=E[0],D=E[1],F="drilling"===r;return f((function(){function n(){return(n=p(u.mark((function r(){var n,a,o,p,l,f,h;return u.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return n=(e||Object.values(F?s:d(d({},c),i))).filter((function(t){return t.dataSource&&t.dataSource.length})),a=[],n.forEach((function(t){t.dataSource.forEach((function(t){var r=t.provider,e=t.collection,n=t.fields;r&&e&&n&&n.length?n.forEach((function(t){return a.push("".concat(r,"#").concat(e,".").concat(t))})):e&&a.push(e)}))})),r.prev=3,o={asset_id:{$in:t}},p=a.reduce((function(t,r){return t[r]=1,t}),{asset_id:1}),l={aggregate:JSON.stringify([{$match:o},{$project:p}])},r.next=9,m("corva","well_cache",null,l);case 9:f=r.sent,h={},f.forEach((function(t){var r=t.asset_id;h[r]=t})),x(h),r.next=18;break;case 15:r.prev=15,r.t0=r.catch(3),console.error(r.t0);case 18:b(!1);case 19:case"end":return r.stop()}}),r,null,[[3,15]])})))).apply(this,arguments)}function a(){return(a=p(u.mark((function e(){var n;return u.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,"drilling"!==r){e.next=7;break}return e.next=4,v(t);case 4:e.t0=e.sent,e.next=10;break;case 7:return e.next=9,w(t);case 9:e.t0=e.sent;case 10:n=e.t0,D(n),e.next=17;break;case 14:e.prev=14,e.t1=e.catch(0),console.error(e.t1);case 17:k(!1);case 18:case"end":return e.stop()}}),e,null,[[0,14]])})))).apply(this,arguments)}b(!0),k(!0),function(){n.apply(this,arguments)}(),function(){a.apply(this,arguments)}()}),[]),[h||$,j,S]}export{x as useWellSummaryData};
1
+ import t from"@babel/runtime/helpers/defineProperty";import"../../../constants/completion.js";import"../../../constants/alerts.js";import{get as e,sortBy as r,omit as n}from"lodash";import a from"@babel/runtime/helpers/slicedToArray";import"../../../constants/goals.js";import"../../../constants/segment.js";import"../../../constants/apps.js";import"../../../constants/drillstring.js";import{DRILLING_WELL_SUMMARY as s,COMPLETION_WELL_SUMMARY as i,DRILLOUT_WELL_SUMMARY as c}from"../../../constants/wellSummary.js";import{RIG_ACTIVITY_COLORS as o}from"../../../constants/rigActivity.js";import u from"@babel/runtime/regenerator";import p from"@babel/runtime/helpers/asyncToGenerator";import{useState as l,useEffect as f}from"react";import{getWell as m,getAppStorage as d}from"../../../clients/jsonApi/index.js";function v(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function h(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?v(Object(n),!0).forEach((function(r){t(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):v(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function b(t){return y.apply(this,arguments)}function y(){return(y=p(u.mark((function t(r){var n,a;return u.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Promise.all(r.map(function(){var t=p(u.mark((function t(r){var n;return u.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,d("corva","activities.summary-continuous",r,{fields:["data.activities","data.start_timestamp","data.end_timestamp"].join(","),limit:1,query:"{timestamp#lte#".concat(Math.floor(Date.now()/1e3),"}"),sort:"{timestamp:-1}"});case 3:return n=t.sent,t.abrupt("return",(e(n,"0.data.activities")||[]).map((function(t){return h(h({},t),{},{duration:(t.day||0)+(t.night||0),color:o[t.name]})})));case 7:t.prev=7,t.t0=t.catch(0),console.error(t.t0);case 10:return t.abrupt("return",[]);case 11:case"end":return t.stop()}}),t,null,[[0,7]])})));return function(e){return t.apply(this,arguments)}}()));case 2:return n=t.sent,a={},n.forEach((function(t,e){a[r[e]]=t})),t.abrupt("return",a);case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function g(t,e,r,n){return w.apply(this,arguments)}function w(){return(w=p(u.mark((function t(a,s,i,c){var o,p;return u.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,d("corva",s,a,{aggregate:JSON.stringify([{$match:{asset_id:a,timestamp:{$lte:i,$gte:i-86400}}},{$project:{_id:-1,stage_number:1,data:1,timestamp:1}},{$group:{_id:"$stage_number",timestamp:{$first:"$timestamp"},stage_number:{$last:"$stage_number"},first_data:{$first:"$data"},last_data:{$last:"$data"}}}])});case 3:return o=t.sent,p=0,r(o,"timestamp").forEach((function(t,r){if(0===r){var a=n(e(t,"first_data"),c),s=n(e(t,"last_data"),c);Object.keys(s).forEach((function(t){p+=s[t]-(a[t]||0)}))}else{var i=n(e(t,"last_data"),c);Object.keys(i).forEach((function(t){p+=i[t]}))}})),t.abrupt("return",p);case 9:t.prev=9,t.t0=t.catch(0),console.error(t.t0);case 12:return t.abrupt("return",0);case 13:case"end":return t.stop()}}),t,null,[[0,9]])})))).apply(this,arguments)}function j(t){return x.apply(this,arguments)}function x(){return(x=p(u.mark((function t(r){var n,s;return u.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Promise.all(r.map(function(){var t=p(u.mark((function t(r){var n,s,i,c,o,p,l,f,m,v,h;return u.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.t0=Promise,t.next=4,d("corva","completion.wits",r,{limit:1,fields:"timestamp"});case 4:return t.t1=t.sent,t.next=7,d("corva","wireline.wits",r,{limit:1,fields:"timestamp"});case 7:return t.t2=t.sent,t.t3=[t.t1,t.t2],t.next=11,t.t0.all.call(t.t0,t.t3);case 11:if(n=t.sent,s=a(n,2),i=s[0],c=s[1],o=e(i,"0.timestamp"),p=e(c,"0.timestamp"),l=null,o&&p?l=o>p?o:p:o?l=o:p&&(l=p),l){t.next=21;break}return t.abrupt("return",[]);case 21:return t.next=23,Promise.all([g(r,"completion.activity.summary-stage",l,["activities"]),g(r,"wireline.activity.summary-stage",l,["durations"])]);case 23:return f=t.sent,m=a(f,2),v=m[0],h=m[1],t.abrupt("return",[{name:"frac",duration:v,color:"#7177FF"},{name:"wireline",duration:h,color:"#FF9C00"}]);case 30:t.prev=30,t.t4=t.catch(0),console.error(t.t4);case 33:return t.abrupt("return",[]);case 34:case"end":return t.stop()}}),t,null,[[0,30]])})));return function(e){return t.apply(this,arguments)}}()));case 2:return n=t.sent,s={},n.forEach((function(t,e){s[r[e]]=t})),t.abrupt("return",s);case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function _(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=l(!0),o=a(n,2),v=o[0],y=o[1],g=l({}),w=a(g,2),x=w[0],_=w[1],O=l(!0),$=a(O,2),k=$[0],P=$[1],E=l({}),S=a(E,2),D=S[0],F=S[1],A="drilling"===e;return f((function(){function n(){return(n=p(u.mark((function e(){var n,a,o,p,l,f,v,b,g,w,j;return u.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=(r||Object.values(A?s:h(h({},i),c))).filter((function(t){return t.dataSource&&t.dataSource.length})),a=[],n.forEach((function(t){t.dataSource.forEach((function(t){var e=t.provider,r=t.collection,n=t.fields;e&&r&&n&&n.length?n.forEach((function(t){return a.push("".concat(e,"#").concat(r,".").concat(t))})):r&&a.push(r)}))})),a.push("well_id"),e.prev=4,l={asset_id:{$in:t}},f=a.reduce((function(t,e){return t[e]=1,t}),{asset_id:1}),v={aggregate:JSON.stringify([{$match:l},{$project:f}])},e.next=10,d("corva","well_cache",null,v);case 10:return b=e.sent,e.next=13,m(b[0].well_id,{fields:"well.last_active_at"});case 13:g=e.sent,w=Date.parse(null===(o=g.data)||void 0===o||null===(p=o.attributes)||void 0===p?void 0:p.last_active_at)/1e3,j={},b.forEach((function(t){var e=t.asset_id;j[e]=t,j[e]["corva#wits"].timestamp=w})),_(j),e.next=23;break;case 20:e.prev=20,e.t0=e.catch(4),console.error(e.t0);case 23:y(!1);case 24:case"end":return e.stop()}}),e,null,[[4,20]])})))).apply(this,arguments)}function a(){return(a=p(u.mark((function r(){var n;return u.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(r.prev=0,"drilling"!==e){r.next=7;break}return r.next=4,b(t);case 4:r.t0=r.sent,r.next=10;break;case 7:return r.next=9,j(t);case 9:r.t0=r.sent;case 10:n=r.t0,F(n),r.next=17;break;case 14:r.prev=14,r.t1=r.catch(0),console.error(r.t1);case 17:P(!1);case 18:case"end":return r.stop()}}),r,null,[[0,14]])})))).apply(this,arguments)}y(!0),P(!0),function(){n.apply(this,arguments)}(),function(){a.apply(this,arguments)}()}),[]),[v||k,x,D]}export{_ as useWellSummaryData};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@corva/ui",
3
- "version": "0.27.0-6",
3
+ "version": "0.27.0-7",
4
4
  "description": "Shared components/utils for Corva ui projects",
5
5
  "keywords": [
6
6
  "corva-ui"