Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions components/linearb/actions/create-incident/create-incident.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "linearb-create-incident",
name: "Create Incident",
description: "Create a new incident within the LinearB platform. [See the documentation](https://docs.linearb.io/api-incidents/#create-incident)",
version: "0.0.2",
version: "0.0.3",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down Expand Up @@ -52,15 +52,17 @@ export default {
optional: true,
},
teams: {
type: "string[]",
label: "Teams",
description: "The list of LinearB teams names related to this incident. (lowercase only)",
propDefinition: [
app,
"teams",
],
optional: true,
},
services: {
type: "string[]",
label: "Services",
description: "The list of LinearB services related to this incident.",
propDefinition: [
app,
"services",
],
optional: true,
},
repositoryUrls: {
Expand Down
106 changes: 106 additions & 0 deletions components/linearb/actions/search-incidents/search-incidents.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
import app from "../../linearb.app.mjs";

export default {
key: "linearb-search-incidents",
name: "Search Incidents",
description: "Search for incidents within the LinearB platform. [See the documentation](https://docs.linearb.io/api-incidents/#search-incidents)",
version: "0.0.1",
type: "action",
annotations: {
destructiveHint: false,
openWorldHint: true,
readOnlyHint: false,
},
props: {
app,
teams: {
propDefinition: [
app,
"teams",
],
optional: true,
},
services: {
propDefinition: [
app,
"services",
],
optional: true,
},
repositoryUrls: {
type: "string[]",
label: "Repository URLs",
description: "The list of repos urls related to this incident. **Lowercase only**",
optional: true,
},
issuedAtBefore: {
type: "string",
label: "Issued At Before",
description: "The specific time when the incident was logged and officially opened. (Format: `YYYY-MM-DD`)",
optional: true,
},
issuedAtAfter: {
type: "string",
label: "Issued At After",
description: "The specific time when the incident was logged and officially opened. (Format: `YYYY-MM-DD`)",
optional: true,
},
startedAt: {
type: "string",
label: "Started At",
description: "The specific time when work on the incident commenced. (Format: `YYYY-MM-DD`)",
optional: true,
},
endedAt: {
type: "string",
label: "Ended At",
description: "The specific time when the incident was successfully resolved. (Format: `YYYY-MM-DD`)",
Comment on lines +39 to +57
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These props mention "specific time" but the format specified is date-only. Which is it, date or datetime? This should be more clear

optional: true,
},
statuses: {
type: "string[]",
label: "Statuses",
description: "A list of statuses of the incident",
options: [
"open",
"in-progress",
"closed",
"deleted",
],
optional: true,
},
maxResults: {
type: "integer",
label: "Max Results",
description: "The maximum number of results to return",
optional: true,
},
},
async run({ $ }) {
const response = await this.app.paginate({
$,
resourceFn: this.app.getIncidents,
resourceName: "items",
resourceFnArgs: {
data: {
issued_at: {
before: this.issuedAtBefore,
after: this.issuedAtAfter,
},
started_at: this.startedAt,
ended_at: this.endedAt,
statuses: this.statuses,
teams: this.teams,
services: this.services,
repository_urls: this.repositoryUrls,
},
},
max: this.maxResults,
});

$.export("$summary", `Successfully searched ${response.length} incident${response.length > 1
? "s"
: ""}`);
return response;
},
};
53 changes: 51 additions & 2 deletions components/linearb/linearb.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,41 @@ import utils from "./common/utils.mjs";
export default {
type: "app",
app: "linearb",
propDefinitions: {},
propDefinitions: {
teams: {
type: "string[]",
label: "Teams",
description: "The list of LinearB teams names related to this incident. (lowercase only)",
async options({ page }) {
const { items } = await this.getTeams({
params: {
page,
},
});

return items.map(({ name }) => name);
},
},
services: {
type: "string[]",
label: "Services",
description: "The list of LinearB services related to this incident. (lowercase only)",
async options({ page }) {
const { items } = await this.getServices({
params: {
page,
},
});

return items.map(({ name }) => name);
},
},
},
methods: {
getUrl(path, versionPath = constants.VERSION_PATH.V1) {
return `${constants.BASE_URL}${versionPath}${path}`;
},
getHeaders(headers) {
getHeaders(headers = {}) {
return {
"Content-Type": "application/json",
"x-api-key": this.$auth.api_key,
Expand Down Expand Up @@ -38,6 +67,26 @@ export default {
...args,
});
},
getTeams(args = {}) {
return this._makeRequest({
path: "/teams",
versionPath: constants.VERSION_PATH.V2,
...args,
});
},
getServices(args = {}) {
return this._makeRequest({
path: "/services",
...args,
});
},
getIncidents(args = {}) {
return this._makeRequest({
method: "POST",
path: "/incidents/search",
...args,
});
},
async *getIterations({
resourceFn, resourceFnArgs, resourceName,
max = constants.DEFAULT_MAX,
Expand Down
4 changes: 2 additions & 2 deletions components/linearb/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/linearb",
"version": "0.1.0",
"version": "0.2.0",
"description": "Pipedream LinearB Components",
"main": "linearb.app.mjs",
"keywords": [
Expand All @@ -13,6 +13,6 @@
"access": "public"
},
"dependencies": {
"@pipedream/platform": "^1.6.0"
"@pipedream/platform": "^3.1.0"
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { DEFAULT_POLLING_SOURCE_TIMER_INTERVAL } from "@pipedream/platform";
import app from "../../linearb.app.mjs";
import constants from "../../common/constants.mjs";
import app from "../../linearb.app.mjs";

export default {
key: "linearb-new-deploy-created",
name: "New Deploy Created",
description: "Emit new event when a new deploy is created in LinearB. [See the documentation](https://docs.linearb.io/api-deployments/)",
version: "0.0.1",
version: "0.0.2",
type: "source",
dedupe: "unique",
props: {
Expand Down
7 changes: 3 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading