Skip to content

Commit fd52301

Browse files
authored
[ESQL] Fix license check (elastic#267919)
## Summary Small fix to make the license check more robust.
1 parent f295228 commit fd52301

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

src/platform/packages/shared/kbn-esql-language/src/language/autocomplete/autocomplete.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ export async function suggest(
8080

8181
const activeProduct = resourceRetriever?.getActiveProduct?.();
8282
const licenseInstance = await resourceRetriever?.getLicense?.();
83-
const hasMinimumLicenseRequired = licenseInstance?.hasAtLeast;
83+
const hasMinimumLicenseRequired = licenseInstance
84+
? (license: LicenseType) => licenseInstance.hasAtLeast(license)
85+
: undefined;
8486

8587
if (astContext.type === 'newCommand') {
8688
// propose main commands here

src/platform/packages/shared/kbn-esql-language/src/language/validation/validation.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,9 @@ async function validateAst(
104104
}
105105

106106
const license = await callbacks?.getLicense?.();
107-
const hasMinimumLicenseRequired = license?.hasAtLeast;
107+
const hasMinimumLicenseRequired = license
108+
? (minimumLicenseRequired: LicenseType) => license.hasAtLeast(minimumLicenseRequired)
109+
: undefined;
108110

109111
// Validate the header commands
110112
for (const command of headerCommands) {

0 commit comments

Comments
 (0)