@forge/cli
14.1.0-next.21-experimental-554d41714.1.0-next.19-experimental-fd0ebbc
out/build/graphql-client.js~
out/build/graphql-client.jsModified+10−17
Index: package/out/build/graphql-client.js
===================================================================
--- package/out/build/graphql-client.js
+++ package/out/build/graphql-client.js
@@ -8,19 +8,11 @@
constructor(graphqlClient) {
this.graphqlClient = graphqlClient;
}
async getAllBuildsByApp(appId, limit) {
- const query = `
- query getBuildsByApp(
- $appId: ID!
- $last: Int
- $before: String
- ) {
- buildsByApp(
- appId: $appId
- last: $last
- before: $before
- ) {
+ const query = (0, cli_shared_1.graphql)(`
+ query getBuildsByApp($appId: ID!, $last: Int, $before: String) {
+ buildsByApp(appId: $appId, last: $last, before: $before) {
nodes {
createdAt
tag
createdByUser {
@@ -39,20 +31,21 @@
}
totalCount
}
}
- `;
+ `);
let hasPreviousPage = true;
let cursor = undefined;
const output = [];
while (hasPreviousPage && (!limit || output.length < limit)) {
const remainingLimit = limit ? limit - output.length : exports.PAGE_SIZE;
const _limit = remainingLimit > 0 ? Math.min(exports.PAGE_SIZE, remainingLimit) : exports.PAGE_SIZE;
- const result = await this.graphqlClient.query(query, {
+ const variables = {
appId,
last: _limit,
before: cursor
- });
+ };
+ const result = await this.graphqlClient.query(query, variables);
if (!result.buildsByApp?.nodes || !result.buildsByApp?.pageInfo) {
throw new cli_shared_1.MissingAppError();
}
const { nodes, pageInfo } = result.buildsByApp;
@@ -64,19 +57,19 @@
output.push({
createdAt: node.createdAt,
tag: node.tag,
createdBy: {
- name: node.createdByUser?.name,
- email: node.createdByUser?.email || null
+ name: node.createdByUser.name,
+ email: 'email' in node.createdByUser ? node.createdByUser.email || undefined : undefined
}
});
if (limit && output.length >= limit) {
break;
}
}
}
hasPreviousPage = pageInfo.hasPreviousPage;
- cursor = pageInfo.endCursor;
+ cursor = pageInfo.endCursor ?? undefined;
}
return output;
}
}