@grafana/sql 13.2.0-28908703397 → 13.2.0

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 (44) hide show
  1. package/dist/cjs/dialects/sqlIdentifier.cjs +28 -0
  2. package/dist/cjs/dialects/sqlIdentifier.cjs.map +1 -0
  3. package/dist/cjs/index.cjs +3 -0
  4. package/dist/cjs/index.cjs.map +1 -1
  5. package/dist/esm/dialects/sqlIdentifier.mjs +23 -0
  6. package/dist/esm/dialects/sqlIdentifier.mjs.map +1 -0
  7. package/dist/esm/index.mjs +1 -0
  8. package/dist/esm/index.mjs.map +1 -1
  9. package/dist/types/SQLVariableEditor.d.ts +1 -1
  10. package/dist/types/SQLVariableSupport.d.ts +2 -1
  11. package/dist/types/components/ConfirmModal.d.ts +1 -1
  12. package/dist/types/components/DatasetSelector.d.ts +1 -1
  13. package/dist/types/components/QueryEditor.d.ts +1 -1
  14. package/dist/types/components/QueryEditorLazy.d.ts +1 -1
  15. package/dist/types/components/QueryHeader.d.ts +1 -1
  16. package/dist/types/components/TableSelector.d.ts +1 -1
  17. package/dist/types/components/configuration/ConnectionLimits.d.ts +1 -1
  18. package/dist/types/components/configuration/Divider.d.ts +1 -1
  19. package/dist/types/components/configuration/MaxLifetimeField.d.ts +1 -1
  20. package/dist/types/components/configuration/MaxOpenConnectionsField.d.ts +1 -1
  21. package/dist/types/components/configuration/NumberInput.d.ts +1 -1
  22. package/dist/types/components/configuration/TLSSecretsConfig.d.ts +1 -1
  23. package/dist/types/components/query-editor-raw/QueryEditorRaw.d.ts +1 -1
  24. package/dist/types/components/query-editor-raw/QueryToolbox.d.ts +1 -1
  25. package/dist/types/components/query-editor-raw/QueryValidator.d.ts +1 -1
  26. package/dist/types/components/query-editor-raw/RawEditor.d.ts +1 -1
  27. package/dist/types/components/visual-query-builder/GroupByRow.d.ts +1 -1
  28. package/dist/types/components/visual-query-builder/OrderByRow.d.ts +2 -1
  29. package/dist/types/components/visual-query-builder/Preview.d.ts +1 -1
  30. package/dist/types/components/visual-query-builder/SQLGroupByRow.d.ts +1 -1
  31. package/dist/types/components/visual-query-builder/SQLOrderByRow.d.ts +1 -1
  32. package/dist/types/components/visual-query-builder/SQLWhereRow.d.ts +1 -1
  33. package/dist/types/components/visual-query-builder/SelectColumn.d.ts +1 -1
  34. package/dist/types/components/visual-query-builder/SelectCustomFunctionParameters.d.ts +1 -1
  35. package/dist/types/components/visual-query-builder/SelectFunctionParameters.d.ts +1 -1
  36. package/dist/types/components/visual-query-builder/SelectRow.d.ts +1 -1
  37. package/dist/types/components/visual-query-builder/VisualEditor.d.ts +1 -1
  38. package/dist/types/components/visual-query-builder/WhereRow.d.ts +1 -1
  39. package/dist/types/constants.d.ts +1 -1
  40. package/dist/types/dialects/sqlIdentifier.d.ts +3 -0
  41. package/dist/types/index.d.ts +1 -0
  42. package/dist/types/types.d.ts +2 -2
  43. package/dist/types/utils/sql.utils.d.ts +1 -1
  44. package/package.json +12 -10
