Skip to content

Commit bee14b5

Browse files
committed
Enhance LinearB component with new prop definitions for teams and services, add search incidents action, and update version to 0.2.0. Bump create incident action version to 0.0.3 and update dependencies.
1 parent 4c1a754 commit bee14b5

File tree

4 files changed

+168
-11
lines changed

4 files changed

+168
-11
lines changed

components/linearb/actions/create-incident/create-incident.mjs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "linearb-create-incident",
55
name: "Create Incident",
66
description: "Create a new incident within the LinearB platform. [See the documentation](https://docs.linearb.io/api-incidents/#create-incident)",
7-
version: "0.0.2",
7+
version: "0.0.3",
88
annotations: {
99
destructiveHint: false,
1010
openWorldHint: true,
@@ -52,15 +52,17 @@ export default {
5252
optional: true,
5353
},
5454
teams: {
55-
type: "string[]",
56-
label: "Teams",
57-
description: "The list of LinearB teams names related to this incident. (lowercase only)",
55+
propDefinition: [
56+
app,
57+
"teams",
58+
],
5859
optional: true,
5960
},
6061
services: {
61-
type: "string[]",
62-
label: "Services",
63-
description: "The list of LinearB services related to this incident.",
62+
propDefinition: [
63+
app,
64+
"services",
65+
],
6466
optional: true,
6567
},
6668
repositoryUrls: {
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
import app from "../../linearb.app.mjs";
2+
3+
export default {
4+
key: "linearb-search-incidents",
5+
name: "Search Incidents",
6+
description: "Search for incidents within the LinearB platform. [See the documentation](https://docs.linearb.io/api-incidents/#search-incidents)",
7+
version: "0.0.1",
8+
type: "action",
9+
annotations: {
10+
destructiveHint: false,
11+
openWorldHint: true,
12+
readOnlyHint: false,
13+
},
14+
props: {
15+
app,
16+
teams: {
17+
propDefinition: [
18+
app,
19+
"teams",
20+
],
21+
optional: true,
22+
},
23+
services: {
24+
propDefinition: [
25+
app,
26+
"services",
27+
],
28+
optional: true,
29+
},
30+
repositoryUrls: {
31+
type: "string[]",
32+
label: "Repository URLs",
33+
description: "The list of repos urls related to this incident. **Lowercase only**",
34+
optional: true,
35+
},
36+
issuedAtBefore: {
37+
type: "string",
38+
label: "Issued At Before",
39+
description: "The specific time when the incident was logged and officially opened. (Format: `YYYY-MM-DD`)",
40+
optional: true,
41+
},
42+
issuedAtAfter: {
43+
type: "string",
44+
label: "Issued At After",
45+
description: "The specific time when the incident was logged and officially opened. (Format: `YYYY-MM-DD`)",
46+
optional: true,
47+
},
48+
startedAt: {
49+
type: "string",
50+
label: "Started At",
51+
description: "The specific time when work on the incident commenced. (Format: `YYYY-MM-DD`)",
52+
optional: true,
53+
},
54+
endedAt: {
55+
type: "string",
56+
label: "Ended At",
57+
description: "The specific time when the incident was successfully resolved. (Format: `YYYY-MM-DD`)",
58+
optional: true,
59+
},
60+
statuses: {
61+
type: "string[]",
62+
label: "Statuses",
63+
description: "A list of statuses of the incident",
64+
options: [
65+
"open",
66+
"in-progress",
67+
"closed",
68+
"deleted",
69+
],
70+
optional: true,
71+
},
72+
maxResults: {
73+
type: "integer",
74+
label: "Max Results",
75+
description: "The maximum number of results to return",
76+
optional: true,
77+
},
78+
},
79+
async run({ $ }) {
80+
const response = await this.app.paginate({
81+
$,
82+
resourceFn: this.app.getIncidents,
83+
resourceName: "items",
84+
resourceFnArgs: {
85+
data: {
86+
issued_at: {
87+
before: this.issuedAtBefore,
88+
after: this.issuedAtAfter,
89+
},
90+
started_at: this.startedAt,
91+
ended_at: this.endedAt,
92+
statuses: this.statuses,
93+
teams: this.teams,
94+
services: this.services,
95+
repository_urls: this.repositoryUrls,
96+
},
97+
},
98+
max: this.maxResults,
99+
});
100+
101+
$.export("$summary", `Successfully searched ${response.length} incident${response.length > 1
102+
? "s"
103+
: ""}`);
104+
return response;
105+
},
106+
};

components/linearb/linearb.app.mjs

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,41 @@ import utils from "./common/utils.mjs";
55
export default {
66
type: "app",
77
app: "linearb",
8-
propDefinitions: {},
8+
propDefinitions: {
9+
teams: {
10+
type: "string[]",
11+
label: "Teams",
12+
description: "The list of LinearB teams names related to this incident. (lowercase only)",
13+
async options({ page }) {
14+
const { items } = await this.getTeams({
15+
params: {
16+
page,
17+
},
18+
});
19+
20+
return items.map(({ name }) => name);
21+
},
22+
},
23+
services: {
24+
type: "string[]",
25+
label: "Services",
26+
description: "The list of LinearB services related to this incident. (lowercase only)",
27+
async options({ page }) {
28+
const { items } = await this.getServices({
29+
params: {
30+
page,
31+
},
32+
});
33+
34+
return items.map(({ name }) => name);
35+
},
36+
},
37+
},
938
methods: {
1039
getUrl(path, versionPath = constants.VERSION_PATH.V1) {
1140
return `${constants.BASE_URL}${versionPath}${path}`;
1241
},
13-
getHeaders(headers) {
42+
getHeaders(headers = {}) {
1443
return {
1544
"Content-Type": "application/json",
1645
"x-api-key": this.$auth.api_key,
@@ -38,6 +67,26 @@ export default {
3867
...args,
3968
});
4069
},
70+
getTeams(args = {}) {
71+
return this._makeRequest({
72+
path: "/teams",
73+
versionPath: constants.VERSION_PATH.V2,
74+
...args,
75+
});
76+
},
77+
getServices(args = {}) {
78+
return this._makeRequest({
79+
path: "/services",
80+
...args,
81+
});
82+
},
83+
getIncidents(args = {}) {
84+
return this._makeRequest({
85+
method: "POST",
86+
path: "/incidents/search",
87+
...args,
88+
});
89+
},
4190
async *getIterations({
4291
resourceFn, resourceFnArgs, resourceName,
4392
max = constants.DEFAULT_MAX,

components/linearb/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/linearb",
3-
"version": "0.1.0",
3+
"version": "0.2.0",
44
"description": "Pipedream LinearB Components",
55
"main": "linearb.app.mjs",
66
"keywords": [
@@ -13,6 +13,6 @@
1313
"access": "public"
1414
},
1515
"dependencies": {
16-
"@pipedream/platform": "^1.6.0"
16+
"@pipedream/platform": "^3.1.0"
1717
}
1818
}

0 commit comments

Comments
 (0)