-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New Components - bugsnag #16866
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
New Components - bugsnag #16866
Changes from 4 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
2de36be
new components
michelle0927 7491544
pnpm-lock.yaml
michelle0927 7f255a2
package.json
michelle0927 dce6243
pnpm-lock.yaml
michelle0927 aa5ee00
update prop description
michelle0927 14d313a
pnpm-lock.yaml
michelle0927 1fd7e00
pnpm-lock.yaml
michelle0927 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
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
50 changes: 50 additions & 0 deletions
50
components/bugsnag/actions/create-project/create-project.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| import bugsnag from "../../bugsnag.app.mjs"; | ||
| import constants from "../../common/constants.mjs"; | ||
|
|
||
| export default { | ||
| key: "bugsnag-create-project", | ||
| name: "Create Project", | ||
| description: "Create a new project for a specific organization in Bugsnag. [See the documentation](https://bugsnagapiv2.docs.apiary.io/#reference/projects/projects/create-a-project-in-an-organization)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| bugsnag, | ||
| organizationId: { | ||
| propDefinition: [ | ||
| bugsnag, | ||
| "organizationId", | ||
| ], | ||
| }, | ||
| name: { | ||
| type: "string", | ||
| label: "Project Name", | ||
| description: "The name of the project", | ||
| }, | ||
| type: { | ||
| type: "string", | ||
| label: "Project Type", | ||
| description: "The new project's framework type", | ||
| options: constants.PROJECT_TYPES, | ||
| }, | ||
| ignoreOldBrowsers: { | ||
| type: "boolean", | ||
| label: "Ignore Old Browsers", | ||
| description: "For javascript projects this will filter errors from older browsers", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.bugsnag.createProject({ | ||
| $, | ||
| organizationId: this.organizationId, | ||
| data: { | ||
| name: this.name, | ||
| type: this.type, | ||
| ignore_old_browsers: this.ignoreOldBrowsers, | ||
| }, | ||
| }); | ||
|
|
||
| $.export("$summary", `Created project: ${this.name}`); | ||
| return response; | ||
| }, | ||
| }; |
57 changes: 57 additions & 0 deletions
57
components/bugsnag/actions/update-error-severity/update-error-severity.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| import bugsnag from "../../bugsnag.app.mjs"; | ||
| import constants from "../../common/constants.mjs"; | ||
|
|
||
| export default { | ||
| key: "bugsnag-update-error-severity", | ||
| name: "Update Error Severity", | ||
| description: "Update an the severity status of an error in Bugsnag. [See the documentation](https://bugsnagapiv2.docs.apiary.io/#reference/errors/errors/update-an-error)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| bugsnag, | ||
| organizationId: { | ||
| propDefinition: [ | ||
| bugsnag, | ||
| "organizationId", | ||
| ], | ||
| }, | ||
| projectId: { | ||
| propDefinition: [ | ||
| bugsnag, | ||
| "projectId", | ||
| (c) => ({ | ||
| organizationId: c.organizationId, | ||
| }), | ||
| ], | ||
| }, | ||
| errorId: { | ||
| propDefinition: [ | ||
| bugsnag, | ||
| "errorId", | ||
| (c) => ({ | ||
| projectId: c.projectId, | ||
| }), | ||
| ], | ||
| }, | ||
| severity: { | ||
| type: "string", | ||
| label: "Severity", | ||
| description: "The Error's new severity. This will be reflected in the Error's overridden_severity property. This is only applicable if the override_severity option is provided.", | ||
| options: constants.ERROR_SEVERITIES, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.bugsnag.updateError({ | ||
| $, | ||
| projectId: this.projectId, | ||
| errorId: this.errorId, | ||
| data: { | ||
| operation: "override_severity", | ||
| severity: this.severity, | ||
| }, | ||
| }); | ||
|
|
||
| $.export("$summary", `Updated error ${this.errorId}`); | ||
| return response; | ||
| }, | ||
| }; | ||
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,198 @@ | ||
| import { axios } from "@pipedream/platform"; | ||
|
|
||
| export default { | ||
| type: "app", | ||
| app: "bugsnag", | ||
| propDefinitions: { | ||
| organizationId: { | ||
| type: "string", | ||
| label: "Organization ID", | ||
| description: "The ID of an organization", | ||
| async options() { | ||
| const organizations = await this.listOrganizations(); | ||
| return organizations?.map(({ | ||
| id: value, name: label, | ||
| }) => ({ | ||
| value, | ||
| label, | ||
| })) || []; | ||
| }, | ||
| }, | ||
| projectId: { | ||
| type: "string", | ||
| label: "Project ID", | ||
| description: "The ID of a project", | ||
| async options({ | ||
| organizationId, prevContext, | ||
| }) { | ||
| const args = { | ||
| organizationId, | ||
| returnFullResponse: true, | ||
| }; | ||
| if (prevContext?.next) { | ||
| args.url = prevContext.next; | ||
| } | ||
| const { | ||
| data, headers, | ||
| } = await this.listProjects(args); | ||
| let next; | ||
| if (headers?.link) { | ||
| next = this.getNextLink(headers.link); | ||
| } | ||
| return { | ||
| options: data?.map(({ | ||
| id: value, name: label, | ||
| }) => ({ | ||
| value, | ||
| label, | ||
| })) || [], | ||
| context: { | ||
| next, | ||
| }, | ||
| }; | ||
| }, | ||
| }, | ||
| errorId: { | ||
| type: "string", | ||
| label: "Error ID", | ||
| description: "The ID of the error", | ||
| async options({ | ||
| projectId, prevContext, | ||
| }) { | ||
| const args = { | ||
| projectId, | ||
| returnFullResponse: true, | ||
| }; | ||
| if (prevContext?.next) { | ||
| args.url = prevContext.next; | ||
| } | ||
| const { | ||
| data, headers, | ||
| } = await this.listErrors(args); | ||
| let next; | ||
| if (headers?.link) { | ||
| next = this.getNextLink(headers.link); | ||
| } | ||
| return { | ||
| options: data?.map(({ | ||
| id: value, message: label, | ||
| }) => ({ | ||
| value, | ||
| label, | ||
| })) || [], | ||
| context: { | ||
| next, | ||
| }, | ||
| }; | ||
| }, | ||
| }, | ||
| releaseStage: { | ||
| type: "string", | ||
| label: "Release Stage", | ||
| description: "The release stage", | ||
| }, | ||
| }, | ||
| methods: { | ||
| _baseUrl() { | ||
| return "https://api.bugsnag.com"; | ||
| }, | ||
| _makeRequest({ | ||
| $ = this, url, path, ...opts | ||
| }) { | ||
| return axios($, { | ||
| url: url || `${this._baseUrl()}${path}`, | ||
| headers: { | ||
| "Authorization": `token ${this.$auth.api_token}`, | ||
| }, | ||
| ...opts, | ||
| }); | ||
| }, | ||
| getNextLink(linkHeader) { | ||
| const match = linkHeader.match(/<([^>]+)>;\s*rel="next"/); // get link to next page | ||
| return match | ||
| ? match[1] | ||
| : null; | ||
| }, | ||
| listOrganizations(opts = {}) { | ||
| return this._makeRequest({ | ||
| path: "/user/organizations", | ||
| ...opts, | ||
| }); | ||
| }, | ||
| listProjects({ | ||
| organizationId, ...opts | ||
| }) { | ||
| return this._makeRequest({ | ||
| path: `/organizations/${organizationId}/projects`, | ||
| ...opts, | ||
| }); | ||
| }, | ||
| listErrors({ | ||
| projectId, ...opts | ||
| }) { | ||
| return this._makeRequest({ | ||
| path: `/projects/${projectId}/errors`, | ||
| ...opts, | ||
| }); | ||
| }, | ||
| listEvents({ | ||
| projectId, ...opts | ||
| }) { | ||
| return this._makeRequest({ | ||
| path: `/projects/${projectId}/events`, | ||
| ...opts, | ||
| }); | ||
| }, | ||
| listReleases({ | ||
| projectId, ...opts | ||
| }) { | ||
| return this._makeRequest({ | ||
| path: `/projects/${projectId}/releases`, | ||
| ...opts, | ||
| }); | ||
| }, | ||
| createProject({ | ||
| organizationId, ...opts | ||
| }) { | ||
| return this._makeRequest({ | ||
| method: "POST", | ||
| path: `/organizations/${organizationId}/projects`, | ||
| ...opts, | ||
| }); | ||
| }, | ||
| updateError({ | ||
| projectId, errorId, ...opts | ||
| }) { | ||
| return this._makeRequest({ | ||
| method: "PATCH", | ||
| path: `/projects/${projectId}/errors/${errorId}`, | ||
| ...opts, | ||
| }); | ||
| }, | ||
| async *paginate({ | ||
| fn, args, max, | ||
| }) { | ||
| args = { | ||
| ...args, | ||
| returnFullResponse: true, | ||
| }; | ||
| let next, count = 0; | ||
| do { | ||
| const { | ||
| data, headers, | ||
| } = await fn(args); | ||
| for (const item of data) { | ||
| yield item; | ||
| if (max && ++count >= max) { | ||
| return; | ||
| } | ||
| } | ||
| next = headers?.link | ||
| ? this.getNextLink(headers.link) | ||
| : false; | ||
| args.url = next; | ||
| args.params = undefined; | ||
| } while (next); | ||
| }, | ||
| }, | ||
| }; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we always pass 'override_severity', I think the last sentence in this description could be removed