@@ -0,0 +1,28 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ "use strict";
6
+ const SQL_IDENTIFIER_DIALECTS = {
7
+ mysql: { quote: "`", unquotedPattern: /^[a-zA-Z_][a-zA-Z0-9_$]*$/ },
8
+ standard: { quote: '"', unquotedPattern: /^[a-zA-Z_][a-zA-Z0-9_]*$/ }
9
+ };
10
+ function quoteIdentifierIfNecessary(value, dialect) {
11
+ const { quote, unquotedPattern } = SQL_IDENTIFIER_DIALECTS[dialect];
12
+ if (unquotedPattern.test(value)) {
13
+ return value;
14
+ }
15
+ return `${quote}${value.replaceAll(quote, `${quote}${quote}`)}${quote}`;
16
+ }
17
+ function unquoteIdentifier(identifier, dialect) {
18
+ const trimmed = identifier.trim();
19
+ const { quote } = SQL_IDENTIFIER_DIALECTS[dialect];
20
+ if (trimmed.length >= 2 && trimmed.startsWith(quote) && trimmed.endsWith(quote)) {
21
+ return trimmed.slice(1, -1).replaceAll(`${quote}${quote}`, quote);
22
+ }
23
+ return trimmed;
24
+ }
25
+
26
+ exports.quoteIdentifierIfNecessary = quoteIdentifierIfNecessary;
27
+ exports.unquoteIdentifier = unquoteIdentifier;
28
+ //# sourceMappingURL=sqlIdentifier.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sqlIdentifier.cjs","sources":["../../../src/dialects/sqlIdentifier.ts"],"sourcesContent":["export type SqlIdentifierDialect = 'mysql' | 'standard';\n\ninterface SqlIdentifierDialectRules {\n quote: string;\n unquotedPattern: RegExp;\n}\n\nconst SQL_IDENTIFIER_DIALECTS = {\n mysql: { quote: '`', unquotedPattern: /^[a-zA-Z_][a-zA-Z0-9_$]*$/ },\n standard: { quote: '\"', unquotedPattern: /^[a-zA-Z_][a-zA-Z0-9_]*$/ },\n} satisfies Record<SqlIdentifierDialect, SqlIdentifierDialectRules>;\n\nexport function quoteIdentifierIfNecessary(value: string, dialect: SqlIdentifierDialect): string {\n const { quote, unquotedPattern } = SQL_IDENTIFIER_DIALECTS[dialect];\n\n if (unquotedPattern.test(value)) {\n return value;\n }\n\n return `${quote}${value.replaceAll(quote, `${quote}${quote}`)}${quote}`;\n}\n\nexport function unquoteIdentifier(identifier: string, dialect: SqlIdentifierDialect): string {\n const trimmed = identifier.trim();\n const { quote } = SQL_IDENTIFIER_DIALECTS[dialect];\n\n if (trimmed.length >= 2 && trimmed.startsWith(quote) && trimmed.endsWith(quote)) {\n return trimmed.slice(1, -1).replaceAll(`${quote}${quote}`, quote);\n }\n\n return trimmed;\n}\n"],"names":[],"mappings":";;;;;AAOA,MAAM,uBAAA,GAA0B;AAAA,EAC9B,KAAA,EAAO,EAAE,KAAA,EAAO,GAAA,EAAK,iBAAiB,2BAAA,EAA4B;AAAA,EAClE,QAAA,EAAU,EAAE,KAAA,EAAO,GAAA,EAAK,iBAAiB,0BAAA;AAC3C,CAAA;AAEO,SAAS,0BAAA,CAA2B,OAAe,OAAA,EAAuC;AAC/F,EAAA,MAAM,EAAE,KAAA,EAAO,eAAA,EAAgB,GAAI,wBAAwB,OAAO,CAAA;AAElE,EAAA,IAAI,eAAA,CAAgB,IAAA,CAAK,KAAK,CAAA,EAAG;AAC/B,IAAA,OAAO,KAAA;AAAA,EACT;AAEA,EAAA,OAAO,CAAA,EAAG,KAAK,CAAA,EAAG,KAAA,CAAM,UAAA,CAAW,KAAA,EAAO,CAAA,EAAG,KAAK,CAAA,EAAG,KAAK,CAAA,CAAE,CAAC,GAAG,KAAK,CAAA,CAAA;AACvE;AAEO,SAAS,iBAAA,CAAkB,YAAoB,OAAA,EAAuC;AAC3F,EAAA,MAAM,OAAA,GAAU,WAAW,IAAA,EAAK;AAChC,EAAA,MAAM,EAAE,KAAA,EAAM,GAAI,uBAAA,CAAwB,OAAO,CAAA;AAEjD,EAAA,IAAI,OAAA,CAAQ,MAAA,IAAU,CAAA,IAAK,OAAA,CAAQ,UAAA,CAAW,KAAK,CAAA,IAAK,OAAA,CAAQ,QAAA,CAAS,KAAK,CAAA,EAAG;AAC/E,IAAA,OAAO,OAAA,CAAQ,KAAA,CAAM,CAAA,EAAG,CAAA,CAAE,CAAA,CAAE,UAAA,CAAW,CAAA,EAAG,KAAK,CAAA,EAAG,KAAK,CAAA,CAAA,EAAI,KAAK,CAAA;AAAA,EAClE;AAEA,EAAA,OAAO,OAAA;AACT;;;;;"}
@@ -21,6 +21,7 @@ var defaults = require('./defaults.cjs');
21
21
  var testHelpers = require('./utils/testHelpers.cjs');
22
22
  var expressions = require('./expressions.cjs');
23
23
  var loadResources = require('./loadResources.cjs');
24
+ var sqlIdentifier = require('./dialects/sqlIdentifier.cjs');
24
25
 
25
26
  "use strict";
26
27
 
@@ -45,4 +46,6 @@ exports.applyQueryDefaults = defaults.applyQueryDefaults;
45
46
  exports.makeVariable = testHelpers.makeVariable;
46
47
  exports.QueryEditorExpressionType = expressions.QueryEditorExpressionType;
47
48
  exports.loadResources = loadResources.loadResources;
49
+ exports.quoteIdentifierIfNecessary = sqlIdentifier.quoteIdentifierIfNecessary;
50
+ exports.unquoteIdentifier = sqlIdentifier.unquoteIdentifier;
48
51
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ const SQL_IDENTIFIER_DIALECTS = {
3
+ mysql: { quote: "`", unquotedPattern: /^[a-zA-Z_][a-zA-Z0-9_$]*$/ },
4
+ standard: { quote: '"', unquotedPattern: /^[a-zA-Z_][a-zA-Z0-9_]*$/ }
5
+ };
6
+ function quoteIdentifierIfNecessary(value, dialect) {
7
+ const { quote, unquotedPattern } = SQL_IDENTIFIER_DIALECTS[dialect];
8
+ if (unquotedPattern.test(value)) {
9
+ return value;
10
+ }
11
+ return `${quote}${value.replaceAll(quote, `${quote}${quote}`)}${quote}`;
12
+ }
13
+ function unquoteIdentifier(identifier, dialect) {
14
+ const trimmed = identifier.trim();
15
+ const { quote } = SQL_IDENTIFIER_DIALECTS[dialect];
16
+ if (trimmed.length >= 2 && trimmed.startsWith(quote) && trimmed.endsWith(quote)) {
17
+ return trimmed.slice(1, -1).replaceAll(`${quote}${quote}`, quote);
18
+ }
19
+ return trimmed;
20
+ }
21
+
22
+ export { quoteIdentifierIfNecessary, unquoteIdentifier };
23
+ //# sourceMappingURL=sqlIdentifier.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sqlIdentifier.mjs","sources":["../../../src/dialects/sqlIdentifier.ts"],"sourcesContent":["export type SqlIdentifierDialect = 'mysql' | 'standard';\n\ninterface SqlIdentifierDialectRules {\n quote: string;\n unquotedPattern: RegExp;\n}\n\nconst SQL_IDENTIFIER_DIALECTS = {\n mysql: { quote: '`', unquotedPattern: /^[a-zA-Z_][a-zA-Z0-9_$]*$/ },\n standard: { quote: '\"', unquotedPattern: /^[a-zA-Z_][a-zA-Z0-9_]*$/ },\n} satisfies Record<SqlIdentifierDialect, SqlIdentifierDialectRules>;\n\nexport function quoteIdentifierIfNecessary(value: string, dialect: SqlIdentifierDialect): string {\n const { quote, unquotedPattern } = SQL_IDENTIFIER_DIALECTS[dialect];\n\n if (unquotedPattern.test(value)) {\n return value;\n }\n\n return `${quote}${value.replaceAll(quote, `${quote}${quote}`)}${quote}`;\n}\n\nexport function unquoteIdentifier(identifier: string, dialect: SqlIdentifierDialect): string {\n const trimmed = identifier.trim();\n const { quote } = SQL_IDENTIFIER_DIALECTS[dialect];\n\n if (trimmed.length >= 2 && trimmed.startsWith(quote) && trimmed.endsWith(quote)) {\n return trimmed.slice(1, -1).replaceAll(`${quote}${quote}`, quote);\n }\n\n return trimmed;\n}\n"],"names":[],"mappings":";AAOA,MAAM,uBAAA,GAA0B;AAAA,EAC9B,KAAA,EAAO,EAAE,KAAA,EAAO,GAAA,EAAK,iBAAiB,2BAAA,EAA4B;AAAA,EAClE,QAAA,EAAU,EAAE,KAAA,EAAO,GAAA,EAAK,iBAAiB,0BAAA;AAC3C,CAAA;AAEO,SAAS,0BAAA,CAA2B,OAAe,OAAA,EAAuC;AAC/F,EAAA,MAAM,EAAE,KAAA,EAAO,eAAA,EAAgB,GAAI,wBAAwB,OAAO,CAAA;AAElE,EAAA,IAAI,eAAA,CAAgB,IAAA,CAAK,KAAK,CAAA,EAAG;AAC/B,IAAA,OAAO,KAAA;AAAA,EACT;AAEA,EAAA,OAAO,CAAA,EAAG,KAAK,CAAA,EAAG,KAAA,CAAM,UAAA,CAAW,KAAA,EAAO,CAAA,EAAG,KAAK,CAAA,EAAG,KAAK,CAAA,CAAE,CAAC,GAAG,KAAK,CAAA,CAAA;AACvE;AAEO,SAAS,iBAAA,CAAkB,YAAoB,OAAA,EAAuC;AAC3F,EAAA,MAAM,OAAA,GAAU,WAAW,IAAA,EAAK;AAChC,EAAA,MAAM,EAAE,KAAA,EAAM,GAAI,uBAAA,CAAwB,OAAO,CAAA;AAEjD,EAAA,IAAI,OAAA,CAAQ,MAAA,IAAU,CAAA,IAAK,OAAA,CAAQ,UAAA,CAAW,KAAK,CAAA,IAAK,OAAA,CAAQ,QAAA,CAAS,KAAK,CAAA,EAAG;AAC/E,IAAA,OAAO,OAAA,CAAQ,KAAA,CAAM,CAAA,EAAG,CAAA,CAAE,CAAA,CAAE,UAAA,CAAW,CAAA,EAAG,KAAK,CAAA,EAAG,KAAK,CAAA,CAAA,EAAI,KAAK,CAAA;AAAA,EAClE;AAEA,EAAA,OAAO,OAAA;AACT;;;;"}
@@ -17,6 +17,7 @@ export { applyQueryDefaults } from './defaults.mjs';
17
17
  export { makeVariable } from './utils/testHelpers.mjs';
18
18
  export { QueryEditorExpressionType } from './expressions.mjs';
19
19
  export { loadResources } from './loadResources.mjs';
20
+ export { quoteIdentifierIfNecessary, unquoteIdentifier } from './dialects/sqlIdentifier.mjs';
20
21
 
21
22
  "use strict";
22
23
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;"}
@@ -1,5 +1,5 @@
1
1
  import { type SqlQueryEditorProps } from './components/QueryEditor';
2
2
  import { type SQLDialect } from './types';
3
3
  type SQLVariableQueryEditorProps = SqlQueryEditorProps;
4
- export declare const SQLVariablesQueryEditor: <T extends SQLDialect>(props: SQLVariableQueryEditorProps) => import("react/jsx-runtime").JSX.Element;
4
+ export declare const SQLVariablesQueryEditor: <T extends SQLDialect>(props: SQLVariableQueryEditorProps) => import("react").JSX.Element;
5
5
  export {};
@@ -1,11 +1,12 @@
1
1
  import { type Observable } from 'rxjs';
2
2
  import { CustomVariableSupport, type DataQueryRequest, type DataQueryResponse } from '@grafana/data';
3
+ import { SQLVariablesQueryEditor } from './SQLVariableEditor';
3
4
  import { type SqlDatasource } from './datasource/SqlDatasource';
4
5
  import { type SQLQuery } from './types';
5
6
  export declare class SQLVariableSupport extends CustomVariableSupport<SqlDatasource, SQLQuery> {
6
7
  readonly datasource: SqlDatasource;
7
8
  constructor(datasource: SqlDatasource);
8
- editor: <T extends import("./types").SQLDialect>(props: import("./components/QueryEditor").SqlQueryEditorProps) => import("react/jsx-runtime").JSX.Element;
9
+ editor: typeof SQLVariablesQueryEditor;
9
10
  query(request: DataQueryRequest<SQLQuery>): Observable<DataQueryResponse>;
10
11
  getDefaultQuery(): Partial<SQLQuery>;
11
12
  }
@@ -4,5 +4,5 @@ type ConfirmModalProps = {
4
4
  onDiscard?: () => void;
5
5
  onCopy?: () => void;
6
6
  };
7
- export declare function ConfirmModal({ isOpen, onCancel, onDiscard, onCopy }: ConfirmModalProps): import("react/jsx-runtime").JSX.Element;
7
+ export declare function ConfirmModal({ isOpen, onCancel, onDiscard, onCopy }: ConfirmModalProps): import("react").JSX.Element;
8
8
  export {};
@@ -8,4 +8,4 @@ export interface DatasetSelectorProps extends ResourceSelectorProps {
8
8
  onChange: (v: SelectableValue) => void;
9
9
  inputId?: string | undefined;
10
10
  }
11
- export declare const DatasetSelector: ({ dataset, db, dialect, onChange, inputId, preconfiguredDataset, }: DatasetSelectorProps) => import("react/jsx-runtime").JSX.Element;
11
+ export declare const DatasetSelector: ({ dataset, db, dialect, onChange, inputId, preconfiguredDataset, }: DatasetSelectorProps) => import("react").JSX.Element;
@@ -5,4 +5,4 @@ import { type QueryHeaderProps } from './QueryHeader';
5
5
  export interface SqlQueryEditorProps extends QueryEditorProps<SqlDatasource, SQLQuery, SQLOptions> {
6
6
  queryHeaderProps?: Pick<QueryHeaderProps, 'dialect' | 'hideRunButton' | 'hideFormatSelector'>;
7
7
  }
8
- export default function SqlQueryEditor({ datasource, query, onChange, onRunQuery, range, app, queryHeaderProps, }: SqlQueryEditorProps): import("react/jsx-runtime").JSX.Element | null;
8
+ export default function SqlQueryEditor({ datasource, query, onChange, onRunQuery, range, app, queryHeaderProps, }: SqlQueryEditorProps): import("react").JSX.Element | null;
@@ -1,2 +1,2 @@
1
1
  import type { SqlQueryEditorProps } from './QueryEditor';
2
- export declare function SqlQueryEditorLazy(props: SqlQueryEditorProps): import("react/jsx-runtime").JSX.Element;
2
+ export declare function SqlQueryEditorLazy(props: SqlQueryEditorProps): import("react").JSX.Element;
@@ -16,4 +16,4 @@ export interface QueryHeaderProps {
16
16
  dataSourceInstanceSettings?: DataSourceInstanceSettings;
17
17
  app?: CoreApp;
18
18
  }
19
- export declare function QueryHeader({ db, dialect, isQueryRunnable, onChange, onQueryRowChange, onRunQuery, preconfiguredDataset, query, queryRowFilter, hideFormatSelector, hideRunButton, dataSourceInstanceSettings, app, }: QueryHeaderProps): import("react/jsx-runtime").JSX.Element;
19
+ export declare function QueryHeader({ db, dialect, isQueryRunnable, onChange, onQueryRowChange, onRunQuery, preconfiguredDataset, query, queryRowFilter, hideFormatSelector, hideRunButton, dataSourceInstanceSettings, app, }: QueryHeaderProps): import("react").JSX.Element;
@@ -7,4 +7,4 @@ export interface TableSelectorProps extends ResourceSelectorProps {
7
7
  onChange: (v: SelectableValue) => void;
8
8
  inputId?: string | undefined;
9
9
  }
10
- export declare const TableSelector: ({ db, dataset, table, className, onChange, inputId }: TableSelectorProps) => import("react/jsx-runtime").JSX.Element;
10
+ export declare const TableSelector: ({ db, dataset, table, className, onChange, inputId }: TableSelectorProps) => import("react").JSX.Element;
@@ -4,5 +4,5 @@ interface Props<T> {
4
4
  onOptionsChange: Function;
5
5
  options: DataSourceSettings<SQLOptions>;
6
6
  }
7
- export declare const ConnectionLimits: <T extends SQLConnectionLimits>(props: Props<T>) => import("react/jsx-runtime").JSX.Element;
7
+ export declare const ConnectionLimits: <T extends SQLConnectionLimits>(props: Props<T>) => import("react").JSX.Element;
8
8
  export {};
@@ -1 +1 @@
1
- export declare const Divider: () => import("react/jsx-runtime").JSX.Element;
1
+ export declare const Divider: () => import("react").JSX.Element;
@@ -4,5 +4,5 @@ interface Props {
4
4
  onMaxLifetimeChanged: (number?: number) => void;
5
5
  jsonData: SQLOptions;
6
6
  }
7
- export declare function MaxLifetimeField({ labelWidth, onMaxLifetimeChanged, jsonData }: Props): import("react/jsx-runtime").JSX.Element;
7
+ export declare function MaxLifetimeField({ labelWidth, onMaxLifetimeChanged, jsonData }: Props): import("react").JSX.Element;
8
8
  export {};
@@ -4,5 +4,5 @@ interface Props {
4
4
  onMaxConnectionsChanged: (number?: number) => void;
5
5
  jsonData: SQLOptions;
6
6
  }
7
- export declare function MaxOpenConnectionsField({ labelWidth, onMaxConnectionsChanged, jsonData }: Props): import("react/jsx-runtime").JSX.Element;
7
+ export declare function MaxOpenConnectionsField({ labelWidth, onMaxConnectionsChanged, jsonData }: Props): import("react").JSX.Element;
8
8
  export {};
@@ -4,5 +4,5 @@ type NumberInputProps = {
4
4
  onChange: (value: number) => void;
5
5
  width: number;
6
6
  };
7
- export declare function NumberInput({ value, defaultValue, onChange, width }: NumberInputProps): import("react/jsx-runtime").JSX.Element;
7
+ export declare function NumberInput({ value, defaultValue, onChange, width }: NumberInputProps): import("react").JSX.Element;
8
8
  export {};
@@ -6,5 +6,5 @@ interface Props<T extends DataSourceJsonData, S> {
6
6
  secureJsonFields?: KeyValue<Boolean>;
7
7
  labelWidth?: number;
8
8
  }
9
- export declare const TLSSecretsConfig: <T extends DataSourceJsonData, S extends {} = {}>(props: Props<T, S>) => import("react/jsx-runtime").JSX.Element;
9
+ export declare const TLSSecretsConfig: <T extends DataSourceJsonData, S extends {} = {}>(props: Props<T, S>) => import("react").JSX.Element;
10
10
  export {};
