n8n/packages/nodes-base/credentials/GithubOAuth2Api.credentials.ts

63 lines
1.5 KiB
TypeScript
Raw Normal View History

import { ICredentialType, INodeProperties } from 'n8n-workflow';
export class GithubOAuth2Api implements ICredentialType {
name = 'githubOAuth2Api';
extends = ['oAuth2Api'];
feat(core): Allow credential reuse on HTTP Request node (#3228) * :sparkles: Create controller * :zap: Mount controller * :pencil2: Add error messages * :sparkles: Create scopes fetcher * :zap: Account for non-existent credential type * :blue_book: Type scopes request * :zap: Adjust error message * :test_tube: Add tests * :sparkles: Introduce simple node versioning * :zap: Add example how to read version in node-code for custom logic * :bug: Fix setting of parameters * :bug: Fix another instance where it sets the wrong parameter * :zap: Remove unnecessary TOODs * :sparkles: Re-version HTTP Request node * :shirt: Satisfy linter * :zap: Retrieve node version * :rewind: Undo Jan's changes to Set node * :test_tube: Fix CI/CD for `/oauth2-credential` tests (#3230) * :bug: Fix notice warning missing background color (#3231) * :bug: Check for generic auth in node cred types * :zap: Refactor credentials dropdown for HTTP Request node (#3222) * :zap: Discoverability flow (#3229) * :sparkles: Added node credentials type proxy. Changed node credentials input order. * :zap: Add computed property from versioning branch * :bug: Fix cred ref lost and unsaved * :zap: Make options consistent with cred type names * :zap: Use prop to set component order * :zap: Use constant and version * :zap: Fix rendering for generic auth creds * :zap: Mark as required on first selection * :zap: Implement discoverability flow * :zap: Mark as required on subsequent selections * :zap: Fix marking as required after cred deletion * :zap: Refactor to clean up * :zap: Detect position automatically * :zap: Add i18n to option label * :zap: Hide subtitle for custom action * :zap: Detect active credential type * :zap: Prop drilling to re-render select * :fire: Remove unneeded property * :pencil2: Rename arg * :fire: Remove unused import * :fire: Remove unneeded getters * :fire: Remove unused import * :zap: Generalize cred component positioning * :zap: Set up request * :bug: Fix edge case in endpoint * :zap: Display scopes alert box * :rewind: Revert "Generalize cred comp positioning" This reverts commit 75eea89273b854110fa6d1f96c7c1d78dd3b0731. * :zap: Consolidate HTTPRN check * :zap: Fix hue percentage to degree * :fire: Remove unused import * :fire: Remove unused import * :fire: Remove unused class * :fire: Remove unused import * :blue_book: Create type for HTTPRN v2 auth params * :pencil2: Rename check * :fire: Remove unused import * :pencil2: Add i18n to `reportUnsetCredential()` * :zap: Refactor Alex's spacing changes * :zap: Post-merge fixes * :zap: Add docs link * :fire: Exclude Notion OAuth cred * :pencil2: Update copy * :pencil2: Rename param * :art: Reposition notice and simplify styling * :pencil2: Update copy * :pencil2: Update copy * :zap: Hide params during custom action * :zap: Show notice if any cred type supported * :bug: Prevent scopes text overflow * :fire: Remove superfluous check * :pencil2: Break up docstring * :art: Tweak notice styling * :zap: Reorder cred param in Webhook node * :pencil2: Shorten cred name in scopes notice * :test_tube: Update Notice snapshots * :bug: Fix check when `globalRole` is `undefined` * :rewind: Revert 3f2c4a6 * :zap: Apply feedback from Product * :test_tube: Update snapshot * :zap: Adjust regex expansion pattern for singular * :fire: Remove unused import * :fire: Remove logging * :zap: Make `somethingElse` key more unique * :zap: Move something else to constants * :zap: Consolidate notice component * :zap: Apply latest feedback * :test_tube: Update tests * :test_tube: Update snapshot * :pencil2: Fix singular version * :test_tube: Finalize tests * :pencil2: Rename constant * :test_tube: Expand tests * :fire: Remove `truncate` prop * :truck: Move scopes fetching to store * :truck: Move method to component * :zap: Use constant * :zap: Refactor `Notice` component * :test_tube: Update tests * :fire: Remove unused keys * :zap: Inject custom API call option * :fire: Remove unused props * :art: Use `compact` prop * :test_tube: Update snapshots * :truck: Move scopes to store * :truck: Move `nodeCredentialTypes` to parent * :pencil2: Rename cred types per branding * :bug: Clear scopes when none * :zap: Add default * :truck: Move `newHttpRequestNodeCredentialType` to parent * :fire: Remove test data * :zap: Separate lines for readability * :zap: Change reference from node to node name * :pencil2: Rename i18n keys * :zap: Refactor OAuth check * :fire: Remove unused key * :truck: Move `OAuth1/2 API` to i18n * :zap: Refactor `skipCheck` * :zap: Add `stopPropagation` and `preventDefault` * :truck: Move active credential scopes logic to store * :art: Fix spacing for `NodeWebhooks` component * :zap: Implement feedback * :zap: Update HTTPRN default and issue copy * Refactor to use `CredentialsSelect` param (#3304) * :zap: Refactor into cred type param * :zap: Componentize scopes notice * :fire: Remove unused data * :fire: Remove unused `loadOptions` * :zap: Componentize `NodeCredentialType` * :bug: Fix param validation * :fire: Remove dup methods * :zap: Refactor all references to `isHttpRequestNodeV2` * :art: Fix styling * :fire: Remove unused import * :fire: Remove unused properties * :art: Fix spacing for Pipedrive Trigger node * :art: Undo Webhook node styling change * :fire: Remove unused style * :zap: Cover `httpHeaderAuth` edge case * :bug: Fix `this.node` reference * :truck: Rename to `credentialsSelect` * :bug: Fix mistaken renaming * :zap: Set one attribute per line * :zap: Move condition to instantiation site * :truck: Rename prop * :zap: Refactor away `prepareScopesNotice` * :pencil2: Rename i18n keys * :pencil2: Update i18n calls * :pencil2: Add more i18n keys * :fire: Remove unused props * :pencil2: Add explanatory comment * :zap: Adjust check in `hasProxyAuth` * :zap: Refactor `credentialSelected` from prop to event * :zap: Eventify `valueChanged`, `setFocus`, `onBlur` * :zap: Eventify `optionSelected` * :zap: Add `noDataExpression` * :fire: Remove logging * :fire: Remove URL from scopes * :zap: Disregard expressions for display * :art: Use CSS modules * :blue_book: Tigthen interface * :bug: Fix generic auth display * :bug: Fix generic auth validation * :blue_book: Loosen type * :truck: Move event params to end * :zap: Generalize reference * :zap: Refactor generic auth as `credentialsSelect` param * :rewind: Restore check for `httpHeaderAuth ` * :truck: Rename `existing` to `predefined` * Extend metrics for HTTP Request node (#3282) * :zap: Extend metrics * :test_tube: Add tests * :zap: Update param names Co-authored-by: Alex Grozav <alex@grozav.com> * :zap: Update check per new branch * :zap: Include generic auth check * :zap: Adjust telemetry (#3359) * :zap: Filter credential types by label Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com> Co-authored-by: Alex Grozav <alex@grozav.com>
2022-05-24 02:36:19 -07:00
displayName = 'GitHub OAuth2 API';
documentationUrl = 'github';
properties: INodeProperties[] = [
{
displayName: 'Grant Type',
name: 'grantType',
type: 'hidden',
default: 'authorizationCode',
},
{
displayName: 'Github Server',
name: 'server',
type: 'string',
default: 'https://api.github.com',
description: 'The server to connect to. Only has to be set if Github Enterprise is used.',
},
{
displayName: 'Authorization URL',
name: 'authUrl',
type: 'hidden',
default:
'={{$self["server"] === "https://api.github.com" ? "https://github.com" : $self["server"]}}/login/oauth/authorize',
required: true,
},
{
displayName: 'Access Token URL',
name: 'accessTokenUrl',
type: 'hidden',
default:
'={{$self["server"] === "https://api.github.com" ? "https://github.com" : $self["server"]}}/login/oauth/access_token',
required: true,
},
{
displayName: 'Scope',
name: 'scope',
type: 'hidden',
default:
'repo,admin:repo_hook,admin:org,admin:org_hook,gist,notifications,user,write:packages,read:packages,delete:packages,workflow',
},
2020-02-09 13:33:40 -08:00
{
displayName: 'Auth URI Query Parameters',
name: 'authQueryParameters',
type: 'hidden',
2020-02-09 13:33:40 -08:00
default: '',
},
{
displayName: 'Authentication',
name: 'authentication',
type: 'hidden',
default: 'header',
},
];
}