@odigos/ui-kit 0.0.253 → 0.0.254

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.
package/lib/hooks.js CHANGED
@@ -1 +1 @@
1
- export{fT as IGNORE_OUTSIDE_CLICK_ATTR,fU as useActionFormData,fV as useBodyScroll,u as useClickNode,p as useClickNotification,dp as useContainerSize,bq as useCopy,fW as useDataStreamFormData,fX as useDestinationFormData,r as useGenericForm,fY as useInstrumentationRuleFormData,bT as useKeyDown,bs as useOnClickOutside,fZ as useOverflow,d as usePopup,b8 as useScrollIntoViewWhen,dS as useScrollTo,dh as useSessionStorage,f_ as useSourceFormData,b7 as useTimeAgo}from"./chunks/ui-components-TeG65JGy.js";import"react/jsx-runtime";import"styled-components";import"./icons.js";import"zustand";import"react";import"javascript-time-ago";import"javascript-time-ago/locale/en";import"prism-react-renderer";import"./chunks/vendor-BFqT13Me.js";import"zustand/middleware";import"react-error-boundary";import"react-dom";import"virtua";
1
+ export{fT as IGNORE_OUTSIDE_CLICK_ATTR,fU as useActionFormData,fV as useBodyScroll,u as useClickNode,p as useClickNotification,dp as useContainerSize,bq as useCopy,fW as useDataStreamFormData,fX as useDestinationFormData,r as useGenericForm,fY as useInstrumentationRuleFormData,bT as useKeyDown,bs as useOnClickOutside,fZ as useOverflow,d as usePopup,b8 as useScrollIntoViewWhen,dS as useScrollTo,dh as useSessionStorage,f_ as useSourceFormData,b7 as useTimeAgo}from"./chunks/ui-components-D_eeOuIL.js";import"react/jsx-runtime";import"styled-components";import"./icons.js";import"zustand";import"react";import"javascript-time-ago";import"javascript-time-ago/locale/en";import"prism-react-renderer";import"./chunks/vendor-BFqT13Me.js";import"zustand/middleware";import"react-error-boundary";import"react-dom";import"virtua";
@@ -1 +1 @@
1
- export{bi as ActionType,dv as Actions,du as RichTitle}from"../chunks/ui-components-TeG65JGy.js";export{C as CancelModal,j as DURATION_OPTIONS,g as DeleteModal,e as DurationErrorsSection,D as DynamicField,I as InstrumentationPreviewSection,N as NOISY_PERCENTAGE_OPTIONS,h as OdigosLogoTextByTier,O as OperationSection,b as PERCENTAGE_OPTIONS,f as PercentageSection,P as PresetWithCustomInput,R as RuleInfoSection,d as RuleTypeSection,c as SamplingPreviewSection,S as SignalsCheckboxList,a as SourceScopeSection,U as UpgradeModal,i as WIDE_DRAWER_WIDTH,W as WideDrawer,Y as YamlSectionCard}from"../chunks/index-DIVbcB6F.js";export{C as ColoredSpan,D as ColoredSpanVariant}from"../chunks/helpers-BEkhis3j.js";import"react/jsx-runtime";import"styled-components";import"../icons.js";import"zustand";import"react";import"javascript-time-ago";import"javascript-time-ago/locale/en";import"prism-react-renderer";import"../chunks/vendor-BFqT13Me.js";import"zustand/middleware";import"react-error-boundary";import"react-dom";import"virtua";
1
+ export{bi as ActionType,dv as Actions,du as RichTitle}from"../chunks/ui-components-D_eeOuIL.js";export{C as CancelModal,j as DURATION_OPTIONS,g as DeleteModal,e as DurationErrorsSection,D as DynamicField,I as InstrumentationPreviewSection,N as NOISY_PERCENTAGE_OPTIONS,h as OdigosLogoTextByTier,O as OperationSection,b as PERCENTAGE_OPTIONS,f as PercentageSection,P as PresetWithCustomInput,R as RuleInfoSection,d as RuleTypeSection,c as SamplingPreviewSection,S as SignalsCheckboxList,a as SourceScopeSection,U as UpgradeModal,i as WIDE_DRAWER_WIDTH,W as WideDrawer,Y as YamlSectionCard}from"../chunks/index-D2nQHheF.js";export{C as ColoredSpan,D as ColoredSpanVariant}from"../chunks/helpers-Cy9W3KCg.js";import"react/jsx-runtime";import"styled-components";import"../icons.js";import"zustand";import"react";import"javascript-time-ago";import"javascript-time-ago/locale/en";import"prism-react-renderer";import"../chunks/vendor-BFqT13Me.js";import"zustand/middleware";import"react-error-boundary";import"react-dom";import"virtua";
package/lib/snippets.js CHANGED
@@ -1 +1 @@
1
- export{F as Flow,M as MapItemNode,N as NoDataNode}from"./chunks/flow-BnkrFBJL.js";import"react/jsx-runtime";import"react";import"@xyflow/react/dist/style.css";import"styled-components";import"./chunks/ui-components-TeG65JGy.js";import"./icons.js";import"zustand";import"javascript-time-ago";import"javascript-time-ago/locale/en";import"prism-react-renderer";import"./chunks/vendor-BFqT13Me.js";import"zustand/middleware";import"react-error-boundary";import"react-dom";import"virtua";import"@xyflow/react";
1
+ export{F as Flow,M as MapItemNode,N as NoDataNode}from"./chunks/flow-Bu1VbeQt.js";import"react/jsx-runtime";import"react";import"@xyflow/react/dist/style.css";import"styled-components";import"./chunks/ui-components-D_eeOuIL.js";import"./icons.js";import"zustand";import"javascript-time-ago";import"javascript-time-ago/locale/en";import"prism-react-renderer";import"./chunks/vendor-BFqT13Me.js";import"zustand/middleware";import"react-error-boundary";import"react-dom";import"virtua";import"@xyflow/react";
package/lib/store.js CHANGED
@@ -1 +1 @@
1
- export{$ as ProgressKeys,a as useActiveNodeStore,fS as useDarkMode,z as useDataStreamStore,bl as useDrawerStore,dd as useFilterStore,bZ as useModalStore,o as useNotificationStore,Z as useProgressStore,dj as useSelectedStore,_ as useSetupStore}from"./chunks/ui-components-TeG65JGy.js";import"react/jsx-runtime";import"styled-components";import"./icons.js";import"zustand";import"react";import"javascript-time-ago";import"javascript-time-ago/locale/en";import"prism-react-renderer";import"./chunks/vendor-BFqT13Me.js";import"zustand/middleware";import"react-error-boundary";import"react-dom";import"virtua";
1
+ export{$ as ProgressKeys,a as useActiveNodeStore,fS as useDarkMode,z as useDataStreamStore,bl as useDrawerStore,dd as useFilterStore,bZ as useModalStore,o as useNotificationStore,Z as useProgressStore,dj as useSelectedStore,_ as useSetupStore}from"./chunks/ui-components-D_eeOuIL.js";import"react/jsx-runtime";import"styled-components";import"./icons.js";import"zustand";import"react";import"javascript-time-ago";import"javascript-time-ago/locale/en";import"prism-react-renderer";import"./chunks/vendor-BFqT13Me.js";import"zustand/middleware";import"react-error-boundary";import"react-dom";import"virtua";
package/lib/theme.js CHANGED
@@ -1 +1 @@
1
- export{f$ as Provider,g0 as animations,g1 as opacity,g2 as palettes}from"./chunks/ui-components-TeG65JGy.js";import"react/jsx-runtime";import"styled-components";import"./icons.js";import"zustand";import"react";import"javascript-time-ago";import"javascript-time-ago/locale/en";import"prism-react-renderer";import"./chunks/vendor-BFqT13Me.js";import"zustand/middleware";import"react-error-boundary";import"react-dom";import"virtua";
1
+ export{f$ as Provider,g0 as animations,g1 as opacity,g2 as palettes}from"./chunks/ui-components-D_eeOuIL.js";import"react/jsx-runtime";import"styled-components";import"./icons.js";import"zustand";import"react";import"javascript-time-ago";import"javascript-time-ago/locale/en";import"prism-react-renderer";import"./chunks/vendor-BFqT13Me.js";import"zustand/middleware";import"react-error-boundary";import"react-dom";import"virtua";
package/lib/types.js CHANGED
@@ -1 +1 @@
1
- export{v as ActionKeyTypes,w as ActionType,eO as AddNodeTypes,eP as AgentInjectedReason,eQ as BooleanOperation,au as CodeAttributesKeyTypes,eR as ConditionType,Y as Crud,Q as CustomInstrumentationsKeyTypes,ba as DesiredStateProgress,eS as DestinationTypes,eT as EdgeTypes,E as EntityTypes,aj as ExtractionDataFormat,L as FieldTypes,R as GolangCustomProbe,O as HeadersCollectionKeyTypes,dU as InputTypes,eU as InstallationMethod,eV as InstallationStatus,V as InstrumentationRuleType,eW as IntrumentationStatus,U as JavaCustomProbe,eX as JsonOperation,a8 as K8sAttributesFrom,W as K8sResourceKind,eY as K8sWorkloadContainerAgentConfigTracesHeadSamplingSpanMetricsMode,eZ as ListDirection,b as NodeTypes,e_ as NumberOperation,e$ as OtelDistroName,f0 as OtherEntityTypes,bf as OtherStatus,aT as OtherStatusType,aw as PayloadCollectionKeyTypes,P as PlatformType,f1 as PodContainerLifecycleStatus,f2 as PodContainerStatus,f3 as PodPhase,f4 as Profile,by as ProgrammingLanguages,f5 as SIGNAL_KEY_TO_TYPE,f6 as SIGNAL_TYPE_TO_KEY,f7 as SignalKey,H as SignalType,f8 as SortDirection,S as StatusType,f9 as StringOperation,c as Tier,fa as WorkloadRolloutReason,dx as WorkloadRolloutStatus}from"./chunks/ui-components-TeG65JGy.js";import"react/jsx-runtime";import"styled-components";import"./icons.js";import"zustand";import"react";import"javascript-time-ago";import"javascript-time-ago/locale/en";import"prism-react-renderer";import"./chunks/vendor-BFqT13Me.js";import"zustand/middleware";import"react-error-boundary";import"react-dom";import"virtua";
1
+ export{v as ActionKeyTypes,w as ActionType,eO as AddNodeTypes,eP as AgentInjectedReason,eQ as BooleanOperation,au as CodeAttributesKeyTypes,eR as ConditionType,Y as Crud,Q as CustomInstrumentationsKeyTypes,ba as DesiredStateProgress,eS as DestinationTypes,eT as EdgeTypes,E as EntityTypes,aj as ExtractionDataFormat,L as FieldTypes,R as GolangCustomProbe,O as HeadersCollectionKeyTypes,dU as InputTypes,eU as InstallationMethod,eV as InstallationStatus,V as InstrumentationRuleType,eW as IntrumentationStatus,U as JavaCustomProbe,eX as JsonOperation,a8 as K8sAttributesFrom,W as K8sResourceKind,eY as K8sWorkloadContainerAgentConfigTracesHeadSamplingSpanMetricsMode,eZ as ListDirection,b as NodeTypes,e_ as NumberOperation,e$ as OtelDistroName,f0 as OtherEntityTypes,bf as OtherStatus,aT as OtherStatusType,aw as PayloadCollectionKeyTypes,P as PlatformType,f1 as PodContainerLifecycleStatus,f2 as PodContainerStatus,f3 as PodPhase,f4 as Profile,by as ProgrammingLanguages,f5 as SIGNAL_KEY_TO_TYPE,f6 as SIGNAL_TYPE_TO_KEY,f7 as SignalKey,H as SignalType,f8 as SortDirection,S as StatusType,f9 as StringOperation,c as Tier,fa as WorkloadRolloutReason,dx as WorkloadRolloutStatus}from"./chunks/ui-components-D_eeOuIL.js";import"react/jsx-runtime";import"styled-components";import"./icons.js";import"zustand";import"react";import"javascript-time-ago";import"javascript-time-ago/locale/en";import"prism-react-renderer";import"./chunks/vendor-BFqT13Me.js";import"zustand/middleware";import"react-error-boundary";import"react-dom";import"virtua";
package/lib/visuals.js CHANGED
@@ -1 +1 @@
1
- export{fb as VISUAL_ODIGOS_LOGO_HEIGHT,fc as VISUAL_ODIGOS_LOGO_WIDTH,eM as VisualGreenRings,fd as VisualOdigosLogo,c8 as VisualPurpleRings}from"./chunks/ui-components-TeG65JGy.js";import"react/jsx-runtime";import"styled-components";import"./icons.js";import"zustand";import"react";import"javascript-time-ago";import"javascript-time-ago/locale/en";import"prism-react-renderer";import"./chunks/vendor-BFqT13Me.js";import"zustand/middleware";import"react-error-boundary";import"react-dom";import"virtua";
1
+ export{fb as VISUAL_ODIGOS_LOGO_HEIGHT,fc as VISUAL_ODIGOS_LOGO_WIDTH,eM as VisualGreenRings,fd as VisualOdigosLogo,c8 as VisualPurpleRings}from"./chunks/ui-components-D_eeOuIL.js";import"react/jsx-runtime";import"styled-components";import"./icons.js";import"zustand";import"react";import"javascript-time-ago";import"javascript-time-ago/locale/en";import"prism-react-renderer";import"./chunks/vendor-BFqT13Me.js";import"zustand/middleware";import"react-error-boundary";import"react-dom";import"virtua";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@odigos/ui-kit",
3
- "version": "0.0.253",
3
+ "version": "0.0.254",
4
4
  "author": "Odigos",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -1 +0,0 @@
1
- import{jsx as o}from"react/jsx-runtime";import{useMemo as n}from"react";import{b as t,_ as r}from"./use-odigos-api-li2VrVHH.js";const e=({connectionIds:e,children:i})=>{const s=t(),a=n(()=>({operations:s.operations,context:{...s.context,connectionIds:e},apolloConfig:s.apolloConfig}),[s.operations,s.context,s.apolloConfig,e.join(",")]);return o(r.Provider,{value:a,children:i})};export{e as O};
@@ -1,5 +0,0 @@
1
- import{useMemo as e,useContext as t,createContext as r,useCallback as a,useEffect as n}from"react";import{HttpLink as o,from as s,split as i,ApolloClient as c,InMemoryCache as d,ApolloProvider as u,useQuery as l,gql as E,useApolloClient as f}from"@apollo/client";import{jsx as T}from"react/jsx-runtime";import{onError as _}from"@apollo/client/link/error";import{setContext as S}from"@apollo/client/link/context";import{getMainDefinition as R}from"@apollo/client/utilities";import{o as y,y as p,D as O,S as m,X as A,Y as I,E as N,P as C,c as h,z as g,Z as L,_ as G,$ as P,a0 as U,a1 as D,a2 as v,a3 as w}from"./ui-components-TeG65JGy.js";const F=e=>{if(!e)return!1;const t=e.toLowerCase();return t.includes("authentication required")||t.includes("authentication expired")||t.includes("http 401")},M=r(null),k=()=>{const e=t(M);if(!e)throw new Error("[ui-kit] useOdigosApi() / useXxxApi() called outside of <OdigosApiProvider>. Make sure the host app mounts the provider at its layout level.");return e},b=({apolloConfig:t,operations:r,context:a,children:n})=>{const l=e(()=>(e=>{const t=new o({uri:e.httpUrl,credentials:e.credentials??"same-origin"}),r=_(({graphQLErrors:t,networkError:r})=>{t&&t.length>0&&t.some(e=>F(e.message))&&e.onAuthError?.(),r&&(401===r.statusCode||F(r.message))&&e.onAuthError?.()}),a=S(async(t,r)=>{const a={...r.headers};if(e.authHeader){const t=await e.authHeader();Object.assign(a,t)}return e.csrfHeader&&Object.assign(a,e.csrfHeader()),{headers:a}}),n=[];e.additionalLinks?.length&&n.push(...e.additionalLinks),n.push(a,r,t);let u=s(n);e.wsLink&&(u=i(({query:e})=>{const t=R(e);return"OperationDefinition"===t.kind&&"subscription"===t.operation},e.wsLink,u));const l=e.defaultFetchPolicies;return new c({link:u,cache:new d({addTypename:e.addTypename??!0,typePolicies:e.cacheTypePolicies}),defaultOptions:{watchQuery:{fetchPolicy:l?.watchQuery??"cache-and-network"},query:{fetchPolicy:l?.query??"cache-first"},mutate:{fetchPolicy:l?.mutate??"network-only"}}})})(t),[t.httpUrl,t.wsLink,t.addTypename,t.credentials]),E=e(()=>({operations:r,context:a,apolloConfig:t}),[r,a,t]);return T(u,{client:l,children:T(M.Provider,{value:E,children:n})})},Y=M,H=(e,t)=>{if(e)return"string"==typeof e?e:A(e,t)},W=e=>{const{addNotification:t}=y(),r=(r,a,n,o,s)=>t({type:r,title:a,message:n,crdType:e,target:H(o,e),hideFromHistory:s});return{notify:r,notifyError:(e,t,a)=>r(m.Error,e,t,a),notifySuccess:(e,t,a)=>r(m.Success,e,t,a),notifyPending:(e,t)=>r(m.Default,"Pending",e,t,!0),notifyReadonly:()=>{t({type:m.Warning,title:O.READONLY,message:p.READONLY_WARNING,hideFromHistory:!0})}}},K=e=>{e({type:m.Warning,title:O.READONLY,message:p.READONLY_WARNING,hideFromHistory:!0})},V=e=>({error:e,results:[],allSucceeded:!1,anySucceeded:!1,successCount:0,failureCount:0}),x=(e,t)=>{if(e)return"function"==typeof e?e(t):e},$=e=>{if(!e)return"Unknown error";if(e instanceof Error)return e.cause instanceof Error?e.cause.message:e.message;if("object"==typeof e){const t=e;return t.cause?.message||t.message||String(e)}return String(e)},B=(e,t)=>e.client??t,j=async(e,t,r,a,n)=>{if(!t)return{error:"Query operation not configured"};if(t.canRun&&!t.canRun(a))return{data:void 0};if(t.run)try{return await t.run(B(t,e),r,a)}catch(e){return{error:$(e)}}const o=x(t.document,a);if(!o)return{error:"Query operation not supported in this context"};const s=t.transformVariables?t.transformVariables(r,a):r,i=B(t,e);try{const e=await i.query({query:o,variables:s,fetchPolicy:n??"network-only"});return{data:t.transformResult?t.transformResult(e.data,a):e.data,error:e.error?$(e.error):void 0}}catch(e){return{error:$(e)}}},q=async(e,t,r,a)=>{if(!t)return{error:"Mutation operation not configured"};if(t.canRun&&!t.canRun(a))return{data:void 0};if(t.run)try{return await t.run(B(t,e),r,a)}catch(e){return{error:$(e)}}const n=x(t.document,a);if(!n)return{error:"Mutation operation not supported in this context"};const o=t.transformVariables?t.transformVariables(r,a):r,s=B(t,e);try{const e=await s.mutate({mutation:n,variables:o});return{data:t.transformResult?t.transformResult(e.data,a):e.data,error:void 0}}catch(e){return{error:$(e)}}},Q=async(e,t,r,a,n)=>{if(!t)return V("Multi fetch operation not configured");if(!r.length)return V("No proxy ids supplied for multi fetch");const o=B(t,e);if(t.transformVariablesMulti&&(t.documentMulti||t.document)){const e=t.transformVariablesMulti(r,a,n),s=[];for(const r of e)try{const e=await o.query({query:r.document,variables:r.variables,fetchPolicy:"network-only"});t.transformMultiResult?t.transformMultiResult(e.data,n).forEach(e=>s.push(e)):r.proxyIDs.forEach(t=>{s.push({proxyID:t,success:!e.error,data:e.data,error:e.error?.message})})}catch(e){const t=$(e);r.proxyIDs.forEach(e=>s.push({proxyID:e,success:!1,error:t}))}const i=s.filter(e=>e.success).length,c=s.length-i,d=Array.from(new Set(s.filter(e=>!!e.error).map(e=>e.error)));return{results:s,allSucceeded:0===c,anySucceeded:i>0,successCount:i,failureCount:c,error:d.length?d.join(", "):void 0}}const s=await Promise.all(r.map(async r=>{const o={...n,proxyID:r},s=await j(e,t,a,o);return{proxyID:r,success:!s.error,data:s.data,error:s.error}})),i=s.filter(e=>e.success).length,c=s.length-i,d=Array.from(new Set(s.filter(e=>!!e.error).map(e=>e.error)));return{results:s,allSucceeded:0===c,anySucceeded:i>0,successCount:i,failureCount:c,error:d.length?d.join(", "):void 0}},z=E`
2
- query OdigosApiNoop {
3
- __typename
4
- }
5
- `,X=(e,t,r)=>{if(void 0===t)return;return e?.transformResult?e.transformResult(t,r):t},J=(t,r,n)=>{const{operations:o,context:s}=k(),i=((e,t)=>e[t])(o,t),c=e(()=>((e,t)=>{if(e)return"function"==typeof e?e(t):e})(i?.document,s),[i,s]),d=e(()=>((e,t,r)=>{if(!e)return;const a=e.transformVariables;return a?a(t,r):t})(i,r,s),[i,r,s]),u=!i||!c,E=!!i?.canRun&&!i.canRun(s),f=n?.skip||u||E,T=l(c??z,{variables:d,skip:f,pollInterval:n?.pollInterval,fetchPolicy:n?.fetchPolicy??"cache-and-network",notifyOnNetworkStatusChange:n?.notifyOnNetworkStatusChange,client:i?.client,onCompleted:n?.onCompleted?e=>{const t=X(i,e,s);void 0!==t&&n.onCompleted(t)}:void 0,onError:n?.onError}),_=e(()=>{if(!f)return X(i,T.data,s)},[i,s,T.data,f]),S=a(async()=>{if(u)return{data:void 0};const e=await T.refetch();return{data:X(i,e.data,s)}},[i,s,T,u]);return{data:_,loading:!f&&T.loading,error:T.error,refetch:S,unsupported:u}},Z=[],ee=(e,t,r,a)=>{let n=!0;const o={sources:[]};for(const[s,i]of Object.entries(e)){if(!i.length)continue;n=!1;const e=i.map(({id:e,selected:t,currentStreamName:a})=>({namespace:e.namespace,name:e.name,kind:e.kind,selected:void 0!==t&&t,currentStreamName:a||r}));let c=0,d=0;for(const r of e){const e=t.find(e=>e.id.namespace===s&&e.id.name===r.name&&e.id.kind===r.kind),a=e?.dataStreamNames||[];r.selected&&!e?c++:!r.selected&&e&&a.length<=1&&d++}a(c,d),o.sources.push(...e)}return{payload:o,isEmpty:n}},te=(e,t)=>{let r=!0;const a={namespaces:[]};for(const[n,{selected:o,currentStreamName:s}]of Object.entries(e))"boolean"==typeof o&&(r=!1,a.namespaces.push({namespace:n,selected:o,currentStreamName:s||t}));return{payload:a,isEmpty:r}},re={filter:{markedForInstrumentation:!0}},ae=[],ne=[],oe=async e=>{const t=(e=>{try{return new URL("/diagnose/download",e).toString()}catch{return null}})(e.httpUrl);if(t)try{const[r,a]=await Promise.all([Promise.resolve(e.authHeader?.()??{}),Promise.resolve(e.csrfHeader?.()??{})]),n=await fetch(t,{credentials:e.credentials??"same-origin",headers:{...r,...a}});if(!n.ok)throw new Error(`Failed to download diagnose archive: ${n.status} ${n.statusText}`);((e,t)=>{if("undefined"==typeof document)return;const r=URL.createObjectURL(e),a=document.createElement("a");a.href=r,a.download=t,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(r)})(await n.blob(),`odigos-diagnose-${Date.now()}.tar.gz`)}catch(e){}},se=[],ie=[],ce=[],de=[],ue=(e,t)=>({...e,fields:e.fields.filter(({value:e})=>void 0!==e),currentStreamName:t}),le=()=>{const{operations:t,context:r}=k(),o=f(),s=((e,t)=>{const r=f(),{notifyError:n,notifySuccess:o,notifyPending:s,notifyReadonly:i}=W(N.Source),{selectedStreamName:c}=g(),{setProgress:d,resetProgress:u}=L(),{setConfiguredSources:l,setConfiguredFutureApps:E}=G(),T=(e,t)=>{const{progress:r}=L.getState();e>0&&d(P.Instrumenting,{total:(r[P.Instrumenting]?.total||0)+e,current:r[P.Instrumenting]?.current||0}),t>0&&d(P.Uninstrumenting,{total:(r[P.Uninstrumenting]?.total||0)+t,current:r[P.Uninstrumenting]?.current||0})},_=a(async()=>{const{error:a}=await j(r,e.GET_WORKLOADS,re,t);a&&n(I.Read,a)},[r,e.GET_WORKLOADS,t,n]);return{useSources:()=>{const e=J("GET_WORKLOADS",re,{fetchPolicy:"cache-first"});return{items:e.data?.workloads??ae,loading:e.loading,refetch:_}},fetchAll:_,fetchByTargets:async(a,o)=>{const s=!!o?.slim,i=a.map(e=>U(e,N.Source)).filter(e=>e.namespace&&e.name&&e.kind);if(0===i.length)return;if(i.length>50)return void await _();const c=s&&e.GET_WORKLOADS_BY_IDS_SLIM?e.GET_WORKLOADS_BY_IDS_SLIM:e.GET_WORKLOADS_BY_IDS,{error:d}=await j(r,c,{ids:i.map(({namespace:e,kind:t,name:r})=>({namespace:e,kind:t,name:r}))},t);d?n(I.Read,d):await _()},fetchById:async a=>{const{data:o,error:s}=await j(r,e.GET_WORKLOADS_BY_IDS,{ids:[{namespace:a.namespace,kind:a.kind,name:a.name}]},t);if(!s)return await _(),o?.workloadsByIds?.find(e=>e.id.namespace===a.namespace&&e.id.kind===a.kind&&e.id.name===a.name);n(I.Read,s)},fetchLibraries:async a=>j(r,e.GET_SOURCE_LIBRARIES,a,t),fetchPeerSources:async a=>j(r,e.GET_PEER_SOURCES,{serviceName:a},t),usePeerSources:(e,t)=>J("GET_PEER_SOURCES",e,t),persist:async(a,o)=>{if(t.isReadonly)return i();const{data:d}=await j(r,e.GET_WORKLOADS,re,t,"cache-first"),f=d?.workloads??ae,{payload:_,isEmpty:S}=ee(a,f,c,T),{payload:R,isEmpty:y}=te(o,c);let p=!1;S||(p=!0,s("Persisting sources...")),y||p||s("Persisting namespaces...");const{error:O}=await q(r,e.PERSIST_SOURCES,_,t);if(O&&(u(P.Instrumenting),u(P.Uninstrumenting),n(I.Update,O)),e.PERSIST_NAMESPACES){const{error:a}=await q(r,e.PERSIST_NAMESPACES,R,t);a&&n(I.Update,a)}l({}),E({})},persistV2:async a=>{if(t.isReadonly)return i(),{error:"readonly"};const n=[];for(const[,o]of Object.entries(a)){const a={sources:[]},s={namespaces:[]};for(const e of o)e.name&&e.kind?a.sources.push(e):s.namespaces.push(e);if(s.namespaces.length>0&&e.PERSIST_NAMESPACES){const{error:a}=await q(r,e.PERSIST_NAMESPACES,s,t);a&&n.push(a)}if(a.sources.length>0){const{error:o}=await q(r,e.PERSIST_SOURCES,a,t);o&&n.push(o)}}return n.length?{error:n.join(", ")}:void 0},update:async(a,d)=>{if(t.isReadonly)return i();s("Updating source...");const u={sourceId:a,patchSourceRequest:{...d,currentStreamName:c}},{data:l,error:E}=await q(r,e.UPDATE_SOURCE,u,t);E?n(I.Update,E,a):l?.updateK8sActualSource&&o(I.Update,`Successfully updated "${a.name}" source`,a)},restartWorkloads:async a=>{if(t.isReadonly)return i();s("Restarting sources...");const{data:c,error:d}=await q(r,e.RESTART_WORKLOADS,{sourceIds:a},t);d?n(I.Update,d):c?.restartWorkloads&&o(I.Update,`Successfully restarted ${a.length} sources`)},restartPod:async(a,c)=>{if(t.isReadonly)return i();s("Restarting pod...");const{data:d,error:u}=await q(r,e.RESTART_POD,{namespace:a,name:c},t);u?n(I.Update,u):d?.restartPod&&o(I.Update,`Successfully restarted pod ${a}/${c}`)},recoverFromRollback:async a=>{if(t.isReadonly)return i();s("Recovering from rollback...");const{data:c,error:d}=await q(r,e.RECOVER_FROM_ROLLBACK,{sourceId:a},t);d?n(I.Update,d,a):c?.recoverFromRollbackForWorkload&&o(I.Update,"Successfully triggered recovery from rollback")}}})(t,r),i=((e,t)=>{const r=f(),{notifyError:a,notifySuccess:n,notifyReadonly:o}=W(N.Destination),{selectedStreamName:s}=g(),i=async()=>{const{error:n}=await j(r,e.GET_DESTINATIONS,void 0,t);n&&a(I.Read,n)};return{useDestinations:()=>{const e=J("GET_DESTINATIONS",void 0,{fetchPolicy:"cache-first"});return{items:e.data?.computePlatform?.destinations??e.data?.destinations??de,loading:e.loading,refetch:i}},useDestinationCategories:()=>{const e=J("GET_DESTINATION_CATEGORIES",void 0);return{data:e.data,loading:e.loading}},usePotentialDestinations:()=>{const e=J("GET_POTENTIAL_DESTINATIONS",void 0);return{data:e.data,loading:e.loading}},fetchAll:i,testConnection:async a=>{const{data:n}=await q(r,e.TEST_DESTINATION_CONNECTION,{destination:ue(a,s)},t);return n},create:async c=>{if(t.isReadonly)return o();const{error:d}=await q(r,e.CREATE_DESTINATION,{destination:ue(c,s)},t);d?a(I.Create,d):(n(I.Create,`Successfully created "${c.type}" destination`),await i())},update:async(c,d)=>{if(t.isReadonly)return o();const{data:u,error:l}=await q(r,e.UPDATE_DESTINATION,{id:c,destination:ue(d,s)},t);l?a(I.Update,l,c):u?.updateDestination&&(n(I.Update,`Successfully updated "${d.type}" destination`,c),await i())},remove:async c=>{if(t.isReadonly)return o();const{data:d}=await j(r,e.GET_DESTINATIONS,void 0,t,"cache-first"),u=d?.computePlatform?.destinations??d?.destinations??de,l=u.find(e=>D(e)===c)?.destinationType?.type,{error:E}=await q(r,e.DELETE_DESTINATION,{id:c,currentStreamName:s},t);E?a(I.Delete,E,c):(n(I.Delete,`Successfully deleted "${l??c}" destination`,c),await i())}}})(t,r),c=((e,t)=>{const r=f(),{notifyError:a,notifySuccess:n,notifyReadonly:o}=W(N.Action),s=async()=>{const{error:n}=await j(r,e.GET_ACTIONS,void 0,t);n&&a(I.Read,n)};return{useActions:()=>{const e=J("GET_ACTIONS",void 0,{fetchPolicy:"cache-first"});return{items:e.data?.computePlatform?.actions??e.data?.actions??ne,loading:e.loading,refetch:s}},fetchAll:s,create:async i=>{if(t.isReadonly)return o();if(!e.CREATE_ACTION)return;const{error:c}=await q(r,e.CREATE_ACTION,{action:i},t);c?a(I.Create,c):(n(I.Create,`Successfully created "${i.type}" action`),await s())},update:async(i,c)=>{if(t.isReadonly)return o();if(!e.UPDATE_ACTION)return;const{error:d}=await q(r,e.UPDATE_ACTION,{id:i,action:c},t);d?a(I.Update,d,i):(n(I.Update,`Successfully updated "${c.type}" action`,i),await s())},remove:async(i,c)=>{if(t.isReadonly)return o();if(!e.DELETE_ACTION)return;const{error:d}=await q(r,e.DELETE_ACTION,{id:i,actionType:c},t);d?a(I.Delete,d,i):(n(I.Delete,`Successfully deleted "${c}" action`,i),await s())}}})(t,r),d=((t,r)=>{const a=f(),{notifyError:n,notifySuccess:o,notifyReadonly:s}=W(N.InstrumentationRule),i=async()=>{const{error:e}=await j(a,t.GET_INSTRUMENTATION_RULES,void 0,r);e&&n(I.Read,e)};return{useRules:()=>{const t=J("GET_INSTRUMENTATION_RULES",void 0,{fetchPolicy:"cache-first"});return{items:e(()=>(t.data?.computePlatform?.instrumentationRules??t.data?.instrumentationRules??[]).map(w),[t.data]),loading:t.loading,refetch:i}},fetchAll:i,create:async(e,c)=>{if(r.isReadonly)return s();if(!t.CREATE_INSTRUMENTATION_RULE)return;const{error:d}=await q(a,t.CREATE_INSTRUMENTATION_RULE,{instrumentationRule:v(e)},r);d?n(I.Create,d):(o(I.Create,`Successfully created${c?` "${c}"`:""} rule`),await i())},update:async(e,c,d)=>{if(r.isReadonly)return s();if(!t.UPDATE_INSTRUMENTATION_RULE)return;const{error:u}=await q(a,t.UPDATE_INSTRUMENTATION_RULE,{ruleId:e,instrumentationRule:v(c)},r);u?n(I.Update,u,e):(o(I.Update,`Successfully updated${d?` "${d}"`:""} rule`,e),await i())},remove:async(e,c)=>{if(r.isReadonly)return s();if(!t.DELETE_INSTRUMENTATION_RULE)return;const{error:d}=await q(a,t.DELETE_INSTRUMENTATION_RULE,{ruleId:e},r);d?n(I.Delete,d,e):(o(I.Delete,`Successfully deleted${c?` "${c}"`:""} rule`,e),await i())}}})(t,r),u=((e,t)=>{const r=f(),{addNotification:a}=y(),{setDataStreams:o}=g(),s=(e,t)=>a({type:m.Error,title:e,message:t}),i=async()=>{const{data:a,error:n}=await j(r,e.GET_DATA_STREAMS,void 0,t);if(n)s(I.Read,n);else if(a){const e=a.computePlatform?.dataStreams??a.dataStreams??[];o(e)}},c=e.CREATE_DATA_STREAM?async n=>{if(t.isReadonly)return K(a);const{error:o}=await q(r,e.CREATE_DATA_STREAM,{stream:n},t);o?s(I.Create,o):await i()}:void 0;return{useDataStreams:()=>{const e=J("GET_DATA_STREAMS",void 0,{fetchPolicy:"cache-first"}),t=e.data?.computePlatform?.dataStreams??e.data?.dataStreams??ce;return n(()=>{o(t)},[JSON.stringify(t.map(e=>e.name))]),{items:t,loading:e.loading,refetch:i}},fetchAll:i,create:c,update:async(n,o)=>{if(t.isReadonly)return K(a);const{error:c}=await q(r,e.UPDATE_DATA_STREAM,{id:n,dataStream:o},t);c?s(I.Update,c):await i()},remove:async n=>{if(t.isReadonly)return K(a);const{error:o}=await q(r,e.DELETE_DATA_STREAM,{id:n},t);o?s(I.Delete,o):await i()}}})(t,r),l=((e,t)=>{const r=f(),{notifyError:a,notifyReadonly:n}=W(N.Namespace),o=async()=>{const n=await j(r,e.GET_NAMESPACES_WITH_WORKLOADS,void 0,t);return n.error&&a(I.Read,n.error),n};return{useNamespaces:()=>{const e=J("GET_NAMESPACES_WITH_WORKLOADS",void 0,{fetchPolicy:"cache-first"});return{items:e.data?.namespaces??ie,loading:e.loading,refetch:o}},fetchAll:o,persist:async o=>{if(t.isReadonly)return n();const{error:s}=await q(r,e.PERSIST_NAMESPACES,o,t);return s&&a(I.Update,s),s?{error:s}:void 0}}})(t,r),E=((e,t)=>{const r=f(),{notifyError:a}=W(N.Source);return{fetch:async n=>{const o=await j(r,e.GET_K8S_MANIFEST,n,t);return o.error&&a(I.Read,o.error),o}}})(t,r),T=((e,t)=>{const r=f(),{notifyError:a,notifySuccess:n,notifyReadonly:o}=W(N.Source);return{useEffectiveConfig:(e,t)=>J("GET_EFFECTIVE_CONFIG",e,t),useConfigYamls:e=>J("GET_CONFIG_YAMLS",void 0,e),getEffectiveConfig:async a=>e.GET_EFFECTIVE_CONFIG?j(r,e.GET_EFFECTIVE_CONFIG,{id:a},t):{error:"GET_EFFECTIVE_CONFIG not configured"},applyConfigurations:e.UPDATE_REMOTE_CONFIG?async(n,s)=>{if(t.isReadonly)return o();const{error:i}=await q(r,e.UPDATE_REMOTE_CONFIG,{formData:n,connectionIds:s},t);return i&&a(I.Update,i),i?{error:i}:void 0}:void 0,getConfigYamls:e.GET_CONFIG_YAMLS?async()=>j(r,e.GET_CONFIG_YAMLS,void 0,t):void 0,updateLocalUiConfig:e.UPDATE_LOCAL_UI_CONFIG?async s=>{if(t.isReadonly)return o();const{error:i}=await q(r,e.UPDATE_LOCAL_UI_CONFIG,{config:s},t);return i?a(I.Update,i):n(I.Update,"Local UI configuration updated successfully"),i?{error:i}:void 0}:void 0,resetLocalUiConfigToDefaults:e.RESET_LOCAL_UI_CONFIG_TO_FACTORY_DEFAULTS?async()=>{if(t.isReadonly)return o();const{error:s}=await q(r,e.RESET_LOCAL_UI_CONFIG_TO_FACTORY_DEFAULTS,void 0,t);return s?a(I.Update,s):n(I.Update,"Local UI configuration reset to factory defaults"),s?{error:s}:void 0}:void 0}})(t,r),_=((e,t)=>{const r=f(),{apolloConfig:a}=k();return{fetchDescribeOdigos:e.GET_DESCRIBE_ODIGOS?async()=>j(r,e.GET_DESCRIBE_ODIGOS,void 0,t):void 0,fetchDescribeSource:e.GET_DESCRIBE_SOURCE?async a=>j(r,e.GET_DESCRIBE_SOURCE,a,t):void 0,downloadDiagnose:e.GET_DIAGNOSE?async(n,o)=>{const s=await j(r,e.GET_DIAGNOSE,{input:n,dryRun:o?.dryRun??!1},t),i=s?.data?.stats?.fileCount??0;return!s.error&&i>0&&!o?.dryRun&&await oe(a),s}:void 0}})(t,r),S=((e,t)=>{const r=f(),{notifyError:a,notifyReadonly:n}=W(N.Source),o=async()=>{e.GET_TOKENS&&await j(r,e.GET_TOKENS,void 0,t)};return{useTokens:()=>{const e=J("GET_TOKENS",void 0,{fetchPolicy:"cache-first"});return{items:e.data??Z,loading:e.loading,refetch:o}},updateToken:e.UPDATE_TOKEN?async o=>{if(t.isReadonly)return n();const{error:s}=await q(r,e.UPDATE_TOKEN,{token:o},t);return s&&a(I.Update,s),s?{error:s}:void 0}:void 0}})(t,r),R=((e,t)=>{const r=f();return{useMetrics:e=>J("GET_METRICS",void 0,e),fetch:async()=>j(r,e.GET_METRICS,void 0,t)}})(t,r),p=((e,t)=>{const r=f();return{useServiceMap:e=>J("GET_SERVICE_MAP",void 0,e),fetch:e.GET_SERVICE_MAP?async()=>j(r,e.GET_SERVICE_MAP,void 0,t):void 0}})(t,r),O=((e,t)=>{const r=f();return{useSlots:e=>J("GET_PROFILING_SLOTS",void 0,e),useSourceProfiling:(e,t)=>J("GET_SOURCE_PROFILING",e,t),fetchSlots:e.GET_PROFILING_SLOTS?async()=>j(r,e.GET_PROFILING_SLOTS,void 0,t):void 0,fetchSourceProfiling:e.GET_SOURCE_PROFILING?async a=>j(r,e.GET_SOURCE_PROFILING,a,t):void 0,enableProfiling:e.ENABLE_SOURCE_PROFILING?async a=>q(r,e.ENABLE_SOURCE_PROFILING,a,t):void 0}})(t,r),A=((e,t)=>{const r=f();return{useGatewayInfo:e=>J("GET_GATEWAY_INFO",void 0,e),useGatewayPods:e=>J("GET_GATEWAY_PODS",void 0,e),useNodeCollectorInfo:e=>J("GET_NODE_COLLECTOR_INFO",void 0,e),useNodeCollectorPods:e=>J("GET_NODE_COLLECTOR_PODS",void 0,e),usePodInfo:(e,t)=>J("GET_COLLECTOR_POD_INFO",e,t),getGatewayInfo:e.GET_GATEWAY_INFO?async()=>j(r,e.GET_GATEWAY_INFO,void 0,t):void 0,getGatewayPods:e.GET_GATEWAY_PODS?async()=>j(r,e.GET_GATEWAY_PODS,void 0,t):void 0,getNodeCollectorInfo:e.GET_NODE_COLLECTOR_INFO?async()=>j(r,e.GET_NODE_COLLECTOR_INFO,void 0,t):void 0,getNodeCollectorPods:e.GET_NODE_COLLECTOR_PODS?async()=>j(r,e.GET_NODE_COLLECTOR_PODS,void 0,t):void 0,getExtendedPodInfo:e.GET_COLLECTOR_POD_INFO?async(a,n)=>j(r,e.GET_COLLECTOR_POD_INFO,{namespace:a,name:n},t):void 0}})(t,r),F=((e,t)=>{const r=f(),{notifyError:a,notifySuccess:n,notifyReadonly:o}=W(N.SamplingRule),s=async()=>{e.GET_SAMPLING_RULES&&await j(r,e.GET_SAMPLING_RULES,void 0,t)},i=(e,i)=>e?async c=>{if(t.isReadonly)return o();const{error:d}=await q(r,e,c,t);return d?a(i,d):(n(I.Create,"Successfully created sampling rule"),await s()),d?{error:d}:void 0}:void 0,c=(e,i)=>e?async(c,d)=>{if(t.isReadonly)return o();const{error:u}=await q(r,e,{samplingId:d.samplingId,ruleId:c,rule:d.rule},t);return u?a(i,u):(n(I.Update,"Successfully updated sampling rule"),await s()),u?{error:u}:void 0}:void 0,d=e=>e?async(i,c)=>{if(t.isReadonly)return o();const{error:d}=await q(r,e,{samplingId:c,ruleId:i},t);return d?a(I.Delete,d):(n(I.Delete,"Successfully deleted sampling rule"),await s()),d?{error:d}:void 0}:void 0;return{useSamplingRules:()=>{const e=J("GET_SAMPLING_RULES",void 0,{fetchPolicy:"cache-first"});return{items:e.data?.computePlatform?.samplingRules??e.data?.samplingRules??se,k8sHealthProbesConfig:e.data?.computePlatform?.k8sHealthProbesConfig??e.data?.k8sHealthProbesConfig??null,loading:e.loading,refetch:s}},fetchAll:e.GET_SAMPLING_RULES?async()=>j(r,e.GET_SAMPLING_RULES,void 0,t):void 0,createNoisy:i(e.CREATE_NOISY_OPERATION_RULE,I.Create),updateNoisy:c(e.UPDATE_NOISY_OPERATION_RULE,I.Update),deleteNoisy:d(e.DELETE_NOISY_OPERATION_RULE),createHighlyRelevant:i(e.CREATE_HIGHLY_RELEVANT_OPERATION_RULE,I.Create),updateHighlyRelevant:c(e.UPDATE_HIGHLY_RELEVANT_OPERATION_RULE,I.Update),deleteHighlyRelevant:d(e.DELETE_HIGHLY_RELEVANT_OPERATION_RULE),createCostReduction:i(e.CREATE_COST_REDUCTION_RULE,I.Create),updateCostReduction:c(e.UPDATE_COST_REDUCTION_RULE,I.Update),deleteCostReduction:d(e.DELETE_COST_REDUCTION_RULE),updateK8sHealthProbesConfig:e.UPDATE_LOCAL_UI_SAMPLING_CONFIG?async n=>{if(t.isReadonly)return o();const{error:i}=await q(r,e.UPDATE_LOCAL_UI_SAMPLING_CONFIG,{config:n},t);return i?a(I.Update,i):await s(),i?{error:i}:void 0}:void 0}})(t,r),M=((e,t)=>{const r=f();return{useSnapshots:()=>{const e=J("GET_ALL_CLUSTER_SNAPSHOTS",void 0,{fetchPolicy:"cache-first"});return{data:e.data,loading:e.loading,unsupported:e.unsupported}},getAllClusterSnapshots:e.GET_ALL_CLUSTER_SNAPSHOTS?async()=>j(r,e.GET_ALL_CLUSTER_SNAPSHOTS,void 0,t):void 0,getClusterSnapshot:e.GET_CLUSTER_SNAPSHOT?async a=>j(r,e.GET_CLUSTER_SNAPSHOT,{clusterId:a},t):void 0}})(t,r);return{sourcesApi:s,destinationsApi:i,actionsApi:c,instrumentationRulesApi:d,dataStreamsApi:u,namespacesApi:l,k8sManifestApi:E,configApi:T,describeApi:_,tokensApi:S,metricsApi:R,serviceMapApi:p,profilingApi:O,collectorsApi:A,samplingApi:F,snapshotsApi:M,capabilities:e(()=>((e,t)=>{const r=t.platformType===C.Vm,a=t.tier===h.Onprem,n=!r;return{canBulkPersistSources:n&&!!e.PERSIST_SOURCES,canFetchSnapshots:n&&!!e.GET_ALL_CLUSTER_SNAPSHOTS,canRecoverFromRollback:n&&!!e.RECOVER_FROM_ROLLBACK,canRestartWorkloads:n&&!!e.RESTART_WORKLOADS,canFetchPeerSources:!!e.GET_PEER_SOURCES,canFetchSourceLibraries:!!e.GET_SOURCE_LIBRARIES,canFetchK8sManifest:n&&!!e.GET_K8S_MANIFEST,canCreateDestination:n&&!!e.CREATE_DESTINATION,canTestConnection:n&&!!e.TEST_DESTINATION_CONNECTION,canFetchDestinationCategories:!!e.GET_DESTINATION_CATEGORIES,canFetchPotentialDestinations:n&&!!e.GET_POTENTIAL_DESTINATIONS,canCreateAction:n&&!!e.CREATE_ACTION,canCreateInstrumentationRule:n&&!!e.CREATE_INSTRUMENTATION_RULE,canApplyEffectiveConfig:n&&!!e.UPDATE_REMOTE_CONFIG&&!!e.GET_EFFECTIVE_CONFIG,canFetchEffectiveConfig:!!e.GET_EFFECTIVE_CONFIG,canFetchConfigYamls:!!e.GET_CONFIG_YAMLS,canFetchProfiling:n&&!!e.GET_PROFILING_SLOTS,canFetchCollectorInfo:n&&!!e.GET_GATEWAY_INFO,canManageSamplingRules:!!e.GET_SAMPLING_RULES,isEnterprise:a,isVm:r}})(t,r),[t,r]),resetCache:a(async()=>{await o.cache.reset()},[o])}};export{b as O,Y as _,ee as a,k as b,Q as c,te as p,q as r,le as u};