@forge/cli-shared
9.7.0-next.14-experimental-fd0ebbc9.7.0-next.16
out/app-logs/graphql-client.js~
out/app-logs/graphql-client.jsModified+27−29
Index: package/out/app-logs/graphql-client.js
===================================================================
--- package/out/app-logs/graphql-client.js
+++ package/out/app-logs/graphql-client.js
@@ -1,8 +1,7 @@
"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,
@@ -50,16 +49,16 @@
logs: result.lines.map(sanitizeLogLine)
};
}
async viewAppLogsV2(details, invocationMap, logLinesWithInvocation, totalRecieved) {
- const query = (0, graphql_1.graphql)(`
+ const query = `
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]
@@ -123,9 +122,9 @@
totalLogs
__typename
}
}
- `);
+ `;
const result = await this.graphqlClient.query(query, details);
if (!result || !result.appLogsWithMetaData || !result.appLogsWithMetaData.appLogs) {
throw new MissingAppLogsError();
}
@@ -172,21 +171,20 @@
const invocations = [...invocationMap.values()];
return details.grouped ? invocations : logLinesWithInvocation;
}
async viewAppLogs(details) {
- const query = (0, graphql_1.graphql)(`
- query forge_cli_getApplicationLogs(
- $appId: ID!
- $environmentId: [ID!]!
- $limit: Int!
- $contextAri: [ID!]
- $startTime: String
- ) {
+ const query = `
+ 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 {
@@ -212,13 +210,10 @@
}
}
}
}
- `);
- const result = await this.graphqlClient.query(query, {
- ...details,
- contextAri: details.contextAri?.map((ari) => String(ari))
- });
+ `;
+ const result = await this.graphqlClient.query(query, details);
if (!result.appLogs || !result.appLogs.nodes) {
throw new MissingAppLogsError();
}
const invocations = [];
@@ -261,11 +256,14 @@
}
return { cursor, lines };
}
async getInvocationLogs(filter) {
- const query = (0, graphql_1.graphql)(`
+ const query = `
query forge_cli_getInvocationLogs($invocationId: ID!, $after: String) {
- appLogLines(after: $after, invocation: $invocationId) {
+ appLogLines(
+ after: $after,
+ invocation: $invocationId
+ ) {
metadata {
id
function {
key
@@ -288,9 +286,9 @@
hasNextPage
}
}
}
- `);
+ `;
const result = await this.graphqlClient.query(query, filter);
if (!result.appLogLines) {
throw new MissingAppLogLinesError();
}