npm package diff

Package: @forge/cli

Versions: 11.4.0-next.1-experimental-5364136 - 11.4.0-next.14

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
@@ -310,14 +310,14 @@
             }
         }
         return uninstallsResult;
     }
-    async listInstallations(appId) {
-        const installations = await this.getAllInstallations(appId);
+    async listInstallations(appId, installationFilterOptions) {
+        const installations = await this.getAllInstallations(appId, installationFilterOptions);
         return await this.resolveInstallationsHostnames(installations);
     }
     async getInstallation(appId, installationId) {
-        const installations = await this.listInstallations(appId);
+        const installations = await this.listInstallations(appId, { installationId });
         const matchedInstallation = installations.find(({ id }) => id === installationId);
         if (matchedInstallation) {
             return matchedInstallation;
         }
@@ -447,9 +447,9 @@
                 version: appEnvironmentVersion
             };
         });
     }
-    async getAllInstallations(appId) {
+    async getAllInstallations(appId, installationFilterOptions) {
         const query = `
       query forge_cli_getEcosystemInstallationsByApp($filter: AppInstallationsByAppFilter!, $first: Int, $after: String) {
         ecosystem {
           appInstallationsByApp(filter: $filter, first: $first, after: $after) {
@@ -482,14 +482,11 @@
         const output = [];
         let cursor = undefined;
         let hasNext = undefined;
         do {
+            const filter = await InstallationsGraphqlClient.buildInstallationsFilter(appId, installationFilterOptions, this.buildInstallationContext.bind(this));
             const result = (await this.graphqlClient.query(query, {
-                filter: {
-                    apps: {
-                        ids: [appId]
-                    }
-                },
+                filter,
                 first: 100,
                 after: cursor
             }));
             if (!result?.ecosystem?.appInstallationsByApp?.nodes) {
@@ -512,8 +509,29 @@
             hasNext = pageInfo.hasNextPage;
         } while (hasNext && cursor);
         return output;
     }
+    static async buildInstallationsFilter(appId, installationFilterOptions, buildInstallationContext) {
+        const filter = {
+            apps: {
+                ids: [appId]
+            }
+        };
+        if (installationFilterOptions?.environment) {
+            filter.appEnvironments = { types: [(0, cli_shared_1.guessEnvironmentType)(installationFilterOptions.environment)] };
+        }
+        if (installationFilterOptions?.site && installationFilterOptions?.product) {
+            const workspaceAri = await buildInstallationContext(installationFilterOptions.product, installationFilterOptions.site);
+            filter.appInstallations = { contexts: [workspaceAri] };
+        }
+        if (installationFilterOptions?.installationId) {
+            filter.appInstallations = {
+                ...filter.appInstallations,
+                ids: [installationFilterOptions.installationId]
+            };
+        }
+        return filter;
+    }
     async getVersions(appId, environmentKey, firstN = 1) {
         const query = `
       query forge_cli_getApplicationEnvironmentLatestVersions($appId: ID!, $environmentKey: String!, $firstN: Int!) {
         app(id: $appId) {