@odigos/ui-kit 0.0.249 → 0.0.251

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.
Files changed (140) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/docs/api-context.md +687 -0
  3. package/lib/chunks/connections-scope-CneIqjeg.js +1 -0
  4. package/lib/chunks/flow-CQi_KYfs.js +49 -0
  5. package/lib/chunks/helpers-K1tnyqhm.js +19 -0
  6. package/lib/chunks/{index-CRKgHzab.js → index-Dv0RvKAp.js} +8 -8
  7. package/lib/chunks/source-instrument-form-context-C79I_5cH.js +1 -0
  8. package/lib/chunks/{ui-components-DODwSdKu.js → ui-components-BKrLf2tx.js} +214 -214
  9. package/lib/chunks/use-odigos-api-CDHW7ekQ.js +5 -0
  10. package/lib/chunks/vendor-BFqT13Me.js +1 -0
  11. package/lib/components/_v2/segment/index.d.ts +4 -2
  12. package/lib/components/v2.js +1 -1
  13. package/lib/components.js +1 -1
  14. package/lib/constants/strings/index.d.ts +7 -0
  15. package/lib/constants.js +1 -1
  16. package/lib/containers/_v2/_drawers/add-action-drawer/index.d.ts +0 -2
  17. package/lib/containers/_v2/_drawers/add-destination-drawer/form-column/index.d.ts +1 -5
  18. package/lib/containers/_v2/_drawers/add-destination-drawer/index.d.ts +0 -6
  19. package/lib/containers/_v2/_drawers/add-destination-drawer/lists-filters/index.d.ts +2 -1
  20. package/lib/containers/_v2/_drawers/add-rule-drawer/index.d.ts +0 -2
  21. package/lib/containers/_v2/_drawers/add-source-drawer/index.d.ts +1 -4
  22. package/lib/containers/_v2/_drawers/edit-action-drawer/index.d.ts +0 -3
  23. package/lib/containers/_v2/_drawers/edit-config-drawer/index.d.ts +1 -3
  24. package/lib/containers/_v2/_drawers/edit-destination-drawer/index.d.ts +0 -5
  25. package/lib/containers/_v2/_drawers/edit-rule-drawer/index.d.ts +0 -3
  26. package/lib/containers/_v2/_drawers/edit-source-drawer/debug/index.d.ts +1 -2
  27. package/lib/containers/_v2/_drawers/edit-source-drawer/index.d.ts +3 -14
  28. package/lib/containers/_v2/_drawers/edit-source-drawer/overview/containers-card/index.d.ts +1 -2
  29. package/lib/containers/_v2/_drawers/edit-source-drawer/overview/index.d.ts +0 -2
  30. package/lib/containers/_v2/_drawers/edit-source-drawer/peers/index.d.ts +1 -6
  31. package/lib/containers/_v2/_drawers/edit-source-drawer/profiling/index.d.ts +1 -15
  32. package/lib/containers/_v2/_drawers/edit-source-drawer/sampling/index.d.ts +8 -0
  33. package/lib/containers/_v2/_drawers/edit-source-drawer/sampling/rule-row.d.ts +8 -0
  34. package/lib/containers/_v2/_drawers/edit-source-drawer/tabs.d.ts +1 -0
  35. package/lib/containers/_v2/_drawers/system-drawer/describe/index.d.ts +1 -8
  36. package/lib/containers/_v2/_drawers/system-drawer/diagnose/index.d.ts +1 -4
  37. package/lib/containers/_v2/_drawers/system-drawer/index.d.ts +1 -4
  38. package/lib/containers/_v2/_drawers/system-drawer/tokens/index.d.ts +1 -2
  39. package/lib/containers/_v2/_forms/add-destination-form/index.d.ts +1 -2
  40. package/lib/containers/_v2/_modals/add-data-stream-modal/index.d.ts +0 -3
  41. package/lib/containers/_v2/_modals/edit-data-stream-modal/index.d.ts +0 -2
  42. package/lib/containers/_v2/_modals/sampling-onboarding-modal/types.d.ts +1 -4
  43. package/lib/containers/_v2/central-connections/index.d.ts +1 -12
  44. package/lib/containers/_v2/onboarding/index.d.ts +0 -8
  45. package/lib/containers/_v2/overview/columns/column/head.d.ts +1 -1
  46. package/lib/containers/_v2/overview/columns/column/index.d.ts +2 -1
  47. package/lib/containers/_v2/overview/columns/index.d.ts +1 -8
  48. package/lib/containers/_v2/overview/data-stream-select/index.d.ts +1 -10
  49. package/lib/containers/_v2/overview/drawers/index.d.ts +2 -29
  50. package/lib/containers/_v2/overview/index.d.ts +2 -8
  51. package/lib/containers/_v2/overview/multi-source-control/index.d.ts +1 -5
  52. package/lib/containers/_v2/pipeline-collectors/index.d.ts +0 -7
  53. package/lib/containers/_v2/pipeline-collectors/pods-info/index.d.ts +1 -2
  54. package/lib/containers/_v2/pipeline-collectors/pods-info/pod-drawer/index.d.ts +1 -2
  55. package/lib/containers/_v2/sampling-rules/helpers.d.ts +2 -0
  56. package/lib/containers/_v2/sampling-rules/types.d.ts +2 -16
  57. package/lib/containers/_v2/settings/index.d.ts +0 -9
  58. package/lib/containers/service-map/index.d.ts +4 -2
  59. package/lib/containers/v2.js +197 -166
  60. package/lib/containers.js +7 -7
  61. package/lib/contexts/index.d.ts +1 -0
  62. package/lib/contexts/odigos-api/capabilities.d.ts +38 -0
  63. package/lib/contexts/odigos-api/client.d.ts +22 -0
  64. package/lib/contexts/odigos-api/connections-scope.d.ts +18 -0
  65. package/lib/contexts/odigos-api/hooks/use-actions-api.d.ts +26 -0
  66. package/lib/contexts/odigos-api/hooks/use-collectors-api.d.ts +25 -0
  67. package/lib/contexts/odigos-api/hooks/use-config-api.d.ts +24 -0
  68. package/lib/contexts/odigos-api/hooks/use-data-streams-api.d.ts +26 -0
  69. package/lib/contexts/odigos-api/hooks/use-describe-api.d.ts +33 -0
  70. package/lib/contexts/odigos-api/hooks/use-destinations-api.d.ts +50 -0
  71. package/lib/contexts/odigos-api/hooks/use-instrumentation-rules-api.d.ts +35 -0
  72. package/lib/contexts/odigos-api/hooks/use-k8s-manifest-api.d.ts +14 -0
  73. package/lib/contexts/odigos-api/hooks/use-metrics-api.d.ts +13 -0
  74. package/lib/contexts/odigos-api/hooks/use-namespace-api.d.ts +30 -0
  75. package/lib/contexts/odigos-api/hooks/use-profiling-api.d.ts +17 -0
  76. package/lib/contexts/odigos-api/hooks/use-sampling-api.d.ts +39 -0
  77. package/lib/contexts/odigos-api/hooks/use-service-map-api.d.ts +13 -0
  78. package/lib/contexts/odigos-api/hooks/use-snapshots-api.d.ts +13 -0
  79. package/lib/contexts/odigos-api/hooks/use-sources-api.d.ts +75 -0
  80. package/lib/contexts/odigos-api/hooks/use-tokens-api.d.ts +12 -0
  81. package/lib/contexts/odigos-api/index.d.ts +37 -0
  82. package/lib/contexts/odigos-api/internal/notify.d.ts +49 -0
  83. package/lib/contexts/odigos-api/internal/source-payloads.d.ts +53 -0
  84. package/lib/contexts/odigos-api/platform-helpers.d.ts +98 -0
  85. package/lib/contexts/odigos-api/provider.d.ts +28 -0
  86. package/lib/contexts/odigos-api/runner.d.ts +32 -0
  87. package/lib/contexts/odigos-api/types.d.ts +831 -0
  88. package/lib/contexts/odigos-api/use-api-for-connections.d.ts +43 -0
  89. package/lib/contexts/odigos-api/use-api-query.d.ts +130 -0
  90. package/lib/contexts/odigos-api/use-odigos-api.d.ts +103 -0
  91. package/lib/contexts/odigos-api.js +1 -0
  92. package/lib/contexts/odigos-context.d.ts +2 -2
  93. package/lib/contexts/storybook-context.d.ts +2 -2
  94. package/lib/contexts.js +1 -1
  95. package/lib/functions.js +1 -1
  96. package/lib/hooks.js +1 -1
  97. package/lib/icons/destinations/open-telemetry-logo/index.d.ts +2 -1
  98. package/lib/snippets/_v2/sampling-rule-form-sections/preset-with-custom-input.d.ts +1 -1
  99. package/lib/snippets/v2.js +1 -1
  100. package/lib/snippets.js +1 -49
  101. package/lib/store/index.d.ts +0 -1
  102. package/lib/store/useDrawerStore.d.ts +6 -1
  103. package/lib/store.js +1 -1
  104. package/lib/theme.js +1 -1
  105. package/lib/types/actions/index.d.ts +0 -5
  106. package/lib/types/common/index.d.ts +29 -4
  107. package/lib/types/destinations/index.d.ts +0 -10
  108. package/lib/types/index.d.ts +0 -1
  109. package/lib/types/instrumentation-rules/index.d.ts +0 -5
  110. package/lib/types/namespaces/index.d.ts +0 -5
  111. package/lib/types/pipeline-collectors/index.d.ts +0 -5
  112. package/lib/types/snapshot/index.d.ts +0 -2
  113. package/lib/types/sources/index.d.ts +0 -30
  114. package/lib/types/tokens/index.d.ts +0 -6
  115. package/lib/types/workload/index.d.ts +46 -22
  116. package/lib/types.js +1 -1
  117. package/lib/visuals.js +1 -1
  118. package/package.json +31 -22
  119. package/lib/chunks/helpers-IEFhGXc7.js +0 -19
  120. package/lib/chunks/source-instrument-form-context-DjIHPYQJ.js +0 -1
  121. package/lib/chunks/vendor-Be0cOokr.js +0 -1
  122. package/lib/mock-data/actions/index.d.ts +0 -2
  123. package/lib/mock-data/config/index.d.ts +0 -3
  124. package/lib/mock-data/connections/index.d.ts +0 -2
  125. package/lib/mock-data/describe/index.d.ts +0 -3
  126. package/lib/mock-data/destinations/index.d.ts +0 -4
  127. package/lib/mock-data/index.d.ts +0 -15
  128. package/lib/mock-data/instrumentation-instances/index.d.ts +0 -2
  129. package/lib/mock-data/instrumentation-rules/index.d.ts +0 -2
  130. package/lib/mock-data/namespaces/index.d.ts +0 -2
  131. package/lib/mock-data/pipeline-collectors/index.d.ts +0 -6
  132. package/lib/mock-data/profiling/index.d.ts +0 -8
  133. package/lib/mock-data/service-map/index.d.ts +0 -4
  134. package/lib/mock-data/snapshot/index.d.ts +0 -5
  135. package/lib/mock-data/sources/index.d.ts +0 -4
  136. package/lib/mock-data/sources/yamls.d.ts +0 -22
  137. package/lib/mock-data/tokens/index.d.ts +0 -2
  138. package/lib/mock-data/traces/index.d.ts +0 -2
  139. package/lib/store/useEntityStore.d.ts +0 -24
  140. package/lib/types/k8s-manifest/index.d.ts +0 -2
