@forge/cli-shared

9.7.0-next.15-experimental-554d4179.7.0-next.14-experimental-fd0ebbc
out/app-logs/graphql-client.js
~out/app-logs/graphql-client.jsModified
+29−27
Index: package/out/app-logs/graphql-client.js
===================================================================
--- package/out/app-logs/graphql-client.js
+++ package/out/app-logs/graphql-client.js
@@ -1,7 +1,8 @@
 "use strict";
 Object.defineProperty(exports, "__esModule", { value: true });
 exports.LogsGraphQLClient = exports.MissingMetadataError = exports.MissingInvocationError = exports.MissingAppLogLinesError = exports.MissingAppLogsError = void 0;
+const graphql_1 = require("../graphql");
 const sanitizeLogLine = (line) => ({
     timestamp: line.timestamp,
     level: line.level || undefined,
     message: line.message || undefined,
@@ -49,16 +50,16 @@
             logs: result.lines.map(sanitizeLogLine)
         };
     }
     async viewAppLogsV2(details, invocationMap, logLinesWithInvocation, totalRecieved) {
-        const query = `
+        const query = (0, graphql_1.graphql)(`
       query forge_cli_getApplicationLogsV2(
-        $appId: String!,
-        $environmentId: String!,
-        $dateSearchInput: DateSearchInput,
-        $offset: Int!,
-        $limit: Int!,
-        $queryStartTime: String!,
+        $appId: String!
+        $environmentId: String!
+        $dateSearchInput: DateSearchInput
+        $offset: Int!
+        $limit: Int!
+        $queryStartTime: String!
         $runtime: String
         $functionKeys: [String]
         $containers: [String]
         $instances: [String]
@@ -122,9 +123,9 @@
           totalLogs
           __typename
         }
       }
-    `;
+    `);
         const result = await this.graphqlClient.query(query, details);
         if (!result || !result.appLogsWithMetaData || !result.appLogsWithMetaData.appLogs) {
             throw new MissingAppLogsError();
         }
@@ -171,20 +172,21 @@
         const invocations = [...invocationMap.values()];
         return details.grouped ? invocations : logLinesWithInvocation;
     }
     async viewAppLogs(details) {
-        const query = `
-      query forge_cli_getApplicationLogs($appId: ID!, $environmentId: [ID!]!, $limit: Int!, $contextAri: [ID!], $startTime: String) {
+        const query = (0, graphql_1.graphql)(`
+      query forge_cli_getApplicationLogs(
+        $appId: ID!
+        $environmentId: [ID!]!
+        $limit: Int!
+        $contextAri: [ID!]
+        $startTime: String
+      ) {
         appLogs(
-          appId: $appId,
-          environmentId: $environmentId,
-          last: $limit,
-          query: {
-            installationContexts: $contextAri,
-            dates: {
-              earliestStart: $startTime
-            }
-          }
+          appId: $appId
+          environmentId: $environmentId
+          last: $limit
+          query: { installationContexts: $contextAri, dates: { earliestStart: $startTime } }
         ) {
           nodes {
             id
             function {
@@ -210,10 +212,13 @@
             }
           }
         }
       }
-    `;
-        const result = await this.graphqlClient.query(query, details);
+    `);
+        const result = await this.graphqlClient.query(query, {
+            ...details,
+            contextAri: details.contextAri?.map((ari) => String(ari))
+        });
         if (!result.appLogs || !result.appLogs.nodes) {
             throw new MissingAppLogsError();
         }
         const invocations = [];
@@ -256,14 +261,11 @@
         }
         return { cursor, lines };
     }
     async getInvocationLogs(filter) {
-        const query = `
+        const query = (0, graphql_1.graphql)(`
       query forge_cli_getInvocationLogs($invocationId: ID!, $after: String) {
-        appLogLines(
-          after: $after,
-          invocation: $invocationId
-        ) {
+        appLogLines(after: $after, invocation: $invocationId) {
           metadata {
             id
             function {
               key
@@ -286,9 +288,9 @@
             hasNextPage
           }
         }
       }
-    `;
+    `);
         const result = await this.graphqlClient.query(query, filter);
         if (!result.appLogLines) {
             throw new MissingAppLogLinesError();
         }