npm package diff
Package: @forge/cli
Versions: 11.3.1-next.8 - 11.3.1-next.8-experimental-98585b7
File: package/out/installations/graphql-client.js
Index: package/out/installations/graphql-client.js
===================================================================
--- package/out/installations/graphql-client.js
+++ package/out/installations/graphql-client.js
@@ -148,8 +148,68 @@
throw new MissingTaskIdError(error.message);
}
await this.monitorAppInstallOrUpgrade(taskId);
}
+ async getEntitlementOffering(site, product) {
+ try {
+ const productKeys = this.getHamsProductKeys(product);
+ const results = await Promise.allSettled(productKeys.map((productKey) => this.graphqlClient.query(`query getEntitlementOffering($hostNames: [String!], $product: String!) {
+ tenantContexts(hostNames: $hostNames) {
+ cloudUrl
+ entitlementInfo(hamsProductKey: $product) {
+ entitlement {
+ ... on HamsEntitlement {
+ id
+ name
+ currentEdition
+ }
+ ... on CcpEntitlement {
+ id
+ offering {
+ name
+ }
+ }
+ }
+ }
+ }
+ }`, {
+ hostNames: [site.hostname],
+ product: productKey
+ })));
+ for (const result of results) {
+ if (result.status === 'fulfilled') {
+ const data = result.value;
+ const tenantContexts = data.tenantContexts || [];
+ if (tenantContexts[0]?.entitlementInfo) {
+ return tenantContexts[0].entitlementInfo.entitlement;
+ }
+ }
+ }
+ return undefined;
+ }
+ catch (error) {
+ return undefined;
+ }
+ }
+ getHamsProductKeys(product) {
+ switch (product) {
+ case 'Jira':
+ [
+ 'jira-software.ondemand',
+ 'jira-core.ondemand',
+ 'jira-servicedesk.ondemand',
+ 'jira-product-discovery.ondemand'
+ ];
+ case 'Confluence':
+ return ['confluence.ondemand'];
+ case 'Compass':
+ return ['compass'];
+ case 'Atlas':
+ return ['townsquare'];
+ default:
+ throw new Error('Unsupported product');
+ }
+ }
async upgradeInstallation({ site, product, environmentKey, appId }) {
const workspaceAri = await this.buildInstallationContext(product, site);
const query = `
mutation forge_cli_upgradeApplication($input: AppInstallationUpgradeInput!) {