mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-10 22:54:05 -08:00
47 lines
835 B
TypeScript
47 lines
835 B
TypeScript
|
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',
|
||
|
},
|
||
|
};
|
||
|
}
|