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, default: 100,
description: 'How many results to return.', description: 'How many results to return.',
}, },
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
/* event:get */ /* event:get */
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */

View file

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

View file

@ -119,6 +119,7 @@ export const organizationFields = [
}, },
], ],
}, },
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
/* organization:get */ /* organization:get */
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
@ -143,6 +144,7 @@ export const organizationFields = [
required: true, required: true,
description: 'The slug of the organization the team should be created for.', description: 'The slug of the organization the team should be created for.',
}, },
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
/* organization:create */ /* organization:create */
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
@ -207,6 +209,7 @@ export const organizationFields = [
}, },
], ],
}, },
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
/* organization:update */ /* organization:update */
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
@ -230,24 +233,6 @@ export const organizationFields = [
required: true, required: true,
description: 'The slug of the organization to update.', 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', displayName: 'Update Fields',
name: 'updateFields', name: 'updateFields',
@ -265,12 +250,19 @@ export const organizationFields = [
}, },
}, },
options: [ options: [
{
displayName: 'Name',
name: 'name',
type: 'string',
default: '',
description: 'The new name of the organization.',
},
{ {
displayName: 'Slug', displayName: 'Slug',
name: 'slug', name: 'slug',
type: 'string', type: 'string',
default: '', 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', value: 'create',
description: 'Create a new project', description: 'Create a new project',
}, },
{
name: 'Delete',
value: 'delete',
description: 'Delete a project',
},
{ {
name: 'Get', name: 'Get',
value: 'get', value: 'get',
@ -35,11 +40,6 @@ export const projectOperations = [
value: 'update', value: 'update',
description: 'Update a project', description: 'Update a project',
}, },
{
name: 'Delete',
value: 'delete',
description: 'Delete a project',
},
], ],
default: 'get', default: 'get',
description: 'The operation to perform', description: 'The operation to perform',
@ -164,6 +164,7 @@ export const projectFields = [
}, },
], ],
}, },
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
/* project:getAll */ /* project:getAll */
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
@ -208,6 +209,7 @@ export const projectFields = [
default: 100, default: 100,
description: 'How many results to return.', description: 'How many results to return.',
}, },
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
/* project:update */ /* project:update */
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
@ -274,11 +276,25 @@ export const projectFields = [
}, },
options: [ options: [
{ {
displayName: 'Team', displayName: 'Bookmarked',
name: 'team', name: 'isBookmarked',
type: 'string', type: 'boolean',
default: '', default: false,
description: 'The new team name.', 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', displayName: 'Name',
@ -294,6 +310,13 @@ export const projectFields = [
default: '', default: '',
description: 'The new slug for the updated project.', description: 'The new slug for the updated project.',
}, },
{
displayName: 'Team',
name: 'team',
type: 'string',
default: '',
description: 'The new team name.',
},
{ {
displayName: 'Platform', displayName: 'Platform',
name: 'platform', name: 'platform',
@ -301,29 +324,9 @@ export const projectFields = [
default: '', default: '',
description: 'The new platform for the updated project.', 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 */ /* project:delete */
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */

View file

@ -20,6 +20,11 @@ export const releaseOperations = [
value: 'create', value: 'create',
description: 'Create a release', description: 'Create a release',
}, },
{
name: 'Delete',
value: 'delete',
description: 'Delete a release',
},
{ {
name: 'Get', name: 'Get',
value: 'get', value: 'get',
@ -35,11 +40,6 @@ export const releaseOperations = [
value: 'update', value: 'update',
description: 'Update a release', description: 'Update a release',
}, },
{
name: 'Delete',
value: 'delete',
description: 'Delete a release',
},
], ],
default: 'get', default: 'get',
description: 'The operation to perform', description: 'The operation to perform',
@ -138,6 +138,7 @@ export const releaseFields = [
}, },
], ],
}, },
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
/* release:get/delete */ /* release:get/delete */
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
@ -182,6 +183,7 @@ export const releaseFields = [
required: true, required: true,
description: 'The version identifier of the release.', description: 'The version identifier of the release.',
}, },
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
/* release:create */ /* release:create */
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
@ -438,6 +440,7 @@ export const releaseFields = [
}, },
], ],
}, },
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
/* release:update */ /* release:update */
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
@ -497,27 +500,6 @@ export const releaseFields = [
}, },
}, },
options: [ 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', displayName: 'Commits',
name: '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', displayName: 'Refs',
name: '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[]; ] as INodeProperties[];

View file

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

View file

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