@@ -319,7 +319,7 @@ export class LicensingClient {
319319 * @throws Error if activation fails or required parameters are missing.
320320 */
321321 public async Activate ( licenseType : LicenseType , servicesConfig : string | undefined = undefined , serial : string | undefined = undefined , username : string | undefined = undefined , password : string | undefined = undefined ) : Promise < void > {
322- let activeLicenses = await this . showEntitlements ( ) ;
322+ let activeLicenses = await this . GetActiveEntitlements ( ) ;
323323
324324 if ( activeLicenses . includes ( licenseType ) ) {
325325 this . logger . info ( `License of type '${ licenseType } ' is already active, skipping activation` ) ;
@@ -398,14 +398,18 @@ export class LicensingClient {
398398 return ;
399399 }
400400
401- const activeLicenses = await this . showEntitlements ( ) ;
401+ const activeLicenses = await this . GetActiveEntitlements ( ) ;
402402
403403 if ( activeLicenses . includes ( licenseType ) ) {
404404 await this . returnLicense ( licenseType ) ;
405405 }
406406 }
407407
408- private async showEntitlements ( ) : Promise < LicenseType [ ] > {
408+ /**
409+ * Shows the currently active entitlements/licenses.
410+ * @returns A list of active license types.
411+ */
412+ public async GetActiveEntitlements ( ) : Promise < LicenseType [ ] > {
409413 const output = await this . exec ( [ `--showEntitlements` ] ) ;
410414 const matches = output . matchAll ( / P r o d u c t N a m e : (?< license > .+ ) / g) ;
411415 const licenses : LicenseType [ ] = [ ] ;
@@ -450,7 +454,7 @@ export class LicensingClient {
450454
451455 await this . exec ( args ) ;
452456
453- const activeLicenses = await this . showEntitlements ( ) ;
457+ const activeLicenses = await this . GetActiveEntitlements ( ) ;
454458
455459 if ( ! activeLicenses . includes ( licenseType ) ) {
456460 throw new Error ( `Failed to activate license of type '${ licenseType } '` ) ;
@@ -462,7 +466,7 @@ export class LicensingClient {
462466 private async returnLicense ( licenseType : LicenseType ) : Promise < void > {
463467 await this . exec ( [ `--return-ulf` ] ) ;
464468
465- const activeLicenses = await this . showEntitlements ( ) ;
469+ const activeLicenses = await this . GetActiveEntitlements ( ) ;
466470
467471 if ( activeLicenses . includes ( licenseType ) ) {
468472 throw new Error ( `Failed to return license of type '${ licenseType } '` ) ;
0 commit comments