mirror of
https://github.com/n8n-io/n8n-nodes-starter.git
synced 2025-10-28 22:12:26 -05:00
Add nodes generated by the Node CLI, update README (#96)
This commit is contained in:
parent
67ee5b8e80
commit
4fb0cd0bc8
41 changed files with 8549 additions and 745 deletions
151
nodes/GithubIssues/shared/descriptions.ts
Normal file
151
nodes/GithubIssues/shared/descriptions.ts
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const repoOwnerSelect: INodeProperties = {
|
||||
displayName: 'Repository Owner',
|
||||
name: 'owner',
|
||||
type: 'resourceLocator',
|
||||
default: { mode: 'list', value: '' },
|
||||
required: true,
|
||||
modes: [
|
||||
{
|
||||
displayName: 'Repository Owner',
|
||||
name: 'list',
|
||||
type: 'list',
|
||||
placeholder: 'Select an owner...',
|
||||
typeOptions: {
|
||||
searchListMethod: 'getUsers',
|
||||
searchable: true,
|
||||
searchFilterRequired: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Link',
|
||||
name: 'url',
|
||||
type: 'string',
|
||||
placeholder: 'e.g. https://github.com/n8n-io',
|
||||
extractValue: {
|
||||
type: 'regex',
|
||||
regex: 'https:\\/\\/github.com\\/([-_0-9a-zA-Z]+)',
|
||||
},
|
||||
validation: [
|
||||
{
|
||||
type: 'regex',
|
||||
properties: {
|
||||
regex: 'https:\\/\\/github.com\\/([-_0-9a-zA-Z]+)(?:.*)',
|
||||
errorMessage: 'Not a valid GitHub URL',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
displayName: 'By Name',
|
||||
name: 'name',
|
||||
type: 'string',
|
||||
placeholder: 'e.g. n8n-io',
|
||||
validation: [
|
||||
{
|
||||
type: 'regex',
|
||||
properties: {
|
||||
regex: '[-_a-zA-Z0-9]+',
|
||||
errorMessage: 'Not a valid GitHub Owner Name',
|
||||
},
|
||||
},
|
||||
],
|
||||
url: '=https://github.com/{{$value}}',
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export const repoNameSelect: INodeProperties = {
|
||||
displayName: 'Repository Name',
|
||||
name: 'repository',
|
||||
type: 'resourceLocator',
|
||||
default: {
|
||||
mode: 'list',
|
||||
value: '',
|
||||
},
|
||||
required: true,
|
||||
modes: [
|
||||
{
|
||||
displayName: 'Repository Name',
|
||||
name: 'list',
|
||||
type: 'list',
|
||||
placeholder: 'Select an Repository...',
|
||||
typeOptions: {
|
||||
searchListMethod: 'getRepositories',
|
||||
searchable: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Link',
|
||||
name: 'url',
|
||||
type: 'string',
|
||||
placeholder: 'e.g. https://github.com/n8n-io/n8n',
|
||||
extractValue: {
|
||||
type: 'regex',
|
||||
regex: 'https:\\/\\/github.com\\/(?:[-_0-9a-zA-Z]+)\\/([-_.0-9a-zA-Z]+)',
|
||||
},
|
||||
validation: [
|
||||
{
|
||||
type: 'regex',
|
||||
properties: {
|
||||
regex: 'https:\\/\\/github.com\\/(?:[-_0-9a-zA-Z]+)\\/([-_.0-9a-zA-Z]+)(?:.*)',
|
||||
errorMessage: 'Not a valid GitHub Repository URL',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
displayName: 'By Name',
|
||||
name: 'name',
|
||||
type: 'string',
|
||||
placeholder: 'e.g. n8n',
|
||||
validation: [
|
||||
{
|
||||
type: 'regex',
|
||||
properties: {
|
||||
regex: '[-_.0-9a-zA-Z]+',
|
||||
errorMessage: 'Not a valid GitHub Repository Name',
|
||||
},
|
||||
},
|
||||
],
|
||||
url: '=https://github.com/{{$parameter["owner"]}}/{{$value}}',
|
||||
},
|
||||
],
|
||||
displayOptions: {
|
||||
hide: {
|
||||
resource: ['user', 'organization'],
|
||||
operation: ['getRepositories'],
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export const issueSelect: INodeProperties = {
|
||||
displayName: 'Issue',
|
||||
name: 'issue',
|
||||
type: 'resourceLocator',
|
||||
default: {
|
||||
mode: 'list',
|
||||
value: '',
|
||||
},
|
||||
required: true,
|
||||
modes: [
|
||||
{
|
||||
displayName: 'Issue',
|
||||
name: 'list',
|
||||
type: 'list',
|
||||
placeholder: 'Select an Issue...',
|
||||
typeOptions: {
|
||||
searchListMethod: 'getIssues',
|
||||
searchable: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'By ID',
|
||||
name: 'name',
|
||||
type: 'string',
|
||||
placeholder: 'e.g. 123',
|
||||
url: '=https://github.com/{{$parameter.owner}}/{{$parameter.repository}}/issues/{{$value}}',
|
||||
},
|
||||
],
|
||||
};
|
||||
32
nodes/GithubIssues/shared/transport.ts
Normal file
32
nodes/GithubIssues/shared/transport.ts
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
import type {
|
||||
IHookFunctions,
|
||||
IExecuteFunctions,
|
||||
IExecuteSingleFunctions,
|
||||
ILoadOptionsFunctions,
|
||||
IHttpRequestMethods,
|
||||
IDataObject,
|
||||
IHttpRequestOptions,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
export async function githubApiRequest(
|
||||
this: IHookFunctions | IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions,
|
||||
method: IHttpRequestMethods,
|
||||
resource: string,
|
||||
qs: IDataObject = {},
|
||||
body: IDataObject | undefined = undefined,
|
||||
) {
|
||||
const authenticationMethod = this.getNodeParameter('authentication', 0);
|
||||
|
||||
const options: IHttpRequestOptions = {
|
||||
method: method,
|
||||
qs,
|
||||
body,
|
||||
url: `https://api.github.com${resource}`,
|
||||
json: true,
|
||||
};
|
||||
|
||||
const credentialType =
|
||||
authenticationMethod === 'accessToken' ? 'githubIssuesApi' : 'githubIssuesOAuth2Api';
|
||||
|
||||
return this.helpers.httpRequestWithAuthentication.call(this, credentialType, options);
|
||||
}
|
||||
14
nodes/GithubIssues/shared/utils.ts
Normal file
14
nodes/GithubIssues/shared/utils.ts
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
export function parseLinkHeader(header?: string): { [rel: string]: string } {
|
||||
const links: { [rel: string]: string } = {};
|
||||
|
||||
for (const part of header?.split(',') ?? []) {
|
||||
const section = part.trim();
|
||||
const match = section.match(/^<([^>]+)>\s*;\s*rel="?([^"]+)"?/);
|
||||
if (match) {
|
||||
const [, url, rel] = match;
|
||||
links[rel] = url;
|
||||
}
|
||||
}
|
||||
|
||||
return links;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue