From dbc9e31dbccd5a743c85b3a52692fd950c0aa292 Mon Sep 17 00:00:00 2001 From: Stratoula Kalafateli Date: Tue, 12 Nov 2024 09:04:01 +0100 Subject: [PATCH] [ES|QL] Marks tech preview functions in the editor (#199631) ## Summary Closes https://github.com/elastic/kibana/issues/194062 Indicates tech preview functions in the editor. ![image (62)](https://github.com/user-attachments/assets/a6d2b1e8-f7c7-4bee-8a9f-3c9d5026c79e) --- .../scripts/generate_function_definitions.ts | 5 + .../src/autocomplete/factories.ts | 13 ++- .../generated/aggregation_functions.ts | 13 +++ .../definitions/generated/scalar_functions.ts | 104 +++++++++++++++++- .../src/definitions/types.ts | 1 + 5 files changed, 134 insertions(+), 2 deletions(-) diff --git a/packages/kbn-esql-validation-autocomplete/scripts/generate_function_definitions.ts b/packages/kbn-esql-validation-autocomplete/scripts/generate_function_definitions.ts index fe2a85456aa12..4f649b44e44b8 100644 --- a/packages/kbn-esql-validation-autocomplete/scripts/generate_function_definitions.ts +++ b/packages/kbn-esql-validation-autocomplete/scripts/generate_function_definitions.ts @@ -255,6 +255,7 @@ function getFunctionDefinition(ESFunctionDefinition: Record): Funct description: ESFunctionDefinition.description, alias: aliasTable[ESFunctionDefinition.name], ignoreAsSuggestion: ESFunctionDefinition.snapshot_only, + preview: ESFunctionDefinition.preview, signatures: _.uniqBy( ESFunctionDefinition.signatures.map((signature: any) => ({ ...signature, @@ -334,6 +335,7 @@ function printGeneratedFunctionsFile( description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.${name}', { defaultMessage: ${JSON.stringify( removeAsciiDocInternalCrossReferences(removeInlineAsciiDocLinks(description), functionNames) )} }),${functionDefinition.ignoreAsSuggestion ? 'ignoreAsSuggestion: true,\n' : ''} + preview: ${functionDefinition.preview || 'false'}, alias: ${alias ? `['${alias.join("', '")}']` : 'undefined'}, signatures: ${JSON.stringify(signatures, null, 2)}, supportedCommands: ${JSON.stringify(functionDefinition.supportedCommands)}, @@ -393,6 +395,9 @@ import { isLiteralItem } from '../../shared/helpers';` (async function main() { const pathToElasticsearch = process.argv[2]; + if (!pathToElasticsearch) { + throw new Error('Path to Elasticsearch is required'); + } const ESFunctionDefinitionsDirectory = join( pathToElasticsearch, diff --git a/packages/kbn-esql-validation-autocomplete/src/autocomplete/factories.ts b/packages/kbn-esql-validation-autocomplete/src/autocomplete/factories.ts index 88560f6d2f4c5..d9813bb0e91a1 100644 --- a/packages/kbn-esql-validation-autocomplete/src/autocomplete/factories.ts +++ b/packages/kbn-esql-validation-autocomplete/src/autocomplete/factories.ts @@ -30,6 +30,13 @@ import { isNumericType } from '../shared/esql_types'; import { getTestFunctions } from '../shared/test_functions'; import { builtinFunctions } from '../definitions/builtin'; +const techPreviewLabel = i18n.translate( + 'kbn-esql-validation-autocomplete.esql.autocomplete.techPreviewLabel', + { + defaultMessage: `Technical Preview`, + } +); + const allFunctions = memoize( () => aggregationFunctionDefinitions @@ -60,13 +67,17 @@ function getSafeInsertSourceText(text: string) { } export function getFunctionSuggestion(fn: FunctionDefinition): SuggestionRawDefinition { + let detail = fn.description; + if (fn.preview) { + detail = `[${techPreviewLabel}] ${detail}`; + } const fullSignatures = getFunctionSignatures(fn, { capitalize: true, withTypes: true }); return { label: fn.name.toUpperCase(), text: `${fn.name.toUpperCase()}($0)`, asSnippet: true, kind: 'Function', - detail: fn.description, + detail, documentation: { value: buildFunctionDocumentation(fullSignatures, fn.examples), }, diff --git a/packages/kbn-esql-validation-autocomplete/src/definitions/generated/aggregation_functions.ts b/packages/kbn-esql-validation-autocomplete/src/definitions/generated/aggregation_functions.ts index f73521ddf3a87..6a429f2288f94 100644 --- a/packages/kbn-esql-validation-autocomplete/src/definitions/generated/aggregation_functions.ts +++ b/packages/kbn-esql-validation-autocomplete/src/definitions/generated/aggregation_functions.ts @@ -36,6 +36,7 @@ const avgDefinition: FunctionDefinition = { description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.avg', { defaultMessage: 'The average of a numeric field.', }), + preview: false, alias: undefined, signatures: [ { @@ -85,6 +86,7 @@ const countDefinition: FunctionDefinition = { description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.count', { defaultMessage: 'Returns the total number (count) of input values.', }), + preview: false, alias: undefined, signatures: [ { @@ -228,6 +230,7 @@ const countDistinctDefinition: FunctionDefinition = { description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.count_distinct', { defaultMessage: 'Returns the approximate number of distinct values.', }), + preview: false, alias: undefined, signatures: [ { @@ -743,6 +746,7 @@ const maxDefinition: FunctionDefinition = { description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.max', { defaultMessage: 'The maximum value of a field.', }), + preview: false, alias: undefined, signatures: [ { @@ -853,6 +857,7 @@ const medianDefinition: FunctionDefinition = { defaultMessage: 'The value that is greater than half of all values and less than half of all values, also known as the 50% `PERCENTILE`.', }), + preview: false, alias: undefined, signatures: [ { @@ -906,6 +911,7 @@ const medianAbsoluteDeviationDefinition: FunctionDefinition = { "Returns the median absolute deviation, a measure of variability. It is a robust statistic, meaning that it is useful for describing data that may have outliers, or may not be normally distributed. For such data it can be more descriptive than standard deviation.\n\nIt is calculated as the median of each data point's deviation from the median of the entire sample. That is, for a random variable `X`, the median absolute deviation is `median(|median(X) - X|)`.", } ), + preview: false, alias: undefined, signatures: [ { @@ -955,6 +961,7 @@ const minDefinition: FunctionDefinition = { description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.min', { defaultMessage: 'The minimum value of a field.', }), + preview: false, alias: undefined, signatures: [ { @@ -1065,6 +1072,7 @@ const percentileDefinition: FunctionDefinition = { defaultMessage: 'Returns the value at which a certain percentage of observed values occur. For example, the 95th percentile is the value which is greater than 95% of the observed values and the 50th percentile is the `MEDIAN`.', }), + preview: false, alias: undefined, signatures: [ { @@ -1228,6 +1236,7 @@ const stCentroidAggDefinition: FunctionDefinition = { description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.st_centroid_agg', { defaultMessage: 'Calculate the spatial centroid over a field with spatial point geometry type.', }), + preview: false, alias: undefined, signatures: [ { @@ -1264,6 +1273,7 @@ const sumDefinition: FunctionDefinition = { description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.sum', { defaultMessage: 'The sum of a numeric expression.', }), + preview: false, alias: undefined, signatures: [ { @@ -1313,6 +1323,7 @@ const topDefinition: FunctionDefinition = { description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.top', { defaultMessage: 'Collects the top values for a field. Includes repeated values.', }), + preview: false, alias: undefined, signatures: [ { @@ -1510,6 +1521,7 @@ const valuesDefinition: FunctionDefinition = { defaultMessage: "Returns all values in a group as a multivalued field. The order of the returned values isn't guaranteed. If you need the values returned in order use esql-mv_sort.", }), + preview: true, alias: undefined, signatures: [ { @@ -1618,6 +1630,7 @@ const weightedAvgDefinition: FunctionDefinition = { description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.weighted_avg', { defaultMessage: 'The weighted average of a numeric expression.', }), + preview: false, alias: undefined, signatures: [ { diff --git a/packages/kbn-esql-validation-autocomplete/src/definitions/generated/scalar_functions.ts b/packages/kbn-esql-validation-autocomplete/src/definitions/generated/scalar_functions.ts index 739a12095ac23..7e9019aeb905a 100644 --- a/packages/kbn-esql-validation-autocomplete/src/definitions/generated/scalar_functions.ts +++ b/packages/kbn-esql-validation-autocomplete/src/definitions/generated/scalar_functions.ts @@ -38,6 +38,7 @@ const absDefinition: FunctionDefinition = { description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.abs', { defaultMessage: 'Returns the absolute value.', }), + preview: false, alias: undefined, signatures: [ { @@ -97,6 +98,7 @@ const acosDefinition: FunctionDefinition = { description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.acos', { defaultMessage: 'Returns the arccosine of `n` as an angle, expressed in radians.', }), + preview: false, alias: undefined, signatures: [ { @@ -154,6 +156,7 @@ const asinDefinition: FunctionDefinition = { defaultMessage: 'Returns the arcsine of the input\nnumeric expression as an angle, expressed in radians.', }), + preview: false, alias: undefined, signatures: [ { @@ -211,6 +214,7 @@ const atanDefinition: FunctionDefinition = { defaultMessage: 'Returns the arctangent of the input\nnumeric expression as an angle, expressed in radians.', }), + preview: false, alias: undefined, signatures: [ { @@ -268,6 +272,7 @@ const atan2Definition: FunctionDefinition = { defaultMessage: 'The angle between the positive x-axis and the ray from the\norigin to the point (x , y) in the Cartesian plane, expressed in radians.', }), + preview: false, alias: undefined, signatures: [ { @@ -526,6 +531,7 @@ const categorizeDefinition: FunctionDefinition = { }), ignoreAsSuggestion: true, + preview: false, alias: undefined, signatures: [ { @@ -563,6 +569,7 @@ const cbrtDefinition: FunctionDefinition = { defaultMessage: 'Returns the cube root of a number. The input can be any numeric value, the return value is always a double.\nCube roots of infinities are null.', }), + preview: false, alias: undefined, signatures: [ { @@ -619,6 +626,7 @@ const ceilDefinition: FunctionDefinition = { description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.ceil', { defaultMessage: 'Round a number up to the nearest integer.', }), + preview: false, alias: undefined, signatures: [ { @@ -676,6 +684,7 @@ const cidrMatchDefinition: FunctionDefinition = { defaultMessage: 'Returns true if the provided IP is contained in one of the provided CIDR blocks.', }), + preview: false, alias: undefined, signatures: [ { @@ -727,6 +736,7 @@ const coalesceDefinition: FunctionDefinition = { defaultMessage: 'Returns the first of its arguments that is not null. If all arguments are null, it returns `null`.', }), + preview: false, alias: undefined, signatures: [ { @@ -990,6 +1000,7 @@ const concatDefinition: FunctionDefinition = { description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.concat', { defaultMessage: 'Concatenates two or more strings.', }), + preview: false, alias: undefined, signatures: [ { @@ -1072,6 +1083,7 @@ const cosDefinition: FunctionDefinition = { description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.cos', { defaultMessage: 'Returns the cosine of an angle.', }), + preview: false, alias: undefined, signatures: [ { @@ -1128,6 +1140,7 @@ const coshDefinition: FunctionDefinition = { description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.cosh', { defaultMessage: 'Returns the hyperbolic cosine of a number.', }), + preview: false, alias: undefined, signatures: [ { @@ -1185,6 +1198,7 @@ const dateDiffDefinition: FunctionDefinition = { defaultMessage: 'Subtracts the `startTimestamp` from the `endTimestamp` and returns the difference in multiples of `unit`.\nIf `startTimestamp` is later than the `endTimestamp`, negative values are returned.', }), + preview: false, alias: undefined, signatures: [ { @@ -1305,6 +1319,7 @@ const dateExtractDefinition: FunctionDefinition = { description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.date_extract', { defaultMessage: 'Extracts parts of a date, like year, month, day, hour.', }), + preview: false, alias: undefined, signatures: [ { @@ -1386,6 +1401,7 @@ const dateFormatDefinition: FunctionDefinition = { description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.date_format', { defaultMessage: 'Returns a string representation of a date, in the provided format.', }), + preview: false, alias: undefined, signatures: [ { @@ -1435,6 +1451,7 @@ const dateParseDefinition: FunctionDefinition = { defaultMessage: 'Returns a date by parsing the second argument using the format specified in the first argument.', }), + preview: false, alias: undefined, signatures: [ { @@ -1511,6 +1528,7 @@ const dateTruncDefinition: FunctionDefinition = { description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.date_trunc', { defaultMessage: 'Rounds down a date to the closest interval.', }), + preview: false, alias: undefined, signatures: [ { @@ -1561,6 +1579,7 @@ const eDefinition: FunctionDefinition = { description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.e', { defaultMessage: "Returns Euler's number.", }), + preview: false, alias: undefined, signatures: [ { @@ -1582,6 +1601,7 @@ const endsWithDefinition: FunctionDefinition = { defaultMessage: 'Returns a boolean that indicates whether a keyword string ends with another string.', }), + preview: false, alias: undefined, signatures: [ { @@ -1658,6 +1678,7 @@ const expDefinition: FunctionDefinition = { description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.exp', { defaultMessage: 'Returns the value of e raised to the power of the given number.', }), + preview: false, alias: undefined, signatures: [ { @@ -1714,6 +1735,7 @@ const floorDefinition: FunctionDefinition = { description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.floor', { defaultMessage: 'Round a number down to the nearest integer.', }), + preview: false, alias: undefined, signatures: [ { @@ -1770,6 +1792,7 @@ const fromBase64Definition: FunctionDefinition = { description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.from_base64', { defaultMessage: 'Decode a base64 string.', }), + preview: false, alias: undefined, signatures: [ { @@ -1807,6 +1830,7 @@ const greatestDefinition: FunctionDefinition = { defaultMessage: 'Returns the maximum value from multiple columns. This is similar to `MV_MAX`\nexcept it is intended to run on multiple columns at once.', }), + preview: false, alias: undefined, signatures: [ { @@ -2023,6 +2047,7 @@ const hypotDefinition: FunctionDefinition = { defaultMessage: 'Returns the hypotenuse of two numbers. The input can be any numeric values, the return value is always a double.\nHypotenuses of infinities are null.', }), + preview: false, alias: undefined, signatures: [ { @@ -2279,6 +2304,7 @@ const ipPrefixDefinition: FunctionDefinition = { description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.ip_prefix', { defaultMessage: 'Truncates an IP to a given prefix length.', }), + preview: false, alias: undefined, signatures: [ { @@ -2318,6 +2344,7 @@ const leastDefinition: FunctionDefinition = { defaultMessage: 'Returns the minimum value from multiple columns. This is similar to `MV_MIN` except it is intended to run on multiple columns at once.', }), + preview: false, alias: undefined, signatures: [ { @@ -2534,6 +2561,7 @@ const leftDefinition: FunctionDefinition = { defaultMessage: "Returns the substring that extracts 'length' chars from 'string' starting from the left.", }), + preview: false, alias: undefined, signatures: [ { @@ -2582,6 +2610,7 @@ const lengthDefinition: FunctionDefinition = { description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.length', { defaultMessage: 'Returns the character length of a string.', }), + preview: false, alias: undefined, signatures: [ { @@ -2619,6 +2648,7 @@ const locateDefinition: FunctionDefinition = { defaultMessage: 'Returns an integer that indicates the position of a keyword substring within another string.\nReturns `0` if the substring cannot be found.\nNote that string positions start from `1`.', }), + preview: false, alias: undefined, signatures: [ { @@ -2776,6 +2806,7 @@ const logDefinition: FunctionDefinition = { defaultMessage: 'Returns the logarithm of a value to a base. The input can be any numeric value, the return value is always a double.\n\nLogs of zero, negative numbers, and base of one return `null` as well as a warning.', }), + preview: false, alias: undefined, signatures: [ { @@ -3099,6 +3130,7 @@ const log10Definition: FunctionDefinition = { defaultMessage: 'Returns the logarithm of a value to base 10. The input can be any numeric value, the return value is always a double.\n\nLogs of 0 and negative numbers return `null` as well as a warning.', }), + preview: false, alias: undefined, signatures: [ { @@ -3178,6 +3210,7 @@ const ltrimDefinition: FunctionDefinition = { description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.ltrim', { defaultMessage: 'Removes leading whitespaces from a string.', }), + preview: false, alias: undefined, signatures: [ { @@ -3217,6 +3250,7 @@ const matchDefinition: FunctionDefinition = { defaultMessage: 'Performs a match query on the specified field. Returns true if the provided query matches the row.', }), + preview: true, alias: undefined, signatures: [ { @@ -3295,6 +3329,7 @@ const mvAppendDefinition: FunctionDefinition = { description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.mv_append', { defaultMessage: 'Concatenates values of two multi-value fields.', }), + preview: false, alias: undefined, signatures: [ { @@ -3507,6 +3542,7 @@ const mvAvgDefinition: FunctionDefinition = { defaultMessage: 'Converts a multivalued field into a single valued field containing the average of all of the values.', }), + preview: false, alias: undefined, signatures: [ { @@ -3564,6 +3600,7 @@ const mvConcatDefinition: FunctionDefinition = { defaultMessage: 'Converts a multivalued string expression into a single valued column containing the concatenation of all values separated by a delimiter.', }), + preview: false, alias: undefined, signatures: [ { @@ -3644,6 +3681,7 @@ const mvCountDefinition: FunctionDefinition = { defaultMessage: 'Converts a multivalued expression into a single valued column containing a count of the number of values.', }), + preview: false, alias: undefined, signatures: [ { @@ -3800,6 +3838,7 @@ const mvDedupeDefinition: FunctionDefinition = { description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.mv_dedupe', { defaultMessage: 'Remove duplicate values from a multivalued field.', }), + preview: false, alias: undefined, signatures: [ { @@ -3947,6 +3986,7 @@ const mvFirstDefinition: FunctionDefinition = { defaultMessage: 'Converts a multivalued expression into a single valued column containing the\nfirst value. This is most useful when reading from a function that emits\nmultivalued columns in a known order like `SPLIT`.', }), + preview: false, alias: undefined, signatures: [ { @@ -4104,6 +4144,7 @@ const mvLastDefinition: FunctionDefinition = { defaultMessage: 'Converts a multivalue expression into a single valued column containing the last\nvalue. This is most useful when reading from a function that emits multivalued\ncolumns in a known order like `SPLIT`.', }), + preview: false, alias: undefined, signatures: [ { @@ -4261,6 +4302,7 @@ const mvMaxDefinition: FunctionDefinition = { defaultMessage: 'Converts a multivalued expression into a single valued column containing the maximum value.', }), + preview: false, alias: undefined, signatures: [ { @@ -4381,6 +4423,7 @@ const mvMedianDefinition: FunctionDefinition = { defaultMessage: 'Converts a multivalued field into a single valued field containing the median value.', }), + preview: false, alias: undefined, signatures: [ { @@ -4444,6 +4487,7 @@ const mvMedianAbsoluteDeviationDefinition: FunctionDefinition = { "Converts a multivalued field into a single valued field containing the median absolute deviation.\n\nIt is calculated as the median of each data point's deviation from the median of the entire sample. That is, for a random variable `X`, the median absolute deviation is `median(|median(X) - X|)`.", } ), + preview: false, alias: undefined, signatures: [ { @@ -4503,6 +4547,7 @@ const mvMinDefinition: FunctionDefinition = { defaultMessage: 'Converts a multivalued expression into a single valued column containing the minimum value.', }), + preview: false, alias: undefined, signatures: [ { @@ -4623,6 +4668,7 @@ const mvPercentileDefinition: FunctionDefinition = { defaultMessage: 'Converts a multivalued field into a single valued field containing the value at which a certain percentage of observed values occur.', }), + preview: false, alias: undefined, signatures: [ { @@ -4780,6 +4826,7 @@ const mvPseriesWeightedSumDefinition: FunctionDefinition = { 'Converts a multivalued expression into a single-valued column by multiplying every element on the input list by its corresponding term in P-Series and computing the sum.', } ), + preview: false, alias: undefined, signatures: [ { @@ -4814,6 +4861,7 @@ const mvSliceDefinition: FunctionDefinition = { defaultMessage: 'Returns a subset of the multivalued field using the start and end index values.\nThis is most useful when reading from a function that emits multivalued columns\nin a known order like `SPLIT` or `MV_SORT`.', }), + preview: false, alias: undefined, signatures: [ { @@ -5093,6 +5141,7 @@ const mvSortDefinition: FunctionDefinition = { description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.mv_sort', { defaultMessage: 'Sorts a multivalued field in lexicographical order.', }), + preview: false, alias: undefined, signatures: [ { @@ -5254,6 +5303,7 @@ const mvSumDefinition: FunctionDefinition = { defaultMessage: 'Converts a multivalued field into a single valued field containing the sum of all of the values.', }), + preview: false, alias: undefined, signatures: [ { @@ -5311,6 +5361,7 @@ const mvZipDefinition: FunctionDefinition = { defaultMessage: 'Combines the values from two multivalued fields with a delimiter that joins them together.', }), + preview: false, alias: undefined, signatures: [ { @@ -5549,6 +5600,7 @@ const nowDefinition: FunctionDefinition = { description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.now', { defaultMessage: 'Returns current date and time.', }), + preview: false, alias: undefined, signatures: [ { @@ -5569,6 +5621,7 @@ const piDefinition: FunctionDefinition = { description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.pi', { defaultMessage: "Returns Pi, the ratio of a circle's circumference to its diameter.", }), + preview: false, alias: undefined, signatures: [ { @@ -5589,6 +5642,7 @@ const powDefinition: FunctionDefinition = { description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.pow', { defaultMessage: 'Returns the value of `base` raised to the power of `exponent`.', }), + preview: false, alias: undefined, signatures: [ { @@ -5849,6 +5903,7 @@ const qstrDefinition: FunctionDefinition = { defaultMessage: 'Performs a query string query. Returns true if the provided query string matches the row.', }), + preview: true, alias: undefined, signatures: [ { @@ -5888,6 +5943,7 @@ const repeatDefinition: FunctionDefinition = { defaultMessage: 'Returns a string constructed by concatenating `string` with itself the specified `number` of times.', }), + preview: false, alias: undefined, signatures: [ { @@ -5924,7 +5980,7 @@ const repeatDefinition: FunctionDefinition = { supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], supportedOptions: ['by'], validate: undefined, - examples: ['ROW a = "Hello!"\n| EVAL triple_a = REPEAT(a, 3);'], + examples: ['ROW a = "Hello!"\n| EVAL triple_a = REPEAT(a, 3)'], }; // Do not edit this manually... generated by scripts/generate_function_definitions.ts @@ -5935,6 +5991,7 @@ const replaceDefinition: FunctionDefinition = { defaultMessage: 'The function substitutes in the string `str` any match of the regular expression `regex`\nwith the replacement string `newStr`.', }), + preview: false, alias: undefined, signatures: [ { @@ -6111,6 +6168,7 @@ const reverseDefinition: FunctionDefinition = { description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.reverse', { defaultMessage: 'Returns a new string representing the input string in reverse order.', }), + preview: false, alias: undefined, signatures: [ { @@ -6151,6 +6209,7 @@ const rightDefinition: FunctionDefinition = { defaultMessage: "Return the substring that extracts 'length' chars from 'str' starting from the right.", }), + preview: false, alias: undefined, signatures: [ { @@ -6200,6 +6259,7 @@ const roundDefinition: FunctionDefinition = { defaultMessage: 'Rounds a number to the specified number of decimal places.\nDefaults to 0, which returns the nearest integer. If the\nprecision is a negative number, rounds to the number of digits left\nof the decimal point.', }), + preview: false, alias: undefined, signatures: [ { @@ -6303,6 +6363,7 @@ const rtrimDefinition: FunctionDefinition = { description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.rtrim', { defaultMessage: 'Removes trailing whitespaces from a string.', }), + preview: false, alias: undefined, signatures: [ { @@ -6342,6 +6403,7 @@ const signumDefinition: FunctionDefinition = { defaultMessage: 'Returns the sign of the given number.\nIt returns `-1` for negative numbers, `0` for `0` and `1` for positive numbers.', }), + preview: false, alias: undefined, signatures: [ { @@ -6398,6 +6460,7 @@ const sinDefinition: FunctionDefinition = { description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.sin', { defaultMessage: 'Returns the sine of an angle.', }), + preview: false, alias: undefined, signatures: [ { @@ -6454,6 +6517,7 @@ const sinhDefinition: FunctionDefinition = { description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.sinh', { defaultMessage: 'Returns the hyperbolic sine of a number.', }), + preview: false, alias: undefined, signatures: [ { @@ -6510,6 +6574,7 @@ const spaceDefinition: FunctionDefinition = { description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.space', { defaultMessage: 'Returns a string made of `number` spaces.', }), + preview: false, alias: undefined, signatures: [ { @@ -6536,6 +6601,7 @@ const splitDefinition: FunctionDefinition = { description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.split', { defaultMessage: 'Split a single valued string into multiple strings.', }), + preview: false, alias: undefined, signatures: [ { @@ -6613,6 +6679,7 @@ const sqrtDefinition: FunctionDefinition = { defaultMessage: 'Returns the square root of a number. The input can be any numeric value, the return value is always a double.\nSquare roots of negative numbers and infinities are null.', }), + preview: false, alias: undefined, signatures: [ { @@ -6670,6 +6737,7 @@ const stContainsDefinition: FunctionDefinition = { defaultMessage: 'Returns whether the first geometry contains the second geometry.\nThis is the inverse of the `ST_WITHIN` function.', }), + preview: false, alias: undefined, signatures: [ { @@ -6809,6 +6877,7 @@ const stDisjointDefinition: FunctionDefinition = { defaultMessage: 'Returns whether the two geometries or geometry columns are disjoint.\nThis is the inverse of the `ST_INTERSECTS` function.\nIn mathematical terms: ST_Disjoint(A, B) ⇔ A ⋂ B = ∅', }), + preview: false, alias: undefined, signatures: [ { @@ -6948,6 +7017,7 @@ const stDistanceDefinition: FunctionDefinition = { defaultMessage: 'Computes the distance between two points.\nFor cartesian geometries, this is the pythagorean distance in the same units as the original coordinates.\nFor geographic geometries, this is the circular distance along the great circle in meters.', }), + preview: false, alias: undefined, signatures: [ { @@ -6997,6 +7067,7 @@ const stIntersectsDefinition: FunctionDefinition = { defaultMessage: 'Returns true if two geometries intersect.\nThey intersect if they have any point in common, including their interior points\n(points along lines or within polygons).\nThis is the inverse of the `ST_DISJOINT` function.\nIn mathematical terms: ST_Intersects(A, B) ⇔ A ⋂ B ≠ ∅', }), + preview: false, alias: undefined, signatures: [ { @@ -7136,6 +7207,7 @@ const stWithinDefinition: FunctionDefinition = { defaultMessage: 'Returns whether the first geometry is within the second geometry.\nThis is the inverse of the `ST_CONTAINS` function.', }), + preview: false, alias: undefined, signatures: [ { @@ -7275,6 +7347,7 @@ const stXDefinition: FunctionDefinition = { defaultMessage: 'Extracts the `x` coordinate from the supplied point.\nIf the points is of type `geo_point` this is equivalent to extracting the `longitude` value.', }), + preview: false, alias: undefined, signatures: [ { @@ -7314,6 +7387,7 @@ const stYDefinition: FunctionDefinition = { defaultMessage: 'Extracts the `y` coordinate from the supplied point.\nIf the points is of type `geo_point` this is equivalent to extracting the `latitude` value.', }), + preview: false, alias: undefined, signatures: [ { @@ -7353,6 +7427,7 @@ const startsWithDefinition: FunctionDefinition = { defaultMessage: 'Returns a boolean that indicates whether a keyword string starts with another string.', }), + preview: false, alias: undefined, signatures: [ { @@ -7430,6 +7505,7 @@ const substringDefinition: FunctionDefinition = { defaultMessage: 'Returns a substring of a string, specified by a start position and an optional length.', }), + preview: false, alias: undefined, signatures: [ { @@ -7490,6 +7566,7 @@ const tanDefinition: FunctionDefinition = { description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.tan', { defaultMessage: 'Returns the tangent of an angle.', }), + preview: false, alias: undefined, signatures: [ { @@ -7546,6 +7623,7 @@ const tanhDefinition: FunctionDefinition = { description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.tanh', { defaultMessage: 'Returns the hyperbolic tangent of a number.', }), + preview: false, alias: undefined, signatures: [ { @@ -7602,6 +7680,7 @@ const tauDefinition: FunctionDefinition = { description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.tau', { defaultMessage: "Returns the ratio of a circle's circumference to its radius.", }), + preview: false, alias: undefined, signatures: [ { @@ -7622,6 +7701,7 @@ const toBase64Definition: FunctionDefinition = { description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.to_base64', { defaultMessage: 'Encode a string to a base64 string.', }), + preview: false, alias: undefined, signatures: [ { @@ -7659,6 +7739,7 @@ const toBooleanDefinition: FunctionDefinition = { defaultMessage: 'Converts an input value to a boolean value.\nA string value of *true* will be case-insensitive converted to the Boolean *true*.\nFor anything else, including the empty string, the function will return *false*.\nThe numerical value of *0* will be converted to *false*, anything else will be converted to *true*.', }), + preview: false, alias: ['to_bool'], signatures: [ { @@ -7749,6 +7830,7 @@ const toCartesianpointDefinition: FunctionDefinition = { 'Converts an input value to a `cartesian_point` value.\nA string will only be successfully converted if it respects WKT Point format.', } ), + preview: false, alias: undefined, signatures: [ { @@ -7801,6 +7883,7 @@ const toCartesianshapeDefinition: FunctionDefinition = { 'Converts an input value to a `cartesian_shape` value.\nA string will only be successfully converted if it respects WKT format.', } ), + preview: false, alias: undefined, signatures: [ { @@ -7859,6 +7942,7 @@ const toDateNanosDefinition: FunctionDefinition = { description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.to_date_nanos', { defaultMessage: 'Converts an input to a nanosecond-resolution date value (aka date_nanos).', }), + preview: true, alias: undefined, signatures: [], supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], @@ -7874,6 +7958,7 @@ const toDateperiodDefinition: FunctionDefinition = { description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.to_dateperiod', { defaultMessage: 'Converts an input value into a `date_period` value.', }), + preview: false, alias: undefined, signatures: [ { @@ -7923,6 +8008,7 @@ const toDatetimeDefinition: FunctionDefinition = { defaultMessage: "Converts an input value to a date value.\nA string will only be successfully converted if it's respecting the format `yyyy-MM-dd'T'HH:mm:ss.SSS'Z'`.\nTo convert dates in other formats, use `DATE_PARSE`.", }), + preview: false, alias: ['to_dt'], signatures: [ { @@ -8012,6 +8098,7 @@ const toDegreesDefinition: FunctionDefinition = { description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.to_degrees', { defaultMessage: 'Converts a number in radians to degrees.', }), + preview: false, alias: undefined, signatures: [ { @@ -8069,6 +8156,7 @@ const toDoubleDefinition: FunctionDefinition = { defaultMessage: 'Converts an input value to a double value. If the input parameter is of a date type,\nits value will be interpreted as milliseconds since the Unix epoch,\nconverted to double. Boolean *true* will be converted to double *1.0*, *false* to *0.0*.', }), + preview: false, alias: ['to_dbl'], signatures: [ { @@ -8198,6 +8286,7 @@ const toGeopointDefinition: FunctionDefinition = { defaultMessage: 'Converts an input value to a `geo_point` value.\nA string will only be successfully converted if it respects WKT Point format.', }), + preview: false, alias: undefined, signatures: [ { @@ -8245,6 +8334,7 @@ const toGeoshapeDefinition: FunctionDefinition = { defaultMessage: 'Converts an input value to a `geo_shape` value.\nA string will only be successfully converted if it respects WKT format.', }), + preview: false, alias: undefined, signatures: [ { @@ -8304,6 +8394,7 @@ const toIntegerDefinition: FunctionDefinition = { defaultMessage: 'Converts an input value to an integer value.\nIf the input parameter is of a date type, its value will be interpreted as milliseconds\nsince the Unix epoch, converted to integer.\nBoolean *true* will be converted to integer *1*, *false* to *0*.', }), + preview: false, alias: ['to_int'], signatures: [ { @@ -8410,6 +8501,7 @@ const toIpDefinition: FunctionDefinition = { description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.to_ip', { defaultMessage: 'Converts an input string to an IP value.', }), + preview: false, alias: undefined, signatures: [ { @@ -8459,6 +8551,7 @@ const toLongDefinition: FunctionDefinition = { defaultMessage: 'Converts an input value to a long value. If the input parameter is of a date type,\nits value will be interpreted as milliseconds since the Unix epoch, converted to long.\nBoolean *true* will be converted to long *1*, *false* to *0*.', }), + preview: false, alias: undefined, signatures: [ { @@ -8577,6 +8670,7 @@ const toLowerDefinition: FunctionDefinition = { description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.to_lower', { defaultMessage: 'Returns a new string representing the input string converted to lower case.', }), + preview: false, alias: undefined, signatures: [ { @@ -8613,6 +8707,7 @@ const toRadiansDefinition: FunctionDefinition = { description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.to_radians', { defaultMessage: 'Converts a number in degrees to radians.', }), + preview: false, alias: undefined, signatures: [ { @@ -8669,6 +8764,7 @@ const toStringDefinition: FunctionDefinition = { description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.to_string', { defaultMessage: 'Converts an input value into a string.', }), + preview: false, alias: ['to_str'], signatures: [ { @@ -8825,6 +8921,7 @@ const toTimedurationDefinition: FunctionDefinition = { description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.to_timeduration', { defaultMessage: 'Converts an input value into a `time_duration` value.', }), + preview: false, alias: undefined, signatures: [ { @@ -8877,6 +8974,7 @@ const toUnsignedLongDefinition: FunctionDefinition = { 'Converts an input value to an unsigned long value. If the input parameter is of a date type,\nits value will be interpreted as milliseconds since the Unix epoch, converted to unsigned long.\nBoolean *true* will be converted to unsigned long *1*, *false* to *0*.', } ), + preview: false, alias: ['to_ul', 'to_ulong'], signatures: [ { @@ -8975,6 +9073,7 @@ const toUpperDefinition: FunctionDefinition = { description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.to_upper', { defaultMessage: 'Returns a new string representing the input string converted to upper case.', }), + preview: false, alias: undefined, signatures: [ { @@ -9011,6 +9110,7 @@ const toVersionDefinition: FunctionDefinition = { description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.to_version', { defaultMessage: 'Converts an input string to a version value.', }), + preview: false, alias: ['to_ver'], signatures: [ { @@ -9057,6 +9157,7 @@ const trimDefinition: FunctionDefinition = { description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.trim', { defaultMessage: 'Removes leading and trailing whitespaces from a string.', }), + preview: false, alias: undefined, signatures: [ { @@ -9096,6 +9197,7 @@ const caseDefinition: FunctionDefinition = { defaultMessage: 'Accepts pairs of conditions and values. The function returns the value that belongs to the first condition that evaluates to `true`. If the number of arguments is odd, the last argument is the default value which is returned when no condition matches.', }), + preview: false, alias: undefined, signatures: [ { diff --git a/packages/kbn-esql-validation-autocomplete/src/definitions/types.ts b/packages/kbn-esql-validation-autocomplete/src/definitions/types.ts index a86811f535f8b..ba0a50c4a71b9 100644 --- a/packages/kbn-esql-validation-autocomplete/src/definitions/types.ts +++ b/packages/kbn-esql-validation-autocomplete/src/definitions/types.ts @@ -118,6 +118,7 @@ export const isReturnType = (str: string | FunctionParameterType): str is Functi export interface FunctionDefinition { type: 'builtin' | 'agg' | 'eval'; + preview?: boolean; ignoreAsSuggestion?: boolean; name: string; alias?: string[];