Improvements on Sentry Node

This commit is contained in:
Jan Oberhauser 2021-04-24 00:38:15 +02:00
parent a3c5f41b0f
commit cc5b1d9cd2
7 changed files with 112 additions and 131 deletions

View file

@ -138,6 +138,7 @@ export const eventFields = [
default: 100,
description: 'How many results to return.',
},
/* -------------------------------------------------------------------------- */
/* event:get */
/* -------------------------------------------------------------------------- */

View file

@ -65,6 +65,7 @@ export const issueFields = [
required: true,
description: 'ID of issue to get.',
},
/* -------------------------------------------------------------------------- */
/* issue:getAll */
/* -------------------------------------------------------------------------- */
@ -204,6 +205,7 @@ export const issueFields = [
},
],
},
/* -------------------------------------------------------------------------- */
/* issue:update */
/* -------------------------------------------------------------------------- */

View file

@ -119,6 +119,7 @@ export const organizationFields = [
},
],
},
/* -------------------------------------------------------------------------- */
/* organization:get */
/* -------------------------------------------------------------------------- */
@ -143,6 +144,7 @@ export const organizationFields = [
required: true,
description: 'The slug of the organization the team should be created for.',
},
/* -------------------------------------------------------------------------- */
/* organization:create */
/* -------------------------------------------------------------------------- */
@ -207,6 +209,7 @@ export const organizationFields = [
},
],
},
/* -------------------------------------------------------------------------- */
/* organization:update */
/* -------------------------------------------------------------------------- */
@ -230,24 +233,6 @@ export const organizationFields = [
required: true,
description: 'The slug of the organization to update.',
},
{
displayName: 'Name',
name: 'name',
type: 'string',
default: '',
displayOptions: {
show: {
resource: [
'organization',
],
operation: [
'update',
],
},
},
required: true,
description: 'The name of the organization.',
},
{
displayName: 'Update Fields',
name: 'updateFields',
@ -265,12 +250,19 @@ export const organizationFields = [
},
},
options: [
{
displayName: 'Name',
name: 'name',
type: 'string',
default: '',
description: 'The new name of the organization.',
},
{
displayName: 'Slug',
name: 'slug',
type: 'string',
default: '',
description: 'The updated URL slug for this organization.',
description: 'The new URL slug for this organization.',
},
],
},

View file

