Skip to content

Commit dcc807d

Browse files
committed
Linear getAll type error (weirdly not in VSCode…) and removed the pagination example that uses the SDK as won’t work with timeouts
1 parent b5e37bf commit dcc807d

File tree

6 files changed

+29
-68
lines changed

6 files changed

+29
-68
lines changed

docs/integrations/apis/linear.mdx

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,10 @@ client.defineJob({
124124

125125
### Pagination
126126

127-
You can paginate responses three different ways:
127+
You can paginate responses two different ways:
128128

129-
1. Via the raw Linear SDK exposed in `io.runTask()`
130-
2. Iterating the same integration task with different params
131-
3. Using the `getAll` helper exposed on the integration (**recommended!**)
129+
1. Iterating the same integration task with different params
130+
2. Using the `getAll` helper exposed on the integration (**recommended!**)
132131

133132
_When ordering results, make sure to use the `PaginationOrderBy` enum._
134133

@@ -149,20 +148,7 @@ client.defineJob({
149148
//the same params will be used for all tasks
150149
const params = { first: 5, orderBy: PaginationOrderBy.UpdatedAt };
151150

152-
//1. Linear SDK
153-
const sdkIssues = await io.linear.runTask("all-issues-via-sdk", async (client) => {
154-
const edges = await client.issues(params);
155-
156-
//this will keep appending nodes until there are no more
157-
while (edges.pageInfo.hasNextPage) {
158-
await edges.fetchNext();
159-
}
160-
161-
//use serialization helper to remove functions etc
162-
return serializeLinearOutput(edges.nodes);
163-
});
164-
165-
//2. Linear integration - no pagination helper
151+
//1. Linear integration - no pagination helper
166152
let edges = await io.linear.issues("get-issues", params);
167153
let noHelper = edges.nodes;
168154

@@ -174,7 +160,7 @@ client.defineJob({
174160
noHelper = noHelper.concat(edges.nodes);
175161
}
176162

177-
//3. Linear integration - with the pagination helper
163+
//2. Linear integration - with the pagination helper
178164
const withHelper = await io.linear.getAll(io.linear.issues, "get-all", params);
179165

180166
return {

integrations/linear/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"dist/index.js.map"
1414
],
1515
"devDependencies": {
16+
"@trigger.dev/tsconfig": "workspace:*",
1617
"@types/node": "16.x",
1718
"rimraf": "^3.0.2",
1819
"tsup": "7.1.x",
@@ -33,4 +34,4 @@
3334
"engines": {
3435
"node": ">=16.8.0"
3536
}
36-
}
37+
}

integrations/linear/src/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ export class Linear implements TriggerIntegration {
184184
key: IntegrationTaskKey,
185185
params: Nullable<QueryVariables> = {}
186186
): Promise<Awaited<ReturnType<TTask>>["nodes"]> {
187-
const boundTask = task.bind(this);
187+
const boundTask = task.bind(this as any);
188188

189189
let edges = await boundTask(`${key}-0`, params);
190190
let nodes = edges.nodes;
@@ -286,7 +286,7 @@ export class Linear implements TriggerIntegration {
286286
messageId: string;
287287
url: string;
288288
variables?: Omit<
289-
L.AttachmentLinkDiscordMutationVariables,
289+
L.AttachmentLinkDiscordMutationVariables,
290290
"channelId" | "issueId" | "messageId" | "url"
291291
>;
292292
}
@@ -406,7 +406,7 @@ export class Linear implements TriggerIntegration {
406406
latest: string;
407407
url: string;
408408
variables?: Omit<
409-
L.AttachmentLinkSlackMutationVariables,
409+
L.AttachmentLinkSlackMutationVariables,
410410
"channel" | "issueId" | "latest" | "url"
411411
>;
412412
}
@@ -2026,4 +2026,4 @@ export const serializeLinearOutput = <T>(obj: T): Prettify<SerializedLinearOutpu
20262026

20272027
export { events };
20282028

2029-
export const PaginationOrderBy = L.PaginationOrderBy
2029+
export const PaginationOrderBy = L.PaginationOrderBy;

integrations/linear/tsconfig.json

Lines changed: 13 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,18 @@
11
{
2+
"extends": "@trigger.dev/tsconfig/node18.json",
3+
"include": ["./src/**/*.ts", "tsup.config.ts"],
24
"compilerOptions": {
3-
"composite": false,
5+
"lib": ["DOM", "DOM.Iterable", "ES2019"],
6+
"paths": {
7+
"@trigger.dev/sdk/*": ["../../packages/trigger-sdk/src/*"],
8+
"@trigger.dev/sdk": ["../../packages/trigger-sdk/src/index"],
9+
"@trigger.dev/integration-kit/*": ["../../packages/integration-kit/src/*"],
10+
"@trigger.dev/integration-kit": ["../../packages/integration-kit/src/index"]
11+
},
412
"declaration": false,
513
"declarationMap": false,
6-
"esModuleInterop": true,
7-
"forceConsistentCasingInFileNames": true,
8-
"inlineSources": false,
9-
"isolatedModules": true,
10-
"moduleResolution": "node16",
11-
"noUnusedLocals": false,
12-
"noUnusedParameters": false,
13-
"preserveWatchOutput": true,
14-
"skipLibCheck": true,
15-
"strict": true,
16-
"experimentalDecorators": true,
17-
"emitDecoratorMetadata": true,
18-
"sourceMap": true,
19-
"resolveJsonModule": true,
20-
"lib": [
21-
"es2019"
22-
],
23-
"module": "commonjs",
24-
"target": "es2021"
14+
"baseUrl": ".",
15+
"stripInternal": true
2516
},
26-
"include": [
27-
"./src/**/*.ts",
28-
"tsup.config.ts"
29-
],
30-
"exclude": [
31-
"node_modules"
32-
]
33-
}
17+
"exclude": ["node_modules"]
18+
}

pnpm-lock.yaml

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

references/job-catalog/src/linear.ts

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -121,20 +121,7 @@ client.defineJob({
121121
//the same params will be used for all tasks
122122
const params = { first: 5, orderBy: PaginationOrderBy.UpdatedAt };
123123

124-
//1. Linear SDK
125-
const sdkIssues = await io.linear.runTask("all-issues-via-sdk", async (client) => {
126-
const edges = await client.issues(params);
127-
128-
//this will keep appending nodes until there are no more
129-
while (edges.pageInfo.hasNextPage) {
130-
await edges.fetchNext();
131-
}
132-
133-
//use serialization helper to remove functions etc
134-
return serializeLinearOutput(edges.nodes);
135-
});
136-
137-
//2. Linear integration - no pagination helper
124+
//1. Linear integration - no pagination helper
138125
let edges = await io.linear.issues("get-issues", params);
139126
let noHelper = edges.nodes;
140127

@@ -146,12 +133,12 @@ client.defineJob({
146133
noHelper = noHelper.concat(edges.nodes);
147134
}
148135

149-
//3. Linear integration - with the pagination helper
136+
//2. Linear integration - with the pagination helper
150137
const withHelper = await io.linear.getAll(io.linear.issues, "get-all", params);
151138

152139
return {
153140
issueCounts: {
154-
withSdk: sdkIssues.length,
141+
// withSdk: sdkIssues.length,
155142
noHelper: noHelper.length,
156143
withHelper: withHelper.length,
157144
},

0 commit comments

Comments
 (0)