@@ -11,5 +11,5 @@ type Props = {
11
11
  height?: number;
12
12
  editorLanguageDefinition: LanguageDefinition;
13
13
  };
14
- export declare function QueryEditorRaw({ children, onChange, query, width, height, editorLanguageDefinition }: Props): import("react/jsx-runtime").JSX.Element;
14
+ export declare function QueryEditorRaw({ children, onChange, query, width, height, editorLanguageDefinition }: Props): React.JSX.Element;
15
15
  export {};
@@ -6,5 +6,5 @@ interface QueryToolboxProps extends Omit<QueryValidatorProps, 'onValidate'> {
6
6
  onExpand?: (expand: boolean) => void;
7
7
  onValidate?: (isValid: boolean) => void;
8
8
  }
9
- export declare function QueryToolbox({ showTools, onFormatCode, onExpand, isExpanded, ...validatorProps }: QueryToolboxProps): import("react/jsx-runtime").JSX.Element;
9
+ export declare function QueryToolbox({ showTools, onFormatCode, onExpand, isExpanded, ...validatorProps }: QueryToolboxProps): import("react").JSX.Element;
10
10
  export {};
@@ -6,4 +6,4 @@ export interface QueryValidatorProps {
6
6
  range?: TimeRange;
7
7
  onValidate: (isValid: boolean) => void;
8
8
  }
9
- export declare function QueryValidator({ db, query, onValidate, range }: QueryValidatorProps): import("react/jsx-runtime").JSX.Element | null;
9
+ export declare function QueryValidator({ db, query, onValidate, range }: QueryValidatorProps): import("react").JSX.Element | null;
@@ -5,5 +5,5 @@ interface RawEditorProps extends Omit<QueryEditorProps, 'onChange'> {
5
5
  onValidate: (isValid: boolean) => void;
6
6
  queryToValidate: SQLQuery;
7
7
  }
8
- export declare function RawEditor({ db, query, onChange, onRunQuery, onValidate, queryToValidate, range }: RawEditorProps): import("react/jsx-runtime").JSX.Element;
8
+ export declare function RawEditor({ db, query, onChange, onRunQuery, onValidate, queryToValidate, range }: RawEditorProps): import("react").JSX.Element;
9
9
  export {};
@@ -5,5 +5,5 @@ interface GroupByRowProps {
5
5
  onSqlChange: (sql: SQLExpression) => void;
6
6
  columns?: Array<SelectableValue<string>>;
7
7
  }
8
- export declare function GroupByRow({ sql, columns, onSqlChange }: GroupByRowProps): import("react/jsx-runtime").JSX.Element;
8
+ export declare function GroupByRow({ sql, columns, onSqlChange }: GroupByRowProps): import("react").JSX.Element;
9
9
  export {};
@@ -1,3 +1,4 @@
1
+ import * as React from 'react';
1
2
  import { type SelectableValue } from '@grafana/data';
2
3
  import { type SQLExpression } from '../../types';
