@@ -17,6 +17,7 @@ import {
1717 Comment ,
1818 CommentConnection ,
1919 CommentPayload ,
20+ Connection ,
2021 CreateOrJoinOrganizationResponse ,
2122 CycleArchivePayload ,
2223 CyclePayload ,
@@ -42,6 +43,7 @@ import {
4243 IssueRelationPayload ,
4344 IssueSearchPayload ,
4445 LinearClient ,
46+ LinearDocument ,
4547 LinearError ,
4648 Notification ,
4749 NotificationArchivePayload ,
@@ -80,8 +82,6 @@ import {
8082 WorkflowStateConnection ,
8183 WorkflowStatePayload ,
8284} from "@linear/sdk" ;
83- import * as events from "./events" ;
84- import { TriggerParams , Webhooks , createTrigger , createWebhookEventSource } from "./webhooks" ;
8585import {
8686 ArchiveIssueMutationVariables ,
8787 ArchiveProjectMutationVariables ,
@@ -139,8 +139,11 @@ import {
139139 WorkflowStateCreateInput ,
140140 WorkflowStatesQueryVariables ,
141141} from "@linear/sdk/dist/_generated_documents" ;
142+
143+ import * as events from "./events" ;
142144import { AwaitNested , LinearReturnType , SerializedLinearOutput } from "./types" ;
143- import { queryProperties } from "./utils" ;
145+ import { Nullable , QueryVariables , queryProperties } from "./utils" ;
146+ import { TriggerParams , Webhooks , createTrigger , createWebhookEventSource } from "./webhooks" ;
144147
145148export type LinearIntegrationOptions = {
146149 id : string ;
@@ -228,6 +231,29 @@ export class Linear implements TriggerIntegration {
228231 ) ;
229232 }
230233
234+ async getAll <
235+ TTask extends (
236+ key : IntegrationTaskKey ,
237+ params : Partial < Nullable < QueryVariables > >
238+ ) => LinearReturnType < Connection < unknown > > ,
239+ > (
240+ task : TTask ,
241+ key : IntegrationTaskKey ,
242+ params : Nullable < QueryVariables > = { }
243+ ) : Promise < Awaited < ReturnType < TTask > > [ "nodes" ] > {
244+ const boundTask = task . bind ( this ) ;
245+
246+ let edges = await boundTask ( `${ key } -0` , params ) ;
247+ let nodes = edges . nodes ;
248+
249+ for ( let i = 1 ; edges . pageInfo . hasNextPage ; i ++ ) {
250+ edges = await boundTask ( `${ key } -${ i } ` , { ...params , after : edges . pageInfo . endCursor } ) ;
251+ nodes = nodes . concat ( edges . nodes ) ;
252+ }
253+
254+ return nodes ;
255+ }
256+
231257 attachment ( key : IntegrationTaskKey , params : { id : string } ) : LinearReturnType < Attachment > {
232258 return this . runTask (
233259 key ,
@@ -2056,3 +2082,5 @@ export const serializeLinearOutput = <T>(obj: T): Prettify<SerializedLinearOutpu
20562082} ;
20572083
20582084export { events } ;
2085+
2086+ export const PaginationOrderBy = LinearDocument . PaginationOrderBy
0 commit comments