11import { Command } from "@cliffy/command"
2+ import { gql } from "../../__codegen__/gql.ts"
23import { getGraphQLClient } from "../../utils/graphql.ts"
34import { getTimeAgo , padDisplay , truncateText } from "../../utils/display.ts"
45import { resolveProjectId } from "../../utils/linear.ts"
56import { shouldShowSpinner } from "../../utils/hyperlink.ts"
67import { handleError , NotFoundError } from "../../utils/errors.ts"
78
8- interface ProjectUpdateNode {
9- id : string
10- body : string | null
11- health : string | null
12- url : string
13- createdAt : string
14- user : {
15- name : string
16- displayName : string
17- } | null
18- }
19-
20- interface ListProjectUpdatesQueryResult {
21- project : {
22- name : string
23- slugId : string
24- projectUpdates : {
25- nodes : ProjectUpdateNode [ ]
26- } | null
27- } | null
28- }
29-
30- const ListProjectUpdatesQuery = /* GraphQL */ `
9+ const ListProjectUpdatesQuery = gql ( `
3110 query ListProjectUpdates($id: String!, $first: Int) {
3211 project(id: $id) {
3312 name
@@ -44,10 +23,14 @@ const ListProjectUpdatesQuery = /* GraphQL */ `
4423 displayName
4524 }
4625 }
26+ pageInfo {
27+ hasNextPage
28+ endCursor
29+ }
4730 }
4831 }
4932 }
50- `
33+ ` )
5134
5235export const listCommand = new Command ( )
5336 . name ( "list" )
@@ -67,13 +50,10 @@ export const listCommand = new Command()
6750 const resolvedProjectId = await resolveProjectId ( projectId )
6851
6952 const client = getGraphQLClient ( )
70- const result = await client . request < ListProjectUpdatesQueryResult > (
71- ListProjectUpdatesQuery ,
72- {
73- id : resolvedProjectId ,
74- first : limit ,
75- } ,
76- )
53+ const result = await client . request ( ListProjectUpdatesQuery , {
54+ id : resolvedProjectId ,
55+ first : limit ,
56+ } )
7757 spinner ?. stop ( )
7858
7959 const project = result . project
@@ -84,17 +64,7 @@ export const listCommand = new Command()
8464 const updates = project . projectUpdates ?. nodes || [ ]
8565
8666 if ( json ) {
87- console . log ( JSON . stringify (
88- {
89- project : {
90- name : project . name ,
91- slugId : project . slugId ,
92- } ,
93- updates,
94- } ,
95- null ,
96- 2 ,
97- ) )
67+ console . log ( JSON . stringify ( project , null , 2 ) )
9868 return
9969 }
10070
0 commit comments