npm package diff
Package: @forge/cli
Versions: 12.7.0 - 12.7.1-next.9-experimental-44e92a2
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
@@ -1,12 +1,13 @@
 "use strict";
 Object.defineProperty(exports, "__esModule", { value: true });
-exports.InstallationsGraphqlClient = exports.InstallationNotFoundError = exports.MissingAppUninstallTask = exports.MissingAppEnvironmentError = exports.MissingAppError = exports.InstallationRequestFailedError = exports.MissingTaskIdError = exports.EnvironmentNotFoundError = exports.UpgradeError = exports.InstallationError = exports.AlreadyInstalledError = exports.PermissionDeniedError = exports.ALREADY_UPGRADED_CODE = exports.UNINSTALLATION_EVENT_POLL_INTERVAL = void 0;
+exports.InstallationsGraphqlClient = exports.InstallationNotFoundError = exports.MissingAppUninstallTask = exports.MissingAppEnvironmentError = exports.MissingAppError = exports.InstallationRequestFailedError = exports.MissingTaskIdError = exports.EnvironmentNotFoundError = exports.UpgradeError = exports.DecoupledStateNotEnabledError = exports.InstallationError = exports.AlreadyInstalledError = exports.PermissionDeniedError = exports.ALREADY_UPGRADED_CODE = exports.UNINSTALLATION_EVENT_POLL_INTERVAL = void 0;
 const exponential_backoff_1 = require("exponential-backoff");
 const ari_1 = require("@forge/util/packages/ari");
 const cli_shared_1 = require("@forge/cli-shared");
 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';
 exports.ALREADY_UPGRADED_CODE = 'INSTALLATION_ALREADY_UPGRADED';
 const ALREADY_INSTALLED_CODE = 'APP_ALREADY_INSTALLED';
 const PERMISSION_DENIED = 'PERMISSION_DENIED';
 class PermissionDeniedError extends cli_shared_1.GraphQlMutationError {
@@ -39,8 +40,14 @@
         super(cli_shared_1.Text.install.error.serverSideInstallationError(message), { requestId, code, statusCode });
     }
 }
 exports.InstallationError = InstallationError;
+class DecoupledStateNotEnabledError extends cli_shared_1.UserError {
+    constructor(requestId) {
+        super(cli_shared_1.Text.upgrade.error.decoupledStateNotEnabled(requestId), requestId);
+    }
+}
+exports.DecoupledStateNotEnabledError = DecoupledStateNotEnabledError;
 class UpgradeError extends cli_shared_1.GraphQlMutationError {
     constructor(message, { requestId, code, statusCode }) {
         super(cli_shared_1.Text.upgrade.error.serverSideInstallationError(message), { requestId, code, statusCode });
     }
@@ -212,9 +219,9 @@
             default:
                 throw new Error('Unsupported product');
         }
     }
-    async upgradeInstallation({ site, product, environmentKey, appId, majorVersionId }) {
+    async upgradeInstallation({ site, product, environmentKey, appId, majorVersionId, isCodeUpgrade }) {
         const workspaceAri = await this.buildInstallationContext(product, site);
         const query = `
       mutation forge_cli_upgradeApplication($input: AppInstallationUpgradeInput!) {
         upgradeApp(input: $input) {
@@ -234,19 +241,27 @@
             input: {
                 installationContext: workspaceAri,
                 appId,
                 environmentKey,
+                ...(majorVersionId ? { versionId: majorVersionId } : {}),
+                ...(isCodeUpgrade ? { computeOnly: isCodeUpgrade } : {}),
                 async: true
             }
         };
         const { response: { upgradeApp: { success, errors, taskId } }, requestId } = await this.graphqlClient.mutate(query, variables);
         const error = (0, cli_shared_1.getError)(errors);
         if (!success) {
-            throw new UpgradeError(`${error.message} (requestId: ${requestId || 'unknown'})`, {
-                requestId,
-                code: error.code,
-                statusCode: error.statusCode
-            });
+            const errorMessage = `${error.message} (requestId: ${requestId || 'unknown'})`;
+            switch (error.code) {
+                case DECOUPLED_STATE_NOT_ENABLED_CODE:
+                    throw new DecoupledStateNotEnabledError(requestId);
+                default:
+                    throw new UpgradeError(errorMessage, {
+                        requestId,
+                        code: error.code,
+                        statusCode: error.statusCode
+                    });
+            }
         }
         if (!taskId) {
             throw new MissingTaskIdError(error.message);
         }
@@ -548,8 +563,10 @@
           environmentByKey(key: $environmentKey) {
             type
             versions(first: $firstN) {
               nodes {
+                version
+                isLatest
                 requiredProducts
                 permissions {
                   egress {
                     addresses