@pipedream/linear_app 0.7.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/actions/create-issue/create-issue.mjs +1 -1
- package/actions/get-issue/get-issue.mjs +1 -1
- package/actions/get-teams/get-teams.mjs +17 -2
- package/actions/search-issues/search-issues.mjs +51 -8
- package/actions/update-issue/update-issue.mjs +1 -1
- package/common/constants.mjs +2 -0
- package/common/utils.mjs +11 -1
- package/linear_app.app.mjs +8 -1
- package/package.json +1 -1
- package/sources/comment-created-instant/comment-created-instant.mjs +1 -1
- package/sources/common/webhook.mjs +11 -0
- package/sources/issue-created-instant/issue-created-instant.mjs +1 -1
- package/sources/issue-updated-instant/issue-updated-instant.mjs +1 -1
- package/sources/new-issue-status-updated/new-issue-status-updated.mjs +5 -2
- package/sources/new-projectupdate-created/new-projectupdate-created.mjs +1 -1
- package/sources/project-updated-instant/project-updated-instant.mjs +1 -1
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
key: "linear_app-create-issue",
|
|
6
6
|
name: "Create Issue",
|
|
7
7
|
description: "Create an issue (API Key). See the docs [here](https://developers.linear.app/docs/graphql/working-with-the-graphql-api#creating-and-editing-issues)",
|
|
8
|
-
version: "0.4.
|
|
8
|
+
version: "0.4.8",
|
|
9
9
|
props: {
|
|
10
10
|
linearApp,
|
|
11
11
|
teamId: {
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "linear_app-get-issue",
|
|
5
5
|
name: "Get Issue",
|
|
6
6
|
description: "Get an issue by ID (API Key). See the docs [here](https://developers.linear.app/docs/graphql/working-with-the-graphql-api)",
|
|
7
|
-
version: "0.1.
|
|
7
|
+
version: "0.1.8",
|
|
8
8
|
type: "action",
|
|
9
9
|
props: {
|
|
10
10
|
linearApp,
|
|
@@ -1,16 +1,31 @@
|
|
|
1
1
|
import linearApp from "../../linear_app.app.mjs";
|
|
2
|
+
import constants from "../../common/constants.mjs";
|
|
2
3
|
|
|
3
4
|
export default {
|
|
4
5
|
key: "linear_app-get-teams",
|
|
5
6
|
name: "Get Teams",
|
|
6
7
|
description: "Get all the teams (API Key). See the docs [here](https://developers.linear.app/docs/graphql/working-with-the-graphql-api)",
|
|
7
|
-
version: "0.2.
|
|
8
|
+
version: "0.2.8",
|
|
8
9
|
type: "action",
|
|
9
10
|
props: {
|
|
10
11
|
linearApp,
|
|
12
|
+
limit: {
|
|
13
|
+
propDefinition: [
|
|
14
|
+
linearApp,
|
|
15
|
+
"limit",
|
|
16
|
+
],
|
|
17
|
+
description: "Maximum number of teams to return. Defaults to 20 if not specified.",
|
|
18
|
+
},
|
|
11
19
|
},
|
|
12
20
|
async run({ $ }) {
|
|
13
|
-
|
|
21
|
+
// Use the specified limit or default to a reasonable number
|
|
22
|
+
const limit = this.limit || constants.DEFAULT_NO_QUERY_LIMIT;
|
|
23
|
+
|
|
24
|
+
const variables = {
|
|
25
|
+
first: limit,
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const { nodes: teams } = await this.linearApp.listTeams(variables);
|
|
14
29
|
|
|
15
30
|
$.export("$summary", `Found ${teams.length} teams(s)`);
|
|
16
31
|
|
|
@@ -1,32 +1,43 @@
|
|
|
1
1
|
import linearApp from "../../linear_app.app.mjs";
|
|
2
2
|
import utils from "../../common/utils.mjs";
|
|
3
|
+
import constants from "../../common/constants.mjs";
|
|
3
4
|
|
|
4
5
|
export default {
|
|
5
6
|
key: "linear_app-search-issues",
|
|
6
7
|
name: "Search Issues",
|
|
7
8
|
description: "Search issues (API Key). See the docs [here](https://developers.linear.app/docs/graphql/working-with-the-graphql-api)",
|
|
8
9
|
type: "action",
|
|
9
|
-
version: "0.2.
|
|
10
|
+
version: "0.2.8",
|
|
10
11
|
props: {
|
|
11
12
|
linearApp,
|
|
12
|
-
|
|
13
|
+
teamId: {
|
|
13
14
|
propDefinition: [
|
|
14
15
|
linearApp,
|
|
15
|
-
"
|
|
16
|
+
"teamId",
|
|
16
17
|
],
|
|
17
18
|
},
|
|
18
|
-
|
|
19
|
+
projectId: {
|
|
19
20
|
propDefinition: [
|
|
20
21
|
linearApp,
|
|
21
|
-
"
|
|
22
|
+
"projectId",
|
|
23
|
+
],
|
|
24
|
+
},
|
|
25
|
+
query: {
|
|
26
|
+
propDefinition: [
|
|
27
|
+
linearApp,
|
|
28
|
+
"query",
|
|
22
29
|
],
|
|
23
30
|
optional: true,
|
|
24
31
|
},
|
|
25
|
-
|
|
32
|
+
stateId: {
|
|
26
33
|
propDefinition: [
|
|
27
34
|
linearApp,
|
|
28
|
-
"
|
|
35
|
+
"stateId",
|
|
36
|
+
({ teamId }) => ({
|
|
37
|
+
teamId,
|
|
38
|
+
}),
|
|
29
39
|
],
|
|
40
|
+
description: "Filter issues by their workflow state (status). States are scoped to the selected team.",
|
|
30
41
|
},
|
|
31
42
|
assigneeId: {
|
|
32
43
|
propDefinition: [
|
|
@@ -52,13 +63,36 @@ export default {
|
|
|
52
63
|
"includeArchived",
|
|
53
64
|
],
|
|
54
65
|
},
|
|
66
|
+
limit: {
|
|
67
|
+
propDefinition: [
|
|
68
|
+
linearApp,
|
|
69
|
+
"limit",
|
|
70
|
+
],
|
|
71
|
+
},
|
|
55
72
|
},
|
|
56
73
|
async run({ $ }) {
|
|
57
74
|
const issues = [];
|
|
58
75
|
let hasNextPage;
|
|
59
76
|
let after;
|
|
60
77
|
|
|
78
|
+
// Determine the overall max limit for all pages combined
|
|
79
|
+
const maxLimit = this.limit || (this.query
|
|
80
|
+
? constants.DEFAULT_MAX_RECORDS
|
|
81
|
+
: constants.DEFAULT_NO_QUERY_LIMIT);
|
|
82
|
+
|
|
83
|
+
// For pagination, we'll use a smaller page size
|
|
84
|
+
const pageSize = Math.min(maxLimit, constants.DEFAULT_LIMIT);
|
|
85
|
+
|
|
61
86
|
do {
|
|
87
|
+
// If we've already reached our limit, stop fetching more data
|
|
88
|
+
if (issues.length >= maxLimit) {
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Calculate how many more items we need for this page
|
|
93
|
+
const remainingNeeded = maxLimit - issues.length;
|
|
94
|
+
const thisPageLimit = Math.min(pageSize, remainingNeeded);
|
|
95
|
+
|
|
62
96
|
const variables = utils.buildVariables(after, {
|
|
63
97
|
filter: {
|
|
64
98
|
query: this.query,
|
|
@@ -66,10 +100,19 @@ export default {
|
|
|
66
100
|
projectId: this.projectId,
|
|
67
101
|
assigneeId: this.assigneeId,
|
|
68
102
|
issueLabels: this.issueLabels,
|
|
103
|
+
state: this.stateId
|
|
104
|
+
? {
|
|
105
|
+
id: {
|
|
106
|
+
eq: this.stateId,
|
|
107
|
+
},
|
|
108
|
+
}
|
|
109
|
+
: undefined,
|
|
69
110
|
},
|
|
70
111
|
orderBy: this.orderBy,
|
|
71
112
|
includeArchived: this.includeArchived,
|
|
113
|
+
limit: thisPageLimit, // Use calculated limit for this page
|
|
72
114
|
});
|
|
115
|
+
|
|
73
116
|
const {
|
|
74
117
|
nodes,
|
|
75
118
|
pageInfo,
|
|
@@ -78,7 +121,7 @@ export default {
|
|
|
78
121
|
issues.push(...nodes);
|
|
79
122
|
after = pageInfo.endCursor;
|
|
80
123
|
hasNextPage = pageInfo.hasNextPage;
|
|
81
|
-
} while (hasNextPage);
|
|
124
|
+
} while (hasNextPage && issues.length < maxLimit);
|
|
82
125
|
|
|
83
126
|
$.export("$summary", `Found ${issues.length} issues`);
|
|
84
127
|
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
name: "Update Issue",
|
|
6
6
|
description: "Update an issue (API Key). See the docs [here](https://developers.linear.app/docs/graphql/working-with-the-graphql-api#creating-and-editing-issues)",
|
|
7
7
|
type: "action",
|
|
8
|
-
version: "0.1.
|
|
8
|
+
version: "0.1.8",
|
|
9
9
|
props: {
|
|
10
10
|
linearApp,
|
|
11
11
|
teamId: {
|
package/common/constants.mjs
CHANGED
|
@@ -2,6 +2,7 @@ const WEBHOOK_ID = "webhookId";
|
|
|
2
2
|
const LINEAR_DELIVERY_HEADER = "linear-delivery";
|
|
3
3
|
const DEFAULT_LIMIT = 100;
|
|
4
4
|
const DEFAULT_MAX_RECORDS = 200;
|
|
5
|
+
const DEFAULT_NO_QUERY_LIMIT = 20;
|
|
5
6
|
|
|
6
7
|
const ACTION = {
|
|
7
8
|
CREATE: "create",
|
|
@@ -49,6 +50,7 @@ export default {
|
|
|
49
50
|
LINEAR_DELIVERY_HEADER,
|
|
50
51
|
DEFAULT_LIMIT,
|
|
51
52
|
DEFAULT_MAX_RECORDS,
|
|
53
|
+
DEFAULT_NO_QUERY_LIMIT,
|
|
52
54
|
ACTION,
|
|
53
55
|
RESOURCE_TYPE,
|
|
54
56
|
RESOURCE_TYPES,
|
package/common/utils.mjs
CHANGED
|
@@ -59,7 +59,17 @@ function buildVariables(endCursor, args) {
|
|
|
59
59
|
const after = endCursor
|
|
60
60
|
? `, after: "${endCursor}"`
|
|
61
61
|
: "";
|
|
62
|
-
|
|
62
|
+
// Determine the appropriate limit:
|
|
63
|
+
// 1. Use custom limit if provided
|
|
64
|
+
// 2. Use a smaller default limit when no query is provided to avoid returning too many results
|
|
65
|
+
// 3. Otherwise use the standard default limit
|
|
66
|
+
const limit = args.limit
|
|
67
|
+
? args.limit
|
|
68
|
+
: (args.filter.query
|
|
69
|
+
? constants.DEFAULT_LIMIT
|
|
70
|
+
: constants.DEFAULT_NO_QUERY_LIMIT);
|
|
71
|
+
|
|
72
|
+
return strToObj(`{ filter: { ${filter} }, first: ${limit}${orderBy}${includeArchived}${after} }`);
|
|
63
73
|
}
|
|
64
74
|
|
|
65
75
|
export default {
|
package/linear_app.app.mjs
CHANGED
|
@@ -164,7 +164,8 @@ export default {
|
|
|
164
164
|
query: {
|
|
165
165
|
type: "string",
|
|
166
166
|
label: "Query",
|
|
167
|
-
description: "Search string to look for",
|
|
167
|
+
description: "Search string to look for in issue titles. The query is used to filter issues where the title contains the query text (case insensitive).",
|
|
168
|
+
optional: true,
|
|
168
169
|
},
|
|
169
170
|
orderBy: {
|
|
170
171
|
type: "string",
|
|
@@ -179,6 +180,12 @@ export default {
|
|
|
179
180
|
description: "Should archived resources be included? (default: `false`)",
|
|
180
181
|
optional: true,
|
|
181
182
|
},
|
|
183
|
+
limit: {
|
|
184
|
+
type: "integer",
|
|
185
|
+
label: "Limit",
|
|
186
|
+
description: "Maximum number of issues to return. If no query is provided, this defaults to 20 to avoid returning too many results.",
|
|
187
|
+
optional: true,
|
|
188
|
+
},
|
|
182
189
|
},
|
|
183
190
|
methods: {
|
|
184
191
|
getAxiosHeaders() {
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@ export default {
|
|
|
7
7
|
name: "New Created Comment (Instant)",
|
|
8
8
|
description: "Emit new event when a new comment is created. [See the documentation](https://developers.linear.app/docs/graphql/webhooks)",
|
|
9
9
|
type: "source",
|
|
10
|
-
version: "0.1.
|
|
10
|
+
version: "0.1.10",
|
|
11
11
|
dedupe: "unique",
|
|
12
12
|
methods: {
|
|
13
13
|
...common.methods,
|
|
@@ -21,6 +21,13 @@ export default {
|
|
|
21
21
|
"projectId",
|
|
22
22
|
],
|
|
23
23
|
},
|
|
24
|
+
limit: {
|
|
25
|
+
propDefinition: [
|
|
26
|
+
linearApp,
|
|
27
|
+
"limit",
|
|
28
|
+
],
|
|
29
|
+
description: "Maximum number of items to return when polling. Defaults to 20 if not specified.",
|
|
30
|
+
},
|
|
24
31
|
db: "$.service.db",
|
|
25
32
|
},
|
|
26
33
|
async additionalProps() {
|
|
@@ -102,10 +109,14 @@ export default {
|
|
|
102
109
|
return data?.user?.admin;
|
|
103
110
|
},
|
|
104
111
|
async emitPolledResources() {
|
|
112
|
+
// Use the specified limit or default to a reasonable number
|
|
113
|
+
const maxLimit = this.limit || constants.DEFAULT_NO_QUERY_LIMIT;
|
|
114
|
+
|
|
105
115
|
const stream = this.linearApp.paginateResources({
|
|
106
116
|
resourcesFn: this.getResourcesFn(),
|
|
107
117
|
resourcesFnArgs: this.getResourcesFnArgs(),
|
|
108
118
|
useGraphQl: this.useGraphQl(),
|
|
119
|
+
max: maxLimit, // Apply the limit to pagination
|
|
109
120
|
});
|
|
110
121
|
const resources = await utils.streamIterator(stream);
|
|
111
122
|
|
|
@@ -7,7 +7,7 @@ export default {
|
|
|
7
7
|
name: "New Created Issue (Instant)",
|
|
8
8
|
description: "Emit new event when a new issue is created. [See the documentation](https://developers.linear.app/docs/graphql/webhooks)",
|
|
9
9
|
type: "source",
|
|
10
|
-
version: "0.3.
|
|
10
|
+
version: "0.3.10",
|
|
11
11
|
dedupe: "unique",
|
|
12
12
|
methods: {
|
|
13
13
|
...common.methods,
|
|
@@ -7,7 +7,7 @@ export default {
|
|
|
7
7
|
name: "New Updated Issue (Instant)",
|
|
8
8
|
description: "Emit new event when an issue is updated. [See the documentation](https://developers.linear.app/docs/graphql/webhooks)",
|
|
9
9
|
type: "source",
|
|
10
|
-
version: "0.3.
|
|
10
|
+
version: "0.3.10",
|
|
11
11
|
dedupe: "unique",
|
|
12
12
|
methods: {
|
|
13
13
|
...common.methods,
|
|
@@ -8,7 +8,7 @@ export default {
|
|
|
8
8
|
name: "New Issue Status Updated (Instant)",
|
|
9
9
|
description: "Emit new event when the status of an issue is updated. [See the documentation](https://developers.linear.app/docs/graphql/webhooks)",
|
|
10
10
|
type: "source",
|
|
11
|
-
version: "0.1.
|
|
11
|
+
version: "0.1.10",
|
|
12
12
|
dedupe: "unique",
|
|
13
13
|
props: {
|
|
14
14
|
linearApp: common.props.linearApp,
|
|
@@ -108,11 +108,14 @@ export default {
|
|
|
108
108
|
const previousStatuses = this._getPreviousStatuses();
|
|
109
109
|
const newStatuses = {};
|
|
110
110
|
|
|
111
|
+
// Use the specified limit or default to a reasonable number
|
|
112
|
+
const maxLimit = this.limit || constants.DEFAULT_NO_QUERY_LIMIT;
|
|
113
|
+
|
|
111
114
|
const stream = this.linearApp.paginateResources({
|
|
112
115
|
resourcesFn: this.getResourcesFn(),
|
|
113
116
|
resourcesFnArgs: this.getResourcesFnArgs(),
|
|
114
117
|
useGraphQl: this.useGraphQl(),
|
|
115
|
-
max: 1000
|
|
118
|
+
max: maxLimit, // Use the configured limit instead of hardcoded 1000
|
|
116
119
|
});
|
|
117
120
|
const resources = await utils.streamIterator(stream);
|
|
118
121
|
|
|
@@ -8,7 +8,7 @@ export default {
|
|
|
8
8
|
name: "New Project Update Written (Instant)",
|
|
9
9
|
description: "Project updates are short status reports on the health of your projects. Emit new event when a new Project Update is written. [See the documentation](https://developers.linear.app/docs/graphql/webhooks)",
|
|
10
10
|
type: "source",
|
|
11
|
-
version: "0.0.
|
|
11
|
+
version: "0.0.2",
|
|
12
12
|
dedupe: "unique",
|
|
13
13
|
props: {
|
|
14
14
|
linearApp,
|
|
@@ -8,7 +8,7 @@ export default {
|
|
|
8
8
|
name: "New Updated Project (Instant)",
|
|
9
9
|
description: "Emit new event when a project is updated. [See the documentation](https://developers.linear.app/docs/graphql/webhooks)",
|
|
10
10
|
type: "source",
|
|
11
|
-
version: "0.0.
|
|
11
|
+
version: "0.0.3",
|
|
12
12
|
dedupe: "unique",
|
|
13
13
|
props: {
|
|
14
14
|
linearApp,
|