@pipedream/linear_app 0.5.0 → 0.5.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.
@@ -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.0",
8
+ version: "0.4.1",
9
9
  props: {
10
10
  linearApp,
11
11
  teamId: {
@@ -1,10 +1,12 @@
1
1
  import linearApp from "../../linear_app.app.mjs";
2
+ import utils from "../../common/utils.mjs";
3
+ const getAdditionalIssueInformation = utils.getAdditionalIssueInformation;
2
4
 
3
5
  export default {
4
6
  key: "linear_app-get-issue",
5
7
  name: "Get Issue",
6
8
  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.0",
9
+ version: "0.1.1",
8
10
  type: "action",
9
11
  props: {
10
12
  linearApp,
@@ -16,9 +18,14 @@ export default {
16
18
  description: "The issue ID",
17
19
  },
18
20
  },
21
+ methods: {
22
+ getAdditionalIssueInformation,
23
+ },
19
24
  async run({ $ }) {
20
25
  const issue = await this.linearApp.getIssue(this.issueId);
21
26
  $.export("$summary", `Found issue with ID ${this.issueId}`);
22
- return issue;
27
+ return (await this.getAdditionalIssueInformation([
28
+ issue,
29
+ ]))[0];
23
30
  },
24
31
  };
@@ -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.0",
7
+ version: "0.2.1",
8
8
  type: "action",
9
9
  props: {
10
10
  linearApp,
@@ -1,12 +1,14 @@
1
- import constants from "../../common/constants.mjs";
2
1
  import linearApp from "../../linear_app.app.mjs";
2
+ import constants from "../../common/constants.mjs";
3
+ import utils from "../../common/utils.mjs";
4
+ const getAdditionalIssueInformation = utils.getAdditionalIssueInformation;
3
5
 
4
6
  export default {
5
7
  key: "linear_app-search-issues",
6
8
  name: "Search Issues",
7
9
  description: "Search issues (API Key). See the docs [here](https://developers.linear.app/docs/graphql/working-with-the-graphql-api)",
8
10
  type: "action",
9
- version: "0.2.0",
11
+ version: "0.2.1",
10
12
  props: {
11
13
  linearApp,
12
14
  query: {
@@ -54,6 +56,7 @@ export default {
54
56
  },
55
57
  },
56
58
  methods: {
59
+ getAdditionalIssueInformation,
57
60
  buildFilter() {
58
61
  return {
59
62
  title: {
@@ -112,6 +115,6 @@ export default {
112
115
 
113
116
  $.export("$summary", `Found ${issues.length} issues`);
114
117
 
115
- return issues;
118
+ return await this.getAdditionalIssueInformation(issues);
116
119
  },
117
120
  };
@@ -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.0",
8
+ version: "0.1.1",
9
9
  props: {
10
10
  linearApp,
11
11
  teamId: {
package/common/utils.mjs CHANGED
@@ -6,6 +6,33 @@ async function streamIterator(stream) {
6
6
  return resources;
7
7
  }
8
8
 
9
+ async function getAdditionalIssueInformation(issues = []) {
10
+ const updatedIssues = [];
11
+ for (const issue of issues) {
12
+ const {
13
+ _assignee, _creator, _project, _state, _team,
14
+ } = issue;
15
+ if (_assignee?.id) {
16
+ issue._assignee = await this.linearApp.getUser(_assignee.id);
17
+ }
18
+ if (_creator?.id) {
19
+ issue._creator = await this.linearApp.getUser(_creator.id);
20
+ }
21
+ if (_project?.id) {
22
+ issue._project = await this.linearApp.getProject(_project.id);
23
+ }
24
+ if (_state?.id) {
25
+ issue._state = await this.linearApp.getState(_state.id);
26
+ }
27
+ if (_team?.id) {
28
+ issue._team = await this.linearApp.getTeam(_team.id);
29
+ }
30
+ updatedIssues.push(issue);
31
+ }
32
+ return updatedIssues;
33
+ }
34
+
9
35
  export default {
10
36
  streamIterator,
37
+ getAdditionalIssueInformation,
11
38
  };
@@ -209,6 +209,18 @@ export default {
209
209
  async getIssue(id) {
210
210
  return this.client().issue(id);
211
211
  },
212
+ async getUser(id) {
213
+ return this.client().user(id);
214
+ },
215
+ async getProject(id) {
216
+ return this.client().project(id);
217
+ },
218
+ async getState(id) {
219
+ return this.client().workflowState(id);
220
+ },
221
+ async getTeam(id) {
222
+ return this.client().team(id);
223
+ },
212
224
  async listTeams(variables = {}) {
213
225
  return this.client().teams(variables);
214
226
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/linear_app",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
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 docs [here](https://developers.linear.app/docs/graphql/webhooks)",
9
9
  type: "source",
10
- version: "0.1.0",
10
+ version: "0.1.1",
11
11
  dedupe: "unique",
12
12
  methods: {
13
13
  ...common.methods,
@@ -1,6 +1,7 @@
1
1
  import linearApp from "../../linear_app.app.mjs";
2
2
  import constants from "../../common/constants.mjs";
3
3
  import utils from "../../common/utils.mjs";
4
+ const getAdditionalIssueInformation = utils.getAdditionalIssueInformation;
4
5
 
5
6
  export default {
6
7
  props: {
@@ -23,6 +24,7 @@ export default {
23
24
  db: "$.service.db",
24
25
  },
25
26
  methods: {
27
+ getAdditionalIssueInformation,
26
28
  setWebhookId(teamId, id) {
27
29
  this.db.set(`webhook-${teamId}`, id);
28
30
  },
@@ -65,7 +67,11 @@ export default {
65
67
  resourcesFn: this.getResourcesFn(),
66
68
  resourcesFnArgs: this.getResourcesFnArgs(),
67
69
  });
68
- const resources = await utils.streamIterator(stream);
70
+ let resources = await utils.streamIterator(stream);
71
+
72
+ if (this.getResourceTypes().includes(constants.RESOURCE_TYPE.ISSUE)) {
73
+ resources = await this.getAdditionalIssueInformation(resources);
74
+ }
69
75
 
70
76
  resources
71
77
  .reverse()
@@ -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.3.0",
10
+ version: "0.3.1",
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 docs [here](https://developers.linear.app/docs/graphql/webhooks)",
9
9
  type: "source",
10
- version: "0.3.0",
10
+ version: "0.3.1",
11
11
  dedupe: "unique",
12
12
  methods: {
13
13
  ...common.methods,
@@ -7,7 +7,7 @@ export default {
7
7
  name: "New Issue Status Updated (Instant)",
8
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
9
  type: "source",
10
- version: "0.1.0",
10
+ version: "0.1.1",
11
11
  dedupe: "unique",
12
12
  methods: {
13
13
  ...common.methods,