@pipedream/linear_app 0.5.2 → 0.5.4

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.2",
8
+ version: "0.4.4",
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.2",
7
+ version: "0.1.4",
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.2",
7
+ version: "0.2.4",
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.2",
9
+ version: "0.2.4",
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.2",
8
+ version: "0.1.4",
9
9
  props: {
10
10
  linearApp,
11
11
  teamId: {
package/common/utils.mjs CHANGED
@@ -8,6 +8,15 @@ async function streamIterator(stream) {
8
8
  return resources;
9
9
  }
10
10
 
11
+ function strToObj(str) {
12
+ var obj = {};
13
+ if (str && typeof str === "string") {
14
+ var objStr = str.match(/\{(.)+\}/g);
15
+ eval("obj =" + objStr);
16
+ }
17
+ return obj;
18
+ }
19
+
11
20
  function buildVariables(endCursor, args) {
12
21
  const title = args.filter.query
13
22
  ? `title: { containsIgnoreCase: "${args.filter.query}" }`
@@ -18,13 +27,13 @@ function buildVariables(endCursor, args) {
18
27
  const projectId = args.filter.projectId
19
28
  ? `, project: { id: { eq: "${args.filter.projectId}" } }`
20
29
  : "";
21
- const team = args.filter.team
30
+ const team = args.filter.team && args.filter.team.id
22
31
  ? `, team: { id: { in: ${JSON.stringify(args.filter.team.id.in)} } }`
23
32
  : "";
24
33
  const project = args.filter.project && args.filter.project.id.eq
25
34
  ? `, project: { id: { eq: "${args.filter.project.id.eq}" } }`
26
35
  : "";
27
- const state = args.filter.state
36
+ const state = args.filter.state && args.filter.state.id.eq
28
37
  ? `, state: { id: { eq: "${args.filter.state.id.eq}" } }`
29
38
  : "";
30
39
  const assigneeId = args.filter.assigneeId
@@ -39,7 +48,7 @@ function buildVariables(endCursor, args) {
39
48
  }
40
49
 
41
50
  const orderBy = args.orderBy
42
- ? `, orderBy: ${args.orderBy}`
51
+ ? `, orderBy: "${args.orderBy}"`
43
52
  : "";
44
53
  const includeArchived = args.includeArchived
45
54
  ? `, includeArchived: ${args.includeArchived}`
@@ -47,10 +56,11 @@ function buildVariables(endCursor, args) {
47
56
  const after = endCursor
48
57
  ? `, after: "${endCursor}"`
49
58
  : "";
50
- return `filter: { ${filter} }, first: ${constants.DEFAULT_LIMIT}${orderBy}${includeArchived}${after}`;
59
+ return strToObj(`{ filter: { ${filter} }, first: ${constants.DEFAULT_LIMIT}${orderBy}${includeArchived}${after} }`);
51
60
  }
52
61
 
53
62
  export default {
54
63
  streamIterator,
64
+ strToObj,
55
65
  buildVariables,
56
66
  };
@@ -205,24 +205,7 @@ export default {
205
205
  return this.client().updateIssue(issueId, input);
206
206
  },
207
207
  async listIssues(variables) {
208
- const { data: { issues } } = await this.makeAxiosRequest({
209
- method: "POST",
210
- data: {
211
- query: `
212
- {
213
- issues(${variables}) {
214
- nodes {
215
- ${constants.ISSUE_NODES}
216
- }
217
- pageInfo {
218
- hasNextPage
219
- endCursor
220
- }
221
- }
222
- }`,
223
- },
224
- });
225
- return issues;
208
+ return this.client().issues(variables);
226
209
  },
227
210
  async getIssue(id) {
228
211
  const { data: { issue } } = await this.makeAxiosRequest({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/linear_app",
3
- "version": "0.5.2",
3
+ "version": "0.5.4",
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.2",
10
+ version: "0.1.4",
11
11
  dedupe: "unique",
12
12
  methods: {
13
13
  ...common.methods,
@@ -78,6 +78,17 @@ export default {
78
78
  });
79
79
  },
80
80
  async activate() {
81
+ const args = {
82
+ resourceTypes: this.getResourceTypes(),
83
+ url: this.http.endpoint,
84
+ label: this.getWebhookLabel(),
85
+ };
86
+ if (!this.teamIds && !this.teamId) {
87
+ args.allPublicTeams = true;
88
+ const { _webhook: webhook } = await this.linearApp.createWebhook(args);
89
+ this.setWebhookId("1", webhook.id);
90
+ return;
91
+ }
81
92
  const teamIds = this.teamIds || [
82
93
  this.teamId,
83
94
  ];
@@ -85,14 +96,19 @@ export default {
85
96
  const { _webhook: webhook } =
86
97
  await this.linearApp.createWebhook({
87
98
  teamId,
88
- resourceTypes: this.getResourceTypes(),
89
- url: this.http.endpoint,
90
- label: this.getWebhookLabel(),
99
+ ...args,
91
100
  });
92
101
  this.setWebhookId(teamId, webhook.id);
93
102
  }
94
103
  },
95
104
  async deactivate() {
105
+ if (!this.teamIds && !this.teamId) {
106
+ const webhookId = this.getWebhookId("1");
107
+ if (webhookId) {
108
+ await this.linearApp.deleteWebhook(webhookId);
109
+ }
110
+ return;
111
+ }
96
112
  const teamIds = this.teamIds || [
97
113
  this.teamId,
98
114
  ];
@@ -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.2",
10
+ version: "0.3.4",
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.2",
10
+ version: "0.3.4",
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.2",
10
+ version: "0.1.4",
11
11
  dedupe: "unique",
12
12
  props: {
13
13
  linearApp: common.props.linearApp,
@@ -20,6 +20,7 @@ export default {
20
20
  common.props.linearApp,
21
21
  "teamId",
22
22
  ],
23
+ optional: true,
23
24
  },
24
25
  projectId: {
25
26
  propDefinition: [
@@ -55,7 +56,7 @@ export default {
55
56
  return {
56
57
  sortBy: "updatedAt",
57
58
  filter: {
58
- team: {
59
+ team: this.teamId && {
59
60
  id: {
60
61
  in: [
61
62
  this.teamId,