@ -20,6 +20,11 @@ export const projectOperations = [
value: 'create',
description: 'Create a new project',
},
{
name: 'Delete',
value: 'delete',
description: 'Delete a project',
},
{
name: 'Get',
value: 'get',
@ -35,11 +40,6 @@ export const projectOperations = [
value: 'update',
description: 'Update a project',
},
{
name: 'Delete',
value: 'delete',
description: 'Delete a project',
},
],
default: 'get',
description: 'The operation to perform',
@ -164,6 +164,7 @@ export const projectFields = [
},
],
},
/* -------------------------------------------------------------------------- */
/* project:getAll */
/* -------------------------------------------------------------------------- */
@ -208,6 +209,7 @@ export const projectFields = [
default: 100,
description: 'How many results to return.',
},
/* -------------------------------------------------------------------------- */
/* project:update */
/* -------------------------------------------------------------------------- */
@ -274,11 +276,25 @@ export const projectFields = [
},
options: [
{
displayName: 'Team',
name: 'team',
type: 'string',
default: '',
description: 'The new team name.',
displayName: 'Bookmarked',
name: 'isBookmarked',
type: 'boolean',
default: false,
description: 'The new platform for the updated project.',
},
{
displayName: 'Digests Maximum Delay',
name: 'digestsMaxDelay',
type: 'number',
default: 1800,
description: 'Maximum interval to digest alerts.',
},
{
displayName: 'Digests Minimun Delay',
name: 'digestsMinDelay',
type: 'number',
default: 60,
description: 'Minium interval to digest alerts.',
},
{
displayName: 'Name',
@ -294,6 +310,13 @@ export const projectFields = [
default: '',
description: 'The new slug for the updated project.',
},
{
displayName: 'Team',
name: 'team',
type: 'string',
default: '',
description: 'The new team name.',
},
{
displayName: 'Platform',
name: 'platform',
@ -301,29 +324,9 @@ export const projectFields = [
default: '',
description: 'The new platform for the updated project.',
},
{
displayName: 'Bookmarked',
name: 'isBookmarked',
type: 'boolean',
default: false,
description: 'The new platform for the updated project.',
},
{
displayName: 'Digests Minimun Delay',
name: 'digestsMinDelay',
type: 'number',
default: 60,
description: 'Minium interval to digest alerts.',
},
{
displayName: 'Digests Maximum Delay',
name: 'digestsMaxDelay',
type: 'number',
default: 1800,
description: 'Maximum interval to digest alerts.',
},
],
},
/* -------------------------------------------------------------------------- */
/* project:delete */
/* -------------------------------------------------------------------------- */

View file

@ -20,6 +20,11 @@ export const releaseOperations = [
value: 'create',
description: 'Create a release',
},
{
name: 'Delete',
value: 'delete',
description: 'Delete a release',
},
{
name: 'Get',
value: 'get',
@ -35,11 +40,6 @@ export const releaseOperations = [
value: 'update',
description: 'Update a release',
},
{
name: 'Delete',
value: 'delete',
description: 'Delete a release',
},
],
default: 'get',
description: 'The operation to perform',
@ -138,6 +138,7 @@ export const releaseFields = [
},
],
},
/* -------------------------------------------------------------------------- */
/* release:get/delete */
/* -------------------------------------------------------------------------- */
@ -182,6 +183,7 @@ export const releaseFields = [
required: true,
description: 'The version identifier of the release.',
},
/* -------------------------------------------------------------------------- */
/* release:create */
/* -------------------------------------------------------------------------- */
@ -438,6 +440,7 @@ export const releaseFields = [
},
],
},
/* -------------------------------------------------------------------------- */
/* release:update */
/* -------------------------------------------------------------------------- */
@ -497,27 +500,6 @@ export const releaseFields = [
},
},
options: [
{
displayName: 'Ref',
name: 'ref',
type: 'string',
default: '',
description: 'A URL that points to the release. This can be the path to an online interface to the sourcecode for instance.',
},
{
displayName: 'URL',
name: 'url',
type: 'string',
default: '',
description: 'A URL that points to the release. This can be the path to an online interface to the sourcecode for instance.',
},
{
displayName: 'Date released',
name: 'dateReleased',
type: 'dateTime',
default: '',
description: 'an optional date that indicates when the release went live. If not provided the current time is assumed.',
},
{
displayName: 'Commits',
name: 'commits',
@ -626,6 +608,20 @@ export const releaseFields = [
},
],
},
{
displayName: 'Date released',
name: 'dateReleased',
type: 'dateTime',
default: '',
description: 'an optional date that indicates when the release went live. If not provided the current time is assumed.',
},
{
displayName: 'Ref',
name: 'ref',
type: 'string',
default: '',
description: 'A URL that points to the release. This can be the path to an online interface to the sourcecode for instance.',
},
{
displayName: 'Refs',
name: 'refs',
@ -667,6 +663,13 @@ export const releaseFields = [
},
],
},
{
displayName: 'URL',
name: 'url',
type: 'string',
default: '',
description: 'A URL that points to the release. This can be the path to an online interface to the sourcecode for instance.',
},
],
},
] as INodeProperties[];

View file

