Skip to content

Commit 0a9fbac

Browse files
committed
updates
1 parent 2a59d22 commit 0a9fbac

File tree

7 files changed

+283
-9
lines changed

7 files changed

+283
-9
lines changed

components/linear_app/actions/create-issue/create-issue.mjs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ export default {
44
type: "action",
55
key: "linear_app-create-issue",
66
name: "Create Issue",
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 Linear docs for additional info [here](https://developers.linear.app/docs/graphql/working-with-the-graphql-api#creating-and-editing-issues).",
8-
version: "0.4.13",
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://developers.linear.app/docs/graphql/working-with-the-graphql-api#creating-and-editing-issues).",
8+
version: "0.4.14",
99
annotations: {
1010
destructiveHint: true,
1111
openWorldHint: true,
@@ -55,6 +55,15 @@ export default {
5555
}),
5656
],
5757
},
58+
labelIds: {
59+
propDefinition: [
60+
linearApp,
61+
"issueLabels",
62+
() => ({
63+
byId: true,
64+
}),
65+
],
66+
},
5867
},
5968
async run({ $ }) {
6069
const {
@@ -65,6 +74,7 @@ export default {
6574
teamId,
6675
assigneeId,
6776
stateId,
77+
labelIds,
6878
} = this;
6979

7080
const response =
@@ -75,6 +85,7 @@ export default {
7585
description,
7686
assigneeId,
7787
stateId,
88+
labelIds,
7889
});
7990

8091
const summary = response.success
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
import linearApp from "../../linear_app.app.mjs";
2+
3+
export default {
4+
key: "linear_app-create-project",
5+
name: "Create Project",
6+
description: "Create a project in Linear. [See the documentation](https://studio.apollographql.com/public/Linear-API/variant/current/schema/reference/inputs/ProjectCreateInput).",
7+
type: "action",
8+
version: "0.0.1",
9+
annotations: {
10+
destructiveHint: false,
11+
openWorldHint: true,
12+
readOnlyHint: false,
13+
},
14+
props: {
15+
linearApp,
16+
teamId: {
17+
propDefinition: [
18+
linearApp,
19+
"teamId",
20+
],
21+
},
22+
name: {
23+
type: "string",
24+
label: "Name",
25+
description: "The name of the project",
26+
},
27+
description: {
28+
type: "string",
29+
label: "Description",
30+
description: "The description of the project",
31+
optional: true,
32+
},
33+
statusId: {
34+
propDefinition: [
35+
linearApp,
36+
"projectStatusId",
37+
],
38+
},
39+
priority: {
40+
propDefinition: [
41+
linearApp,
42+
"projectPriority",
43+
],
44+
},
45+
memberIds: {
46+
propDefinition: [
47+
linearApp,
48+
"assigneeId",
49+
],
50+
type: "string[]",
51+
label: "Member IDs",
52+
description: "The IDs of the members of the project",
53+
optional: true,
54+
},
55+
startDate: {
56+
type: "string",
57+
label: "Start Date",
58+
description: "The start date of the project in ISO 8601 format",
59+
optional: true,
60+
},
61+
targetDate: {
62+
type: "string",
63+
label: "Target Date",
64+
description: "The target date of the project in ISO 8601 format",
65+
optional: true,
66+
},
67+
labelIds: {
68+
propDefinition: [
69+
linearApp,
70+
"projectLabelIds",
71+
],
72+
},
73+
},
74+
async run({ $ }) {
75+
const response = await this.linearApp.client().createProject({
76+
teamIds: [
77+
this.teamId,
78+
],
79+
name: this.name,
80+
description: this.description,
81+
statusId: this.statusId,
82+
priority: this.priority,
83+
memberIds: this.memberIds,
84+
startDate: this.startDate,
85+
targetDate: this.targetDate,
86+
labelIds: this.labelIds,
87+
});
88+
89+
$.export("$summary", `Successfully created project with ID ${response._project.id}`);
90+
91+
return response;
92+
},
93+
};
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import linearApp from "../../linear_app.app.mjs";
2+
import utils from "../../common/utils.mjs";
3+
4+
export default {
5+
key: "linear_app-list-projects",
6+
name: "List Projects",
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+
type: "action",
9+
version: "0.0.1",
10+
annotations: {
11+
destructiveHint: false,
12+
openWorldHint: true,
13+
readOnlyHint: true,
14+
},
15+
props: {
16+
linearApp,
17+
teamId: {
18+
propDefinition: [
19+
linearApp,
20+
"teamId",
21+
],
22+
},
23+
orderBy: {
24+
propDefinition: [
25+
linearApp,
26+
"orderBy",
27+
],
28+
},
29+
first: {
30+
type: "integer",
31+
label: "First",
32+
description: "The number of projects to return",
33+
optional: true,
34+
},
35+
after: {
36+
type: "string",
37+
label: "After",
38+
description: "The cursor to return the next page of projects",
39+
optional: true,
40+
},
41+
},
42+
async run({ $ }) {
43+
const variables = utils.buildVariables(this.after, {
44+
filter: {
45+
accessibleTeams: {
46+
id: {
47+
eq: this.teamId,
48+
},
49+
},
50+
},
51+
orderBy: this.orderBy,
52+
first: this.first,
53+
});
54+
55+
const {
56+
nodes, pageInfo,
57+
} = await this.linearApp.listProjects(variables);
58+
59+
$.export("$summary", `Found ${nodes.length} projects`);
60+
61+
return {
62+
nodes,
63+
pageInfo,
64+
};
65+
},
66+
};

components/linear_app/actions/update-issue/update-issue.mjs

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import linearApp from "../../linear_app.app.mjs";
33
export default {
44
key: "linear_app-update-issue",
55
name: "Update Issue",
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 Linear docs for additional info [here](https://developers.linear.app/docs/graphql/working-with-the-graphql-api#creating-and-editing-issues).",
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://developers.linear.app/docs/graphql/working-with-the-graphql-api#creating-and-editing-issues).",
77
type: "action",
8-
version: "0.1.13",
8+
version: "0.1.14",
99
annotations: {
1010
destructiveHint: true,
1111
openWorldHint: true,
@@ -68,6 +68,24 @@ export default {
6868
"assigneeId",
6969
],
7070
},
71+
labelIds: {
72+
propDefinition: [
73+
linearApp,
74+
"issueLabels",
75+
() => ({
76+
byId: true,
77+
}),
78+
],
79+
},
80+
projectId: {
81+
propDefinition: [
82+
linearApp,
83+
"projectId",
84+
({ teamId }) => ({
85+
teamId,
86+
}),
87+
],
88+
},
7189
},
7290
async run({ $ }) {
7391
const {
@@ -77,6 +95,8 @@ export default {
7795
teamIdToUpdate,
7896
stateId,
7997
assigneeId,
98+
labelIds,
99+
projectId,
80100
} = this;
81101

82102
const response =
@@ -88,6 +108,8 @@ export default {
88108
description,
89109
assigneeId,
90110
stateId,
111+
labelIds,
112+
projectId,
91113
},
92114
});
93115

components/linear_app/common/constants.mjs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,29 @@ const ORDER_BY_OPTIONS = [
4545
},
4646
];
4747

48+
const PRIORITY_OPTIONS = [
49+
{
50+
value: 0,
51+
label: "No priority",
52+
},
53+
{
54+
value: 1,
55+
label: "Urgent",
56+
},
57+
{
58+
value: 2,
59+
label: "High",
60+
},
61+
{
62+
value: 3,
63+
label: "Normal",
64+
},
65+
{
66+
value: 4,
67+
label: "Low",
68+
},
69+
];
70+
4871
export default {
4972
WEBHOOK_ID,
5073
LINEAR_DELIVERY_HEADER,
@@ -57,4 +80,5 @@ export default {
5780
CLIENT_IPS,
5881
ORDER_BY_OPTIONS,
5982
FIELD,
83+
PRIORITY_OPTIONS,
6084
};

components/linear_app/linear_app.app.mjs

Lines changed: 61 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,14 +151,66 @@ export default {
151151
label: "Issue Labels",
152152
description: "The labels in the issue",
153153
optional: true,
154-
async options({ prevContext }) {
154+
async options({
155+
prevContext, byId = false,
156+
}) {
155157
return this.listResourcesOptions({
156158
prevContext,
157159
resourcesFn: this.listIssueLabels,
158-
resouceMapper: ({ name }) => name,
160+
resouceMapper: ({
161+
id, name,
162+
}) => byId
163+
? ({
164+
label: name,
165+
value: id,
166+
})
167+
: name,
168+
});
169+
},
170+
},
171+
projectStatusId: {
172+
type: "string",
173+
label: "Status ID",
174+
description: "The ID of the status of the project",
175+
optional: true,
176+
async options({ prevContext }) {
177+
return this.listResourcesOptions({
178+
prevContext,
179+
resourcesFn: this.listProjectStatuses,
180+
resouceMapper: ({
181+
id, name,
182+
}) => ({
183+
label: name,
184+
value: id,
185+
}),
159186
});
160187
},
161188
},
189+
projectLabelIds: {
190+
type: "string[]",
191+
label: "Label IDs",
192+
description: "The IDs of the labels for the project",
193+
optional: true,
194+
async options({ prevContext }) {
195+
return this.listResourcesOptions({
196+
prevContext,
197+
resourcesFn: this.listProjectLabels,
198+
resouceMapper: ({
199+
id, name,
200+
}) => ({
201+
label: name,
202+
value: id,
203+
}),
204+
});
205+
},
206+
},
207+
projectPriority: {
208+
type: "integer",
209+
label: "Priority",
210+
description: "The priority of the project",
211+
optional: true,
212+
options: constants.PRIORITY_OPTIONS,
213+
},
162214
query: {
163215
type: "string",
164216
label: "Query",
@@ -167,7 +219,7 @@ export default {
167219
},
168220
orderBy: {
169221
type: "string",
170-
label: "Order by",
222+
label: "Order By",
171223
description: "By which field should the pagination order by. Available options are `createdAt` (default) and `updatedAt`.",
172224
optional: true,
173225
options: constants.ORDER_BY_OPTIONS,
@@ -315,6 +367,12 @@ export default {
315367
});
316368
return comment;
317369
},
370+
async listProjectStatuses(variables = {}) {
371+
return this.client().projectStatuses(variables);
372+
},
373+
async listProjectLabels(variables = {}) {
374+
return this.client().projectLabels(variables);
375+
},
318376
async listResourcesOptions({
319377
prevContext, resourcesFn, resourcesArgs, resouceMapper,
320378
} = {}) {

0 commit comments

Comments
 (0)