@pipedream/linear_app 0.6.0 → 0.7.0

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.
@@ -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.6",
8
+ version: "0.4.7",
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.6",
7
+ version: "0.1.7",
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.2.6",
7
+ version: "0.2.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.2.6",
9
+ version: "0.2.7",
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.1.6",
8
+ version: "0.1.7",
9
9
  props: {
10
10
  linearApp,
11
11
  teamId: {
@@ -13,6 +13,7 @@ const RESOURCE_TYPE = {
13
13
  ISSUE: "Issue",
14
14
  ISSUE_LABEL: "IssueLabel",
15
15
  PROJECT: "Project",
16
+ PROJECT_UPDATE: "ProjectUpdate",
16
17
  CYCLE: "Cycle",
17
18
  REACTION: "Reaction",
18
19
  };
@@ -136,4 +136,33 @@ export default {
136
136
  url
137
137
  }
138
138
  `,
139
+ projectUpdate: `
140
+ fragment ProjectUpdate on ProjectUpdate {
141
+ id
142
+ body
143
+ health
144
+ project {
145
+ id
146
+ name
147
+ lead {
148
+ id
149
+ name
150
+ }
151
+ initiatives {
152
+ nodes {
153
+ name
154
+ }
155
+ }
156
+ }
157
+ user {
158
+ id
159
+ }
160
+ createdAt
161
+ updatedAt
162
+ bodyData
163
+ slugId
164
+ infoSnapshot
165
+ url
166
+ }
167
+ `,
139
168
  };
@@ -75,4 +75,32 @@ export default {
75
75
  ${fragments.project}
76
76
  ${fragments.pageInfo}
77
77
  `,
78
+ listProjectUpdates: `
79
+ query ListProjectUpdates(
80
+ $filter: ProjectUpdateFilter,
81
+ $before: String,
82
+ $after: String,
83
+ $first: Int,
84
+ $last: Int,
85
+ $orderBy: PaginationOrderBy
86
+ ) {
87
+ projectUpdates(
88
+ filter: $filter,
89
+ before: $before,
90
+ after: $after,
91
+ first: $first,
92
+ last: $last,
93
+ orderBy: $orderBy
94
+ ) {
95
+ pageInfo {
96
+ ...PageInfo
97
+ }
98
+ nodes {
99
+ ...ProjectUpdate
100
+ }
101
+ }
102
+ }
103
+ ${fragments.projectUpdate}
104
+ ${fragments.pageInfo}
105
+ `,
78
106
  };
package/common/utils.mjs CHANGED
@@ -42,7 +42,10 @@ function buildVariables(endCursor, args) {
42
42
  const issueLabels = args.filter.issueLabels
43
43
  ? `, labels: { name: { in: ${JSON.stringify(args.filter.issueLabels)} } }`
44
44
  : "";
45
- let filter = `${title}${teamId}${projectId}${team}${project}${state}${assigneeId}${issueLabels}`;
45
+ const createdAt = args.filter.createdAt
46
+ ? `, createdAt: { gte: "${args.filter.createdAt.gte}" }`
47
+ : "";
48
+ let filter = `${title}${teamId}${projectId}${team}${project}${state}${assigneeId}${issueLabels}${createdAt}`;
46
49
  if (filter[0] === ",") {
47
50
  filter = filter.substring(2, filter.length);
48
51
  }
@@ -248,6 +248,9 @@ export default {
248
248
  async getProject(id) {
249
249
  return this.client().project(id);
250
250
  },
251
+ async getProjectUpdate(id) {
252
+ return this.client().projectUpdate(id);
253
+ },
251
254
  async getState(id) {
252
255
  return this.client().workflowState(id);
253
256
  },
@@ -266,6 +269,15 @@ export default {
266
269
  });
267
270
  return projects;
268
271
  },
272
+ async listProjectUpdates(variables) {
273
+ const { data: { projectUpdates } } = await this.post({
274
+ data: {
275
+ query: queries.listProjectUpdates,
276
+ variables,
277
+ },
278
+ });
279
+ return projectUpdates;
280
+ },
269
281
  async listUsers(variables = {}) {
270
282
  return this.client().users(variables);
271
283
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/linear_app",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "Pipedream Linear_app Components",
5
5
  "main": "linear_app.app.mjs",
6
6
  "keywords": [
@@ -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.8",
10
+ version: "0.1.9",
11
11
  dedupe: "unique",
12
12
  methods: {
13
13
  ...common.methods,
@@ -61,6 +61,9 @@ export default {
61
61
  isRelevant() {
62
62
  return true;
63
63
  },
64
+ isRelevantPolling() {
65
+ return true;
66
+ },
64
67
  useGraphQl() {
65
68
  return true;
66
69
  },
@@ -108,6 +111,7 @@ export default {
108
111
 
109
112
  resources
110
113
  .reverse()
114
+ .filter((resource) => this.isRelevantPolling(resource))
111
115
  .forEach((resource) => {
112
116
  this.$emit(resource, this.getMetadata(resource));
113
117
  });
@@ -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.8",
10
+ version: "0.3.9",
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.8",
10
+ version: "0.3.9",
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.8",
11
+ version: "0.1.9",
12
12
  dedupe: "unique",
13
13
  props: {
14
14
  linearApp: common.props.linearApp,
@@ -0,0 +1,86 @@
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-new-projectupdate-created",
8
+ name: "New Project Update Written (Instant)",
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
+ type: "source",
11
+ version: "0.0.1",
12
+ dedupe: "unique",
13
+ props: {
14
+ linearApp,
15
+ db: "$.service.db",
16
+ teamId: {
17
+ label: "Team ID",
18
+ type: "string",
19
+ propDefinition: [
20
+ common.props.linearApp,
21
+ "teamId",
22
+ ],
23
+ description: "The identifier or key of the team associated with the project",
24
+ reloadProps: true,
25
+ },
26
+ projectId: {
27
+ propDefinition: [
28
+ common.props.linearApp,
29
+ "projectId",
30
+ (c) => ({
31
+ teamId: c.teamId,
32
+ }),
33
+ ],
34
+ description: "Filter results by project",
35
+ },
36
+ },
37
+ methods: {
38
+ ...common.methods,
39
+ getResourceTypes() {
40
+ return [
41
+ constants.RESOURCE_TYPE.PROJECT_UPDATE,
42
+ ];
43
+ },
44
+ getWebhookLabel() {
45
+ return "Project Update created";
46
+ },
47
+ getResourcesFn() {
48
+ return this.linearApp.listProjectUpdates;
49
+ },
50
+ getResourcesFnArgs() {
51
+ return {
52
+ orderBy: "createdAt",
53
+ filter: {
54
+ createdAt: {
55
+ gte: "-P1W", // within the last week
56
+ },
57
+ },
58
+ };
59
+ },
60
+ getResource(projectUpdate) {
61
+ return this.linearApp.getProjectUpdate(projectUpdate.id);
62
+ },
63
+ isRelevant(body) {
64
+ const teamIds = body.data.infoSnapshot.teamsInfo.map(({ id }) => id);
65
+ return body?.action === "create" && teamIds.includes(this.teamId);
66
+ },
67
+ isRelevantPolling(resource) {
68
+ const teamIds = resource.infoSnapshot.teamsInfo.map(({ id }) => id);
69
+ const projectId = resource.project.id;
70
+ return (teamIds.includes(this.teamId)) && (!this.projectId || projectId === this.projectId);
71
+ },
72
+ getMetadata(resource) {
73
+ const {
74
+ data,
75
+ createdAt,
76
+ } = resource;
77
+ const ts = Date.parse(data?.createdAt || createdAt);
78
+ const id = data?.id || resource.id;
79
+ return {
80
+ id,
81
+ summary: `New Project Update: ${id}`,
82
+ ts,
83
+ };
84
+ },
85
+ },
86
+ };
@@ -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.1",
11
+ version: "0.0.2",
12
12
  dedupe: "unique",
13
13
  props: {
14
14
  linearApp,
@@ -19,6 +19,7 @@ export default {
19
19
  linearApp,
20
20
  "teamId",
21
21
  ],
22
+ description: "The identifier or key of the team associated with the project",
22
23
  reloadProps: true,
23
24
  },
24
25
  db: "$.service.db",