@pipedream/linear_app 0.4.6 → 0.4.7
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 +1 -1
- package/actions/search-issues/search-issues.mjs +1 -1
- package/actions/update-issue/update-issue.mjs +1 -1
- package/linear_app.app.mjs +25 -4
- package/package.json +3 -2
- package/sources/comment-created-instant/comment-created-instant.mjs +1 -1
- package/sources/common/webhook.mjs +10 -0
- package/sources/issue-created-instant/issue-created-instant.mjs +4 -1
- package/sources/issue-updated-instant/issue-updated-instant.mjs +1 -1
- package/sources/new-issue-status-updated/new-issue-status-updated.mjs +59 -0
|
@@ -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.3.
|
|
8
|
+
version: "0.3.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.0.
|
|
7
|
+
version: "0.0.5",
|
|
8
8
|
type: "action",
|
|
9
9
|
props: {
|
|
10
10
|
linearApp,
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "linear_app-get-teams",
|
|
5
5
|
name: "Get Teams",
|
|
6
6
|
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.1.
|
|
7
|
+
version: "0.1.7",
|
|
8
8
|
type: "action",
|
|
9
9
|
props: {
|
|
10
10
|
linearApp,
|
|
@@ -6,7 +6,7 @@ export default {
|
|
|
6
6
|
name: "Search Issues",
|
|
7
7
|
description: "Search issues (API Key). See the docs [here](https://developers.linear.app/docs/graphql/working-with-the-graphql-api)",
|
|
8
8
|
type: "action",
|
|
9
|
-
version: "0.1.
|
|
9
|
+
version: "0.1.6",
|
|
10
10
|
props: {
|
|
11
11
|
linearApp,
|
|
12
12
|
query: {
|
|
@@ -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.0.
|
|
8
|
+
version: "0.0.8",
|
|
9
9
|
props: {
|
|
10
10
|
linearApp,
|
|
11
11
|
issueId: {
|
package/linear_app.app.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { LinearClient } from "@linear/sdk";
|
|
2
2
|
import constants from "./common/constants.mjs";
|
|
3
|
+
import { axios } from "@pipedream/platform";
|
|
3
4
|
|
|
4
5
|
export default {
|
|
5
6
|
type: "app",
|
|
@@ -125,6 +126,20 @@ export default {
|
|
|
125
126
|
},
|
|
126
127
|
},
|
|
127
128
|
methods: {
|
|
129
|
+
getAxiosHeaders() {
|
|
130
|
+
return {
|
|
131
|
+
Authorization: `${this.$auth.api_key}`,
|
|
132
|
+
};
|
|
133
|
+
},
|
|
134
|
+
async makeAxiosRequest({
|
|
135
|
+
$ = this, ...args
|
|
136
|
+
}) {
|
|
137
|
+
return axios($, {
|
|
138
|
+
url: "https://api.linear.app/graphql",
|
|
139
|
+
headers: this.getAxiosHeaders(),
|
|
140
|
+
...args,
|
|
141
|
+
});
|
|
142
|
+
},
|
|
128
143
|
getClientOptions(options = {}) {
|
|
129
144
|
return {
|
|
130
145
|
apiKey: this.$auth.api_key,
|
|
@@ -157,8 +172,14 @@ export default {
|
|
|
157
172
|
async listTeams(variables = {}) {
|
|
158
173
|
return this.client().teams(variables);
|
|
159
174
|
},
|
|
160
|
-
async listProjects(
|
|
161
|
-
|
|
175
|
+
async listProjects() {
|
|
176
|
+
const { data: { projects } } = await this.makeAxiosRequest({
|
|
177
|
+
method: "POST",
|
|
178
|
+
data: {
|
|
179
|
+
query: "{ projects { nodes { id name } } }",
|
|
180
|
+
},
|
|
181
|
+
});
|
|
182
|
+
return projects;
|
|
162
183
|
},
|
|
163
184
|
async listUsers(variables = {}) {
|
|
164
185
|
return this.client().users(variables);
|
|
@@ -196,8 +217,8 @@ export default {
|
|
|
196
217
|
return {
|
|
197
218
|
options: nodes.map(resouceMapper),
|
|
198
219
|
context: {
|
|
199
|
-
after: pageInfo
|
|
200
|
-
hasNextPage: pageInfo
|
|
220
|
+
after: pageInfo?.endCursor,
|
|
221
|
+
hasNextPage: pageInfo?.hasNextPage,
|
|
201
222
|
},
|
|
202
223
|
};
|
|
203
224
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pipedream/linear_app",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.7",
|
|
4
4
|
"description": "Pipedream Linear_app Components",
|
|
5
5
|
"main": "linear_app.app.mjs",
|
|
6
6
|
"keywords": [
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"access": "public"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@linear/sdk": "^2.
|
|
17
|
+
"@linear/sdk": "^2.6.0",
|
|
18
|
+
"@pipedream/platform": "^1.3.0"
|
|
18
19
|
}
|
|
19
20
|
}
|
|
@@ -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 docs [here](https://developers.linear.app/docs/graphql/webhooks)",
|
|
9
9
|
type: "source",
|
|
10
|
-
version: "0.0.
|
|
10
|
+
version: "0.0.7",
|
|
11
11
|
dedupe: "unique",
|
|
12
12
|
methods: {
|
|
13
13
|
...common.methods,
|
|
@@ -32,6 +32,12 @@ export default {
|
|
|
32
32
|
isWebhookValid(clientIp) {
|
|
33
33
|
return constants.CLIENT_IPS.includes(clientIp);
|
|
34
34
|
},
|
|
35
|
+
isFromProject(body) {
|
|
36
|
+
return !this.projectId || body?.data?.projectId == this.projectId;
|
|
37
|
+
},
|
|
38
|
+
isRelevant() {
|
|
39
|
+
return true;
|
|
40
|
+
},
|
|
35
41
|
getResourceTypes() {
|
|
36
42
|
throw new Error("getResourceTypes is not implemented");
|
|
37
43
|
},
|
|
@@ -107,6 +113,10 @@ export default {
|
|
|
107
113
|
return;
|
|
108
114
|
}
|
|
109
115
|
|
|
116
|
+
if (!this.isFromProject(body) || !this.isRelevant(body)) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
|
|
110
120
|
const meta = this.getMetadata(resource);
|
|
111
121
|
this.$emit(body, meta);
|
|
112
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 docs [here](https://developers.linear.app/docs/graphql/webhooks)",
|
|
9
9
|
type: "source",
|
|
10
|
-
version: "0.2.
|
|
10
|
+
version: "0.2.6",
|
|
11
11
|
dedupe: "unique",
|
|
12
12
|
methods: {
|
|
13
13
|
...common.methods,
|
|
@@ -39,6 +39,9 @@ export default {
|
|
|
39
39
|
},
|
|
40
40
|
};
|
|
41
41
|
},
|
|
42
|
+
isRelevant(body) {
|
|
43
|
+
return body?.action === "create";
|
|
44
|
+
},
|
|
42
45
|
getMetadata(resource) {
|
|
43
46
|
const {
|
|
44
47
|
delivery,
|
|
@@ -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 docs [here](https://developers.linear.app/docs/graphql/webhooks)",
|
|
9
9
|
type: "source",
|
|
10
|
-
version: "0.2.
|
|
10
|
+
version: "0.2.6",
|
|
11
11
|
dedupe: "unique",
|
|
12
12
|
methods: {
|
|
13
13
|
...common.methods,
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import common from "../common/webhook.mjs";
|
|
2
|
+
import constants from "../../common/constants.mjs";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
...common,
|
|
6
|
+
key: "linear_app-new-issue-status-updated",
|
|
7
|
+
name: "New Issue Status Updated (Instant)",
|
|
8
|
+
description: "Emit new event when the status of an issue is updated. See the docs [here](https://developers.linear.app/docs/graphql/webhooks)",
|
|
9
|
+
type: "source",
|
|
10
|
+
version: "0.0.1",
|
|
11
|
+
dedupe: "unique",
|
|
12
|
+
methods: {
|
|
13
|
+
...common.methods,
|
|
14
|
+
getResourceTypes() {
|
|
15
|
+
return [
|
|
16
|
+
constants.RESOURCE_TYPE.ISSUE,
|
|
17
|
+
];
|
|
18
|
+
},
|
|
19
|
+
getWebhookLabel() {
|
|
20
|
+
return "Issue status updated";
|
|
21
|
+
},
|
|
22
|
+
getResourcesFn() {
|
|
23
|
+
return this.linearApp.listIssues;
|
|
24
|
+
},
|
|
25
|
+
getResourcesFnArgs() {
|
|
26
|
+
return {
|
|
27
|
+
sortBy: "updatedAt",
|
|
28
|
+
filter: {
|
|
29
|
+
team: {
|
|
30
|
+
id: {
|
|
31
|
+
in: this.teamIds,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
project: {
|
|
35
|
+
id: {
|
|
36
|
+
eq: this.projectId,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
},
|
|
42
|
+
isRelevant(body) {
|
|
43
|
+
return body?.updatedFrom?.stateId;
|
|
44
|
+
},
|
|
45
|
+
getMetadata(resource) {
|
|
46
|
+
const {
|
|
47
|
+
delivery,
|
|
48
|
+
title,
|
|
49
|
+
data,
|
|
50
|
+
updatedAt,
|
|
51
|
+
} = resource;
|
|
52
|
+
return {
|
|
53
|
+
id: delivery || resource.id,
|
|
54
|
+
summary: `Issue status updated: ${data?.title || title}`,
|
|
55
|
+
ts: Date.parse(updatedAt),
|
|
56
|
+
};
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
};
|