Skip to content

Commit f88c81a

Browse files
authored
fix(nango): add pagination support for nango listconnections (#3745)
1 parent 575b8ef commit f88c81a

4 files changed

Lines changed: 71 additions & 32 deletions

File tree

backend/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"allowSyntheticDefaultImports": true,
44
"resolveJsonModule": true,
55
"esModuleInterop": true,
6-
"lib": ["es2018", "dom", "ES2021.String"],
6+
"lib": ["es2018", "dom", "ES2021.String", "ES2022.Object"],
77
"module": "commonjs",
88
"moduleResolution": "node",
99
"noUnusedLocals": false,

pnpm-lock.yaml

Lines changed: 56 additions & 27 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

services/libs/nango/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
"@crowd/logging": "workspace:*",
1818
"@crowd/types": "workspace:*",
1919
"@nangohq/frontend": "^0.52.4",
20-
"@nangohq/node": "^0.50.0",
21-
"@nangohq/types": "^0.50.0",
20+
"@nangohq/node": "^0.69.22",
21+
"@nangohq/types": "^0.69.22",
2222
"axios": "^1.8.4"
2323
}
2424
}

services/libs/nango/src/client.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,19 @@ export const getNangoConnectionStatus = async (
115115
export const getNangoConnections = async (): Promise<ApiPublicConnection[]> => {
116116
ensureBackendClient()
117117

118-
const results = await backendClient.listConnections()
118+
const limit = 1000
119+
let page = 0
120+
let hasMore = true
121+
const allConnections: ApiPublicConnection[] = []
122+
123+
while (hasMore) {
124+
const results = await backendClient.listConnections(undefined, undefined, { limit, page })
125+
allConnections.push(...results.connections)
126+
hasMore = results.connections.length === limit
127+
page++
128+
}
119129

120-
return results.connections
130+
return allConnections
121131
}
122132

123133
export const getNangoConnectionData = async (

0 commit comments

Comments
 (0)