@pipedream/linear_app 0.8.1 → 0.8.3

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: "Creates a new issue in Linear. Requires team ID and title. Optional: description, assignee, project, state. Returns response object with success status and issue details. Uses API Key authentication. [See the documentation](https://linear.app/developers/graphql#creating-and-editing-issues).",
8
- version: "0.4.15",
8
+ version: "0.4.17",
9
9
  annotations: {
10
10
  destructiveHint: true,
11
11
  openWorldHint: true,
@@ -5,7 +5,7 @@ export default {
5
5
  name: "Create Project",
6
6
  description: "Create a project in Linear. [See the documentation](https://studio.apollographql.com/public/Linear-API/variant/current/schema/reference/inputs/ProjectCreateInput).",
7
7
  type: "action",
8
- version: "0.0.1",
8
+ version: "0.0.3",
9
9
  annotations: {
10
10
  destructiveHint: false,
11
11
  openWorldHint: true,
@@ -1,10 +1,11 @@
1
1
  import linearApp from "../../linear_app.app.mjs";
2
+ import { ConfigurationError } from "@pipedream/platform";
2
3
 
3
4
  export default {
4
5
  key: "linear_app-get-issue",
5
6
  name: "Get Issue",
6
- description: "Retrieves a Linear issue by its ID. Returns complete issue details including title, description, state, assignee, team, project, labels, and timestamps. Uses API Key authentication. See Linear docs for additional info [here](https://linear.app/developers/graphql).",
7
- version: "0.1.15",
7
+ description: "Retrieves a Linear issue by its ID or identifier. Returns complete issue details including title, description, state, assignee, team, project, labels, and timestamps. Uses API Key authentication. [See the documentation](https://linear.app/developers/graphql).",
8
+ version: "0.1.17",
8
9
  annotations: {
9
10
  destructiveHint: false,
10
11
  openWorldHint: true,
@@ -18,19 +19,40 @@ export default {
18
19
  linearApp,
19
20
  "issueId",
20
21
  ],
22
+ label: "Issue ID",
21
23
  description: "The issue ID",
24
+ optional: true,
25
+ },
26
+ issueIdentifier: {
27
+ propDefinition: [
28
+ linearApp,
29
+ "issueIdentifier",
30
+ ],
31
+ optional: true,
22
32
  },
23
33
  },
24
34
  async run({ $ }) {
25
35
  const {
26
36
  linearApp,
27
37
  issueId,
38
+ issueIdentifier,
28
39
  } = this;
29
40
 
41
+ if (!issueId && !issueIdentifier) {
42
+ throw new ConfigurationError("You must provide either an issue ID or an issue identifier");
43
+ }
44
+
45
+ if (issueId && issueIdentifier) {
46
+ throw new ConfigurationError("You must provide either an issue ID or an issue identifier, not both");
47
+ }
48
+
30
49
  const issue = await linearApp.getIssue({
31
- issueId,
50
+ issueId: issueId || issueIdentifier,
32
51
  });
33
- $.export("$summary", `Found issue with ID ${issueId}`);
52
+ if (!issue) {
53
+ throw new ConfigurationError(`Issue not found: ${issueId || issueIdentifier}`);
54
+ }
55
+ $.export("$summary", `Found issue with ID ${issue?.id}`);
34
56
  return issue;
35
57
  },
36
58
  };
@@ -5,7 +5,7 @@ export default {
5
5
  key: "linear_app-get-teams",
6
6
  name: "Get Teams",
7
7
  description: "Retrieves all teams in your Linear workspace. Returns array of team objects with details like ID, name, and key. Supports pagination with configurable limit. Uses API Key authentication. See Linear docs for additional info [here](https://linear.app/developers/graphql).",
8
- version: "0.2.15",
8
+ version: "0.2.17",
9
9
  annotations: {
10
10
  destructiveHint: false,
11
11
  openWorldHint: true,
@@ -6,7 +6,7 @@ export default {
6
6
  name: "List Projects",
7
7
  description: "List projects in Linear. [See the documentation](https://studio.apollographql.com/public/Linear-API/variant/current/schema/reference/objects/ProjectConnection?query=projects).",
8
8
  type: "action",
9
- version: "0.0.1",
9
+ version: "0.0.3",
10
10
  annotations: {
11
11
  destructiveHint: false,
12
12
  openWorldHint: true,
@@ -7,7 +7,7 @@ export default {
7
7
  name: "Search Issues",
8
8
  description: "Searches Linear issues by team, project, assignee, labels, state, or text query. Supports pagination, ordering, and archived issues. Returns array of matching issues. Uses API Key authentication. See Linear docs for additional info [here](https://linear.app/developers/graphql).",
9
9
  type: "action",
10
- version: "0.2.15",
10
+ version: "0.2.17",
11
11
  annotations: {
12
12
  destructiveHint: false,
13
13
  openWorldHint: true,
@@ -5,7 +5,7 @@ export default {
5
5
  name: "Update Issue",
6
6
  description: "Updates an existing Linear issue. Can modify title, description, assignee, state, project, team, labels, priority, and dates. Returns updated issue details. Uses API Key authentication. [See the documentation](https://linear.app/developers/graphql#creating-and-editing-issues).",
7
7
  type: "action",
8
- version: "0.1.15",
8
+ version: "0.1.17",
9
9
  annotations: {
10
10
  destructiveHint: true,
11
11
  openWorldHint: true,
package/common/utils.mjs CHANGED
@@ -8,57 +8,83 @@ 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
-
20
11
  function buildVariables(endCursor, args) {
21
- const title = args.filter.query
22
- ? `title: { containsIgnoreCase: "${args.filter.query}" }`
23
- : "";
24
- const teamId = args.filter.teamId
25
- ? `, team: { id: { eq: "${args.filter.teamId}" } }`
26
- : "";
27
- const projectId = args.filter.projectId
28
- ? `, project: { id: { eq: "${args.filter.projectId}" } }`
29
- : "";
30
- const team = args.filter.team && args.filter.team.id
31
- ? `, team: { id: { in: ${JSON.stringify(args.filter.team.id.in)} } }`
32
- : "";
33
- const project = args.filter.project && args.filter.project.id.eq
34
- ? `, project: { id: { eq: "${args.filter.project.id.eq}" } }`
35
- : "";
36
- const state = args.filter.state && args.filter.state.id.eq
37
- ? `, state: { id: { eq: "${args.filter.state.id.eq}" } }`
38
- : "";
39
- const assigneeId = args.filter.assigneeId
40
- ? `, assignee: { id: { eq: "${args.filter.assigneeId}" } }`
41
- : "";
42
- const issueLabels = args.filter.issueLabels
43
- ? `, labels: { name: { in: ${JSON.stringify(args.filter.issueLabels)} } }`
44
- : "";
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}`;
49
- if (filter[0] === ",") {
50
- filter = filter.substring(2, filter.length);
12
+ const filter = {};
13
+
14
+ if (args.filter.query) {
15
+ filter.title = {
16
+ containsIgnoreCase: args.filter.query,
17
+ };
18
+ }
19
+ if (args.filter.teamId) {
20
+ filter.team = {
21
+ id: {
22
+ eq: args.filter.teamId,
23
+ },
24
+ };
25
+ }
26
+ if (args.filter.projectId) {
27
+ filter.project = {
28
+ id: {
29
+ eq: args.filter.projectId,
30
+ },
31
+ };
32
+ }
33
+ if (args.filter.team?.id?.in) {
34
+ filter.team = {
35
+ id: {
36
+ in: args.filter.team.id.in,
37
+ },
38
+ };
39
+ }
40
+ if (args.filter.project?.id?.eq) {
41
+ filter.project = {
42
+ id: {
43
+ eq: args.filter.project.id.eq,
44
+ },
45
+ };
46
+ }
47
+ if (args.filter.state?.id?.eq) {
48
+ filter.state = {
49
+ id: {
50
+ eq: args.filter.state.id.eq,
51
+ },
52
+ };
53
+ }
54
+ if (args.filter.assigneeId) {
55
+ filter.assignee = {
56
+ id: {
57
+ eq: args.filter.assigneeId,
58
+ },
59
+ };
60
+ }
61
+ if (args.filter.issueLabels) {
62
+ filter.labels = {
63
+ name: {
64
+ in: args.filter.issueLabels,
65
+ },
66
+ };
67
+ }
68
+ if (args.filter.createdAt?.gte) {
69
+ filter.createdAt = {
70
+ gte: args.filter.createdAt.gte,
71
+ };
72
+ }
73
+ if (args.filter.accessibleTeams?.id?.eq) {
74
+ filter.accessibleTeams = {
75
+ id: {
76
+ eq: args.filter.accessibleTeams.id.eq,
77
+ },
78
+ };
79
+ }
80
+ if (args.filter.accessibleTeams?.id?.in) {
81
+ filter.accessibleTeams = {
82
+ id: {
83
+ in: args.filter.accessibleTeams.id.in,
84
+ },
85
+ };
51
86
  }
52
87
 
53
- const orderBy = args.orderBy
54
- ? `, orderBy: "${args.orderBy}"`
55
- : "";
56
- const includeArchived = args.includeArchived
57
- ? `, includeArchived: ${args.includeArchived}`
58
- : "";
59
- const after = endCursor
60
- ? `, after: "${endCursor}"`
61
- : "";
62
88
  // Determine the appropriate limit:
63
89
  // 1. Use custom limit if provided
64
90
  // 2. Use a smaller default limit when no query is provided to avoid returning too many results
@@ -69,11 +95,25 @@ function buildVariables(endCursor, args) {
69
95
  ? constants.DEFAULT_LIMIT
70
96
  : constants.DEFAULT_NO_QUERY_LIMIT);
71
97
 
72
- return strToObj(`{ filter: { ${filter} }, first: ${limit}${orderBy}${includeArchived}${after} }`);
98
+ const variables = {
99
+ filter,
100
+ first: limit,
101
+ };
102
+
103
+ if (args.orderBy) {
104
+ variables.orderBy = args.orderBy;
105
+ }
106
+ if (args.includeArchived) {
107
+ variables.includeArchived = args.includeArchived;
108
+ }
109
+ if (endCursor) {
110
+ variables.after = endCursor;
111
+ }
112
+
113
+ return variables;
73
114
  }
74
115
 
75
116
  export default {
76
117
  streamIterator,
77
- strToObj,
78
118
  buildVariables,
79
119
  };
@@ -53,6 +53,34 @@ export default {
53
53
  });
54
54
  },
55
55
  },
56
+ issueIdentifier: {
57
+ type: "string",
58
+ label: "Issue Identifier",
59
+ description: "The identifier of the issue. Example: `APP-1234`",
60
+ async options({
61
+ teamId, prevContext,
62
+ }) {
63
+ return this.listResourcesOptions({
64
+ prevContext,
65
+ resourcesFn: this.listIssues,
66
+ resourcesArgs: teamId && {
67
+ filter: {
68
+ team: {
69
+ id: {
70
+ eq: teamId,
71
+ },
72
+ },
73
+ },
74
+ },
75
+ resouceMapper: ({
76
+ identifier, title,
77
+ }) => ({
78
+ label: title,
79
+ value: identifier,
80
+ }),
81
+ });
82
+ },
83
+ },
56
84
  projectId: {
57
85
  type: "string",
58
86
  label: "Project",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/linear_app",
3
- "version": "0.8.1",
3
+ "version": "0.8.3",
4
4
  "description": "Pipedream Linear_app Components",
5
5
  "main": "linear_app.app.mjs",
6
6
  "keywords": [
@@ -15,6 +15,6 @@
15
15
  },
16
16
  "dependencies": {
17
17
  "@linear/sdk": "^55.1.0",
18
- "@pipedream/platform": "^3.1.0"
18
+ "@pipedream/platform": "^3.1.1"
19
19
  }
20
20
  }
@@ -7,7 +7,7 @@ export default {
7
7
  name: "New Comment Created (Instant)",
8
8
  description: "Triggers instantly when a new comment is added to an issue in Linear. Returns comment details including content, author, issue reference, and timestamps. Supports filtering by team. See Linear docs for additional info [here](https://linear.app/developers/webhooks).",
9
9
  type: "source",
10
- version: "0.1.16",
10
+ version: "0.1.18",
11
11
  dedupe: "unique",
12
12
  methods: {
13
13
  ...common.methods,
@@ -7,7 +7,7 @@ export default {
7
7
  name: "New Issue Created (Instant)",
8
8
  description: "Triggers instantly when a new issue is created in Linear. Provides complete issue details including title, description, team, assignee, state, and timestamps. Supports filtering by team and project. See Linear docs for additional info [here](https://linear.app/developers/webhooks).",
9
9
  type: "source",
10
- version: "0.3.16",
10
+ version: "0.3.18",
11
11
  dedupe: "unique",
12
12
  methods: {
13
13
  ...common.methods,
@@ -7,7 +7,7 @@ export default {
7
7
  name: "Issue Updated (Instant)",
8
8
  description: "Triggers instantly when any issue is updated in Linear. Provides complete issue details with changes. Supports filtering by team and project. Includes all updates except status changes. See Linear docs for additional info [here](https://linear.app/developers/webhooks).",
9
9
  type: "source",
10
- version: "0.3.16",
10
+ version: "0.3.18",
11
11
  dedupe: "unique",
12
12
  methods: {
13
13
  ...common.methods,
@@ -8,7 +8,7 @@ export default {
8
8
  name: "Issue Status Updated (Instant)",
9
9
  description: "Triggers instantly when an issue's workflow state changes (e.g., Todo to In Progress). Returns issue with previous and current state info. Can filter by specific target state. See Linear docs for additional info [here](https://linear.app/developers/webhooks).",
10
10
  type: "source",
11
- version: "0.1.16",
11
+ version: "0.1.18",
12
12
  dedupe: "unique",
13
13
  props: {
14
14
  linearApp: common.props.linearApp,
@@ -8,7 +8,7 @@ export default {
8
8
  name: "New Project Update Written (Instant)",
9
9
  description: "Triggers instantly when a project update (status report) is created in Linear. Returns update content, author, project details, and health status. Filters by team and optionally by project. See Linear docs for additional info [here](https://linear.app/developers/webhooks).",
10
10
  type: "source",
11
- version: "0.0.8",
11
+ version: "0.0.10",
12
12
  dedupe: "unique",
13
13
  props: {
14
14
  linearApp,
@@ -8,7 +8,7 @@ export default {
8
8
  name: "Project Updated (Instant)",
9
9
  description: "Triggers instantly when a project is updated in Linear. Returns project details including name, description, status, dates, and team info. Supports filtering by specific teams. See Linear docs for additional info [here](https://linear.app/developers/webhooks).",
10
10
  type: "source",
11
- version: "0.0.9",
11
+ version: "0.0.11",
12
12
  dedupe: "unique",
13
13
  props: {
14
14
  linearApp,