import { LicensingPluginSetup } from '../../../../licensing/public' ; import { MlLicense } from '../../../common/license' ; import { MlClientLicense } from './ml_client_license' ; let mlLicense = null ; export param { LicensingPluginSetup } licensingSetup returns { MlClientLicense } export function setLicenseCache ( licensingSetup , postInitFunctions ? ) { mlLicense = new MlClientLicense ( ) ; mlLicense . setup ( licensingSetup . license$ , postInitFunctions ) ; return mlLicense ; } export returns { Promise < void > } export async function checkFullLicense ( ) { if ( mlLicense === null ) { console . error ( 'ML Licensing not initialized' ) ; return Promise . reject ( ) ; } return mlLicense . fullLicenseResolver ( ) ; } export returns { Promise < void > } export async function checkBasicLicense ( ) { if ( mlLicense === null ) { console . error ( 'ML Licensing not initialized' ) ; return Promise . reject ( ) ; } return mlLicense . basicLicenseResolver ( ) ; } export returns { boolean } export function hasLicenseExpired ( ) { return mlLicense !== null && mlLicense . hasLicenseExpired ( ) ; } export returns { boolean } export function isFullLicense ( ) { return mlLicense !== null && mlLicense . isFullLicense ( ) ; }