@forge/cli

14.1.0-next.21-experimental-554d41714.1.0-next.19-experimental-fd0ebbc
out/migration-keys/graphql-client.js
~out/migration-keys/graphql-client.jsModified
+50−25
Index: package/out/migration-keys/graphql-client.js
===================================================================
--- package/out/migration-keys/graphql-client.js
+++ package/out/migration-keys/graphql-client.js
@@ -1,38 +1,61 @@
 "use strict";
 Object.defineProperty(exports, "__esModule", { value: true });
 exports.GraphqlClient = void 0;
 const cli_shared_1 = require("@forge/cli-shared");
+const GET_MIGRATION_KEYS = (0, cli_shared_1.graphql)(`
+  query forge_cli_getMigrationKeys($id: ID!, $key: String!) {
+    app(id: $id) {
+      environmentByKey(key: $key) {
+        id
+        versions(first: 1) {
+          edges {
+            node {
+              isLatest
+              migrationKeys {
+                jira
+                confluence
+              }
+              version
+            }
+          }
+        }
+      }
+    }
+  }
+`);
+const GET_MIGRATION_KEYS_WITH_MARKETPLACE = (0, cli_shared_1.graphql)(`
+  query forge_cli_getMigrationKeysWithMarketplace($id: ID!, $key: String!) {
+    app(id: $id) {
+      environmentByKey(key: $key) {
+        id
+        versions(first: 1) {
+          edges {
+            node {
+              isLatest
+              migrationKeys {
+                jira
+                confluence
+              }
+              version
+            }
+          }
+        }
+      }
+      marketplaceApp {
+        appKey
+      }
+    }
+  }
+`);
 class GraphqlClient {
     graphqlClient;
     constructor(graphqlClient) {
         this.graphqlClient = graphqlClient;
     }
     async getLatestMigrationKeys(appId, environmentKey) {
-        const marketplaceQuery = (0, cli_shared_1.isFedrampEnv)() ? '' : 'marketplaceApp { appKey }';
-        const query = `
-          query forge_cli_getMigrationKeys($id: ID!, $key: String!) {
-            app(id: $id) {
-              environmentByKey(key: $key) {
-                id
-                versions(first: 1) {
-                  edges {
-                    node {
-                      isLatest
-                      migrationKeys {
-                        jira
-                        confluence
-                      }
-                      version
-                    }
-                  }
-                }
-              }
-              ${marketplaceQuery}
-            }
-          }
-     `;
-        const result = await this.graphqlClient.query(query, {
+        const document = (0, cli_shared_1.isFedrampEnv)() ? GET_MIGRATION_KEYS : GET_MIGRATION_KEYS_WITH_MARKETPLACE;
+        const result = await this.graphqlClient.query(document, {
             id: appId,
             key: environmentKey
         });
         if (!result.app) {
@@ -40,9 +63,11 @@
         }
         if (!result.app.environmentByKey) {
             throw new cli_shared_1.MissingAppEnvironmentError(environmentKey);
         }
-        const mpacAppKey = result.app.marketplaceApp?.appKey;
+        const mpacAppKey = 'marketplaceApp' in result.app
+            ? result.app.marketplaceApp?.appKey
+            : undefined;
         const versions = result.app.environmentByKey.versions;
         let isSkeletonVersion = true;
         let migrationKeys;
         for (const edge of versions?.edges || []) {