@forge/cli
12.22.0-experimental-04cc2b912.23.0-next.7-experimental-44b7a12
out/installations/graphql-client.js~
out/installations/graphql-client.jsModified+30−1
Index: package/out/installations/graphql-client.js
===================================================================
--- package/out/installations/graphql-client.js
+++ package/out/installations/graphql-client.js
@@ -7,8 +7,9 @@
const egress_1 = require("@forge/egress");
const harmonized_app_installation_errors_1 = require("./harmonized-apps/harmonized-app-installation-errors");
exports.UNINSTALLATION_EVENT_POLL_INTERVAL = 500;
const DECOUPLED_STATE_NOT_ENABLED_CODE = 'DECOUPLED_STATE_NOT_ENABLED';
+const APP_INSTALLATION_LIMIT_WARNING = 'APP_INSTALLATION_LIMIT_WARNING';
const RollingReleaseValidationErrorCodes = {
DIFFERENT_ENVIRONMENT_ROLLING_RELEASE_CODE: 'DIFFERENT_ENVIRONMENT_ROLLING_RELEASE',
VERSION_DECREASES_ROLLING_RELEASE_CODE: 'VERSION_DECREASES_ROLLING_RELEASE',
EGRESS_TO_WEB_TRIGGER_ROLLING_RELEASE_CODE: 'EGRESS_TO_WEB_TRIGGER_ROLLING_RELEASE',
@@ -160,8 +161,31 @@
return this.bitbucketTranslator;
}
return this.sitedProductTranslator;
}
+ extractInstallWarnings(extensions) {
+ const installWarnings = extensions?.installApp ?? this.findNamespacedInstallWarnings(extensions);
+ return (installWarnings ?? [])
+ .filter(({ type }) => type === APP_INSTALLATION_LIMIT_WARNING)
+ .map(() => ({
+ type: APP_INSTALLATION_LIMIT_WARNING,
+ message: cli_shared_1.Text.install.installationLimitWarning
+ }));
+ }
+ findNamespacedInstallWarnings(extensions) {
+ if (!extensions) {
+ return undefined;
+ }
+ for (const value of Object.values(extensions)) {
+ if (value && !Array.isArray(value) && typeof value === 'object') {
+ const namespacedExtension = value;
+ if (Array.isArray(namespacedExtension.installApp)) {
+ return namespacedExtension.installApp;
+ }
+ }
+ }
+ return undefined;
+ }
async installAppIntoSite({ environmentKey, site, product, appId, licenseOverride, overrides, majorVersionId, environmentType }) {
const workspaceAri = await this.buildInstallationContext(product, site);
const query = `
mutation forge_cli_installApplication($input: AppInstallationInput!) {
@@ -188,9 +212,10 @@
overrides,
...(majorVersionId ? { versionId: majorVersionId } : {})
}
};
- const { response: { installApp: { success, taskId, errors } }, requestId } = await this.graphqlClient.mutate(query, variables);
+ const mutationResult = await this.graphqlClient.mutate(query, variables);
+ const { response: { installApp: { success, taskId, errors } }, requestId, extensions } = mutationResult;
const error = (0, cli_shared_1.getError)(errors);
if (!success) {
if (error.code === PERMISSION_DENIED) {
throw new PermissionDeniedError(requestId, ari_1.AnyAri.parse(appId).resourceId, error.statusCode);
@@ -204,8 +229,12 @@
if (!taskId) {
throw new MissingTaskIdError(error.message);
}
await this.monitorAppInstallOrUpgrade(taskId, !!majorVersionId, environmentKey, environmentType);
+ const warnings = this.extractInstallWarnings(extensions);
+ return {
+ warnings
+ };
}
async getEntitlementOffering(site, product) {
try {
const productKeys = this.getHamsProductKeys(product);