@@ -0,0 +1,831 @@
1
+ /**
2
+ * Public types for the OdigosApiContext.
3
+ *
4
+ * The context provides a unified, host-agnostic API surface for all `_v2`
5
+ * containers in the kit. Each host app (odigos webapp, odigos-enterprise
6
+ * central-ui) supplies an `OdigosApiOperations` map (one entry per logical
7
+ * operation) plus an `ApolloConfig` describing how Apollo should be
8
+ * constructed. The kit owns Apollo end-to-end from there.
9
+ *
10
+ * The `Operation<TData, TVars>` shape is deliberately generic enough to
11
+ * support both:
12
+ * - direct GraphQL execution (odigos webapp): `{ document: gql\`...\` }`
13
+ * - REMOTE_FETCH-wrapped execution (central-ui): `{ document: REMOTE_FETCH,
14
+ * transformVariables: (vars, ctx) => ({ proxyID, query: getVersionedQuery(...), variables: vars }),
15
+ * transformResult: (raw) => parseJsonString(raw.remoteFetch).data }`
16
+ */
17
+ import type { ReactNode } from 'react';
18
+ import type { DocumentNode } from 'graphql';
19
+ import type { InstrumentationRuleInputWire } from '@/functions/instrumentation-rule-source-scopes';
20
+ import type { Action, ActionFormData, AllClusterSnapshots, ClusterSnapshot, ConfigYaml, CostReductionRule, CostReductionRuleInput, DataStream, DescribeOdigos, DescribeSource, Destination, DestinationFormData, DiagnoseFormData, EffectiveConfig, EffectiveConfigInput, EnableProfilingResult, ExtendedPodInfo, FetchedConfig, GatewayInfo, GetDestinationCategoriesResult, GetPotentialDestinationsResult, HighlyRelevantOperationRule, HighlyRelevantOperationRuleInput, InstrumentationRule, K8sResourceKind, LocalUiConfigInput, Metrics, Namespace, NoisyOperationRule, NoisyOperationRuleInput, NodeCollectoInfo, PlatformType, PodInfo, ProfilingSlots, SamplingRules, SamplingRulesK8sHealthConfig, ServiceMapSources, SourceFormData, SourceProfilingResult, TestConnectionResponse, Tier, TokenPayload, Workload, WorkloadId, PeerSources } from '@/types';
21
+ import type { ApolloClient, ApolloLink, FetchPolicy, MutationFetchPolicy, NormalizedCacheObject, TypePolicies, WatchQueryFetchPolicy } from '@apollo/client';
22
+ /**
23
+ * The execution context for a given operation, propagated through every
24
+ * `Operation.document(ctx)` / `transformVariables(vars, ctx)` /
25
+ * `transformResult(raw, ctx)` callback.
26
+ *
27
+ * Hosts update this context whenever the active proxy / version / tier
28
+ * changes (e.g. central-ui re-derives this from `useProxy()`).
29
+ */
30
+ export interface OperationContext {
31
+ /** k8s | vm — used to pick a platform-specific GraphQL string in versioned-query maps. */
32
+ platformType: PlatformType;
33
+ /** community | onprem — used to gate enterprise-only capabilities. */
34
+ tier: Tier;
35
+ /** Backend / proxy version. Hosts that don't have proxies (odigos standalone) pass the local backend version. */
36
+ version: string;
37
+ /** Currently selected proxy id (central-ui only). Undefined when not applicable. */
38
+ proxyID?: string;
39
+ /**
40
+ * Whether the current user can perform writes. Hosts derive this from
41
+ * their own auth/role state (e.g. central-ui's `useConfig().isReadonly`,
42
+ * webapp's `useConfig().isReadonly`) and update the provider when it
43
+ * changes. Domain hooks use this to short-circuit mutations with a
44
+ * readonly warning toast.
45
+ */
46
+ isReadonly?: boolean;
47
+ /**
48
+ * Optional list of proxy/connection ids the current operation should
49
+ * fan out to. Set by `<OdigosApiConnectionsScope>` (used by bulk
50
+ * drawers in central-ui's `<CentralConnections>`). The host adapter
51
+ * reads this in `transformVariables` to route REMOTE_MULTI_FETCH
52
+ * across the selected clusters. Empty/undefined means "use proxyID".
53
+ */
54
+ connectionIds?: string[];
55
+ }
56
+ export interface MultiFetchResult<TData> {
57
+ proxyID: string;
58
+ success: boolean;
59
+ data?: TData;
60
+ error?: string;
61
+ }
62
+ export interface MultiFetchResponse<TData> {
63
+ error?: string;
64
+ results: MultiFetchResult<TData>[];
65
+ allSucceeded: boolean;
66
+ anySucceeded: boolean;
67
+ successCount: number;
68
+ failureCount: number;
69
+ }
70
+ /**
71
+ * Per-operation hook into version grouping for multi-cluster fan-out.
72
+ *
73
+ * Returned by `Operation.transformVariablesMulti` to allow the host to
74
+ * group target proxies by resolved-version and emit one Apollo call per
75
+ * group. The runner iterates these groups and merges results.
76
+ */
77
+ export interface MultiFetchGroup {
78
+ /** The Apollo document to use for this group (e.g. REMOTE_MULTI_FETCH). */
79
+ document: DocumentNode;
80
+ /**
81
+ * Variables to send for this group. Apollo's `client.query({ variables })`
82
+ * accepts any keyed payload, and host adapters compose this freely (REMOTE_MULTI_FETCH,
83
+ * versioned variables, etc.) — typed as `Record<string, unknown>` so the
84
+ * runner doesn't pretend it knows the per-host shape but the field
85
+ * still has meaningful structure (key-value of unknown values, not raw `unknown`).
86
+ */
87
+ variables: Record<string, unknown>;
88
+ /** Proxy ids included in this group, in order. */
89
+ proxyIDs: string[];
90
+ }
91
+ /**
92
+ * A single logical operation. The host supplies one of these per
93
+ * `OdigosApiOperations` key. The kit calls these via `runner.ts`.
94
+ *
95
+ * Note on variance: the optional callbacks here are declared with
96
+ * **method-shorthand** syntax (`fn(args): R`) instead of the property
97
+ * form (`fn: (args) => R`). TypeScript checks method shorthand
98
+ * **bivariantly** rather than strictly contravariantly. This matters for
99
+ * `transformVariables(vars: TVars, ...)` and friends — without
100
+ * bivariance, a host adapter that supplies a tightly-typed
101
+ * `Operation<MyData, MyVars>` couldn't be assigned into the aggregate
102
+ * `OdigosApiOperations` slot (the assignment direction would fail strict
103
+ * contravariance on `TVars`). Method shorthand is the precise tool for
104
+ * this exact case and avoids any `any` in the operation surface.
105
+ */
106
+ export interface Operation<TData = unknown, TVars = unknown> {
107
+ /**
108
+ * The Apollo document for single (non-fanout) execution.
109
+ * Pass a function when the document depends on the runtime context
110
+ * (e.g. central-ui resolves a versioned-query map per `ctx.version`).
111
+ * Returning undefined from the function aborts the call with an
112
+ * "operation not supported in this context" error.
113
+ */
114
+ document: DocumentNode | ((ctx: OperationContext) => DocumentNode | undefined);
115
+ /**
116
+ * Optional document used by `fetchMulti` (multi-cluster fan-out).
117
+ * Only present in central-ui's adapter (REMOTE_MULTI_FETCH).
118
+ * When omitted, `fetchMulti` falls back to N sequential `document` calls.
119
+ */
120
+ documentMulti?: DocumentNode | ((ctx: OperationContext) => DocumentNode | undefined);
121
+ /**
122
+ * Massage raw variables before they're sent. Returns the wire-shaped
123
+ * variables object — typed as `Record<string, unknown>` so adapter
124
+ * authors can construct any shape Apollo accepts without an `any`
125
+ * cast escape hatch. Use `vars: TVars` (the slot's typed input)
126
+ * inside the body and produce the wire-side shape.
127
+ */
128
+ transformVariables?(vars: TVars, ctx: OperationContext): Record<string, unknown>;
129
+ /**
130
+ * Group target proxy ids and produce one or more `{ document, variables, proxyIDs }`
131
+ * groups. Used by central-ui to split fan-out by proxy version.
132
+ */
133
+ transformVariablesMulti?(proxyIDs: string[], vars: TVars | undefined, ctx: OperationContext): MultiFetchGroup[];
134
+ /**
135
+ * Massage the raw Apollo response before it reaches the consumer.
136
+ *
137
+ * `raw` is typed `unknown` because Apollo's response is opaque to
138
+ * the kit — the adapter is the only place that knows the wire
139
+ * shape. Cast at the boundary (e.g. `(raw as { x?: T })?.x`) and
140
+ * return the slot's `TData`. The consumer always sees the typed
141
+ * `TData`, never `unknown`.
142
+ */
143
+ transformResult?(raw: unknown, ctx: OperationContext): TData | undefined;
144
+ /** Massage the raw Apollo response into per-proxy multi-fetch results. */
145
+ transformMultiResult?(raw: unknown, ctx: OperationContext): MultiFetchResult<TData>[];
146
+ /**
147
+ * Optional override of the ApolloClient this single operation runs against.
148
+ *
149
+ * The provider mounts one default client (built from `ApolloConfig`); when
150
+ * an operation supplies its own `client`, the runner uses it instead of
151
+ * the default. Use this when an operation needs to talk to a *different*
152
+ * GraphQL endpoint than the rest of the kit — e.g. a fully-constructed
153
+ * `ApolloClient` from `@odigos/vmagent-api-apollo-client` that connects
154
+ * directly to a vm-agent rather than going through the central proxy, or
155
+ * a separate cloud-provider GraphQL service for cloud-platform sources.
156
+ *
157
+ * The host can also achieve this with Apollo's `ApolloLink.split` on the
158
+ * default client, but per-operation overrides keep the routing rule
159
+ * colocated with the operation it applies to (and avoid pushing
160
+ * platform-aware splitter logic into the link layer).
161
+ */
162
+ client?: ApolloClient<unknown>;
163
+ /**
164
+ * Optional precondition guard. When provided and it returns `false`
165
+ * for the current context, the operation is treated as not runnable:
166
+ *
167
+ * - `useApiQuery` / `useApiLazyQuery` `skip` the query (no network
168
+ * request, no active Apollo observer).
169
+ * - The imperative `runQuery` / `runMutation` short-circuit and
170
+ * resolve to `{ data: undefined }` with no error (so domain
171
+ * hooks don't surface a spurious failure toast).
172
+ *
173
+ * This is the kit-level hook for "don't dispatch this operation
174
+ * until its required context exists". central-ui uses it to gate
175
+ * every `REMOTE_FETCH`-backed operation on `ctx.proxyID`: on
176
+ * out-of-proxy pages (`/connections`, `/access-management`, …) there
177
+ * is no selected proxy, so firing a remote operation would send an
178
+ * empty `RemoteFetch` (missing `proxyID` + `query`) that the backend
179
+ * rejects. Guarding here keeps those requests from ever leaving the
180
+ * client.
181
+ *
182
+ * The multi-cluster fan-out path (`runMulti` /
183
+ * `transformVariablesMulti`) does NOT consult `canRun` — it's scoped
184
+ * explicitly by the supplied `proxyIDs`, so connections-scope bulk
185
+ * drawers keep working even though `ctx.proxyID` is empty there.
186
+ */
187
+ canRun?(ctx: OperationContext): boolean;
188
+ }
189
+ /** Variables for `GET_WORKLOADS` — optionally filter by instrumentation flag. */
190
+ export interface GetWorkloadsVars {
191
+ filter?: {
192
+ markedForInstrumentation?: boolean;
193
+ };
194
+ }
195
+ /** Result of `GET_WORKLOADS`. */
196
+ export interface GetWorkloadsData {
197
+ workloads: Workload[];
198
+ }
199
+ /** Variables for `GET_WORKLOADS_BY_IDS` (and `_SLIM`). */
200
+ export interface GetWorkloadsByIdsVars {
201
+ ids: WorkloadId[];
202
+ }
203
+ /** Result of `GET_WORKLOADS_BY_IDS`. */
204
+ export interface GetWorkloadsByIdsData {
205
+ workloadsByIds: Workload[];
206
+ }
207
+ /** Variables for the slim source library lookup. */
208
+ export type GetSourceLibrariesVars = WorkloadId;
209
+ /** Result envelope for `GET_SOURCE_LIBRARIES` (instrumentation instance components). */
210
+ export interface GetSourceLibrariesData {
211
+ instrumentationInstanceComponents?: {
212
+ name: string;
213
+ nonIdentifyingAttributes?: {
214
+ key: string;
215
+ value: string;
216
+ }[];
217
+ }[];
218
+ }
219
+ /** Variables for the peer-sources query (used by service map). */
220
+ export interface GetPeerSourcesVars {
221
+ serviceName: string;
222
+ }
223
+ /** Wire-shape of the bulk source-instrumentation persist mutation. */
224
+ export interface PersistSourcesVars {
225
+ sources: {
226
+ namespace: string;
227
+ name: string;
228
+ kind: K8sResourceKind | '';
229
+ selected: boolean;
230
+ currentStreamName: string;
231
+ }[];
232
+ }
233
+ /** Wire-shape of the bulk namespace-instrumentation persist mutation. */
234
+ export interface PersistNamespacesVars {
235
+ namespaces: {
236
+ namespace: string;
237
+ selected: boolean;
238
+ currentStreamName: string;
239
+ }[];
240
+ }
241
+ /** Variables for `UPDATE_SOURCE`. */
242
+ export interface UpdateSourceVars {
243
+ sourceId: WorkloadId;
244
+ patchSourceRequest: SourceFormData & {
245
+ currentStreamName: string;
246
+ };
247
+ }
248
+ /** Variables for `RESTART_WORKLOADS`. */
249
+ export interface RestartWorkloadsVars {
250
+ sourceIds: WorkloadId[];
251
+ }
252
+ /** Variables for `RESTART_POD`. */
253
+ export interface RestartPodVars {
254
+ namespace: string;
255
+ name: string;
256
+ }
257
+ /** Variables for `RECOVER_FROM_ROLLBACK`. */
258
+ export interface RecoverFromRollbackVars {
259
+ sourceId: WorkloadId;
260
+ }
261
+ /**
262
+ * `GET_DESTINATIONS` envelope — central-ui returns `{ computePlatform: { … } }`,
263
+ * standalone webapp returns a flat shape. Both supported.
264
+ */
265
+ export interface GetDestinationsData {
266
+ computePlatform?: {
267
+ destinations?: Destination[];
268
+ };
269
+ destinations?: Destination[];
270
+ }
271
+ /**
272
+ * Wire-form of a destination form payload. `DestinationFormData.fields`
273
+ * is `{ key: string; value: unknown }[]` in the kit; the wire form
274
+ * narrows `value` to `string` (the kit pre-stringifies in
275
+ * `prepareDestinationFormData`).
276
+ */
277
+ export interface DestinationWireInput extends Omit<DestinationFormData, 'fields'> {
278
+ fields: {
279
+ key: string;
280
+ value: string;
281
+ }[];
282
+ }
283
+ export interface CreateDestinationVars {
284
+ destination: DestinationWireInput;
285
+ }
286
+ export interface UpdateDestinationVars {
287
+ id: string;
288
+ destination: DestinationWireInput;
289
+ }
290
+ export interface UpdateDestinationData {
291
+ updateDestination: {
292
+ id: string;
293
+ };
294
+ }
295
+ export interface DeleteDestinationVars {
296
+ id: string;
297
+ currentStreamName: string;
298
+ }
299
+ export interface TestDestinationConnectionVars {
300
+ destination: DestinationWireInput;
301
+ }
302
+ /** Generic list envelope for backends that nest under `computePlatform`. */
303
+ export interface GetActionsData {
304
+ computePlatform?: {
305
+ actions?: Action[];
306
+ };
307
+ actions?: Action[];
308
+ }
309
+ export interface CreateActionVars {
310
+ action: ActionFormData;
311
+ }
312
+ export interface UpdateActionVars {
313
+ id: string;
314
+ action: ActionFormData;
315
+ }
316
+ export interface DeleteActionVars {
317
+ id: string;
318
+ /** The action's `type` (e.g. `K8sAttributes`, `AddClusterInfo`). The wire
319
+ * mutation requires both `id` and `actionType` so the server knows which
320
+ * CRD type to delete — they come from different parts of the underlying
321
+ * resource graph and aren't derivable from the `id` alone. */
322
+ actionType: string;
323
+ }
324
+ export interface GetInstrumentationRulesData {
325
+ computePlatform?: {
326
+ instrumentationRules?: InstrumentationRule[];
327
+ };
328
+ instrumentationRules?: InstrumentationRule[];
329
+ }
330
+ /**
331
+ * Wire-shape vars for `CREATE_INSTRUMENTATION_RULE`. The kit's
332
+ * spec-shape `InstrumentationRuleFormData` uses `sourceScopes` (folded
333
+ * tri-list); the wire's `InstrumentationRuleInput` uses `sourcesScopes`
334
+ * (row array) — so the slot's `TVars` declares the wire type
335
+ * `InstrumentationRuleInputWire`. The kit's `useInstrumentationRulesApi` runs
336
+ * `adaptInstrumentationRuleInputForWire(input)` (in `@/functions/instrumentation-rule-source-scopes`)
337
+ * to convert the consumer-side spec input to this wire input before dispatch.
338
+ */
339
+ export interface CreateInstrumentationRuleVars {
340
+ instrumentationRule: InstrumentationRuleInputWire;
341
+ }
342
+ export interface UpdateInstrumentationRuleVars {
343
+ ruleId: string;
344
+ instrumentationRule: InstrumentationRuleInputWire;
345
+ }
346
+ export interface DeleteInstrumentationRuleVars {
347
+ ruleId: string;
348
+ }
349
+ export interface GetDataStreamsData {
350
+ computePlatform?: {
351
+ dataStreams?: DataStream[];
352
+ };
353
+ dataStreams?: DataStream[];
354
+ }
355
+ export interface CreateDataStreamVars {
356
+ stream: DataStream;
357
+ }
358
+ export interface UpdateDataStreamVars {
359
+ /** Wire variable name is `$id`; the data stream's name doubles as its id. */
360
+ id: string;
361
+ /** Wire variable name is `$dataStream` — the new stream payload. */
362
+ dataStream: DataStream;
363
+ }
364
+ export interface DeleteDataStreamVars {
365
+ /** Wire variable name is `$id`; the data stream's name doubles as its id. */
366
+ id: string;
367
+ }
368
+ /**
369
+ * `GET_NAMESPACES_WITH_WORKLOADS` returns the namespaces flat at the
370
+ * root (the legacy `computePlatform.k8sActualNamespaces` shape was
371
+ * replaced with a top-level `namespaces` field as of v1.20). Adapters
372
+ * that talk to the legacy schema should `transformResult` into this
373
+ * shape; the kit's hook reads `data.namespaces` directly.
374
+ */
375
+ export interface GetNamespacesWithWorkloadsData {
376
+ namespaces?: Namespace[];
377
+ }
378
+ export interface GetNamespaceVars {
379
+ namespaceName: string;
380
+ }
381
+ /** Variables for `GET_K8S_MANIFEST`. */
382
+ export interface GetK8sManifestVars {
383
+ kind: K8sResourceKind | string;
384
+ name: string;
385
+ namespace?: string;
386
+ ext?: 'yaml' | 'json';
387
+ }
388
+ /**
389
+ * `GET_K8S_MANIFEST` returns the manifest YAML / JSON as a single
390
+ * string. Hosts whose wire shape is `{ k8sActualManifest: string }` or
391
+ * `{ manifest: string }` MUST flatten it inside `Operation.transformResult`
392
+ * (or via the central-ui adapter's `wrapRemote(..., extract)`) so
393
+ * containers see the canonical bare-string shape.
394
+ */
395
+ export type GetK8sManifestData = string;
396
+ export interface GetEffectiveConfigVars {
397
+ id?: string;
398
+ }
399
+ export interface GetConfigYamlsData {
400
+ configYamls: ConfigYaml[];
401
+ }
402
+ export interface UpdateRemoteConfigVars {
403
+ formData: Partial<EffectiveConfigInput>;
404
+ connectionIds: string[];
405
+ }
406
+ export interface DescribeOdigosData {
407
+ describeOdigos: DescribeOdigos;
408
+ }
409
+ export interface DescribeSourceData {
410
+ describeSource: DescribeSource;
411
+ }
412
+ /**
413
+ * Server response for `GET_DIAGNOSE`. Mirrors the GraphQL `Diagnose`
414
+ * type returned by `diagnose(input, dryRun)`. The actual download URL
415
+ * (if the diagnose was kicked off in non-dry-run mode) is propagated
416
+ * via SSE / progress store, not through this response.
417
+ */
418
+ export interface DiagnoseResult {
419
+ stats?: {
420
+ fileCount: number;
421
+ totalSizeBytes: number;
422
+ totalSizeHuman: string;
423
+ };
424
+ includeProfiles?: boolean;
425
+ includeMetrics?: boolean;
426
+ includeSourceWorkloads?: boolean;
427
+ sourceWorkloadNamespaces?: string[];
428
+ }
429
+ export interface DiagnoseEnvelope {
430
+ diagnose?: DiagnoseResult;
431
+ }
432
+ /**
433
+ * Variables for `GET_DIAGNOSE` — wire mutation declares
434
+ * `($input: DiagnoseInput!, $dryRun: Boolean)`, so the form data is
435
+ * wrapped under `input`. The `useDescribeApi.downloadDiagnose(...)`
436
+ * helper takes the bare `DiagnoseFormData` and wraps it for the
437
+ * caller; only the slot type uses this wire-shaped variant.
438
+ */
439
+ export interface DiagnoseVars {
440
+ input: DiagnoseFormData;
441
+ dryRun?: boolean;
442
+ }
443
+ /**
444
+ * @deprecated The `GET_TOKENS` slot now returns a bare `TokenPayload[]`
445
+ * — adapters whose wire shape is `{ tokens } | { computePlatform: { tokens } }`
446
+ * MUST flatten via `Operation.transformResult` (or `wrapRemote`'s
447
+ * `extract` callback). Kept exported for adapter authors that want to
448
+ * type the wire envelope explicitly inside their extract function.
449
+ */
450
+ export interface GetTokensData {
451
+ tokens?: TokenPayload[];
452
+ computePlatform?: {
453
+ tokens?: TokenPayload[];
454
+ };
455
+ }
456
+ export interface UpdateTokenVars {
457
+ token: string;
458
+ }
459
+ export interface GetMetricsData {
460
+ getOverviewMetrics?: Metrics;
461
+ }
462
+ export interface GetServiceMapData {
463
+ serviceMap?: ServiceMapSources;
464
+ }
465
+ export interface GetProfilingSlotsData {
466
+ profilingSlots?: ProfilingSlots;
467
+ }
468
+ export interface GetSourceProfilingData {
469
+ sourceProfiling?: SourceProfilingResult;
470
+ }
471
+ export interface EnableSourceProfilingData {
472
+ enableSourceProfiling?: EnableProfilingResult;
473
+ }
474
+ export interface GetGatewayInfoData {
475
+ gatewayInfo?: GatewayInfo;
476
+ }
477
+ export interface GetGatewayPodsData {
478
+ gatewayPods?: PodInfo[];
479
+ }
480
+ export interface GetNodeCollectorInfoData {
481
+ nodeCollectorInfo?: NodeCollectoInfo;
482
+ }
483
+ export interface GetNodeCollectorPodsData {
484
+ nodeCollectorPods?: PodInfo[];
485
+ }
486
+ export interface GetCollectorPodInfoVars {
487
+ namespace: string;
488
+ name: string;
489
+ }
490
+ export interface GetCollectorPodInfoData {
491
+ extendedPodInfo?: ExtendedPodInfo;
492
+ }
493
+ export interface GetSamplingRulesData {
494
+ samplingRules?: SamplingRules[];
495
+ k8sHealthProbesConfig?: SamplingRulesK8sHealthConfig;
496
+ computePlatform?: {
497
+ samplingRules?: SamplingRules[];
498
+ k8sHealthProbesConfig?: SamplingRulesK8sHealthConfig;
499
+ };
500
+ }
501
+ export interface SamplingRuleCreateVars<TInput> {
502
+ samplingId: string;
503
+ rule: TInput;
504
+ }
505
+ export interface SamplingRuleUpdateVars<TInput> {
506
+ samplingId: string;
507
+ ruleId: string;
508
+ rule: TInput;
509
+ }
510
+ export interface SamplingRuleDeleteVars {
511
+ samplingId: string;
512
+ ruleId: string;
513
+ }
514
+ /**
515
+ * The wire `SamplingConfigInput` shape — the inner config payload
516
+ * that `UpdateLocalUiSamplingConfigVars.config` carries.
517
+ */
518
+ export interface SamplingK8sHealthConfigInput {
519
+ enabled: boolean;
520
+ keepPercentage: number;
521
+ }
522
+ /**
523
+ * @deprecated alias retained for any host code that imported the old
524
+ * inner-config name. Prefer `SamplingK8sHealthConfigInput` for the
525
+ * inner shape, or `UpdateLocalUiSamplingConfigVars` for the wire vars.
526
+ */
527
+ export type SamplingK8sHealthConfigVars = SamplingK8sHealthConfigInput;
528
+ /**
529
+ * Variables for `UPDATE_LOCAL_UI_CONFIG` — wire mutation requires
530
+ * the input wrapped under `$config: LocalUiConfigInput!`.
531
+ */
532
+ export interface UpdateLocalUiConfigVars {
533
+ config: LocalUiConfigInput;
534
+ }
535
+ /**
536
+ * Variables for `UPDATE_LOCAL_UI_SAMPLING_CONFIG` — wire mutation
537
+ * requires the input wrapped under `$config: SamplingConfigInput`.
538
+ */
539
+ export interface UpdateLocalUiSamplingConfigVars {
540
+ config: SamplingK8sHealthConfigInput;
541
+ }
542
+ export interface GetClusterSnapshotVars {
543
+ clusterId: string;
544
+ }
545
+ export interface GetAllClusterSnapshotsData {
546
+ allClusterSnapshots?: AllClusterSnapshots;
547
+ }
548
+ export interface GetClusterSnapshotData {
549
+ clusterSnapshot?: ClusterSnapshot;
550
+ }
551
+ export interface PersistSourcesResult {
552
+ persistK8sSources: boolean;
553
+ }
554
+ export interface CreateDestinationResult {
555
+ createNewDestination: Destination;
556
+ }
557
+ export interface DeleteDestinationResult {
558
+ deleteDestination: boolean;
559
+ }
560
+ export interface CreateActionResult {
561
+ createAction: Action;
562
+ }
563
+ export interface UpdateActionResult {
564
+ updateAction: Action;
565
+ }
566
+ export interface DeleteActionResult {
567
+ deleteAction: boolean;
568
+ }
569
+ export interface CreateInstrumentationRuleResult {
570
+ createInstrumentationRule: InstrumentationRule;
571
+ }
572
+ export interface UpdateInstrumentationRuleResult {
573
+ updateInstrumentationRule: InstrumentationRule;
574
+ }
575
+ export interface DeleteInstrumentationRuleResult {
576
+ deleteInstrumentationRule: boolean;
577
+ }
578
+ export interface CreateDataStreamResult {
579
+ createDataStream: DataStream;
580
+ }
581
+ export interface UpdateDataStreamResult {
582
+ updateDataStream: DataStream;
583
+ }
584
+ export interface DeleteDataStreamResult {
585
+ deleteDataStream: boolean;
586
+ }
587
+ export interface PersistNamespacesResult {
588
+ persistK8sNamespaces: boolean;
589
+ }
590
+ export interface UpdateRemoteConfigResult {
591
+ updateRemoteConfig: boolean;
592
+ }
593
+ export interface UpdateLocalUiConfigResult {
594
+ updateLocalUiConfig: boolean;
595
+ }
596
+ export interface ResetLocalUiConfigResult {
597
+ resetLocalUiConfigToFactoryDefaults: boolean;
598
+ }
599
+ export interface UpdateTokenResult {
600
+ updateApiToken: boolean;
601
+ }
602
+ export interface CreateNoisyOperationRuleResult {
603
+ createNoisyOperationRule: NoisyOperationRule;
604
+ }
605
+ export interface UpdateNoisyOperationRuleResult {
606
+ updateNoisyOperationRule: NoisyOperationRule;
607
+ }
608
+ export interface DeleteNoisyOperationRuleResult {
609
+ deleteNoisyOperationRule: boolean;
610
+ }
611
+ export interface CreateHighlyRelevantOperationRuleResult {
612
+ createHighlyRelevantOperationRule: HighlyRelevantOperationRule;
613
+ }
614
+ export interface UpdateHighlyRelevantOperationRuleResult {
615
+ updateHighlyRelevantOperationRule: HighlyRelevantOperationRule;
616
+ }
617
+ export interface DeleteHighlyRelevantOperationRuleResult {
618
+ deleteHighlyRelevantOperationRule: boolean;
619
+ }
620
+ export interface CreateCostReductionRuleResult {
621
+ createCostReductionRule: CostReductionRule;
622
+ }
623
+ export interface UpdateCostReductionRuleResult {
624
+ updateCostReductionRule: CostReductionRule;
625
+ }
626
+ export interface DeleteCostReductionRuleResult {
627
+ deleteCostReductionRule: boolean;
628
+ }
629
+ export interface UpdateLocalUiSamplingConfigResult {
630
+ updateLocalUiSamplingConfig: boolean;
631
+ }
632
+ export interface SourceConditionEntry {
633
+ namespace: string;
634
+ name: string;
635
+ kind: string;
636
+ conditions: {
637
+ status: string;
638
+ type: string;
639
+ reason: string;
640
+ message: string;
641
+ }[];
642
+ }
643
+ export interface GetSourceConditionsData {
644
+ sourceConditions: SourceConditionEntry[];
645
+ }
646
+ export interface OdigosApiOperations {
647
+ GET_WORKLOADS: Operation<GetWorkloadsData, GetWorkloadsVars | undefined>;
648
+ GET_WORKLOADS_BY_IDS: Operation<GetWorkloadsByIdsData, GetWorkloadsByIdsVars>;
649
+ GET_WORKLOADS_BY_IDS_SLIM?: Operation<GetWorkloadsByIdsData, GetWorkloadsByIdsVars>;
650
+ GET_SOURCE: Operation<{
651
+ source?: Workload;
652
+ }, WorkloadId>;
653
+ /** central-ui only, legacy <v1.20 path */
654
+ GET_SOURCES?: Operation<GetWorkloadsData, GetWorkloadsVars | undefined>;
655
+ /** central-ui only, legacy <v1.20 path */
656
+ GET_SOURCE_CONDITIONS?: Operation<GetSourceConditionsData, WorkloadId>;
657
+ GET_SOURCE_LIBRARIES: Operation<GetSourceLibrariesData, GetSourceLibrariesVars>;
658
+ GET_PEER_SOURCES: Operation<{
659
+ peerSources?: PeerSources;
660
+ }, GetPeerSourcesVars>;
661
+ PERSIST_SOURCES: Operation<PersistSourcesResult, PersistSourcesVars>;
662
+ UPDATE_SOURCE: Operation<{
663
+ updateK8sActualSource: boolean;
664
+ }, UpdateSourceVars>;
665
+ RESTART_WORKLOADS: Operation<{
666
+ restartWorkloads: boolean;
667
+ }, RestartWorkloadsVars>;
668
+ RESTART_POD: Operation<{
669
+ restartPod: boolean;
670
+ }, RestartPodVars>;
671
+ RECOVER_FROM_ROLLBACK: Operation<{
672
+ recoverFromRollbackForWorkload: boolean;
673
+ }, RecoverFromRollbackVars>;
674
+ GET_DESTINATIONS: Operation<GetDestinationsData, undefined>;
675
+ GET_DESTINATION_CATEGORIES: Operation<GetDestinationCategoriesResult, undefined>;
676
+ GET_POTENTIAL_DESTINATIONS: Operation<GetPotentialDestinationsResult, undefined>;
677
+ CREATE_DESTINATION: Operation<CreateDestinationResult, CreateDestinationVars>;
678
+ UPDATE_DESTINATION: Operation<UpdateDestinationData, UpdateDestinationVars>;
679
+ DELETE_DESTINATION: Operation<DeleteDestinationResult, DeleteDestinationVars>;
680
+ TEST_DESTINATION_CONNECTION: Operation<TestConnectionResponse, TestDestinationConnectionVars>;
681
+ GET_ACTIONS: Operation<GetActionsData, undefined>;
682
+ CREATE_ACTION: Operation<CreateActionResult, CreateActionVars>;
683
+ UPDATE_ACTION: Operation<UpdateActionResult, UpdateActionVars>;
684
+ DELETE_ACTION: Operation<DeleteActionResult, DeleteActionVars>;
685
+ GET_INSTRUMENTATION_RULES: Operation<GetInstrumentationRulesData, undefined>;
686
+ CREATE_INSTRUMENTATION_RULE: Operation<CreateInstrumentationRuleResult, CreateInstrumentationRuleVars>;
687
+ UPDATE_INSTRUMENTATION_RULE: Operation<UpdateInstrumentationRuleResult, UpdateInstrumentationRuleVars>;
688
+ DELETE_INSTRUMENTATION_RULE: Operation<DeleteInstrumentationRuleResult, DeleteInstrumentationRuleVars>;
689
+ GET_DATA_STREAMS: Operation<GetDataStreamsData, undefined>;
690
+ /** odigos webapp only — central-ui uses UPDATE_DATA_STREAM with a synthetic input for create */
691
+ CREATE_DATA_STREAM?: Operation<CreateDataStreamResult, CreateDataStreamVars>;
692
+ UPDATE_DATA_STREAM: Operation<UpdateDataStreamResult, UpdateDataStreamVars>;
693
+ DELETE_DATA_STREAM: Operation<DeleteDataStreamResult, DeleteDataStreamVars>;
694
+ GET_NAMESPACES_WITH_WORKLOADS: Operation<GetNamespacesWithWorkloadsData, undefined>;
695
+ /** central-ui legacy <v1.20 path */
696
+ GET_NAMESPACES?: Operation<GetNamespacesWithWorkloadsData, undefined>;
697
+ /** central-ui legacy <v1.20 path */
698
+ GET_NAMESPACE?: Operation<{
699
+ namespace?: Namespace;
700
+ }, GetNamespaceVars>;
701
+ PERSIST_NAMESPACES: Operation<PersistNamespacesResult, PersistNamespacesVars>;
702
+ GET_K8S_MANIFEST: Operation<GetK8sManifestData, GetK8sManifestVars>;
703
+ GET_CONFIG?: Operation<FetchedConfig, undefined>;
704
+ GET_EFFECTIVE_CONFIG?: Operation<EffectiveConfig, GetEffectiveConfigVars>;
705
+ GET_CONFIG_YAMLS?: Operation<GetConfigYamlsData, undefined>;
706
+ UPDATE_REMOTE_CONFIG?: Operation<UpdateRemoteConfigResult, UpdateRemoteConfigVars>;
707
+ UPDATE_LOCAL_UI_CONFIG?: Operation<UpdateLocalUiConfigResult, UpdateLocalUiConfigVars>;
708
+ RESET_LOCAL_UI_CONFIG_TO_FACTORY_DEFAULTS?: Operation<ResetLocalUiConfigResult, undefined>;
709
+ GET_DESCRIBE_ODIGOS?: Operation<DescribeOdigosData, undefined>;
710
+ GET_DESCRIBE_SOURCE?: Operation<DescribeSourceData, WorkloadId>;
711
+ GET_DIAGNOSE?: Operation<DiagnoseResult, DiagnoseVars>;
712
+ GET_TOKENS?: Operation<TokenPayload[], undefined>;
713
+ UPDATE_TOKEN?: Operation<UpdateTokenResult, UpdateTokenVars>;
714
+ GET_METRICS: Operation<GetMetricsData, undefined>;
715
+ GET_SERVICE_MAP?: Operation<GetServiceMapData, undefined>;
716
+ GET_PROFILING_SLOTS?: Operation<ProfilingSlots, undefined>;
717
+ GET_SOURCE_PROFILING?: Operation<SourceProfilingResult, WorkloadId>;
718
+ ENABLE_SOURCE_PROFILING?: Operation<EnableProfilingResult, WorkloadId>;
719
+ GET_GATEWAY_INFO?: Operation<GatewayInfo, undefined>;
720
+ GET_GATEWAY_PODS?: Operation<PodInfo[], undefined>;
721
+ GET_NODE_COLLECTOR_INFO?: Operation<NodeCollectoInfo, undefined>;
722
+ GET_NODE_COLLECTOR_PODS?: Operation<PodInfo[], undefined>;
723
+ GET_COLLECTOR_POD_INFO?: Operation<ExtendedPodInfo, GetCollectorPodInfoVars>;
724
+ GET_SAMPLING_RULES?: Operation<GetSamplingRulesData, undefined>;
725
+ CREATE_NOISY_OPERATION_RULE?: Operation<CreateNoisyOperationRuleResult, SamplingRuleCreateVars<NoisyOperationRuleInput>>;
726
+ UPDATE_NOISY_OPERATION_RULE?: Operation<UpdateNoisyOperationRuleResult, SamplingRuleUpdateVars<NoisyOperationRuleInput>>;
727
+ DELETE_NOISY_OPERATION_RULE?: Operation<DeleteNoisyOperationRuleResult, SamplingRuleDeleteVars>;
728
+ CREATE_HIGHLY_RELEVANT_OPERATION_RULE?: Operation<CreateHighlyRelevantOperationRuleResult, SamplingRuleCreateVars<HighlyRelevantOperationRuleInput>>;
729
+ UPDATE_HIGHLY_RELEVANT_OPERATION_RULE?: Operation<UpdateHighlyRelevantOperationRuleResult, SamplingRuleUpdateVars<HighlyRelevantOperationRuleInput>>;
730
+ DELETE_HIGHLY_RELEVANT_OPERATION_RULE?: Operation<DeleteHighlyRelevantOperationRuleResult, SamplingRuleDeleteVars>;
731
+ CREATE_COST_REDUCTION_RULE?: Operation<CreateCostReductionRuleResult, SamplingRuleCreateVars<CostReductionRuleInput>>;
732
+ UPDATE_COST_REDUCTION_RULE?: Operation<UpdateCostReductionRuleResult, SamplingRuleUpdateVars<CostReductionRuleInput>>;
733
+ DELETE_COST_REDUCTION_RULE?: Operation<DeleteCostReductionRuleResult, SamplingRuleDeleteVars>;
734
+ UPDATE_LOCAL_UI_SAMPLING_CONFIG?: Operation<UpdateLocalUiSamplingConfigResult, UpdateLocalUiSamplingConfigVars>;
735
+ GET_ALL_CLUSTER_SNAPSHOTS?: Operation<AllClusterSnapshots, undefined>;
736
+ GET_CLUSTER_SNAPSHOT?: Operation<ClusterSnapshot, GetClusterSnapshotVars>;
737
+ }
738
+ /**
739
+ * The host's Apollo configuration. The kit constructs the ApolloClient
740
+ * from this shape, attaching auth/CSRF/error/SSR concerns the host
741
+ * passes in as callbacks. Keeps host-specific wire-format concerns in
742
+ * the host while letting the kit own usage.
743
+ */
744
+ export interface ApolloConfig {
745
+ /** GraphQL HTTP endpoint. Required. */
746
+ httpUrl: string;
747
+ /**
748
+ * Optional WebSocket link for GraphQL subscriptions (e.g. `GraphQLWsLink`).
749
+ * The host constructs this — keeps `graphql-ws` out of the kit's dep tree.
750
+ */
751
+ wsLink?: ApolloLink;
752
+ /** Cookie credentials policy (defaults to 'same-origin'). */
753
+ credentials?: 'include' | 'same-origin' | 'omit';
754
+ /**
755
+ * Returns auth headers to attach to every request. May be sync or async.
756
+ * Used by central-ui for `Authorization: Bearer <token>` from the user store.
757
+ */
758
+ authHeader?: () => Record<string, string> | Promise<Record<string, string>>;
759
+ /**
760
+ * Returns CSRF headers to attach to every request. Used by odigos webapp.
761
+ * The webapp adapter resolves the CSRF token before mounting the provider,
762
+ * then `csrfHeader` returns the cached value synchronously.
763
+ */
764
+ csrfHeader?: () => Record<string, string>;
765
+ /**
766
+ * Called when an Apollo error is detected as an auth failure (401 or
767
+ * known auth-error message). Hosts use this to clear local user state
768
+ * and redirect to the sign-in page.
769
+ */
770
+ onAuthError?: () => void;
771
+ /**
772
+ * When true, the kit uses Apollo's Next.js SSR multipart link in the
773
+ * server-side branch. The webapp adapter sets this; central-ui does not.
774
+ * Apollo Next.js support requires `@apollo/experimental-nextjs-app-support`
775
+ * to be available — the host imports it and passes through `ssrAppProvider`.
776
+ */
777
+ ssr?: boolean;
778
+ /**
779
+ * When `ssr: true` and the host wants Next.js's `ApolloNextAppProvider`
780
+ * wrapping, supply the wrapper component here. The kit will mount it
781
+ * at the appropriate level.
782
+ */
783
+ ssrAppProvider?: (props: {
784
+ makeClient: () => unknown;
785
+ children?: ReactNode;
786
+ }) => ReactNode;
787
+ /**
788
+ * Optional override for `InMemoryCache.addTypename`. Defaults to true.
789
+ * webapp historically uses `addTypename: false`; central-ui uses default.
790
+ */
791
+ addTypename?: boolean;
792
+ /** Optional `InMemoryCache` type policies. */
793
+ cacheTypePolicies?: TypePolicies;
794
+ /** Optional override for default fetch policies. */
795
+ defaultFetchPolicies?: {
796
+ watchQuery?: WatchQueryFetchPolicy;
797
+ query?: FetchPolicy;
798
+ mutate?: MutationFetchPolicy;
799
+ };
800
+ /**
801
+ * Extra Apollo links composed into the chain (before HTTP/WS).
802
+ * Hosts can pass observability links, retry links, etc.
803
+ */
804
+ additionalLinks?: ApolloLink[];
805
+ }
806
+ export interface OdigosApiProviderProps {
807
+ apolloConfig: ApolloConfig;
808
+ operations: OdigosApiOperations;
809
+ /** Initial operation context. Hosts re-render with a new context whenever the active proxy/version changes. */
810
+ context: OperationContext;
811
+ children?: ReactNode;
812
+ }
813
+ export type ApolloCacheShape = NormalizedCacheObject;
814
+ /**
815
+ * The minimal value the inner provider exposes — used by per-domain hooks
816
+ * via `useOdigosApiInternal()`.
817
+ */
818
+ export interface OdigosApiInternalValue {
819
+ operations: OdigosApiOperations;
820
+ context: OperationContext;
821
+ /**
822
+ * Apollo + transport configuration propagated from
823
+ * `<OdigosApiProvider apolloConfig={…}>`. Exposed on the internal
824
+ * context so domain hooks that need to talk to non-GraphQL endpoints
825
+ * on the same host (e.g. the diagnose archive download) can re-use
826
+ * the host's `httpUrl` origin, credentials policy, auth headers,
827
+ * and CSRF headers — without forcing the host to wire a separate
828
+ * helper for each REST round-trip.
829
+ */
830
+ apolloConfig: ApolloConfig;
831
+ }