@forge/cli

14.1.0-next.1-experimental-13c2f8d14.1.0-next.21-experimental-554d417
out/containers/container-command.js
~out/containers/container-command.jsModified
+34−18
Index: package/out/containers/container-command.js
===================================================================
--- package/out/containers/container-command.js
+++ package/out/containers/container-command.js
@@ -1,8 +1,9 @@
 "use strict";
 Object.defineProperty(exports, "__esModule", { value: true });
 exports.ContainerCommand = exports.UnexpectedAppContainerServicesError = exports.UnexpectedAppContainerRegistryLoginError = void 0;
 const cli_shared_1 = require("@forge/cli-shared");
+const PLACEMENTS_PER_PAGE = 5;
 class UnexpectedAppContainerRegistryLoginError extends Error {
     constructor() {
         super('Unable to retrieve app container registry login details');
     }
@@ -70,15 +71,16 @@
             appId
         });
         return appContainers ?? [];
     }
-    async getContainerServiceDetails(environmentKey, serviceNames, shard) {
+    async getContainerServiceDetails(environmentKey, serviceNames, placementId) {
         const { id: appId } = await this.getAppConfig();
         const query = `
-      query forge_cli_appContainerServices($appId: ID!, $environmentKey: String!, $serviceNames: [String!]!, $contextFilter: AppContainerServiceContextFilter) {
-        appContainerServices(appId: $appId, environmentKey: $environmentKey, serviceNames: $serviceNames, contextFilter: $contextFilter) {
+      query forge_cli_appContainerServices($appId: ID!, $environmentKey: String!, $serviceNames: [String!]!, $contextFilter: AppContainerServiceContextFilter, $first: Int, $after: String) {
+        appContainerServices(appId: $appId, environmentKey: $environmentKey, serviceNames: $serviceNames, contextFilter: $contextFilter, first: $first, after: $after) {
           services {
             key
+            placementAri
             runningCount
             pendingCount
             maxCount
             minCount
@@ -99,25 +101,39 @@
                 instance
               }
             }
           }
+          pageInfo {
+            hasNextPage
+            endCursor
+          }
         }
       }`;
-        const { appContainerServices } = await this.client.query(query, {
-            appId,
-            environmentKey,
-            serviceNames,
-            contextFilter: shard
-                ? {
-                    type: cli_shared_1.AppContainerServiceContextFilterType.ShardContext,
-                    value: shard
-                }
-                : undefined
-        });
-        if (!appContainerServices) {
-            throw new UnexpectedAppContainerServicesError();
-        }
-        return appContainerServices;
+        const contextFilter = placementId
+            ? {
+                type: cli_shared_1.AppContainerServiceContextFilterType.Placement,
+                value: (0, cli_shared_1.placementIdToAriString)(placementId)
+            }
+            : undefined;
+        const services = [];
+        let after;
+        do {
+            const { appContainerServices } = await this.client.query(query, {
+                appId,
+                environmentKey,
+                serviceNames,
+                contextFilter,
+                first: PLACEMENTS_PER_PAGE,
+                after
+            });
+            if (!appContainerServices) {
+                throw new UnexpectedAppContainerServicesError();
+            }
+            services.push(...(appContainerServices.services ?? []));
+            const { hasNextPage, endCursor } = appContainerServices.pageInfo;
+            after = hasNextPage ? endCursor ?? undefined : undefined;
+        } while (after);
+        return services;
     }
     async deleteContainer(key) {
         const { id: appId } = await this.getAppConfig();
         const mutation = `