@forge/cli

13.3.0-next.12-experimental-4b981ef-experimental-5b8eb3c13.3.0-next.25
out/manifest/render.js
+out/manifest/render.jsNew file
+52
Index: package/out/manifest/render.js
===================================================================
--- package/out/manifest/render.js
+++ package/out/manifest/render.js
@@ -0,0 +1,52 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.ManifestRenderCommand = exports.MissingAppManifestTransformationError = void 0;
+const cli_shared_1 = require("@forge/cli-shared");
+class MissingAppManifestTransformationError extends Error {
+    constructor() {
+        super(cli_shared_1.Text.manifest.render.errorMissingTransformation);
+    }
+}
+exports.MissingAppManifestTransformationError = MissingAppManifestTransformationError;
+class ManifestRenderCommand {
+    graphqlClient;
+    getAppConfig;
+    configFile;
+    constructor(graphqlClient, getAppConfig, configFile) {
+        this.graphqlClient = graphqlClient;
+        this.getAppConfig = getAppConfig;
+        this.configFile = configFile;
+    }
+    async execute({ environment, placement }) {
+        const [{ id: appId }, manifest] = await Promise.all([this.getAppConfig(), this.configFile.readConfig()]);
+        const query = `
+      query forge_cli_appManifestTransformation(
+        $appId: ID!
+        $environmentKey: String!
+        $manifest: JSON!
+        $contextFilter: AppManifestTransformationContextFilter
+      ) {
+        appManifestTransformation(
+          appId: $appId
+          environmentKey: $environmentKey
+          manifest: $manifest
+          contextFilter: $contextFilter
+        ) {
+          manifest
+        }
+      }
+    `;
+        const { appManifestTransformation } = await this.graphqlClient.query(query, {
+            appId,
+            environmentKey: environment,
+            manifest,
+            contextFilter: placement ? { placement } : undefined
+        });
+        if (!appManifestTransformation?.manifest) {
+            throw new MissingAppManifestTransformationError();
+        }
+        return appManifestTransformation.manifest;
+    }
+}
+exports.ManifestRenderCommand = ManifestRenderCommand;
+//# sourceMappingURL=render.js.map
\ No newline at end of file