n8n/packages/nodes-base/credentials/NpmApi.credentials.ts
कारतोफ्फेलस्क्रिप्ट™ f3bc6f19b6
feat: Create NPM node (#6177)
2023-05-10 12:37:26 +02:00

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',
},
};
}