Skip to content

Commit cbfedd7

Browse files
committed
project-updated-instant
1 parent 717258a commit cbfedd7

File tree

6 files changed

+133
-6
lines changed

6 files changed

+133
-6
lines changed

components/linear/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/linear",
3-
"version": "0.5.8",
3+
"version": "0.6.0",
44
"description": "Pipedream Linear Components",
55
"main": "linear.app.mjs",
66
"keywords": [
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import projectUpdatedInstant from "@pipedream/linear_app/sources/project-updated-instant/project-updated-instant.mjs";
2+
import utils from "../../common/utils.mjs";
3+
4+
/* eslint-disable pipedream/required-properties-type */
5+
/* eslint-disable pipedream/required-properties-name */
6+
/* eslint-disable pipedream/required-properties-version */
7+
8+
export default {
9+
...projectUpdatedInstant,
10+
...utils.getAppProps(projectUpdatedInstant),
11+
key: "linear-project-updated-instant",
12+
description: "Emit new event when a project is updated (OAuth). [See the documentation](https://developers.linear.app/docs/graphql/webhooks)",
13+
version: "0.0.1",
14+
};

components/linear_app/common/fragments.mjs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,4 +101,39 @@ export default {
101101
}
102102
}
103103
`,
104+
project: `
105+
fragment Project on Project {
106+
id
107+
name
108+
creator {
109+
id
110+
}
111+
lead {
112+
id
113+
}
114+
status {
115+
id
116+
}
117+
color
118+
completedIssueCountHistory
119+
completedScopeHistory
120+
createdAt
121+
description
122+
inProgressScopeHistory
123+
issueCountHistory
124+
name
125+
priority
126+
progress
127+
scope
128+
scopeHistory
129+
slackIssueComments
130+
slackIssueStatuses
131+
slackNewIssue
132+
slugId
133+
sortOrder
134+
state
135+
updatedAt
136+
url
137+
}
138+
`,
104139
};

components/linear_app/common/queries.mjs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,23 @@ export default {
4848
${fragments.comment}
4949
`,
5050
listProjects: `
51-
query ListProjects {
52-
projects {
51+
query ListProjects(
52+
$filter: ProjectFilter,
53+
$orderBy: PaginationOrderBy
54+
) {
55+
projects(
56+
filter: $filter,
57+
orderBy: $orderBy
58+
) {
59+
pageInfo {
60+
...PageInfo
61+
}
5362
nodes {
54-
id
55-
name
63+
...Project
5664
}
5765
}
5866
}
67+
${fragments.project}
68+
${fragments.pageInfo}
5969
`,
6070
};

components/linear_app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/linear_app",
3-
"version": "0.5.7",
3+
"version": "0.6.0",
44
"description": "Pipedream Linear_app Components",
55
"main": "linear_app.app.mjs",
66
"keywords": [
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
import common from "../common/webhook.mjs";
2+
import constants from "../../common/constants.mjs";
3+
import linearApp from "../../linear_app.app.mjs";
4+
5+
export default {
6+
...common,
7+
key: "linear_app-project-updated-instant",
8+
name: "New Updated Project (Instant)",
9+
description: "Emit new event when a project is updated. [See the documentation](https://developers.linear.app/docs/graphql/webhooks)",
10+
type: "source",
11+
version: "0.0.1",
12+
dedupe: "unique",
13+
props: {
14+
linearApp,
15+
teamIds: {
16+
label: "Team IDs",
17+
type: "string[]",
18+
propDefinition: [
19+
linearApp,
20+
"teamId",
21+
],
22+
reloadProps: true,
23+
},
24+
db: "$.service.db",
25+
},
26+
methods: {
27+
...common.methods,
28+
getResourceTypes() {
29+
return [
30+
constants.RESOURCE_TYPE.PROJECT,
31+
];
32+
},
33+
getWebhookLabel() {
34+
return "Project updated";
35+
},
36+
getResourcesFn() {
37+
return this.linearApp.listProjects;
38+
},
39+
getResourcesFnArgs() {
40+
return {
41+
orderBy: "updatedAt",
42+
filter: {
43+
accessibleTeams: {
44+
id: {
45+
in: this.teamIds,
46+
},
47+
},
48+
},
49+
};
50+
},
51+
getResource(project) {
52+
return this.linearApp.getProject(project.id);
53+
},
54+
getMetadata(resource) {
55+
const {
56+
name,
57+
data,
58+
updatedAt,
59+
} = resource;
60+
const ts = Date.parse(data?.updatedAt || updatedAt);
61+
return {
62+
id: `${resource.id}-${ts}`,
63+
summary: `Project Updated: ${data?.name || name}`,
64+
ts,
65+
};
66+
},
67+
},
68+
};

0 commit comments

Comments
 (0)