58ca4e68db
- Go backend API with full CRUD for all modules (CRM, Sales, Finance, HR, Legal, Marketing, Support, Purchase, Inventory, Projects, Automation, Analytics) - Rust analytics service with parallel report generation - C runtime with POSIX shared memory IPC - PostgreSQL schema with 30+ tables, full migrations - Redis cache, sessions, pub/sub - Kafka event streaming with Zookeeper - WebSocket hub for real-time updates - Automation engine with cron jobs, workflows, event triggers - JWT authentication, multi-tenant from start - Docker Compose with all services - Nginx reverse proxy with rate limiting - Integration tests passing - Feature gap analysis against Fortnox/Odoo/Visma Refs: BOC-001
2 lines
10 KiB
JavaScript
2 lines
10 KiB
JavaScript
var dt=e=>{throw TypeError(e)};var X=(e,t,s)=>t.has(e)||dt("Cannot "+s);var i=(e,t,s)=>(X(e,t,"read from private field"),s?s.call(e):t.get(e)),b=(e,t,s)=>t.has(e)?dt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,s),c=(e,t,s,r)=>(X(e,t,"write to private field"),r?r.call(e,s):t.set(e,s),s),d=(e,t,s)=>(X(e,t,"access private method"),s);import{a_ as St,bj as ft,bk as C,a$ as Y,bl as H,b4 as Z,bm as q,bn as pt,bo as Et,bp as It,bq as Qt,br as bt,b2 as vt,r as S,b5 as wt,b3 as xt}from"./index-oAPVDf-r.js";var y,a,z,g,x,D,E,I,V,_,M,T,F,Q,P,n,A,tt,et,st,it,rt,at,nt,Ct,mt,Tt=(mt=class extends St{constructor(t,s){super();b(this,n);b(this,y);b(this,a);b(this,z);b(this,g);b(this,x);b(this,D);b(this,E);b(this,I);b(this,V);b(this,_);b(this,M);b(this,T);b(this,F);b(this,Q);b(this,P,new Set);this.options=s,c(this,y,t),c(this,I,null),c(this,E,ft()),this.options.experimental_prefetchInRender||i(this,E).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(s)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(i(this,a).addObserver(this),gt(i(this,a),this.options)?d(this,n,A).call(this):this.updateResult(),d(this,n,it).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ht(i(this,a),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ht(i(this,a),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,d(this,n,rt).call(this),d(this,n,at).call(this),i(this,a).removeObserver(this)}setOptions(t){const s=this.options,r=i(this,a);if(this.options=i(this,y).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof C(this.options.enabled,i(this,a))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");d(this,n,nt).call(this),i(this,a).setOptions(this.options),s._defaulted&&!Y(this.options,s)&&i(this,y).getQueryCache().notify({type:"observerOptionsUpdated",query:i(this,a),observer:this});const u=this.hasListeners();u&&yt(i(this,a),r,this.options,s)&&d(this,n,A).call(this),this.updateResult(),u&&(i(this,a)!==r||C(this.options.enabled,i(this,a))!==C(s.enabled,i(this,a))||H(this.options.staleTime,i(this,a))!==H(s.staleTime,i(this,a)))&&d(this,n,tt).call(this);const h=d(this,n,et).call(this);u&&(i(this,a)!==r||C(this.options.enabled,i(this,a))!==C(s.enabled,i(this,a))||h!==i(this,Q))&&d(this,n,st).call(this,h)}getOptimisticResult(t){const s=i(this,y).getQueryCache().build(i(this,y),t),r=this.createResult(s,t);return Ut(this,r)&&(c(this,g,r),c(this,D,this.options),c(this,x,i(this,a).state)),r}getCurrentResult(){return i(this,g)}trackResult(t,s){return new Proxy(t,{get:(r,u)=>(this.trackProp(u),s==null||s(u),Reflect.get(r,u))})}trackProp(t){i(this,P).add(t)}getCurrentQuery(){return i(this,a)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const s=i(this,y).defaultQueryOptions(t),r=i(this,y).getQueryCache().build(i(this,y),s);return r.fetch().then(()=>this.createResult(r,s))}fetch(t){return d(this,n,A).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),i(this,g)))}createResult(t,s){var lt;const r=i(this,a),u=this.options,h=i(this,g),o=i(this,x),w=i(this,D),v=t!==r?t.state:i(this,z),{state:L}=t;let l={...L},k=!1,f;if(s._optimisticResults){const m=this.hasListeners(),N=!m&>(t,s),U=m&&yt(t,r,s,u);(N||U)&&(l={...l,...Qt(L.data,t.options)}),s._optimisticResults==="isRestoring"&&(l.fetchStatus="idle")}let{error:B,errorUpdatedAt:j,status:R}=l;f=l.data;let W=!1;if(s.placeholderData!==void 0&&f===void 0&&R==="pending"){let m;h!=null&&h.isPlaceholderData&&s.placeholderData===(w==null?void 0:w.placeholderData)?(m=h.data,W=!0):m=typeof s.placeholderData=="function"?s.placeholderData((lt=i(this,M))==null?void 0:lt.state.data,i(this,M)):s.placeholderData,m!==void 0&&(R="success",f=bt(h==null?void 0:h.data,m,s),k=!0)}if(s.select&&f!==void 0&&!W)if(h&&f===(o==null?void 0:o.data)&&s.select===i(this,V))f=i(this,_);else try{c(this,V,s.select),f=s.select(f),f=bt(h==null?void 0:h.data,f,s),c(this,_,f),c(this,I,null)}catch(m){c(this,I,m)}i(this,I)&&(B=i(this,I),f=i(this,_),j=Date.now(),R="error");const $=l.fetchStatus==="fetching",G=R==="pending",J=R==="error",ct=G&&$,ut=f!==void 0,O={status:R,fetchStatus:l.fetchStatus,isPending:G,isSuccess:R==="success",isError:J,isInitialLoading:ct,isLoading:ct,data:f,dataUpdatedAt:l.dataUpdatedAt,error:B,errorUpdatedAt:j,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:l.dataUpdateCount>0||l.errorUpdateCount>0,isFetchedAfterMount:l.dataUpdateCount>v.dataUpdateCount||l.errorUpdateCount>v.errorUpdateCount,isFetching:$,isRefetching:$&&!G,isLoadingError:J&&!ut,isPaused:l.fetchStatus==="paused",isPlaceholderData:k,isRefetchError:J&&ut,isStale:ot(t,s),refetch:this.refetch,promise:i(this,E),isEnabled:C(s.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const m=K=>{O.status==="error"?K.reject(O.error):O.data!==void 0&&K.resolve(O.data)},N=()=>{const K=c(this,E,O.promise=ft());m(K)},U=i(this,E);switch(U.status){case"pending":t.queryHash===r.queryHash&&m(U);break;case"fulfilled":(O.status==="error"||O.data!==U.value)&&N();break;case"rejected":(O.status!=="error"||O.error!==U.reason)&&N();break}}return O}updateResult(){const t=i(this,g),s=this.createResult(i(this,a),this.options);if(c(this,x,i(this,a).state),c(this,D,this.options),i(this,x).data!==void 0&&c(this,M,i(this,a)),Y(s,t))return;c(this,g,s);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:u}=this.options,h=typeof u=="function"?u():u;if(h==="all"||!h&&!i(this,P).size)return!0;const o=new Set(h??i(this,P));return this.options.throwOnError&&o.add("error"),Object.keys(i(this,g)).some(w=>{const p=w;return i(this,g)[p]!==t[p]&&o.has(p)})};d(this,n,Ct).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&d(this,n,it).call(this)}},y=new WeakMap,a=new WeakMap,z=new WeakMap,g=new WeakMap,x=new WeakMap,D=new WeakMap,E=new WeakMap,I=new WeakMap,V=new WeakMap,_=new WeakMap,M=new WeakMap,T=new WeakMap,F=new WeakMap,Q=new WeakMap,P=new WeakMap,n=new WeakSet,A=function(t){d(this,n,nt).call(this);let s=i(this,a).fetch(this.options,t);return t!=null&&t.throwOnError||(s=s.catch(Z)),s},tt=function(){d(this,n,rt).call(this);const t=H(this.options.staleTime,i(this,a));if(q||i(this,g).isStale||!pt(t))return;const r=Et(i(this,g).dataUpdatedAt,t)+1;c(this,T,setTimeout(()=>{i(this,g).isStale||this.updateResult()},r))},et=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(i(this,a)):this.options.refetchInterval)??!1},st=function(t){d(this,n,at).call(this),c(this,Q,t),!(q||C(this.options.enabled,i(this,a))===!1||!pt(i(this,Q))||i(this,Q)===0)&&c(this,F,setInterval(()=>{(this.options.refetchIntervalInBackground||It.isFocused())&&d(this,n,A).call(this)},i(this,Q)))},it=function(){d(this,n,tt).call(this),d(this,n,st).call(this,d(this,n,et).call(this))},rt=function(){i(this,T)&&(clearTimeout(i(this,T)),c(this,T,void 0))},at=function(){i(this,F)&&(clearInterval(i(this,F)),c(this,F,void 0))},nt=function(){const t=i(this,y).getQueryCache().build(i(this,y),this.options);if(t===i(this,a))return;const s=i(this,a);c(this,a,t),c(this,z,t.state),this.hasListeners()&&(s==null||s.removeObserver(this),t.addObserver(this))},Ct=function(t){vt.batch(()=>{t.listeners&&this.listeners.forEach(s=>{s(i(this,g))}),i(this,y).getQueryCache().notify({query:i(this,a),type:"observerResultsUpdated"})})},mt);function Ft(e,t){return C(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function gt(e,t){return Ft(e,t)||e.state.data!==void 0&&ht(e,t,t.refetchOnMount)}function ht(e,t,s){if(C(t.enabled,e)!==!1&&H(t.staleTime,e)!=="static"){const r=typeof s=="function"?s(e):s;return r==="always"||r!==!1&&ot(e,t)}return!1}function yt(e,t,s,r){return(e!==t||C(r.enabled,e)===!1)&&(!s.suspense||e.state.status!=="error")&&ot(e,s)}function ot(e,t){return C(t.enabled,e)!==!1&&e.isStaleByTime(H(t.staleTime,e))}function Ut(e,t){return!Y(e.getCurrentResult(),t)}var Ot=S.createContext(!1),Dt=()=>S.useContext(Ot);Ot.Provider;function _t(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Mt=S.createContext(_t()),Pt=()=>S.useContext(Mt),Lt=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},kt=e=>{S.useEffect(()=>{e.clearReset()},[e])},Bt=({result:e,errorResetBoundary:t,throwOnError:s,query:r,suspense:u})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(u&&e.data===void 0||wt(s,[e.error,r])),jt=e=>{if(e.suspense){const t=r=>r==="static"?r:Math.max(r??1e3,1e3),s=e.staleTime;e.staleTime=typeof s=="function"?(...r)=>t(s(...r)):t(s),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},At=(e,t)=>e.isLoading&&e.isFetching&&!t,Ht=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Rt=(e,t,s)=>t.fetchOptimistic(e).catch(()=>{s.clearReset()});function zt(e,t,s){var l,k,f,B,j;const r=Dt(),u=Pt(),h=xt(),o=h.defaultQueryOptions(e);(k=(l=h.getDefaultOptions().queries)==null?void 0:l._experimental_beforeQuery)==null||k.call(l,o),o._optimisticResults=r?"isRestoring":"optimistic",jt(o),Lt(o,u),kt(u);const w=!h.getQueryCache().get(o.queryHash),[p]=S.useState(()=>new t(h,o)),v=p.getOptimisticResult(o),L=!r&&e.subscribed!==!1;if(S.useSyncExternalStore(S.useCallback(R=>{const W=L?p.subscribe(vt.batchCalls(R)):Z;return p.updateResult(),W},[p,L]),()=>p.getCurrentResult(),()=>p.getCurrentResult()),S.useEffect(()=>{p.setOptions(o)},[o,p]),Ht(o,v))throw Rt(o,p,u);if(Bt({result:v,errorResetBoundary:u,throwOnError:o.throwOnError,query:h.getQueryCache().get(o.queryHash),suspense:o.suspense}))throw v.error;if((B=(f=h.getDefaultOptions().queries)==null?void 0:f._experimental_afterQuery)==null||B.call(f,o,v),o.experimental_prefetchInRender&&!q&&At(v,r)){const R=w?Rt(o,p,u):(j=h.getQueryCache().get(o.queryHash))==null?void 0:j.promise;R==null||R.catch(Z).finally(()=>{p.updateResult()})}return o.notifyOnChangeProps?v:p.trackResult(v)}function Kt(e,t){return zt(e,Tt)}export{Kt as u};
|