feat: Create NPM node (#6177)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2023-05-10 10:37:26 +00:00
committed by GitHub
parent 80831cd7c6
commit f3bc6f19b6
12 changed files with 566 additions and 5 deletions

View File

@@ -0,0 +1,46 @@
import type {
IAuthenticateGeneric,
ICredentialTestRequest,
ICredentialType,
INodeProperties,
} from 'n8n-workflow';
export class NpmApi implements ICredentialType {
name = 'npmApi';
displayName = 'Npm API';
documentationUrl = 'npm';
properties: INodeProperties[] = [
{
displayName: 'Access Token',
name: 'accessToken',
type: 'string',
typeOptions: { password: true },
default: '',
},
{
displayName: 'Registry Url',
name: 'registryUrl',
type: 'string',
default: 'https://registry.npmjs.org',
},
];
authenticate: IAuthenticateGeneric = {
type: 'generic',
properties: {
headers: {
Authorization: '=Bearer {{$credentials.accessToken}}',
},
},
};
test: ICredentialTestRequest = {
request: {
baseURL: '={{$credentials.registryUrl}}',
url: '/-/whoami',
},
};
}