@ -475,16 +475,10 @@ export class SentryIo implements INodeType {
responseData = await sentryIoApiRequest.call(this, 'POST', endpoint, qs);
}
if (operation === 'update') {
const name = this.getNodeParameter('name', i) as string;
const organizationSlug = this.getNodeParameter('organization_slug', i) as string;
const updateFields = this.getNodeParameter('updateFields', i) as IDataObject;
const endpoint = `/api/0/organizations/${organizationSlug}/`;
const body = {name};
if (updateFields.slug) {
Object.assign(body, updateFields.slug as string);
}
const body = this.getNodeParameter('updateFields', i) as IDataObject;
responseData = await sentryIoApiRequest.call(this, 'PUT', endpoint, body, qs);
}
@ -650,7 +644,7 @@ export class SentryIo implements INodeType {
const updateFields = this.getNodeParameter('updateFields', i) as IDataObject;
const body = {...updateFields};
const body = { ...updateFields };
if (updateFields.commits) {
const commits: ICommit[] = [];
@ -694,7 +688,7 @@ export class SentryIo implements INodeType {
body.refs = refs;
}
responseData = await sentryIoApiRequest.call(this, 'PUT', endpoint, body, qs);
}
}
@ -742,17 +736,10 @@ export class SentryIo implements INodeType {
if (operation === 'update') {
const organizationSlug = this.getNodeParameter('organizationSlug', i) as string;
const teamSlug = this.getNodeParameter('teamSlug', i) as string;
const name = this.getNodeParameter('name', i) as string;
const endpoint = `/api/0/teams/${organizationSlug}/${teamSlug}/`;
const updateFields = this.getNodeParameter('updateFields', i) as IDataObject;
const body = this.getNodeParameter('updateFields', i) as IDataObject;
const body={name};
if (updateFields.slug) {
Object.assign(body, updateFields);
}
responseData = await sentryIoApiRequest.call(this, 'PUT', endpoint, body, qs);
}
if (operation === 'delete') {

View file

@ -20,6 +20,11 @@ export const teamOperations = [
value: 'create',
description: 'Create a new team',
},
{
name: 'Delete',
value: 'delete',
description: 'Delete a team',
},
{
name: 'Get',
value: 'get',
@ -35,11 +40,6 @@ export const teamOperations = [
value: 'update',
description: 'Update a team',
},
{
name: 'Delete',
value: 'delete',
description: 'Delete a team',
},
],
default: 'get',
description: 'The operation to perform',
@ -47,9 +47,9 @@ export const teamOperations = [
] as INodeProperties[];
export const teamFields = [
/* -------------------------------------------------------------------------- */
/* team:getAll */
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
/* team:getAll */
/* -------------------------------------------------------------------------- */
{
displayName: 'Organization Slug',
name: 'organizationSlug',
@ -112,9 +112,10 @@ export const teamFields = [
default: 100,
description: 'How many results to return.',
},
/* -------------------------------------------------------------------------- */
/* team:get */
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
/* team:get */
/* -------------------------------------------------------------------------- */
{
displayName: 'Organization Slug',
name: 'organizationSlug',
@ -160,9 +161,10 @@ export const teamFields = [
required: true,
description: 'The slug of the team to get.',
},
/* -------------------------------------------------------------------------- */
/* team:create */
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
/* team:create */
/* -------------------------------------------------------------------------- */
{
displayName: 'Organization Slug',
name: 'organizationSlug',
@ -228,9 +230,10 @@ export const teamFields = [
},
],
},
/* -------------------------------------------------------------------------- */
/* team:update */
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
/* team:update */
/* -------------------------------------------------------------------------- */
{
displayName: 'Organization Slug',
name: 'organizationSlug',
@ -276,24 +279,6 @@ export const teamFields = [
required: true,
description: 'The slug of the team to update.',
},
{
displayName: 'Name',
name: 'name',
type: 'string',
default: '',
displayOptions: {
show: {
resource: [
'team',
],
operation: [
'update',
],
},
},
required: true,
description: 'The new name of the team.',
},
{
displayName: 'Update Fields',
name: 'updateFields',
@ -311,6 +296,13 @@ export const teamFields = [
},
},
options: [
{
displayName: 'Name',
name: 'name',
type: 'string',
default: '',
description: 'The new name of the team.',
},
{
displayName: 'Slug',
name: 'slug',
@ -320,9 +312,10 @@ export const teamFields = [
},
],
},
/* -------------------------------------------------------------------------- */
/* team:delete */
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
/* team:delete */
/* -------------------------------------------------------------------------- */
{
displayName: 'Organization Slug',
name: 'organizationSlug',