@odigos/ui-kit 0.0.266 → 0.0.267
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/CHANGELOG.md +7 -0
- package/docs/api-context.md +2 -2
- package/lib/chunks/{source-instrument-form-context-DnvGijkN.js → source-instrument-form-context-oSSPNkMA.js} +1 -1
- package/lib/containers.js +1 -1
- package/lib/contexts/odigos-api/types.d.ts +13 -0
- package/lib/contexts/odigos-api/use-odigos-api.d.ts +11 -2
- package/lib/contexts.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.0.267](https://github.com/odigos-io/ui-kit/compare/ui-kit-v0.0.266...ui-kit-v0.0.267) (2026-07-16)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* **api-context:** enhance proxy switching with clientKey for cache management ([#1086](https://github.com/odigos-io/ui-kit/issues/1086)) ([a30ea01](https://github.com/odigos-io/ui-kit/commit/a30ea01f21df18785ba5e386b310251c1b48b3b0))
|
|
9
|
+
|
|
3
10
|
## [0.0.266](https://github.com/odigos-io/ui-kit/compare/ui-kit-v0.0.265...ui-kit-v0.0.266) (2026-07-15)
|
|
4
11
|
|
|
5
12
|
|
package/docs/api-context.md
CHANGED
|
@@ -461,7 +461,7 @@ graph LR
|
|
|
461
461
|
FETCH -->|"runQuery<br/>(network-only)"| CACHE
|
|
462
462
|
MUT -->|"runMutation<br/>then await fetchAll()"| CACHE
|
|
463
463
|
SSE[Host SSE handler] -->|"sourcesApi.fetchAll()"| CACHE
|
|
464
|
-
PROXY[Proxy switch<br/>central-ui] -->|"
|
|
464
|
+
PROXY[Proxy switch<br/>central-ui] -->|"bump clientKey<br/>(new ApolloClient)"| CACHE
|
|
465
465
|
|
|
466
466
|
CACHE -.broadcast.-> SUB
|
|
467
467
|
CACHE -.broadcast.-> SUB2
|
|
@@ -473,7 +473,7 @@ graph LR
|
|
|
473
473
|
|
|
474
474
|
**SSE.** Both host SSE handlers (`useSSE.ts`) drop their old `useEntityStore` imports and refresh through the same `sourcesApi.fetchAll()` / `destinationsApi.fetchAll()` entry points. The deleted-target eviction primitive is gone — for an envelope-aware kit (central-ui's `REMOTE_FETCH` makes generic `cache.modify` impractical), refetching the canonical list is simpler and the result is identical.
|
|
475
475
|
|
|
476
|
-
**Reset.** Central-ui
|
|
476
|
+
**Reset.** Central-ui bumps `ApolloConfig.clientKey` (via an `apolloCacheEpoch` on the proxy store) when switching proxies and on every out-of-proxy navigation. That recreates the ApolloClient with an empty cache and orphans any in-flight writes onto the discarded client — the reliable hard boundary for multi-proxy caching. Soft alternative: `useOdigosApi().resetCache()` → `client.cache.reset()`, which does **not** abort in-flight queries (avoids Apollo error #42) but also cannot stop those responses from writing the previous proxy's data back into the cleared cache. Prefer `clientKey` for proxy switches; use `resetCache` when you only need to drop entities without tearing down the client.
|
|
477
477
|
|
|
478
478
|
**Precondition guards (`Operation.canRun`).** An `Operation` may declare `canRun?(ctx): boolean`. When it returns `false`, `useApiQuery` / `useApiLazyQuery` / `useApiMutation` skip the dispatch (no network request, no Apollo observer) and the imperative `runQuery` / `runMutation` short-circuit to `{ data: undefined }` with no error (so domain hooks don't toast). central-ui sets `canRun: (ctx) => !!ctx.proxyID && !!getVersionedQuery(...)` on every `REMOTE_FETCH`-backed op: out-of-proxy pages have no selected proxy, so without the guard the kit would fire an empty `RemoteFetch($proxyID, $query, $variables)` with both required vars missing. The multi-cluster fan-out path (`runMulti` / `transformVariablesMulti`) is scoped by explicit `proxyIDs` and intentionally bypasses `canRun`, so connections-scope bulk drawers keep working even though `ctx.proxyID` is empty there.
|
|
479
479
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsx as e}from"react/jsx-runtime";import{useMemo as t,useContext as r,createContext as a,useCallback as n,useState as o,useEffect as s,useRef as i}from"react";import{b1 as c,b2 as l,D as d,aB as u,b3 as m,b4 as p,b5 as f,P as E,b as y,b6 as h,b7 as S,b8 as T,b9 as g,ba as _,bb as A,bc as R,bd as I,be as v,bf as C,bg as N,aR as O,bh as D,bi as b,bj as w,bk as P,bl as L,bm as k,bn as F,bo as G,s as U,bp as M,F as x,bq as H,H as K,q as V,G as W,J as Y,p as $,br as j}from"./ui-components-Dq_j4_BI.js";import{n as q,m as B,k as Q,l as z,o as J,p as X,v as Z,q as ee,u as te}from"./odigos-context-DzuZq_D5.js";import{ApolloProvider as re,useLazyQuery as ae,useApolloClient as ne,useQuery as oe}from"@apollo/client/react";import{ErrorLink as se}from"@apollo/client/link/error";import{SetContextLink as ie}from"@apollo/client/link/context";import{getMainDefinition as ce}from"@apollo/client/utilities";import{CombinedGraphQLErrors as le,ServerError as de}from"@apollo/client/errors";import{HttpLink as ue,ApolloLink as me,ApolloClient as pe,InMemoryCache as fe,gql as Ee}from"@apollo/client";const ye=e=>{if(!e)return!1;const t=e.toLowerCase();return t.includes("authentication required")||t.includes("authentication expired")||t.includes("http 401")},he=a(null),Se=()=>{const e=r(he);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},Te=({apolloConfig:r,operations:a,context:n,children:o})=>{const s=t(()=>(e=>{const t=new ue({uri:e.httpUrl,credentials:e.credentials??"same-origin"}),r=new se(({error:t})=>{le.is(t)?t.errors.some(e=>ye(e.message))&&e.onAuthError?.():(de.is(t)&&401===t.statusCode||ye(t.message))&&e.onAuthError?.()}),a=new ie(async t=>{const r={...t.headers};if(e.authHeader){const t=await e.authHeader();Object.assign(r,t)}return e.csrfHeader&&Object.assign(r,e.csrfHeader()),{headers:r}}),n=[];e.additionalLinks?.length&&n.push(...e.additionalLinks),n.push(a,r,t);let o=me.from(n);e.wsLink&&(o=me.split(({query:e})=>{const t=ce(e);return"OperationDefinition"===t.kind&&"subscription"===t.operation},e.wsLink,o));const s=e.defaultFetchPolicies;return new pe({link:o,cache:new fe({typePolicies:e.cacheTypePolicies}),defaultOptions:{watchQuery:{fetchPolicy:s?.watchQuery??"cache-and-network"},query:{fetchPolicy:s?.query??"cache-first"},mutate:{fetchPolicy:s?.mutate??"network-only"}}})})(r),[r.httpUrl,r.wsLink,r.credentials]),i=t(()=>({operations:a,context:n,apolloConfig:r}),[a,n,r]);return e(re,{client:s,children:e(he.Provider,{value:i,children:o})})},ge=he,_e=({connectionIds:r,children:a})=>{const n=Se(),o=t(()=>({operations:n.operations,context:{...n.context,connectionIds:r},apolloConfig:n.apolloConfig}),[n.operations,n.context,n.apolloConfig,r.join(",")]);return e(ge.Provider,{value:o,children:a})},Ae=(e,t)=>{if(e)return"string"==typeof e?e:m(e,t)},Re=e=>{const{addNotification:t}=c(),r=(r,a,n,o,s)=>t({type:r,title:a,message:n,crdType:e,target:Ae(o,e),hideFromHistory:s});return{notify:r,notifyError:(e,t,a)=>r(u.Error,e,t,a),notifySuccess:(e,t,a)=>r(u.Success,e,t,a),notifyPending:(e,t)=>r(u.Default,"Pending",e,t,!0),notifyReadonly:()=>{t({type:u.Warning,title:d.READONLY,message:l.READONLY_WARNING,hideFromHistory:!0})}}},Ie=e=>{e({type:u.Warning,title:d.READONLY,message:l.READONLY_WARNING,hideFromHistory:!0})},ve=e=>({error:e,results:[],allSucceeded:!1,anySucceeded:!1,successCount:0,failureCount:0}),Ce=(e,t)=>{if(e)return"function"==typeof e?e(t):e},Ne=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)},Oe=(e,t)=>e.client??t,De=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(Oe(t,e),r,a)}catch(e){return{error:Ne(e)}}const o=Ce(t.document,a);if(!o)return{error:"Query operation not supported in this context"};const s=t.transformVariables?t.transformVariables(r,a):r,i=Oe(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?Ne(e.error):void 0}}catch(e){return{error:Ne(e)}}},be=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(Oe(t,e),r,a)}catch(e){return{error:Ne(e)}}const n=Ce(t.document,a);if(!n)return{error:"Mutation operation not supported in this context"};const o=t.transformVariables?t.transformVariables(r,a):r,s=Oe(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:Ne(e)}}},we=async(e,t,r,a,n)=>{if(!t)return ve("Multi fetch operation not configured");if(!r.length)return ve("No proxy ids supplied for multi fetch");const o=Oe(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=Ne(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,l=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:l.length?l.join(", "):void 0}}const s=await Promise.all(r.map(async r=>{const o={...n,proxyID:r},s=await De(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,l=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:l.length?l.join(", "):void 0}},Pe=Ee`
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{useMemo as t,useContext as r,createContext as a,useCallback as n,useState as o,useEffect as s,useRef as i}from"react";import{b1 as c,b2 as l,D as d,aB as u,b3 as m,b4 as p,b5 as f,P as E,b as y,b6 as h,b7 as S,b8 as T,b9 as g,ba as _,bb as A,bc as R,bd as I,be as v,bf as C,bg as N,aR as O,bh as D,bi as b,bj as w,bk as P,bl as L,bm as k,bn as F,bo as G,s as U,bp as M,F as x,bq as H,H as K,q as V,G as W,J as Y,p as $,br as j}from"./ui-components-Dq_j4_BI.js";import{n as q,m as B,k as Q,l as z,o as J,p as X,v as Z,q as ee,u as te}from"./odigos-context-DzuZq_D5.js";import{ApolloProvider as re,useLazyQuery as ae,useApolloClient as ne,useQuery as oe}from"@apollo/client/react";import{ErrorLink as se}from"@apollo/client/link/error";import{SetContextLink as ie}from"@apollo/client/link/context";import{getMainDefinition as ce}from"@apollo/client/utilities";import{CombinedGraphQLErrors as le,ServerError as de}from"@apollo/client/errors";import{HttpLink as ue,ApolloLink as me,ApolloClient as pe,InMemoryCache as fe,gql as Ee}from"@apollo/client";const ye=e=>{if(!e)return!1;const t=e.toLowerCase();return t.includes("authentication required")||t.includes("authentication expired")||t.includes("http 401")},he=a(null),Se=()=>{const e=r(he);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},Te=({apolloConfig:r,operations:a,context:n,children:o})=>{const s=t(()=>(e=>{const t=new ue({uri:e.httpUrl,credentials:e.credentials??"same-origin"}),r=new se(({error:t})=>{le.is(t)?t.errors.some(e=>ye(e.message))&&e.onAuthError?.():(de.is(t)&&401===t.statusCode||ye(t.message))&&e.onAuthError?.()}),a=new ie(async t=>{const r={...t.headers};if(e.authHeader){const t=await e.authHeader();Object.assign(r,t)}return e.csrfHeader&&Object.assign(r,e.csrfHeader()),{headers:r}}),n=[];e.additionalLinks?.length&&n.push(...e.additionalLinks),n.push(a,r,t);let o=me.from(n);e.wsLink&&(o=me.split(({query:e})=>{const t=ce(e);return"OperationDefinition"===t.kind&&"subscription"===t.operation},e.wsLink,o));const s=e.defaultFetchPolicies;return new pe({link:o,cache:new fe({typePolicies:e.cacheTypePolicies}),defaultOptions:{watchQuery:{fetchPolicy:s?.watchQuery??"cache-and-network"},query:{fetchPolicy:s?.query??"cache-first"},mutate:{fetchPolicy:s?.mutate??"network-only"}}})})(r),[r.httpUrl,r.wsLink,r.credentials,r.clientKey]),i=t(()=>({operations:a,context:n,apolloConfig:r}),[a,n,r]);return e(re,{client:s,children:e(he.Provider,{value:i,children:o})})},ge=he,_e=({connectionIds:r,children:a})=>{const n=Se(),o=t(()=>({operations:n.operations,context:{...n.context,connectionIds:r},apolloConfig:n.apolloConfig}),[n.operations,n.context,n.apolloConfig,r.join(",")]);return e(ge.Provider,{value:o,children:a})},Ae=(e,t)=>{if(e)return"string"==typeof e?e:m(e,t)},Re=e=>{const{addNotification:t}=c(),r=(r,a,n,o,s)=>t({type:r,title:a,message:n,crdType:e,target:Ae(o,e),hideFromHistory:s});return{notify:r,notifyError:(e,t,a)=>r(u.Error,e,t,a),notifySuccess:(e,t,a)=>r(u.Success,e,t,a),notifyPending:(e,t)=>r(u.Default,"Pending",e,t,!0),notifyReadonly:()=>{t({type:u.Warning,title:d.READONLY,message:l.READONLY_WARNING,hideFromHistory:!0})}}},Ie=e=>{e({type:u.Warning,title:d.READONLY,message:l.READONLY_WARNING,hideFromHistory:!0})},ve=e=>({error:e,results:[],allSucceeded:!1,anySucceeded:!1,successCount:0,failureCount:0}),Ce=(e,t)=>{if(e)return"function"==typeof e?e(t):e},Ne=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)},Oe=(e,t)=>e.client??t,De=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(Oe(t,e),r,a)}catch(e){return{error:Ne(e)}}const o=Ce(t.document,a);if(!o)return{error:"Query operation not supported in this context"};const s=t.transformVariables?t.transformVariables(r,a):r,i=Oe(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?Ne(e.error):void 0}}catch(e){return{error:Ne(e)}}},be=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(Oe(t,e),r,a)}catch(e){return{error:Ne(e)}}const n=Ce(t.document,a);if(!n)return{error:"Mutation operation not supported in this context"};const o=t.transformVariables?t.transformVariables(r,a):r,s=Oe(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:Ne(e)}}},we=async(e,t,r,a,n)=>{if(!t)return ve("Multi fetch operation not configured");if(!r.length)return ve("No proxy ids supplied for multi fetch");const o=Oe(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=Ne(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,l=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:l.length?l.join(", "):void 0}}const s=await Promise.all(r.map(async r=>{const o={...n,proxyID:r},s=await De(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,l=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:l.length?l.join(", "):void 0}},Pe=Ee`
|
|
2
2
|
query OdigosApiNoop {
|
|
3
3
|
__typename
|
|
4
4
|
}
|
package/lib/containers.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import n,{useEffect as i,useMemo as a,useRef as l,useCallback as r,useState as s,Fragment as c,forwardRef as d,useImperativeHandle as p,Children as u,createContext as h,useContext as m,useLayoutEffect as g,memo as f}from"react";import b,{useTheme as v,css as y,keyframes as C}from"styled-components";import{u as S,n as x,C as w,f as T,e as k,d as E,q as I,g as N,h as $,j as O,p as A,l as R,c as D,r as _,S as P,s as L,R as F,t as M,w as z,o as B,x as X,y as U,z as V,A as H,B as j,D as G,E as W,F as K,G as Y,H as q,I as J,J as Z}from"./chunks/odigos-context-DzuZq_D5.js";import{bi as Q,w as ee,x as te,C as oe,aT as ne,I as ie,bs as ae,d as le,e as re,j as se,aX as ce,bt as de,N as pe,Q as ue,U as he,y as me,m as ge,n as fe,B as be,S as ve,bu as ye,bv as Ce,a1 as Se,bw as xe,bx as we,k as Te,by as ke,F as Ee,bz as Ie,s as Ne,T as $e,bA as Oe,bj as Ae,aW as Re,bB as De,bC as _e,i as Pe,az as Le,aB as Fe,bD as Me,bo as ze,bp as Be,bn as Xe,bE as Ue,u as Ve,H as He,r as je,G as Ge,J as We,q as Ke,p as Ye,bF as qe,bG as Je,aJ as Ze,W as Qe,D as et,b6 as tt,bH as ot,bI as nt,bJ as it,bK as at,bL as lt,bM as rt,bN as st,bO as ct,z as dt,bP as pt,bQ as ut,bR as ht,bS as mt,bT as gt,aV as ft,bm as bt,h as vt,bU as yt,bV as Ct,aY as St,bW as xt,bX as wt,aR as Tt,bq as kt,b5 as Et,b as It,f as Nt,bY as $t,b7 as Ot,bZ as At,b_ as Rt,b9 as Dt,b$ as _t,a_ as Pt,c0 as Lt,c as Ft,l as Mt,bc as zt,bh as Bt,ay as Xt,c1 as Ut,c2 as Vt,bg as Ht,c3 as jt,c4 as Gt,c5 as Wt,v as Kt,b1 as Yt,b2 as qt,aD as Jt,c6 as Zt,c7 as Qt,c8 as eo,c9 as to,ca as oo,cb as no,cc as io,cd as ao,ce as lo,cf as ro,cg as so,A as co,aZ as po,aU as uo,ch as ho,ci as mo,cj as go,ck as fo,cl as bo,cm as vo,br as yo,cn as Co,co as So,cp as xo,cq as wo,cr as To,cs as ko,ct as Eo,cu as Io,cv as No,aI as $o,cw as Oo,cx as Ao,cy as Ro,cz as Do,cA as _o,cB as Po,cC as Lo,cD as Fo,cE as Mo,cF as zo,cG as Bo,cH as Xo,cI as Uo,ao as Vo,cJ as Ho,cK as jo,cL as Go,cM as Wo,cN as Ko,cO as Yo,cP as qo,cQ as Jo,cR as Zo,cS as Qo,cT as en,cU as tn,cV as on,cW as nn,cX as an,a7 as ln,cY as rn,cZ as sn,a$ as cn,c_ as dn,c$ as pn,d0 as un,d1 as hn,d2 as mn,d3 as gn,d4 as fn,d5 as bn,d6 as vn,d7 as yn,d8 as Cn,d9 as Sn,da as xn,db as wn,dc as Tn,dd as kn,de as En,df as In,dg as Nn,dh as $n,di as On,dj as An,dk as Rn,dl as Dn,dm as _n,dn as Pn,dp as Ln,dq as Fn,dr as Mn,ds as zn,dt as Bn,du as Xn,dv as Un,dw as Vn,dx as Hn,dy as jn,dz as Gn,dA as Wn,dB as Kn,dC as Yn,dD as qn,dE as Jn,dF as Zn,dG as Qn,dH as ei,dI as ti,dJ as oi,dK as ni,dL as ii,dM as ai,dN as li,dO as ri,dP as si,dQ as ci,dR as di,dS as pi,dT as ui,dU as hi,dV as mi,dW as gi,dX as fi,dY as bi,dZ as vi,d_ as yi,d$ as Ci,e0 as Si,e1 as xi,e2 as wi,e3 as Ti,e4 as ki,e5 as Ei,e6 as Ii,e7 as Ni,e8 as $i,e9 as Oi,ea as Ai,eb as Ri,P as Di,ec as _i,ed as Pi,ee as Li,ef as Fi,eg as Mi,eh as zi,aS as Bi,ei as Xi,aN as Ui,ej as Vi,ek as Hi,el as ji,em as Gi,en as Wi,eo as Ki,ep as Yi,eq as qi,er as Ji,es as Zi,et as Qi,eu as ea,b8 as ta,ev as oa,R as na,a as ia,ew as aa,ex as la,ey as ra,ez as sa,eA as ca,eB as da,eC as pa,eD as ua,eE as ha,eF as ma,eG as ga,eH as fa,eI as ba,eJ as va,eK as ya,eL as Ca,eM as Sa,eN as xa,eO as wa,eP as Ta,eQ as ka,eR as Ea}from"./chunks/ui-components-Dq_j4_BI.js";import{TrashIcon as Ia,PlusIcon as Na,ArrowRightIcon as $a,VSquareIcon as Oa,XSquareIcon as Aa,BookIcon as Ra,DeleteIcon as Da,EditIcon as _a,GoLogo as Pa,JavaLogo as La,ChevronRightIcon as Fa,ActionIcon as Ma,DestinationIcon as za,ChevronUpIcon as Ba,ChevronDownIcon as Xa,VIcon as Ua,XIcon as Va,InstrumentationRuleIcon as Ha,SourceIcon as ja,NamespacesIcon as Ga,AwsLogo as Wa,CloudConnectorIcon as Ka,EyeOpenIcon as Ya,CloudConnectorPolicyIcon as qa,ArrowLeftIcon as Ja,ISquareIcon as Za,RefreshIcon as Qa,SettingsIcon as el,PodIcon as tl,OdigosLogo as ol,K8sLogo as nl,ExclamationCircleIcon as il,QuestionCircleIcon as al,InboundIcon as ll,OutboundIcon as rl,UserIcon as sl,TerminalIcon as cl,RefreshLeftArrowIcon as dl,MinusIcon as pl,SearchIcon as ul,ExpandIcon as hl,CopyIcon as ml,DotIcon as gl,ArrowDownIcon as fl,DownloadIcon as bl,VmLogo as vl,SamplingIcon as yl,ExclamationTriangleIcon as Cl,KeyIcon as Sl,DiagnoseIcon as xl,StarIcon as wl,ArrowIcon as Tl,ConnectionsIcon as kl,FilterIcon as El,DataStreamIcon as Il,PipelineCollectorIcon as Nl,ArrowDownSquareIcon as $l,ArrowUpSquareIcon as Ol,GatewayIcon as Al,YamlIcon as Rl,ImageErrorIcon as Dl,LockIcon as _l}from"./icons.js";import{h as Pl,o as Ll,n as Fl,q as Ml,m as zl,t as Bl,s as Xl,S as Ul,w as Vl,E as Hl,x as jl,y as Gl,v as Wl,l as Kl,d as Yl,O as ql,f as Jl,b as Zl,A as Ql,R as er,C as tr,e as or,D as nr}from"./chunks/source-instrument-form-context-
|
|
1
|
+
import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import n,{useEffect as i,useMemo as a,useRef as l,useCallback as r,useState as s,Fragment as c,forwardRef as d,useImperativeHandle as p,Children as u,createContext as h,useContext as m,useLayoutEffect as g,memo as f}from"react";import b,{useTheme as v,css as y,keyframes as C}from"styled-components";import{u as S,n as x,C as w,f as T,e as k,d as E,q as I,g as N,h as $,j as O,p as A,l as R,c as D,r as _,S as P,s as L,R as F,t as M,w as z,o as B,x as X,y as U,z as V,A as H,B as j,D as G,E as W,F as K,G as Y,H as q,I as J,J as Z}from"./chunks/odigos-context-DzuZq_D5.js";import{bi as Q,w as ee,x as te,C as oe,aT as ne,I as ie,bs as ae,d as le,e as re,j as se,aX as ce,bt as de,N as pe,Q as ue,U as he,y as me,m as ge,n as fe,B as be,S as ve,bu as ye,bv as Ce,a1 as Se,bw as xe,bx as we,k as Te,by as ke,F as Ee,bz as Ie,s as Ne,T as $e,bA as Oe,bj as Ae,aW as Re,bB as De,bC as _e,i as Pe,az as Le,aB as Fe,bD as Me,bo as ze,bp as Be,bn as Xe,bE as Ue,u as Ve,H as He,r as je,G as Ge,J as We,q as Ke,p as Ye,bF as qe,bG as Je,aJ as Ze,W as Qe,D as et,b6 as tt,bH as ot,bI as nt,bJ as it,bK as at,bL as lt,bM as rt,bN as st,bO as ct,z as dt,bP as pt,bQ as ut,bR as ht,bS as mt,bT as gt,aV as ft,bm as bt,h as vt,bU as yt,bV as Ct,aY as St,bW as xt,bX as wt,aR as Tt,bq as kt,b5 as Et,b as It,f as Nt,bY as $t,b7 as Ot,bZ as At,b_ as Rt,b9 as Dt,b$ as _t,a_ as Pt,c0 as Lt,c as Ft,l as Mt,bc as zt,bh as Bt,ay as Xt,c1 as Ut,c2 as Vt,bg as Ht,c3 as jt,c4 as Gt,c5 as Wt,v as Kt,b1 as Yt,b2 as qt,aD as Jt,c6 as Zt,c7 as Qt,c8 as eo,c9 as to,ca as oo,cb as no,cc as io,cd as ao,ce as lo,cf as ro,cg as so,A as co,aZ as po,aU as uo,ch as ho,ci as mo,cj as go,ck as fo,cl as bo,cm as vo,br as yo,cn as Co,co as So,cp as xo,cq as wo,cr as To,cs as ko,ct as Eo,cu as Io,cv as No,aI as $o,cw as Oo,cx as Ao,cy as Ro,cz as Do,cA as _o,cB as Po,cC as Lo,cD as Fo,cE as Mo,cF as zo,cG as Bo,cH as Xo,cI as Uo,ao as Vo,cJ as Ho,cK as jo,cL as Go,cM as Wo,cN as Ko,cO as Yo,cP as qo,cQ as Jo,cR as Zo,cS as Qo,cT as en,cU as tn,cV as on,cW as nn,cX as an,a7 as ln,cY as rn,cZ as sn,a$ as cn,c_ as dn,c$ as pn,d0 as un,d1 as hn,d2 as mn,d3 as gn,d4 as fn,d5 as bn,d6 as vn,d7 as yn,d8 as Cn,d9 as Sn,da as xn,db as wn,dc as Tn,dd as kn,de as En,df as In,dg as Nn,dh as $n,di as On,dj as An,dk as Rn,dl as Dn,dm as _n,dn as Pn,dp as Ln,dq as Fn,dr as Mn,ds as zn,dt as Bn,du as Xn,dv as Un,dw as Vn,dx as Hn,dy as jn,dz as Gn,dA as Wn,dB as Kn,dC as Yn,dD as qn,dE as Jn,dF as Zn,dG as Qn,dH as ei,dI as ti,dJ as oi,dK as ni,dL as ii,dM as ai,dN as li,dO as ri,dP as si,dQ as ci,dR as di,dS as pi,dT as ui,dU as hi,dV as mi,dW as gi,dX as fi,dY as bi,dZ as vi,d_ as yi,d$ as Ci,e0 as Si,e1 as xi,e2 as wi,e3 as Ti,e4 as ki,e5 as Ei,e6 as Ii,e7 as Ni,e8 as $i,e9 as Oi,ea as Ai,eb as Ri,P as Di,ec as _i,ed as Pi,ee as Li,ef as Fi,eg as Mi,eh as zi,aS as Bi,ei as Xi,aN as Ui,ej as Vi,ek as Hi,el as ji,em as Gi,en as Wi,eo as Ki,ep as Yi,eq as qi,er as Ji,es as Zi,et as Qi,eu as ea,b8 as ta,ev as oa,R as na,a as ia,ew as aa,ex as la,ey as ra,ez as sa,eA as ca,eB as da,eC as pa,eD as ua,eE as ha,eF as ma,eG as ga,eH as fa,eI as ba,eJ as va,eK as ya,eL as Ca,eM as Sa,eN as xa,eO as wa,eP as Ta,eQ as ka,eR as Ea}from"./chunks/ui-components-Dq_j4_BI.js";import{TrashIcon as Ia,PlusIcon as Na,ArrowRightIcon as $a,VSquareIcon as Oa,XSquareIcon as Aa,BookIcon as Ra,DeleteIcon as Da,EditIcon as _a,GoLogo as Pa,JavaLogo as La,ChevronRightIcon as Fa,ActionIcon as Ma,DestinationIcon as za,ChevronUpIcon as Ba,ChevronDownIcon as Xa,VIcon as Ua,XIcon as Va,InstrumentationRuleIcon as Ha,SourceIcon as ja,NamespacesIcon as Ga,AwsLogo as Wa,CloudConnectorIcon as Ka,EyeOpenIcon as Ya,CloudConnectorPolicyIcon as qa,ArrowLeftIcon as Ja,ISquareIcon as Za,RefreshIcon as Qa,SettingsIcon as el,PodIcon as tl,OdigosLogo as ol,K8sLogo as nl,ExclamationCircleIcon as il,QuestionCircleIcon as al,InboundIcon as ll,OutboundIcon as rl,UserIcon as sl,TerminalIcon as cl,RefreshLeftArrowIcon as dl,MinusIcon as pl,SearchIcon as ul,ExpandIcon as hl,CopyIcon as ml,DotIcon as gl,ArrowDownIcon as fl,DownloadIcon as bl,VmLogo as vl,SamplingIcon as yl,ExclamationTriangleIcon as Cl,KeyIcon as Sl,DiagnoseIcon as xl,StarIcon as wl,ArrowIcon as Tl,ConnectionsIcon as kl,FilterIcon as El,DataStreamIcon as Il,PipelineCollectorIcon as Nl,ArrowDownSquareIcon as $l,ArrowUpSquareIcon as Ol,GatewayIcon as Al,YamlIcon as Rl,ImageErrorIcon as Dl,LockIcon as _l}from"./icons.js";import{h as Pl,o as Ll,n as Fl,q as Ml,m as zl,t as Bl,s as Xl,S as Ul,w as Vl,E as Hl,x as jl,y as Gl,v as Wl,l as Kl,d as Yl,O as ql,f as Jl,b as Zl,A as Ql,R as er,C as tr,e as or,D as nr}from"./chunks/source-instrument-form-context-oSSPNkMA.js";import{d as ir,i as ar,I as lr,j as rr,A as sr,g as cr,P as dr,S as pr,R as ur,e as hr,h as mr,c as gr,f as fr,k as br,W as vr,C as yr,b as Cr,Y as Sr,O as xr,a as wr,U as Tr}from"./chunks/index-DUhfkGj1.js";import{createPortal as kr}from"react-dom";import{MarkerType as Er,useNodesState as Ir,useEdgesState as Nr,Handle as $r,Position as Or,getSmoothStepPath as Ar,BaseEdge as Rr,EdgeLabelRenderer as Dr,ReactFlowProvider as _r,ReactFlow as Pr,Background as Lr,Controls as Fr,ControlButton as Mr,useReactFlow as zr}from"@xyflow/react";import Br from"elkjs/lib/elk.bundled.js";import"@xyflow/react/dist/style.css";import"zustand";import"javascript-time-ago";import"javascript-time-ago/locale/en";import"prism-react-renderer";import"zustand/middleware";import"react-error-boundary";import"virtua";import"@apollo/client/react";import"@apollo/client/link/error";import"@apollo/client/link/context";import"@apollo/client/utilities";import"@apollo/client/errors";import"@apollo/client";const Xr=[{id:"CREDIT_CARD",label:"Credit card"}],Ur=[{id:Q.CollectContainerAttributes,label:"Collect container attributes"},{id:Q.CollectReplicaSetAttributes,label:"Collect ReplicaSet attributes"},{id:Q.CollectWorkloadId,label:"Collect workload ID"},{id:Q.CollectClusterId,label:"Collect cluster ID"}],Vr=[{id:ae.Pod,label:ae.Pod},{id:ae.Namespace,label:ae.Namespace},{id:ae.Node,label:ae.Node}],Hr=[{label:"Label key",keyName:"labelKey",placeholder:"app.kubernetes.io/name"},{label:"Attribute key",keyName:"attributeKey",placeholder:"app.kubernetes.name"},{label:"From sources",keyName:"fromSources",placeholder:"pod, namespace",tooltip:"Select multiple sources. Higher precedence sources (pod > namespace > node) will override lower ones.",componentType:"multi-dropdown",options:Vr}],jr=[{label:"Annotation key",keyName:"annotationKey",placeholder:"kubectl.kubernetes.io/restartedAt"},{label:"Attribute key",keyName:"attributeKey",placeholder:"kubectl.kubernetes.restartedAt"},{label:"From sources",keyName:"fromSources",placeholder:"pod, namespace",tooltip:"Select multiple sources. Higher precedence sources (pod > namespace > node) will override lower ones.",componentType:"multi-dropdown",options:Vr}],Gr=/^[a-zA-Z]$/,Wr=new Set(["*","+","?"]),Kr=new Set(["^","$"]),Yr={group:"rgba(102, 242, 102, 0.5)","anchor-quantifier":"rgba(102, 191, 255, 0.5)","class-bracket":"rgba(255, 153, 153, 0.5)","class-content":"rgba(178, 1, 1, 0.5)",alternation:"rgba(255, 153, 153, 0.5)",literal:"transparent"},qr=b.div`
|
|
2
2
|
padding: 8px 16px;
|
|
3
3
|
border-radius: 6px;
|
|
4
4
|
border: 1px solid ${({theme:e})=>e.v2.colors.silver[500]};
|
|
@@ -823,6 +823,19 @@ export interface ApolloConfig {
|
|
|
823
823
|
* Hosts can pass observability links, retry links, etc.
|
|
824
824
|
*/
|
|
825
825
|
additionalLinks?: ApolloLink[];
|
|
826
|
+
/**
|
|
827
|
+
* Opaque identity for the ApolloClient instance. When this value changes,
|
|
828
|
+
* `<OdigosApiProvider>` discards the current client (and its normalized
|
|
829
|
+
* cache) and constructs a fresh one.
|
|
830
|
+
*
|
|
831
|
+
* Use this for hard context boundaries where `resetCache()` alone is not
|
|
832
|
+
* enough — e.g. central-ui switching proxies. `cache.reset()` leaves
|
|
833
|
+
* in-flight requests alone, so a response that was already on the wire
|
|
834
|
+
* can write the previous proxy's data back into the freshly-cleared
|
|
835
|
+
* cache. Bumping `clientKey` orphans that write onto the discarded
|
|
836
|
+
* client instead.
|
|
837
|
+
*/
|
|
838
|
+
clientKey?: string | number;
|
|
826
839
|
}
|
|
827
840
|
export interface OdigosApiProviderProps {
|
|
828
841
|
apolloConfig: ApolloConfig;
|
|
@@ -80,8 +80,17 @@ export interface UseOdigosApiReturn {
|
|
|
80
80
|
snapshotsApi: SnapshotsApi;
|
|
81
81
|
capabilities: Capabilities;
|
|
82
82
|
/**
|
|
83
|
-
* Wipe Apollo's normalized cache
|
|
84
|
-
*
|
|
83
|
+
* Wipe Apollo's normalized cache in place. Soft alternative to bumping
|
|
84
|
+
* `ApolloConfig.clientKey` (which discards the whole client).
|
|
85
|
+
*
|
|
86
|
+
* Delegates to `client.cache.reset()`, so active subscribers re-fetch on
|
|
87
|
+
* the next render and in-flight requests are NOT cancelled (avoids Apollo
|
|
88
|
+
* error #42, "Store reset while query was in flight").
|
|
89
|
+
*
|
|
90
|
+
* Prefer bumping `clientKey` for hard boundaries like central-ui proxy
|
|
91
|
+
* switches — in-flight responses can otherwise rewrite the previous
|
|
92
|
+
* proxy's data into the freshly-reset cache. Use `resetCache` when you
|
|
93
|
+
* need to drop cached entities without tearing down the client/WS link.
|
|
85
94
|
*/
|
|
86
95
|
resetCache: () => Promise<void>;
|
|
87
96
|
}
|
package/lib/contexts.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as a,r as x,a as y}from"./chunks/source-instrument-form-context-
|
|
1
|
+
import{u as a,r as x,a as y}from"./chunks/source-instrument-form-context-oSSPNkMA.js";export{A as ActionFormContextProvider,C as CloudConnectorFormContextProvider,D as DataStreamFormContextProvider,b as DestinationFormContextProvider,O as OdigosApiConnectionsScope,c as OdigosApiProvider,R as RuleFormContextProvider,S as SamplingRuleFormType,d as SamplingRulesFormProvider,e as SourceEditFormContextProvider,f as SourceInstrumentFormContextProvider,p as prepareNamespacePayloads,g as prepareSourcePayloads,h as useActionFormContext,i as useApiLazyQuery,j as useApiMutation,k as useApiQuery,l as useCloudConnectorFormContext,m as useDataStreamFormContext,n as useDestinationFormContext,o as useOdigosApi,q as useRuleFormContext,s as useSamplingRulesFormContext,t as useSourceEditFormContext,v as useSourceInstrumentFormContext}from"./chunks/source-instrument-form-context-oSSPNkMA.js";export{O as OdigosProvider,c as checkVersionSupport,r as resolveMinSupportedVersion,u as useOdigos}from"./chunks/odigos-context-DzuZq_D5.js";import{jsx as F}from"react/jsx-runtime";import{useMemo as P,useContext as T,createContext as E}from"react";import{P as I,t as _}from"./chunks/ui-components-Dq_j4_BI.js";import{useApolloClient as M}from"@apollo/client/react";import"@apollo/client/link/error";import"@apollo/client/link/context";import"@apollo/client/utilities";import"@apollo/client/errors";import"@apollo/client";import"styled-components";import"./icons.js";import"zustand";import"javascript-time-ago";import"javascript-time-ago/locale/en";import"react-dom";import"prism-react-renderer";import"zustand/middleware";import"react-error-boundary";import"virtua";const V=()=>{const o=M(),{operations:r,context:e}=a();return{multiFetch:async(t,s,n)=>{const i=r[t];return i?y(o,i,s,n,e):{results:[],allSucceeded:!1,anySucceeded:!1,successCount:0,failureCount:s.length,error:`Operation ${String(t)} not configured`}},bulkPersistSources:async(t,s)=>{const n=[];for(const i of t){const t={...e,proxyID:i},{error:a}=await x(o,r.PERSIST_SOURCES,s,t);a&&n.push(`${i}: ${a}`)}return n.length?{error:n.join(", ")}:void 0},applyConfigurations:async(t,s)=>{if(!r.UPDATE_REMOTE_CONFIG)return{error:"UPDATE_REMOTE_CONFIG not configured"};const{error:n}=await x(o,r.UPDATE_REMOTE_CONFIG,{formData:s,connectionIds:t},e);return n?{error:n}:void 0}}},N=(o,r)=>o.platformType===I.K8s?r.K8s:o.platformType===I.Vm?r.Vm:void 0,U=o=>r=>{const e=o[r.platformType];if(!e)return;const t=Object.keys(e);if(0===t.length)return;const s=_(r.schemaVersion??r.version),n=[...t].sort((o,r)=>_(r)-_(o)).find(o=>s>=_(o));return n?e[n]:void 0},w=(o,r)=>{const e={};for(const t of Object.keys(o))e[t]=r(o[t]);return e},z=E({formType:void 0}),G=({children:o,formType:r})=>{const e=P(()=>({formType:r}),[r]);return F(z.Provider,{value:e,children:o})},$=()=>T(z);export{G as StorybookProvider,N as pickByPlatform,V as useApiForConnections,$ as useStorybook,U as versionedDocument,w as vmDialectMap};
|