@grafana/plugin-ui 0.15.1 → 0.16.0-dsconfig.a155abe
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/dist/cjs/index.cjs +11687 -2012
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +719 -2
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/DatasourceConfigWizard.js +217 -0
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/DatasourceConfigWizard.js.map +1 -0
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/DatasourceErrorBoundary.js +27 -0
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/DatasourceErrorBoundary.js.map +1 -0
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/FieldInput.js +135 -0
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/FieldInput.js.map +1 -0
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/SchemaField.js +80 -0
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/SchemaField.js.map +1 -0
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/SidebarNav.js +54 -0
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/SidebarNav.js.map +1 -0
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/TabLayout.js +155 -0
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/TabLayout.js.map +1 -0
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/cel.js +75 -0
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/cel.js.map +1 -0
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/config.js +262 -0
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/config.js.map +1 -0
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/datasource.js +354 -0
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/datasource.js.map +1 -0
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/fieldUtils.js +138 -0
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/fieldUtils.js.map +1 -0
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/hooks/formInterpreter.js +93 -0
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/hooks/formInterpreter.js.map +1 -0
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/hooks/useDatasourceConfigForm.js +253 -0
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/hooks/useDatasourceConfigForm.js.map +1 -0
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/hooks/useHealthChecks.js +106 -0
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/hooks/useHealthChecks.js.map +1 -0
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/inputs/AuthorizationHeaderField.js +52 -0
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/inputs/AuthorizationHeaderField.js.map +1 -0
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/inputs/ComplexFieldNote.js +26 -0
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/inputs/ComplexFieldNote.js.map +1 -0
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/inputs/FileUploadField.js +106 -0
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/inputs/FileUploadField.js.map +1 -0
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/inputs/IndexedPairEditor.js +124 -0
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/inputs/IndexedPairEditor.js.map +1 -0
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/inputs/ObjectArrayEditor.js +190 -0
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/inputs/ObjectArrayEditor.js.map +1 -0
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/inputs/PdcFieldNote.js +31 -0
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/inputs/PdcFieldNote.js.map +1 -0
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/inputs/PrimitiveInputs.js +103 -0
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/inputs/PrimitiveInputs.js.map +1 -0
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/inputs/SecureFieldInput.js +59 -0
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/inputs/SecureFieldInput.js.map +1 -0
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/inputs/StringArrayInput.js +80 -0
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/inputs/StringArrayInput.js.map +1 -0
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/layoutParts.js +82 -0
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/layoutParts.js.map +1 -0
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/resolvePluginName.js +30 -0
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/resolvePluginName.js.map +1 -0
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/styles.js +340 -0
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/styles.js.map +1 -0
- package/dist/esm/index.d.ts +719 -2
- package/dist/esm/index.js +11 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/node_modules/js-yaml/dist/js-yaml.js +3043 -0
- package/dist/esm/node_modules/js-yaml/dist/js-yaml.js.map +1 -0
- package/dist/esm/node_modules/react-hook-form/dist/index.esm.js +2766 -0
- package/dist/esm/node_modules/react-hook-form/dist/index.esm.js.map +1 -0
- package/dist/esm/node_modules/semver/classes/range.js +24 -4
- package/dist/esm/node_modules/semver/classes/range.js.map +1 -1
- package/dist/esm/node_modules/semver/classes/semver.js +19 -2
- package/dist/esm/node_modules/semver/classes/semver.js.map +1 -1
- package/dist/esm/node_modules/semver/functions/diff.js +1 -1
- package/dist/esm/node_modules/semver/functions/diff.js.map +1 -1
- package/dist/esm/node_modules/semver/functions/truncate.js +62 -0
- package/dist/esm/node_modules/semver/functions/truncate.js.map +1 -0
- package/dist/esm/node_modules/semver/index.js +3 -0
- package/dist/esm/node_modules/semver/index.js.map +1 -1
- package/dist/esm/node_modules/semver/internal/re.js +3 -3
- package/dist/esm/node_modules/semver/internal/re.js.map +1 -1
- package/dist/esm/node_modules/semver/ranges/subset.js +3 -3
- package/dist/esm/node_modules/semver/ranges/subset.js.map +1 -1
- package/dist/esm/node_modules/tslib/tslib.es6.js.map +1 -1
- package/dist/esm/schema/utils/constants.js +4 -0
- package/dist/esm/schema/utils/constants.js.map +1 -0
- package/dist/esm/schema/utils/dsconfig.js +97 -0
- package/dist/esm/schema/utils/dsconfig.js.map +1 -0
- package/dist/esm/schema/utils/llm.js +54 -0
- package/dist/esm/schema/utils/llm.js.map +1 -0
- package/dist/esm/schema/utils/packs.js +113 -0
- package/dist/esm/schema/utils/packs.js.map +1 -0
- package/dist/esm/schema/utils/provisioning.js +434 -0
- package/dist/esm/schema/utils/provisioning.js.map +1 -0
- package/dist/esm/schema/utils/registry.js +30 -0
- package/dist/esm/schema/utils/registry.js.map +1 -0
- package/dist/esm/schema/utils/useDatasourceSchema.js +39 -0
- package/dist/esm/schema/utils/useDatasourceSchema.js.map +1 -0
- package/package.json +12 -9
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { ComponentProps, PureComponent, ReactElement, ReactNode, FunctionComponent, HTMLProps } from 'react';
|
|
1
|
+
import React, { ComponentProps, PureComponent, ReactElement, ReactNode, Component, ErrorInfo, FunctionComponent, HTMLProps } from 'react';
|
|
2
2
|
import { Input, Segment as Segment$1, monacoTypes, Monaco, ButtonProps, Field, PopoverContent, Switch, SelectCommonProps, InlineLabel } from '@grafana/ui';
|
|
3
3
|
import { DataSourceInstanceSettings, SelectableValue, DataSourceJsonData, VariableSuggestion, TimeRange, DataFrame, MetricFindValue, ThemeSpacingTokens, ScopedVars, DataFrameView, VariableModel, QueryEditorProps as QueryEditorProps$1, DataSourceSettings, RegistryItem, DataSourceApi, Registry, DataQuery as DataQuery$1, PanelData, DataQueryRequest, DataQueryResponse, LoadingState } from '@grafana/data';
|
|
4
4
|
import { DataSourceSrv, DataSourceWithBackend, TemplateSrv } from '@grafana/runtime';
|
|
@@ -1014,6 +1014,723 @@ type Props$a<C extends Config = Config> = {
|
|
|
1014
1014
|
};
|
|
1015
1015
|
declare const AdvancedHttpSettings: <C extends Config = Config>(props: Props$a<C>) => JSX.Element;
|
|
1016
1016
|
|
|
1017
|
+
interface DatasourceConfigSchema {
|
|
1018
|
+
/**
|
|
1019
|
+
* Schema version (required)
|
|
1020
|
+
* Used for compatibility and migrations
|
|
1021
|
+
*
|
|
1022
|
+
* Example: "v2"
|
|
1023
|
+
*/
|
|
1024
|
+
schemaVersion: string;
|
|
1025
|
+
/**
|
|
1026
|
+
* Unique datasource plugin identifier
|
|
1027
|
+
* Example: "prometheus"
|
|
1028
|
+
*/
|
|
1029
|
+
pluginType: string;
|
|
1030
|
+
/**
|
|
1031
|
+
* Human-readable name
|
|
1032
|
+
*/
|
|
1033
|
+
pluginName: string;
|
|
1034
|
+
/**
|
|
1035
|
+
* Optional documentation URL
|
|
1036
|
+
*/
|
|
1037
|
+
docURL?: string;
|
|
1038
|
+
/**
|
|
1039
|
+
* SDK field packs to merge into this schema before validation.
|
|
1040
|
+
* Pack fields are prepended to `fields` in declaration order.
|
|
1041
|
+
* Plugin-declared fields with a matching ID take precedence over pack fields.
|
|
1042
|
+
* Call `resolveBaseFields()` before consuming the schema.
|
|
1043
|
+
*/
|
|
1044
|
+
baseFields?: BaseFieldRef[];
|
|
1045
|
+
/**
|
|
1046
|
+
* Source of truth for configuration
|
|
1047
|
+
*/
|
|
1048
|
+
fields: ConfigField[];
|
|
1049
|
+
/**
|
|
1050
|
+
* Optional UI grouping
|
|
1051
|
+
*/
|
|
1052
|
+
groups?: ConfigGroup[];
|
|
1053
|
+
/**
|
|
1054
|
+
* Optional instructions rendered alongside the config form.
|
|
1055
|
+
*/
|
|
1056
|
+
instructions?: Instruction[];
|
|
1057
|
+
/**
|
|
1058
|
+
* Relationships between fields
|
|
1059
|
+
*/
|
|
1060
|
+
relationships?: FieldRelationship[];
|
|
1061
|
+
}
|
|
1062
|
+
interface Instruction {
|
|
1063
|
+
msg: string;
|
|
1064
|
+
tags?: string[];
|
|
1065
|
+
}
|
|
1066
|
+
/**
|
|
1067
|
+
* Identifier of a built-in field pack defined by grafana/dsconfig.
|
|
1068
|
+
* Convention: `<sdk_name>_settings`.
|
|
1069
|
+
*/
|
|
1070
|
+
type FieldPackID = 'plugin_sdk_settings' | 'aws_sdk_settings' | 'azure_sdk_settings' | 'google_sdk_settings' | 'sqleng_settings';
|
|
1071
|
+
/**
|
|
1072
|
+
* Declares a single field pack to compose into the schema.
|
|
1073
|
+
*/
|
|
1074
|
+
interface BaseFieldRef {
|
|
1075
|
+
/** Identifier of a built-in field pack. */
|
|
1076
|
+
from: FieldPackID;
|
|
1077
|
+
/**
|
|
1078
|
+
* Field IDs from the pack to omit entirely.
|
|
1079
|
+
* Each ID must exist in the pack (else resolution fails).
|
|
1080
|
+
*/
|
|
1081
|
+
exclude?: string[];
|
|
1082
|
+
/**
|
|
1083
|
+
* Presentation-only overrides keyed by pack field ID.
|
|
1084
|
+
* Structural properties (id, key, valueType, target, role) cannot be patched.
|
|
1085
|
+
*/
|
|
1086
|
+
patch?: Record<string, FieldPatch>;
|
|
1087
|
+
}
|
|
1088
|
+
/**
|
|
1089
|
+
* Safe-to-override presentation properties for a pack field.
|
|
1090
|
+
* Only non-undefined values are applied.
|
|
1091
|
+
*/
|
|
1092
|
+
interface FieldPatch {
|
|
1093
|
+
label?: string;
|
|
1094
|
+
description?: string;
|
|
1095
|
+
placeholder?: string;
|
|
1096
|
+
defaultValue?: unknown;
|
|
1097
|
+
required?: boolean;
|
|
1098
|
+
/** When true, the field is dropped from the resolved schema. */
|
|
1099
|
+
hidden?: boolean;
|
|
1100
|
+
}
|
|
1101
|
+
/**
|
|
1102
|
+
* Named set of ConfigField definitions provided by an SDK.
|
|
1103
|
+
* Pack field IDs are namespaced with the pack ID, e.g. `plugin_sdk_settings.url`.
|
|
1104
|
+
*/
|
|
1105
|
+
interface FieldPack {
|
|
1106
|
+
id: FieldPackID;
|
|
1107
|
+
fields: ConfigField[];
|
|
1108
|
+
}
|
|
1109
|
+
interface ConfigField {
|
|
1110
|
+
/**
|
|
1111
|
+
* Globally unique identifier
|
|
1112
|
+
* Recommended format: dot-separated path
|
|
1113
|
+
* Example: "auth.method", "httpHeaders.item.key"
|
|
1114
|
+
*/
|
|
1115
|
+
id: string;
|
|
1116
|
+
/**
|
|
1117
|
+
* Local key used in storage or object
|
|
1118
|
+
*/
|
|
1119
|
+
key: string;
|
|
1120
|
+
/**
|
|
1121
|
+
* UI metadata
|
|
1122
|
+
*/
|
|
1123
|
+
label?: string;
|
|
1124
|
+
description?: string;
|
|
1125
|
+
docURL?: string;
|
|
1126
|
+
/**
|
|
1127
|
+
* Core type of the field
|
|
1128
|
+
*/
|
|
1129
|
+
valueType: ValueType;
|
|
1130
|
+
/**
|
|
1131
|
+
* Storage location (required for storage fields)
|
|
1132
|
+
*/
|
|
1133
|
+
target?: TargetLocation;
|
|
1134
|
+
/**
|
|
1135
|
+
* Semantic role identifying what a field represents to the SDK.
|
|
1136
|
+
* Field packs annotate their fields with roles (e.g. `endpoint.baseUrl`).
|
|
1137
|
+
*/
|
|
1138
|
+
role?: Role;
|
|
1139
|
+
/**
|
|
1140
|
+
* Dotted path prefix within the target for nested objects.
|
|
1141
|
+
* Example: for jsonData.tracesToLogs.datasourceUid,
|
|
1142
|
+
* target="jsonData", section="tracesToLogs", key="datasourceUid".
|
|
1143
|
+
*/
|
|
1144
|
+
section?: string;
|
|
1145
|
+
/**
|
|
1146
|
+
* Field kind.
|
|
1147
|
+
* @default "storage"
|
|
1148
|
+
*/
|
|
1149
|
+
kind?: FieldKind;
|
|
1150
|
+
/**
|
|
1151
|
+
* True if field belongs to array item schema
|
|
1152
|
+
*/
|
|
1153
|
+
isItemField?: boolean;
|
|
1154
|
+
/**
|
|
1155
|
+
* UI rendering hints
|
|
1156
|
+
*/
|
|
1157
|
+
ui?: FieldUI;
|
|
1158
|
+
/**
|
|
1159
|
+
* Validations rules
|
|
1160
|
+
*/
|
|
1161
|
+
validations?: FieldValidationRule[];
|
|
1162
|
+
/**
|
|
1163
|
+
* Visibility condition (CEL expression)
|
|
1164
|
+
*/
|
|
1165
|
+
dependsOn?: Expression;
|
|
1166
|
+
/**
|
|
1167
|
+
* Always required
|
|
1168
|
+
*/
|
|
1169
|
+
required?: boolean;
|
|
1170
|
+
/**
|
|
1171
|
+
* Conditionally required
|
|
1172
|
+
*/
|
|
1173
|
+
requiredWhen?: Expression;
|
|
1174
|
+
/**
|
|
1175
|
+
* Disabled condition
|
|
1176
|
+
*/
|
|
1177
|
+
disabledWhen?: Expression;
|
|
1178
|
+
/**
|
|
1179
|
+
* Dynamic overrides
|
|
1180
|
+
*/
|
|
1181
|
+
overrides?: FieldOverride[];
|
|
1182
|
+
/**
|
|
1183
|
+
* Declarative multi-field write side-effects.
|
|
1184
|
+
* When this field's value matches a condition, the listed target
|
|
1185
|
+
* fields are set to specified values. Typically used on virtual
|
|
1186
|
+
* selector fields (e.g. auth method dropdown).
|
|
1187
|
+
*/
|
|
1188
|
+
effects?: FieldEffect[];
|
|
1189
|
+
/**
|
|
1190
|
+
* Item schema for array elements or map values.
|
|
1191
|
+
* Required if valueType === "array" or "map".
|
|
1192
|
+
*/
|
|
1193
|
+
item?: FieldItemSchema;
|
|
1194
|
+
/**
|
|
1195
|
+
* Legacy indexed fields (deprecated)
|
|
1196
|
+
*/
|
|
1197
|
+
repeatable?: boolean;
|
|
1198
|
+
pattern?: string;
|
|
1199
|
+
/**
|
|
1200
|
+
* Storage mapping
|
|
1201
|
+
*/
|
|
1202
|
+
storage?: StorageMapping;
|
|
1203
|
+
/**
|
|
1204
|
+
* Metadata
|
|
1205
|
+
*/
|
|
1206
|
+
tags?: string[];
|
|
1207
|
+
examples?: unknown[];
|
|
1208
|
+
defaultValue?: unknown;
|
|
1209
|
+
}
|
|
1210
|
+
interface FieldItemSchema {
|
|
1211
|
+
/**
|
|
1212
|
+
* Type of array items or map values.
|
|
1213
|
+
* For arrays, describes each element.
|
|
1214
|
+
* For maps, describes each value (keys are always strings).
|
|
1215
|
+
*/
|
|
1216
|
+
valueType: ValueType;
|
|
1217
|
+
/**
|
|
1218
|
+
* Sub-fields for object items. Optional even when valueType = "object"
|
|
1219
|
+
* (omitting allows an unconstrained object).
|
|
1220
|
+
*/
|
|
1221
|
+
fields?: ConfigField[];
|
|
1222
|
+
}
|
|
1223
|
+
/**
|
|
1224
|
+
* CEL expression string
|
|
1225
|
+
*/
|
|
1226
|
+
type Expression = string;
|
|
1227
|
+
type ValueType = 'string' | 'number' | 'boolean' | 'array' | 'object' | 'map' | 'any';
|
|
1228
|
+
type FieldKind = 'storage' | 'virtual';
|
|
1229
|
+
type TargetLocation = 'root' | 'jsonData' | 'secureJsonData';
|
|
1230
|
+
/**
|
|
1231
|
+
* Semantic role identifying what a field represents to the SDK.
|
|
1232
|
+
* Kept as `string` for forward compatibility with newer packs from
|
|
1233
|
+
* grafana/dsconfig; see that repo for the canonical role list.
|
|
1234
|
+
*/
|
|
1235
|
+
type Role = string;
|
|
1236
|
+
type UIComponent = 'input' | 'textarea' | 'select' | 'multiselect' | 'radio' | 'checkbox' | 'switch' | 'code' | 'keyvalue' | 'list' | 'fileUpload';
|
|
1237
|
+
type UIWidth = 'full' | 'half';
|
|
1238
|
+
/**
|
|
1239
|
+
* UI configuration
|
|
1240
|
+
*/
|
|
1241
|
+
interface FieldUI {
|
|
1242
|
+
component: UIComponent;
|
|
1243
|
+
multiline?: boolean;
|
|
1244
|
+
rows?: number;
|
|
1245
|
+
options?: FieldOption[];
|
|
1246
|
+
allowCustom?: boolean;
|
|
1247
|
+
width?: UIWidth;
|
|
1248
|
+
placeholder?: string;
|
|
1249
|
+
/**
|
|
1250
|
+
* Language hint for code editor components.
|
|
1251
|
+
* Example: "promql", "logql", "traceql", "sql", "json"
|
|
1252
|
+
*/
|
|
1253
|
+
language?: string;
|
|
1254
|
+
/**
|
|
1255
|
+
* Layout row index for item fields inside object arrays.
|
|
1256
|
+
* Fields with the same row number are rendered horizontally.
|
|
1257
|
+
* Fields without a row number use auto-layout:
|
|
1258
|
+
* - ≤3 fields: all on one row
|
|
1259
|
+
* - >3 fields: each on its own row
|
|
1260
|
+
*/
|
|
1261
|
+
row?: number;
|
|
1262
|
+
/**
|
|
1263
|
+
* Accepted file types for fileUpload component.
|
|
1264
|
+
* Uses HTML accept attribute format with leading dot.
|
|
1265
|
+
* Example: [".json"]
|
|
1266
|
+
*/
|
|
1267
|
+
accept?: string[];
|
|
1268
|
+
/**
|
|
1269
|
+
* Maps keys in an uploaded JSON file to target field IDs.
|
|
1270
|
+
* Used by fileUpload to distribute parsed values to other form fields.
|
|
1271
|
+
* Example: { "private_key": "secureJsonData.privateKey", "client_email": "jsonData.clientEmail" }
|
|
1272
|
+
*/
|
|
1273
|
+
fileMapping?: Record<string, string>;
|
|
1274
|
+
}
|
|
1275
|
+
type FieldValidationRule = PatternValidationRule | RangeValidationRule | LengthValidationRule | ItemCountValidationRule | AllowedValuesValidationRule | CustomValidationRule;
|
|
1276
|
+
interface BaseValidationRule {
|
|
1277
|
+
/**
|
|
1278
|
+
* Optional stable ID for the validation rule.
|
|
1279
|
+
* Useful for docs, localization, and test snapshots.
|
|
1280
|
+
*/
|
|
1281
|
+
id?: string;
|
|
1282
|
+
/**
|
|
1283
|
+
* Human-readable validation error message.
|
|
1284
|
+
*/
|
|
1285
|
+
message?: string;
|
|
1286
|
+
}
|
|
1287
|
+
interface PatternValidationRule extends BaseValidationRule {
|
|
1288
|
+
type: 'pattern';
|
|
1289
|
+
pattern: string;
|
|
1290
|
+
}
|
|
1291
|
+
interface RangeValidationRule extends BaseValidationRule {
|
|
1292
|
+
type: 'range';
|
|
1293
|
+
min?: number;
|
|
1294
|
+
max?: number;
|
|
1295
|
+
}
|
|
1296
|
+
interface LengthValidationRule extends BaseValidationRule {
|
|
1297
|
+
type: 'length';
|
|
1298
|
+
min?: number;
|
|
1299
|
+
max?: number;
|
|
1300
|
+
}
|
|
1301
|
+
interface ItemCountValidationRule extends BaseValidationRule {
|
|
1302
|
+
type: 'itemCount';
|
|
1303
|
+
min?: number;
|
|
1304
|
+
max?: number;
|
|
1305
|
+
}
|
|
1306
|
+
interface AllowedValuesValidationRule extends BaseValidationRule {
|
|
1307
|
+
type: 'allowedValues';
|
|
1308
|
+
values: unknown[];
|
|
1309
|
+
}
|
|
1310
|
+
interface CustomValidationRule extends BaseValidationRule {
|
|
1311
|
+
type: 'custom';
|
|
1312
|
+
/**
|
|
1313
|
+
* CEL expression.
|
|
1314
|
+
*
|
|
1315
|
+
* Should evaluate to true when the field value is valid.
|
|
1316
|
+
*/
|
|
1317
|
+
expression: Expression;
|
|
1318
|
+
}
|
|
1319
|
+
interface FieldOverride {
|
|
1320
|
+
/**
|
|
1321
|
+
* CEL condition
|
|
1322
|
+
*/
|
|
1323
|
+
when: Expression;
|
|
1324
|
+
defaultValue?: unknown;
|
|
1325
|
+
/**
|
|
1326
|
+
* When true, the field is disabled/read-only while this override is active.
|
|
1327
|
+
*/
|
|
1328
|
+
readOnly?: boolean;
|
|
1329
|
+
description?: string;
|
|
1330
|
+
placeholder?: string;
|
|
1331
|
+
tooltip?: string;
|
|
1332
|
+
validations?: FieldValidationRule[];
|
|
1333
|
+
options?: FieldOption[];
|
|
1334
|
+
/**
|
|
1335
|
+
* When present on an `isItemField` field, the value is routed to
|
|
1336
|
+
* `secureJsonData` under the resolved key instead of being stored
|
|
1337
|
+
* inline in the parent array.
|
|
1338
|
+
*
|
|
1339
|
+
* The template string supports placeholders:
|
|
1340
|
+
* - `{index}` — 0-based array position
|
|
1341
|
+
* - `{index1}` — 1-based array position
|
|
1342
|
+
* - `{item.KEY}` — value of sibling item field `KEY`
|
|
1343
|
+
*
|
|
1344
|
+
* Examples:
|
|
1345
|
+
* - `"secureHttpHeaders.{item.name}"` (ClickHouse)
|
|
1346
|
+
* - `"httpHeaderValue{index1}"` (Grafana core headers)
|
|
1347
|
+
*/
|
|
1348
|
+
secureKey?: string;
|
|
1349
|
+
}
|
|
1350
|
+
/**
|
|
1351
|
+
* Declares that when a field's value matches a condition,
|
|
1352
|
+
* listed target fields should be set to specified values.
|
|
1353
|
+
*
|
|
1354
|
+
* Use "value" in the `when` expression to refer to the field's value.
|
|
1355
|
+
*/
|
|
1356
|
+
interface FieldEffect {
|
|
1357
|
+
/**
|
|
1358
|
+
* CEL expression. Example: "value == 'basic-auth'"
|
|
1359
|
+
*/
|
|
1360
|
+
when: Expression;
|
|
1361
|
+
/**
|
|
1362
|
+
* Maps field IDs to the values they should be set to.
|
|
1363
|
+
* Must contain at least one entry.
|
|
1364
|
+
*/
|
|
1365
|
+
set: Record<string, unknown> & {
|
|
1366
|
+
[k: string]: unknown;
|
|
1367
|
+
};
|
|
1368
|
+
}
|
|
1369
|
+
type StorageMapping = DirectMapping | IndexedPairMapping | ComputedMapping;
|
|
1370
|
+
/**
|
|
1371
|
+
* Direct mapping
|
|
1372
|
+
*/
|
|
1373
|
+
interface DirectMapping {
|
|
1374
|
+
type: 'direct';
|
|
1375
|
+
}
|
|
1376
|
+
/**
|
|
1377
|
+
* Indexed pair mapping (headers)
|
|
1378
|
+
*/
|
|
1379
|
+
interface IndexedPairMapping {
|
|
1380
|
+
type: 'indexedPair';
|
|
1381
|
+
key: MappingField;
|
|
1382
|
+
value: MappingField;
|
|
1383
|
+
startIndex?: number;
|
|
1384
|
+
}
|
|
1385
|
+
/**
|
|
1386
|
+
* Computed mapping (virtual fields).
|
|
1387
|
+
* At least one of `read` or `write` must be provided.
|
|
1388
|
+
*/
|
|
1389
|
+
type ComputedMapping = {
|
|
1390
|
+
type: 'computed';
|
|
1391
|
+
read: Expression;
|
|
1392
|
+
write?: Expression;
|
|
1393
|
+
} | {
|
|
1394
|
+
type: 'computed';
|
|
1395
|
+
read?: Expression;
|
|
1396
|
+
write: Expression;
|
|
1397
|
+
};
|
|
1398
|
+
/**
|
|
1399
|
+
* Mapping field
|
|
1400
|
+
*/
|
|
1401
|
+
interface MappingField {
|
|
1402
|
+
target: TargetLocation;
|
|
1403
|
+
pattern: string;
|
|
1404
|
+
}
|
|
1405
|
+
interface FieldOption {
|
|
1406
|
+
label: string;
|
|
1407
|
+
/**
|
|
1408
|
+
* Must match parent field valueType.
|
|
1409
|
+
* Must not be null.
|
|
1410
|
+
*/
|
|
1411
|
+
value: NonNullable<unknown>;
|
|
1412
|
+
/**
|
|
1413
|
+
* Optional human-readable description of the option.
|
|
1414
|
+
*/
|
|
1415
|
+
description?: string;
|
|
1416
|
+
}
|
|
1417
|
+
interface ConfigGroup {
|
|
1418
|
+
id: string;
|
|
1419
|
+
title: string;
|
|
1420
|
+
description?: string;
|
|
1421
|
+
order?: number;
|
|
1422
|
+
/**
|
|
1423
|
+
* When true, the group is optional and can be collapsed/hidden by default.
|
|
1424
|
+
*/
|
|
1425
|
+
optional?: boolean;
|
|
1426
|
+
/**
|
|
1427
|
+
* References field IDs (not keys)
|
|
1428
|
+
*/
|
|
1429
|
+
fieldRefs: string[];
|
|
1430
|
+
}
|
|
1431
|
+
type RelationshipType = 'pair' | 'group' | 'datasourceReference';
|
|
1432
|
+
interface FieldRelationship {
|
|
1433
|
+
type: RelationshipType;
|
|
1434
|
+
/**
|
|
1435
|
+
* References field IDs
|
|
1436
|
+
*/
|
|
1437
|
+
fields: string[];
|
|
1438
|
+
description?: string;
|
|
1439
|
+
/**
|
|
1440
|
+
* Constrains the datasource UID to a specific plugin type.
|
|
1441
|
+
* Only applicable when type is "datasourceReference".
|
|
1442
|
+
*/
|
|
1443
|
+
targetPluginType?: string;
|
|
1444
|
+
}
|
|
1445
|
+
type SecureFieldState = {
|
|
1446
|
+
type: 'unset';
|
|
1447
|
+
} | {
|
|
1448
|
+
type: 'configured';
|
|
1449
|
+
} | {
|
|
1450
|
+
type: 'updated';
|
|
1451
|
+
value: string;
|
|
1452
|
+
};
|
|
1453
|
+
interface FormState {
|
|
1454
|
+
values: Record<string, unknown>;
|
|
1455
|
+
secure: Record<string, SecureFieldState>;
|
|
1456
|
+
}
|
|
1457
|
+
|
|
1458
|
+
type DatasourceConfigWizardProps = {
|
|
1459
|
+
schema: DatasourceConfigSchema;
|
|
1460
|
+
dsUid: string;
|
|
1461
|
+
dsName: string;
|
|
1462
|
+
onSuccess: (status: string, message?: string) => void;
|
|
1463
|
+
onSaving?: (saving: boolean) => void;
|
|
1464
|
+
onRetest?: () => void;
|
|
1465
|
+
onFollowup?: (intent: string) => void;
|
|
1466
|
+
healthError?: string;
|
|
1467
|
+
mode?: 'tab' | 'wizard';
|
|
1468
|
+
/** Optional render prop for custom action buttons (e.g. analyze/troubleshoot). */
|
|
1469
|
+
renderActions?: (props: {
|
|
1470
|
+
dsUid: string;
|
|
1471
|
+
dsName: string;
|
|
1472
|
+
dsType: string;
|
|
1473
|
+
healthError?: string;
|
|
1474
|
+
}) => ReactNode;
|
|
1475
|
+
};
|
|
1476
|
+
declare function DatasourceConfigWizard(props: DatasourceConfigWizardProps): React.JSX.Element;
|
|
1477
|
+
|
|
1478
|
+
/** Lightweight error boundary scoped to datasource config widgets — won't crash the host UI. */
|
|
1479
|
+
declare class DatasourceErrorBoundary extends Component<{
|
|
1480
|
+
children: ReactNode;
|
|
1481
|
+
dsName?: string;
|
|
1482
|
+
}, {
|
|
1483
|
+
error: Error | null;
|
|
1484
|
+
}> {
|
|
1485
|
+
state: {
|
|
1486
|
+
error: Error | null;
|
|
1487
|
+
};
|
|
1488
|
+
static getDerivedStateFromError(error: Error): {
|
|
1489
|
+
error: Error;
|
|
1490
|
+
};
|
|
1491
|
+
componentDidCatch(error: Error, info: ErrorInfo): void;
|
|
1492
|
+
render(): string | number | boolean | Iterable<React.ReactNode> | React.JSX.Element | null | undefined;
|
|
1493
|
+
}
|
|
1494
|
+
|
|
1495
|
+
type HealthState = 'pending' | 'checking' | 'done';
|
|
1496
|
+
interface DatasourceHealth {
|
|
1497
|
+
state: HealthState;
|
|
1498
|
+
status?: string;
|
|
1499
|
+
message?: string;
|
|
1500
|
+
}
|
|
1501
|
+
/**
|
|
1502
|
+
* Health check hook — on-demand only.
|
|
1503
|
+
* Call `checkUids(uids)` to trigger checks for specific UIDs.
|
|
1504
|
+
* Call `retry(uid)` to force re-check a single UID.
|
|
1505
|
+
* UIDs that have already been checked (or are in-flight) are automatically skipped.
|
|
1506
|
+
*/
|
|
1507
|
+
declare function useHealthChecks(): {
|
|
1508
|
+
healthMap: Record<string, DatasourceHealth>;
|
|
1509
|
+
checkUids: (uids: string[]) => void;
|
|
1510
|
+
retry: (uid: string) => void;
|
|
1511
|
+
};
|
|
1512
|
+
|
|
1513
|
+
declare function resolvePluginName(pluginType: string): string;
|
|
1514
|
+
|
|
1515
|
+
/**
|
|
1516
|
+
* CEL (Common Expression Language) expression evaluator for schema conditions.
|
|
1517
|
+
*
|
|
1518
|
+
* Used by `dependsOn`, `requiredWhen`, `disabledWhen`, and `overrides[].when`.
|
|
1519
|
+
* Wraps @marcbachmann/cel-js with field-ID-aware context building.
|
|
1520
|
+
*
|
|
1521
|
+
* Go equivalent: github.com/google/cel-go
|
|
1522
|
+
*/
|
|
1523
|
+
/**
|
|
1524
|
+
* Build a nested context object from flat form values keyed by field IDs.
|
|
1525
|
+
*
|
|
1526
|
+
* CEL interprets dots as property access, so `jsonData.auth_method == 'oauth2'`
|
|
1527
|
+
* requires `{ jsonData: { auth_method: 'oauth2' } }`.
|
|
1528
|
+
*
|
|
1529
|
+
* This function takes flat key-value pairs (from react-hook-form `watch()`)
|
|
1530
|
+
* and builds the nested structure CEL expects.
|
|
1531
|
+
*
|
|
1532
|
+
* @param values - Flat map of form keys to values (e.g. `{ "auth_method": "oauth2", "oauth2.oauth2_type": "jwt" }`)
|
|
1533
|
+
* @param fieldIdToFormKey - Optional map from field ID to form key for translation
|
|
1534
|
+
*/
|
|
1535
|
+
declare function buildCelContext(values: Record<string, unknown>): Record<string, unknown>;
|
|
1536
|
+
/**
|
|
1537
|
+
* Evaluate a CEL expression against a context of field values.
|
|
1538
|
+
* Returns the boolean result, or `defaultValue` if the expression is invalid.
|
|
1539
|
+
*
|
|
1540
|
+
* @example
|
|
1541
|
+
* ```ts
|
|
1542
|
+
* evaluateCelExpression("jsonData.auth_method == 'oauth2'", { jsonData: { auth_method: 'oauth2' } })
|
|
1543
|
+
* // => true
|
|
1544
|
+
*
|
|
1545
|
+
* evaluateCelExpression("auth_method == 'oauth2' && oauth2_type == 'jwt'", { auth_method: 'oauth2', oauth2_type: 'jwt' })
|
|
1546
|
+
* // => true
|
|
1547
|
+
* ```
|
|
1548
|
+
*/
|
|
1549
|
+
declare function evaluateCelExpression(expr: string, context: Record<string, unknown>, defaultValue?: boolean): boolean;
|
|
1550
|
+
/**
|
|
1551
|
+
* Evaluate a CEL expression directly using `evaluate` (no caching).
|
|
1552
|
+
* Useful for one-off evaluations or testing.
|
|
1553
|
+
*/
|
|
1554
|
+
declare function evaluateCelDirect(expr: string, context: Record<string, unknown>): unknown;
|
|
1555
|
+
/**
|
|
1556
|
+
* Validate that a CEL expression can be parsed without errors.
|
|
1557
|
+
* Returns true if valid, false otherwise.
|
|
1558
|
+
*/
|
|
1559
|
+
declare function isValidCelExpression(expr: string): boolean;
|
|
1560
|
+
/**
|
|
1561
|
+
* Extract all field ID references from a simple expression.
|
|
1562
|
+
* Used by `resolveRequiredFieldsGroup` to find dependency relationships.
|
|
1563
|
+
*
|
|
1564
|
+
* For simple expressions like `fieldA == 'x'`, returns `['fieldA']`.
|
|
1565
|
+
* For compound expressions like `fieldA == 'x' && fieldB == 'y'`, returns `['fieldA', 'fieldB']`.
|
|
1566
|
+
*
|
|
1567
|
+
* This uses regex extraction (not AST walking) for simplicity and speed.
|
|
1568
|
+
*/
|
|
1569
|
+
declare function extractFieldRefs(expr: string): string[];
|
|
1570
|
+
/**
|
|
1571
|
+
* Clear the expression cache. Useful for testing.
|
|
1572
|
+
*/
|
|
1573
|
+
declare function clearExpressionCache(): void;
|
|
1574
|
+
|
|
1575
|
+
/**
|
|
1576
|
+
* Generate LLM hints for select fields (used when creating datasources).
|
|
1577
|
+
*/
|
|
1578
|
+
declare function generateLLMHint(schema: DatasourceConfigSchema): string;
|
|
1579
|
+
/**
|
|
1580
|
+
* Generate comprehensive structured field data for troubleshooting context.
|
|
1581
|
+
* Returns an array of field descriptors the LLM can use to render rich tables.
|
|
1582
|
+
*/
|
|
1583
|
+
declare function generateTroubleshootingFields(schema: DatasourceConfigSchema): Array<{
|
|
1584
|
+
label: string;
|
|
1585
|
+
key: string;
|
|
1586
|
+
target: string;
|
|
1587
|
+
type: string;
|
|
1588
|
+
required: boolean;
|
|
1589
|
+
description?: string;
|
|
1590
|
+
defaultValue?: unknown;
|
|
1591
|
+
options?: string[];
|
|
1592
|
+
section?: string;
|
|
1593
|
+
dependsOn?: string;
|
|
1594
|
+
}>;
|
|
1595
|
+
|
|
1596
|
+
type YamlRenderOptions = {
|
|
1597
|
+
jsonDataKeys?: string[];
|
|
1598
|
+
secureKeys?: string[];
|
|
1599
|
+
};
|
|
1600
|
+
type ProvisioningYamlOptions = {
|
|
1601
|
+
/** Include comments with field descriptions. Default: true for template, false for export. */
|
|
1602
|
+
comments?: boolean;
|
|
1603
|
+
/** Name override (used in template mode). */
|
|
1604
|
+
name?: string;
|
|
1605
|
+
};
|
|
1606
|
+
/**
|
|
1607
|
+
* Generate a Grafana provisioning YAML from a dsconfig schema.
|
|
1608
|
+
* In template mode (no values), emits all fields with defaults and comments.
|
|
1609
|
+
* When values are provided, emits actual values — used for existing datasource export.
|
|
1610
|
+
*/
|
|
1611
|
+
declare function toProvisioningYaml(schema: DatasourceConfigSchema, values?: Record<string, unknown>, options?: ProvisioningYamlOptions): string;
|
|
1612
|
+
/**
|
|
1613
|
+
* Generate provisioning YAML from an existing Grafana datasource API response.
|
|
1614
|
+
* If a dsconfig schema is available, uses it for field ordering and comments.
|
|
1615
|
+
* If not, generates basic YAML from the raw API response.
|
|
1616
|
+
*/
|
|
1617
|
+
declare function datasourceToProvisioningYaml(ds: Record<string, unknown>, schema: DatasourceConfigSchema | null): string;
|
|
1618
|
+
declare const configToYaml: (ds: Record<string, unknown>, options?: YamlRenderOptions) => string;
|
|
1619
|
+
declare const formatYamlDiff: (existing: Record<string, unknown>, body: Record<string, unknown>) => string;
|
|
1620
|
+
|
|
1621
|
+
type UseDatasourceSchemaResult = {
|
|
1622
|
+
schema: DatasourceConfigSchema | null;
|
|
1623
|
+
loading: boolean;
|
|
1624
|
+
error: string | null;
|
|
1625
|
+
};
|
|
1626
|
+
declare function useDatasourceSchema(pluginType: string): UseDatasourceSchemaResult;
|
|
1627
|
+
declare function fetchConfigSchema(pluginType: string): Promise<DatasourceConfigSchema | null>;
|
|
1628
|
+
|
|
1629
|
+
declare const ROOT_CONFIG_FIELDS: readonly ["name", "type", "id", "uid", "access", "url", "basicAuth", "basicAuthUser", "user", "isDefault", "database", "withCredentials"];
|
|
1630
|
+
type DatasourceConfig = Record<any, any>;
|
|
1631
|
+
declare const buildCreateDatasourcePayload: (input: DatasourceConfig) => DatasourceConfig;
|
|
1632
|
+
declare const buildCloneDatasourcePayload: (source: DatasourceConfig, name: string) => DatasourceConfig;
|
|
1633
|
+
declare const buildUpdateDatasourcePayload: (existing: DatasourceConfig, input: DatasourceConfig) => {
|
|
1634
|
+
body: DatasourceConfig;
|
|
1635
|
+
hasChanges: boolean;
|
|
1636
|
+
};
|
|
1637
|
+
|
|
1638
|
+
declare function getConfigSchema(pluginType: string): Promise<DatasourceConfigSchema | null>;
|
|
1639
|
+
|
|
1640
|
+
/**
|
|
1641
|
+
* Pure helper functions for working with DatasourceConfigSchema.
|
|
1642
|
+
*
|
|
1643
|
+
* Types are defined in schema.ts — import them from there directly.
|
|
1644
|
+
*/
|
|
1645
|
+
|
|
1646
|
+
/** A group paired with its resolved ConfigField objects (in fieldRefs order). */
|
|
1647
|
+
type ResolvedGroup = {
|
|
1648
|
+
group: ConfigGroup;
|
|
1649
|
+
fields: ConfigField[];
|
|
1650
|
+
};
|
|
1651
|
+
/**
|
|
1652
|
+
* Group ids that denote the authentication section. Registry schemas use the
|
|
1653
|
+
* full form `authentication`; `auth` is accepted for backwards compatibility
|
|
1654
|
+
* with older/short-form schemas.
|
|
1655
|
+
*/
|
|
1656
|
+
declare const AUTH_GROUP_IDS: readonly string[];
|
|
1657
|
+
/** Whether a group id denotes the authentication group. */
|
|
1658
|
+
declare function isAuthGroupId(id: string): boolean;
|
|
1659
|
+
/**
|
|
1660
|
+
* Resolve a schema's groups into arrays of ConfigField objects.
|
|
1661
|
+
* If the schema has no groups, returns a single group containing all non-virtual fields.
|
|
1662
|
+
*/
|
|
1663
|
+
declare function resolveGroups(schema: DatasourceConfigSchema): ResolvedGroup[];
|
|
1664
|
+
/**
|
|
1665
|
+
* Build a virtual "Required" group containing all required fields, any parent
|
|
1666
|
+
* fields they depend on (via `dependsOn`), and any child fields that depend on
|
|
1667
|
+
* required fields. When the schema contains an authentication group (id
|
|
1668
|
+
* `authentication` or `auth`), its fields are also pulled in (auth is
|
|
1669
|
+
* effectively required for Prometheus/Loki/Tempo style datasources). Fields
|
|
1670
|
+
* are returned in schema order and de-duplicated.
|
|
1671
|
+
* Returns `null` when the virtual group would be empty.
|
|
1672
|
+
*/
|
|
1673
|
+
declare function resolveRequiredFieldsGroup(schema: DatasourceConfigSchema): ResolvedGroup | null;
|
|
1674
|
+
/**
|
|
1675
|
+
* Unique form key for a field. Section-scoped fields (e.g. section:"logs", key:"defaultTable")
|
|
1676
|
+
* get a prefixed key ("logs.defaultTable") so they don't collide with top-level fields that
|
|
1677
|
+
* share the same key name.
|
|
1678
|
+
*/
|
|
1679
|
+
declare function formKey(field: ConfigField): string;
|
|
1680
|
+
/**
|
|
1681
|
+
* Resolve a possibly-dotted key against watchedValues from react-hook-form.
|
|
1682
|
+
* RHF's `watch()` returns nested objects for dotted Controller names
|
|
1683
|
+
* (e.g. "logs.otelEnabled" → { logs: { otelEnabled: true } }),
|
|
1684
|
+
* so a flat `obj["logs.otelEnabled"]` lookup misses.
|
|
1685
|
+
*
|
|
1686
|
+
* For dotted keys we must try the nested path **first**: react-hook-form's
|
|
1687
|
+
* Controller `onChange` writes nested objects via its internal `set()`, but
|
|
1688
|
+
* `reset()` may have created a flat dotted key with the same name. After user
|
|
1689
|
+
* interaction the nested value is authoritative; the stale flat key must not
|
|
1690
|
+
* shadow it. This mirrors RHF's own `get()` semantics (nested-first, flat
|
|
1691
|
+
* fallback).
|
|
1692
|
+
*/
|
|
1693
|
+
declare function getWatchedValue(watchedValues: Record<string, unknown>, key: string): unknown;
|
|
1694
|
+
/**
|
|
1695
|
+
* Parse a simple CEL-like dependsOn expression: "fieldId == 'value'" or "fieldId != 'value'".
|
|
1696
|
+
* Only single comparisons are supported — no &&, ||, or parentheses.
|
|
1697
|
+
* Field IDs may contain dots and underscores (e.g. "jsonData.oauth2.oauth2_type").
|
|
1698
|
+
* Values may be single-quoted, double-quoted, or unquoted literals (true/false/numbers).
|
|
1699
|
+
* Returns { field, value, negate } or null if unparseable.
|
|
1700
|
+
*/
|
|
1701
|
+
declare function parseDependsOn(expr: string): {
|
|
1702
|
+
field: string;
|
|
1703
|
+
value: string;
|
|
1704
|
+
negate: boolean;
|
|
1705
|
+
} | null;
|
|
1706
|
+
/**
|
|
1707
|
+
* Evaluate a parsed dependsOn condition against a value.
|
|
1708
|
+
* Handles both == and != operators.
|
|
1709
|
+
*/
|
|
1710
|
+
declare function evaluateDependsOn(parsed: {
|
|
1711
|
+
value: string;
|
|
1712
|
+
negate: boolean;
|
|
1713
|
+
}, currentValue: unknown): boolean;
|
|
1714
|
+
/**
|
|
1715
|
+
* Resolve the first matching override for a field given current form values.
|
|
1716
|
+
* Override `when` uses the same "fieldId == 'value'" syntax as dependsOn.
|
|
1717
|
+
* Returns the matching override or undefined if none match.
|
|
1718
|
+
*/
|
|
1719
|
+
declare function resolveActiveOverride(field: ConfigField, watchedValues: Record<string, unknown>, fieldById: Map<string, ConfigField>): FieldOverride | undefined;
|
|
1720
|
+
/**
|
|
1721
|
+
* Evaluate a simple computed.read expression against form values.
|
|
1722
|
+
* Supports patterns used in dsconfig schemas:
|
|
1723
|
+
* - "fieldRef == true ? 'a' : (fieldRef == true ? 'b' : 'c')"
|
|
1724
|
+
* - Simple ternary chains with equality checks
|
|
1725
|
+
* Falls back to the field's defaultValue if the expression can't be evaluated.
|
|
1726
|
+
*/
|
|
1727
|
+
declare function evaluateComputedRead(expr: string, values: Record<string, unknown>, fields: ConfigField[]): unknown;
|
|
1728
|
+
/**
|
|
1729
|
+
* Compute initial values for all virtual fields that have storage.computed.read expressions.
|
|
1730
|
+
* Call after loading existing storage field values.
|
|
1731
|
+
*/
|
|
1732
|
+
declare function computeVirtualFieldValues(schema: DatasourceConfigSchema, existingValues: Record<string, unknown>): Record<string, unknown>;
|
|
1733
|
+
|
|
1017
1734
|
interface CustomHeader {
|
|
1018
1735
|
id: string;
|
|
1019
1736
|
name: string;
|
|
@@ -1295,4 +2012,4 @@ interface RequestLoopOptions<TQuery extends DataQuery$1 = DataQuery$1> {
|
|
|
1295
2012
|
*/
|
|
1296
2013
|
declare function getRequestLooper<T extends DataQuery$1 = DataQuery$1>(req: DataQueryRequest<T>, options: RequestLoopOptions<T>): Observable<DataQueryResponse>;
|
|
1297
2014
|
|
|
1298
|
-
export { AccessoryButton, AdvancedHttpSettings, type Aggregate, Auth, AuthMethod, type Props$c as AuthProps, BINARY_OPERATIONS_KEY, CatalogSelector, type ColumnDefinition, CompletionItemInsertTextRule, CompletionItemKind, CompletionItemPriority, ConfigDescriptionLink, ConfigSection, ConfigSubSection, ConnectionSettings, CustomHeadersSettings, type CustomMeta, type DB, DataLink, type DataLinkConfig, DataLinks, DataSourceDescription, DataSourcePicker, DatasetSelector, DatasourceWithAsyncBackend, DatePicker, type DatePickerProps, DatePickerWithInput, type DatePickerWithInputProps, DebounceInput, type DebounceInputProps, EditorField, EditorFieldGroup, EditorHeader, EditorList, EditorMode, EditorRow, EditorRows, EditorStack, EditorSwitch, FlexItem, GroupByRow, InlineSelect, InputGroup, LabelFilters, type LanguageCompletionProvider, type LanguageDefinition, LinkedToken, MacroType, type MetaDefinition, type NameValue, OperationExplainedBox, OperationList, OperationListExplained, OperationsEditorRow, OperatorType, type PositionContext, type Props$s as Props, QUERY_FORMAT_OPTIONS, QueryBuilderHints, type QueryBuilderLabelFilter, type QueryBuilderOperation, type QueryBuilderOperationDefinition, type QueryBuilderOperationParamDef, type QueryBuilderOperationParamEditorProps, type QueryBuilderOperationParamValue, QueryEditorMode, QueryEditorModeToggle, type QueryEditorProps, QueryEditorRow, QueryFormat, QueryHeaderSwitch, QueryModellerBase, QueryOptionGroup, type QueryRowFilter, type QueryStats, type QueryWithDefaults, type RAQBFieldTypes, RawQuery, type RequestLoopOptions, type ResourceSelectorProps, type ResponseParser, RunQueryButton, RunQueryButtons, type RunQueryButtonsProps, type RunningQueryInfo, type SQLConnectionLimits, SQLEditor, SQLEditorMode, SQLEditorTestUtils, type SQLExpression, type SQLFilters, type SQLMonarchLanguage, type SQLOptions, type SQLQuery, type SQLSelectableValue, type SchemaDefinition, SecureSocksProxyToggle, Segment, type SegmentProps, Space, SqlDatasource, SqlQueryEditor, type SqlQueryForInterpolation, type SqlQueryModel, type State$1 as State, type StatementPlacementProvider, StatementPosition, SuggestionKind, type SuggestionKindProvider, TLSSettings, type Props$f as TLSSettingsProps, type TableDefinition, type TableFieldSchema, type TableIdentifier, type TableSchema, TableSelector, type TestQueryModel, TokenType, type ValidationResults, type VisualQuery, type VisualQueryBinary, type VisualQueryModeller, convertLegacyAuthProps, formatDate, getRequestLooper, getStandardSQLCompletionProvider, language as grafanaStandardSQLLanguage, conf as grafanaStandardSQLLanguageConf, toOption };
|
|
2015
|
+
export { AUTH_GROUP_IDS, AccessoryButton, AdvancedHttpSettings, type Aggregate, type AllowedValuesValidationRule, Auth, AuthMethod, type Props$c as AuthProps, BINARY_OPERATIONS_KEY, type BaseFieldRef, type BaseValidationRule, CatalogSelector, type ColumnDefinition, CompletionItemInsertTextRule, CompletionItemKind, CompletionItemPriority, type ComputedMapping, ConfigDescriptionLink, type ConfigField, type ConfigGroup, ConfigSection, ConfigSubSection, ConnectionSettings, CustomHeadersSettings, type CustomMeta, type CustomValidationRule, type DB, DataLink, type DataLinkConfig, DataLinks, DataSourceDescription, DataSourcePicker, DatasetSelector, type DatasourceConfigSchema, DatasourceConfigWizard, type DatasourceConfigWizardProps, DatasourceErrorBoundary, type DatasourceHealth, DatasourceWithAsyncBackend, DatePicker, type DatePickerProps, DatePickerWithInput, type DatePickerWithInputProps, DebounceInput, type DebounceInputProps, type DirectMapping, EditorField, EditorFieldGroup, EditorHeader, EditorList, EditorMode, EditorRow, EditorRows, EditorStack, EditorSwitch, type Expression, type FieldEffect, type FieldItemSchema, type FieldKind, type FieldOption, type FieldOverride, type FieldPack, type FieldPackID, type FieldPatch, type FieldRelationship, type FieldUI, type FieldValidationRule, FlexItem, type FormState, GroupByRow, type HealthState, type IndexedPairMapping, InlineSelect, InputGroup, type Instruction, type ItemCountValidationRule, LabelFilters, type LanguageCompletionProvider, type LanguageDefinition, type LengthValidationRule, LinkedToken, MacroType, type MappingField, type MetaDefinition, type NameValue, OperationExplainedBox, OperationList, OperationListExplained, OperationsEditorRow, OperatorType, type PatternValidationRule, type PositionContext, type Props$s as Props, type ProvisioningYamlOptions, QUERY_FORMAT_OPTIONS, QueryBuilderHints, type QueryBuilderLabelFilter, type QueryBuilderOperation, type QueryBuilderOperationDefinition, type QueryBuilderOperationParamDef, type QueryBuilderOperationParamEditorProps, type QueryBuilderOperationParamValue, QueryEditorMode, QueryEditorModeToggle, type QueryEditorProps, QueryEditorRow, QueryFormat, QueryHeaderSwitch, QueryModellerBase, QueryOptionGroup, type QueryRowFilter, type QueryStats, type QueryWithDefaults, type RAQBFieldTypes, ROOT_CONFIG_FIELDS, type RangeValidationRule, RawQuery, type RelationshipType, type RequestLoopOptions, type ResolvedGroup, type ResourceSelectorProps, type ResponseParser, type Role, RunQueryButton, RunQueryButtons, type RunQueryButtonsProps, type RunningQueryInfo, type SQLConnectionLimits, SQLEditor, SQLEditorMode, SQLEditorTestUtils, type SQLExpression, type SQLFilters, type SQLMonarchLanguage, type SQLOptions, type SQLQuery, type SQLSelectableValue, type SchemaDefinition, type SecureFieldState, SecureSocksProxyToggle, Segment, type SegmentProps, Space, SqlDatasource, SqlQueryEditor, type SqlQueryForInterpolation, type SqlQueryModel, type State$1 as State, type StatementPlacementProvider, StatementPosition, type StorageMapping, SuggestionKind, type SuggestionKindProvider, TLSSettings, type Props$f as TLSSettingsProps, type TableDefinition, type TableFieldSchema, type TableIdentifier, type TableSchema, TableSelector, type TargetLocation, type TestQueryModel, TokenType, type UIComponent, type UIWidth, type ValidationResults, type ValueType, type VisualQuery, type VisualQueryBinary, type VisualQueryModeller, buildCelContext, buildCloneDatasourcePayload, buildCreateDatasourcePayload, buildUpdateDatasourcePayload, clearExpressionCache, computeVirtualFieldValues, configToYaml, convertLegacyAuthProps, datasourceToProvisioningYaml, evaluateCelDirect, evaluateCelExpression, evaluateComputedRead, evaluateDependsOn, extractFieldRefs, fetchConfigSchema, formKey, formatDate, formatYamlDiff, generateLLMHint, generateTroubleshootingFields, getConfigSchema, getRequestLooper, getStandardSQLCompletionProvider, getWatchedValue, language as grafanaStandardSQLLanguage, conf as grafanaStandardSQLLanguageConf, isAuthGroupId, isValidCelExpression, parseDependsOn, resolveActiveOverride, resolveGroups, resolvePluginName, resolveRequiredFieldsGroup, toOption, toProvisioningYaml, useDatasourceSchema, useHealthChecks };
|