3
4
  type OrderByRowProps = {
@@ -6,5 +7,5 @@ type OrderByRowProps = {
6
7
  columns?: Array<SelectableValue<string>>;
7
8
  showOffset?: boolean;
8
9
  };
9
- export declare function OrderByRow({ sql, onSqlChange, columns, showOffset }: OrderByRowProps): import("react/jsx-runtime").JSX.Element;
10
+ export declare function OrderByRow({ sql, onSqlChange, columns, showOffset }: OrderByRowProps): React.JSX.Element;
10
11
  export {};
@@ -2,5 +2,5 @@ type PreviewProps = {
2
2
  rawSql: string;
3
3
  datasourceType?: string;
4
4
  };
5
- export declare function Preview({ rawSql, datasourceType }: PreviewProps): import("react/jsx-runtime").JSX.Element;
5
+ export declare function Preview({ rawSql, datasourceType }: PreviewProps): import("react").JSX.Element;
6
6
  export {};
@@ -7,5 +7,5 @@ interface SQLGroupByRowProps {
7
7
  onQueryChange: (query: SQLQuery) => void;
8
8
  db: DB;
9
9
  }
10
- export declare function SQLGroupByRow({ fields, query, onQueryChange, db }: SQLGroupByRowProps): import("react/jsx-runtime").JSX.Element;
10
+ export declare function SQLGroupByRow({ fields, query, onQueryChange, db }: SQLGroupByRowProps): import("react").JSX.Element;
11
11
  export {};
@@ -7,5 +7,5 @@ type SQLOrderByRowProps = {
7
7
  onQueryChange: (query: SQLQuery) => void;
8
8
  db: DB;
9
9
  };
10
- export declare function SQLOrderByRow({ fields, query, onQueryChange, db }: SQLOrderByRowProps): import("react/jsx-runtime").JSX.Element;
10
+ export declare function SQLOrderByRow({ fields, query, onQueryChange, db }: SQLOrderByRowProps): import("react").JSX.Element;
11
11
  export {};
@@ -7,6 +7,6 @@ interface WhereRowProps {
7
7
  onQueryChange: (query: SQLQuery) => void;
8
8
  db: DB;
9
9
  }
10
- export declare function SQLWhereRow({ query, fields, onQueryChange, db }: WhereRowProps): import("react/jsx-runtime").JSX.Element;
10
+ export declare function SQLWhereRow({ query, fields, onQueryChange, db }: WhereRowProps): import("react").JSX.Element;
11
11
  export declare function removeQuotesForMultiVariables(val: SQLExpression, templateVars: TypedVariableModel[]): void;
12
12
  export {};
@@ -4,5 +4,5 @@ interface Props {
4
4
  onParameterChange: (value?: string) => void;
5
5
  value: SelectableValue<string> | null;
6
6
  }
7
- export declare function SelectColumn({ columns, onParameterChange, value }: Props): import("react/jsx-runtime").JSX.Element;
7
+ export declare function SelectColumn({ columns, onParameterChange, value }: Props): import("react").JSX.Element;
8
8
  export {};
@@ -7,5 +7,5 @@ interface Props {
7
7
  onParameterChange: (index: number) => (value?: string) => void;
8
8
  currentColumnIndex: number;
9
9
  }
10
- export declare function SelectCustomFunctionParameters({ columns, query, onSqlChange, onParameterChange, currentColumnIndex, }: Props): import("react/jsx-runtime").JSX.Element;
10
+ export declare function SelectCustomFunctionParameters({ columns, query, onSqlChange, onParameterChange, currentColumnIndex, }: Props): import("react").JSX.Element;
11
11
  export {};
@@ -7,5 +7,5 @@ interface Props {
7
7
  db: DB;
8
8
  columns: Array<SelectableValue<string>>;
9
9
  }
10
- export declare function SelectFunctionParameters({ query, onSqlChange, currentColumnIndex, db, columns }: Props): import("react/jsx-runtime").JSX.Element;
10
+ export declare function SelectFunctionParameters({ query, onSqlChange, currentColumnIndex, db, columns }: Props): import("react").JSX.Element;
11
11
  export {};
@@ -6,5 +6,5 @@ interface SelectRowProps {
6
6
  db: DB;
7
7
  columns: Array<SelectableValue<string>>;
8
8
  }
9
- export declare function SelectRow({ query, onQueryChange, db, columns }: SelectRowProps): import("react/jsx-runtime").JSX.Element;
9
+ export declare function SelectRow({ query, onQueryChange, db, columns }: SelectRowProps): import("react").JSX.Element;
10
10
  export {};
@@ -4,5 +4,5 @@ interface VisualEditorProps extends QueryEditorProps {
4
4
  queryRowFilter: QueryRowFilter;
5
5
  onValidate: (isValid: boolean) => void;
6
6
  }
7
- export declare const VisualEditor: ({ query, db, queryRowFilter, onChange, onValidate, range }: VisualEditorProps) => import("react/jsx-runtime").JSX.Element;
7
+ export declare const VisualEditor: ({ query, db, queryRowFilter, onChange, onValidate, range }: VisualEditorProps) => import("react").JSX.Element;
8
8
  export {};
@@ -5,5 +5,5 @@ interface SQLBuilderWhereRowProps {
5
5
  onSqlChange: (sql: SQLExpression) => void;
6
6
  config?: Partial<Config>;
7
7
  }
8
- export declare function WhereRow({ sql, config, onSqlChange }: SQLBuilderWhereRowProps): import("react/jsx-runtime").JSX.Element | null;
8
+ export declare function WhereRow({ sql, config, onSqlChange }: SQLBuilderWhereRowProps): import("react").JSX.Element | null;
9
9
  export {};
@@ -5,8 +5,8 @@ export declare const MACRO_FUNCTIONS: (columnParam: FuncParameter) => ({
5
5
  description: string;
6
6
  parameters: FuncParameter[];
7
7
  } | {
8
+ description?: undefined;
8
9
  name: string;
9
10
  parameters: FuncParameter[];
10
- description?: undefined;
11
11
  })[];
12
12
  export declare const MACRO_NAMES: string[];
@@ -0,0 +1,3 @@
1
+ export type SqlIdentifierDialect = 'mysql' | 'standard';
2
+ export declare function quoteIdentifierIfNecessary(value: string, dialect: SqlIdentifierDialect): string;
3
+ export declare function unquoteIdentifier(identifier: string, dialect: SqlIdentifierDialect): string;
@@ -19,3 +19,4 @@ export { applyQueryDefaults } from './defaults';
19
19
  export { makeVariable } from './utils/testHelpers';
20
20
  export { QueryEditorExpressionType } from './expressions';
21
21
  export { loadResources } from './loadResources';
22
+ export { quoteIdentifierIfNecessary, unquoteIdentifier, type SqlIdentifierDialect } from './dialects/sqlIdentifier';
@@ -1,5 +1,5 @@
1
1
  import type { JsonTree } from '@react-awesome-query-builder/ui';
2
- import { type DataFrame, type DataQuery, type DataSourceJsonData, type MetricFindValue, type SelectableValue, type TimeRange } from '@grafana/data';
2
+ import { type DataFrame, type DataQuery, type DataSourceJsonData, type MetricFindValue, type SelectableValue, type TimeRange, toOption as toOptionFromData } from '@grafana/data';
3
3
  import { type EditorMode, type LanguageDefinition } from '@grafana/plugin-ui';
4
4
  import { type QueryWithDefaults } from './defaults';
5
5
  import { type QueryEditorFunctionExpression, type QueryEditorGroupByExpression, type QueryEditorPropertyExpression } from './expressions';
@@ -67,7 +67,7 @@ export declare const QUERY_FORMAT_OPTIONS: {
67
67
  label: string;
68
68
  value: QueryFormat;
69
69
  }[];
70
- export declare const toOption: (value: string) => SelectableValue<string>;
70
+ export declare const toOption: typeof toOptionFromData;
71
71
  export interface ResourceSelectorProps {
72
72
  disabled?: boolean;
73
73
  className?: string;
@@ -2,7 +2,7 @@ import { type SelectableValue } from '@grafana/data';
2
2
  import { type QueryEditorFunctionExpression, type QueryEditorFunctionParameterExpression, type QueryEditorGroupByExpression, type QueryEditorPropertyExpression } from '../expressions';
3
3
  import { type SQLExpression } from '../types';
4
4
  export declare function createSelectClause(sqlColumns: NonNullable<SQLExpression['columns']>): string;
5
- export declare const haveColumns: (columns: SQLExpression["columns"]) => columns is NonNullable<SQLExpression["columns"]>;
5
+ export declare const haveColumns: (columns: SQLExpression['columns']) => columns is NonNullable<SQLExpression['columns']>;
6
6
  /**
7
7
  * Creates a GroupByExpression for a specified field
8
8
  */
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "author": "Grafana Labs",
3
3
  "license": "AGPL-3.0-only",
4
4
  "name": "@grafana/sql",
5
- "version": "13.2.0-28908703397",
5
+ "version": "13.2.0",
6
6
  "description": "Shared UI components and utilities used by SQL-based datasource plugins",
7
7
  "sideEffects": false,
8
8
  "repository": {
@@ -44,9 +44,9 @@
44
44
  "@emotion/css": "^11.13.5",
45
45
  "@grafana/assistant": "^0.1.24",
46
46
  "@grafana/data": ">=10.4.0",
47
- "@grafana/e2e-selectors": "13.2.0-28908703397",
48
- "@grafana/i18n": "13.2.0-28908703397",
49
- "@grafana/plugin-ui": "^0.13.1",
47
+ "@grafana/e2e-selectors": "13.2.0",
48
+ "@grafana/i18n": "13.2.0",
49
+ "@grafana/plugin-ui": "^0.17.3",
50
50
  "@grafana/ui": ">=10.4.0",
51
51
  "@react-awesome-query-builder/ui": "^6.6.15",
52
52
  "lodash": "^4.18.1",
@@ -66,19 +66,21 @@
66
66
  "@types/jest": "^29.5.4",
67
67
  "@types/lodash": "4.17.20",
68
68
  "@types/node": "24.10.1",
69
- "@types/react": "18.3.18",
70
- "@types/react-dom": "18.3.5",
69
+ "@types/react": "19.2.18",
70
+ "@types/react-dom": "19.2.4",
71
71
  "@types/systemjs": "6.15.3",
72
+ "@typescript/native": "npm:typescript@^7.0.2",
72
73
  "i18next-cli": "^1.48.0",
73
74
  "jest": "^29.6.4",
74
75
  "rollup": "^4.60.1",
75
- "typescript": "6.0.2"
76
+ "typescript": "npm:@typescript/typescript6@^6.0.2"
76
77
  },
77
78
  "peerDependencies": {
78
79
  "@grafana/data": ">=10.4.0",
79
80
  "@grafana/runtime": ">=10.4.0",
80
81
  "@grafana/ui": ">=10.4.0",
81
- "react": "^18.0.0",
82
- "react-dom": "^18.0.0"
83
- }
82
+ "react": ">=19",
83
+ "react-dom": ">=19"
84
+ },
85
+ "gitHead": "f681b1359f6a0b8ecb9f2c49a88ac72b75bde73b"
84
86
  }