mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-11 07:04:06 -08:00
63b6c9f128
* ✏️ Alphabetize rules * 🔖 Update version * ⚡ Update lintfix command * ⚡ Run baseline lintfix * 📦 Update package-lock.json * 👕 Apply `node-param-description-untrimmed` (#3200) * Removing unneeded backticks (#3249) * 👕 Apply node-param-description-wrong-for-return-all (#3253) * 👕 Apply node-param-description-missing-limit (#3252) Co-authored-by: Iván Ovejero <ivov.src@gmail.com> * 👕 Apply node-param-description-excess-final-period (#3250) Co-authored-by: Iván Ovejero <ivov.src@gmail.com> * 👕 Apply node-param-description-unencoded-angle-brackets (#3256) Co-authored-by: Iván Ovejero <ivov.src@gmail.com> * 👕 Apply node-param-description-url-missing-protocol (#3258) * 👕 Apply `node-param-description-miscased-id` (#3254) Co-authored-by: Iván Ovejero <ivov.src@gmail.com> * 👕 Apply node-param-description-wrong-for-limit (#3257) Co-authored-by: Iván Ovejero <ivov.src@gmail.com> * 👕 Apply node-param-description-wrong-for-ignore-ssl-issues (#3261) * 👕 Apply rule * ⚡ Restore lintfix script * ⚡ Restore lintfix script Co-authored-by: agobrech <45268029+agobrech@users.noreply.github.com> Co-authored-by: Omar Ajoue <krynble@gmail.com> Co-authored-by: Michael Kret <88898367+michael-radency@users.noreply.github.com>
302 lines
5.2 KiB
TypeScript
302 lines
5.2 KiB
TypeScript
import {
|
|
INodeProperties,
|
|
} from 'n8n-workflow';
|
|
|
|
import {
|
|
address,
|
|
currencies,
|
|
makeCustomFieldsFixedCollection,
|
|
makeGetAllFields,
|
|
} from './SharedFields';
|
|
|
|
export const vendorOperations: INodeProperties[] = [
|
|
{
|
|
displayName: 'Operation',
|
|
name: 'operation',
|
|
type: 'options',
|
|
displayOptions: {
|
|
show: {
|
|
resource: [
|
|
'vendor',
|
|
],
|
|
},
|
|
},
|
|
options: [
|
|
{
|
|
name: 'Create',
|
|
value: 'create',
|
|
description: 'Create a vendor',
|
|
},
|
|
{
|
|
name: 'Create or Update',
|
|
value: 'upsert',
|
|
description: 'Create a new record, or update the current one if it already exists (upsert)',
|
|
},
|
|
{
|
|
name: 'Delete',
|
|
value: 'delete',
|
|
description: 'Delete a vendor',
|
|
},
|
|
{
|
|
name: 'Get',
|
|
value: 'get',
|
|
description: 'Get a vendor',
|
|
},
|
|
{
|
|
name: 'Get All',
|
|
value: 'getAll',
|
|
description: 'Get all vendors',
|
|
},
|
|
{
|
|
name: 'Update',
|
|
value: 'update',
|
|
description: 'Update a vendor',
|
|
},
|
|
],
|
|
default: 'create',
|
|
description: 'Operation to perform',
|
|
},
|
|
];
|
|
|
|
export const vendorFields: INodeProperties[] = [
|
|
// ----------------------------------------
|
|
// vendor: create
|
|
// ----------------------------------------
|
|
{
|
|
displayName: 'Vendor Name',
|
|
name: 'vendorName',
|
|
type: 'string',
|
|
required: true,
|
|
default: '',
|
|
displayOptions: {
|
|
show: {
|
|
resource: [
|
|
'vendor',
|
|
],
|
|
operation: [
|
|
'create',
|
|
],
|
|
},
|
|
},
|
|
},
|
|
|
|
// ----------------------------------------
|
|
// vendor: upsert
|
|
// ----------------------------------------
|
|
{
|
|
displayName: 'Vendor Name',
|
|
name: 'vendorName',
|
|
description: 'Name of the vendor. If a record with this vendor name exists it will be updated, otherwise a new one will be created.',
|
|
type: 'string',
|
|
required: true,
|
|
default: '',
|
|
displayOptions: {
|
|
show: {
|
|
resource: [
|
|
'vendor',
|
|
],
|
|
operation: [
|
|
'upsert',
|
|
],
|
|
},
|
|
},
|
|
},
|
|
|
|
// ----------------------------------------
|
|
// vendor: create + upsert
|
|
// ----------------------------------------
|
|
{
|
|
displayName: 'Additional Fields',
|
|
name: 'additionalFields',
|
|
type: 'collection',
|
|
placeholder: 'Add Field',
|
|
default: {},
|
|
displayOptions: {
|
|
show: {
|
|
resource: [
|
|
'vendor',
|
|
],
|
|
operation: [
|
|
'create',
|
|
'upsert',
|
|
],
|
|
},
|
|
},
|
|
options: [
|
|
address,
|
|
{
|
|
displayName: 'Category',
|
|
name: 'Category',
|
|
type: 'string',
|
|
default: '',
|
|
},
|
|
{
|
|
displayName: 'Currency',
|
|
name: 'Currency',
|
|
type: 'options',
|
|
default: 'USD',
|
|
options: currencies,
|
|
},
|
|
makeCustomFieldsFixedCollection('vendor'),
|
|
{
|
|
displayName: 'Description',
|
|
name: 'Description',
|
|
type: 'string',
|
|
default: '',
|
|
},
|
|
{
|
|
displayName: 'Email',
|
|
name: 'Email',
|
|
type: 'string',
|
|
default: '',
|
|
},
|
|
{
|
|
displayName: 'Phone',
|
|
name: 'Phone',
|
|
type: 'string',
|
|
default: '',
|
|
},
|
|
{
|
|
displayName: 'Website',
|
|
name: 'Website',
|
|
type: 'string',
|
|
default: '',
|
|
},
|
|
],
|
|
},
|
|
|
|
// ----------------------------------------
|
|
// vendor: delete
|
|
// ----------------------------------------
|
|
{
|
|
displayName: 'Vendor ID',
|
|
name: 'vendorId',
|
|
description: 'ID of the vendor to delete',
|
|
type: 'string',
|
|
required: true,
|
|
default: '',
|
|
displayOptions: {
|
|
show: {
|
|
resource: [
|
|
'vendor',
|
|
],
|
|
operation: [
|
|
'delete',
|
|
],
|
|
},
|
|
},
|
|
},
|
|
|
|
// ----------------------------------------
|
|
// vendor: get
|
|
// ----------------------------------------
|
|
{
|
|
displayName: 'Vendor ID',
|
|
name: 'vendorId',
|
|
description: 'ID of the vendor to retrieve',
|
|
type: 'string',
|
|
required: true,
|
|
default: '',
|
|
displayOptions: {
|
|
show: {
|
|
resource: [
|
|
'vendor',
|
|
],
|
|
operation: [
|
|
'get',
|
|
],
|
|
},
|
|
},
|
|
},
|
|
|
|
// ----------------------------------------
|
|
// vendor: getAll
|
|
// ----------------------------------------
|
|
...makeGetAllFields('vendor'),
|
|
|
|
// ----------------------------------------
|
|
// vendor: update
|
|
// ----------------------------------------
|
|
{
|
|
displayName: 'Vendor ID',
|
|
name: 'vendorId',
|
|
description: 'ID of the vendor to update',
|
|
type: 'string',
|
|
required: true,
|
|
default: '',
|
|
displayOptions: {
|
|
show: {
|
|
resource: [
|
|
'vendor',
|
|
],
|
|
operation: [
|
|
'update',
|
|
],
|
|
},
|
|
},
|
|
},
|
|
{
|
|
displayName: 'Update Fields',
|
|
name: 'updateFields',
|
|
type: 'collection',
|
|
placeholder: 'Add Field',
|
|
default: {},
|
|
displayOptions: {
|
|
show: {
|
|
resource: [
|
|
'vendor',
|
|
],
|
|
operation: [
|
|
'update',
|
|
],
|
|
},
|
|
},
|
|
options: [
|
|
address,
|
|
{
|
|
displayName: 'Category',
|
|
name: 'Category',
|
|
type: 'string',
|
|
default: '',
|
|
},
|
|
{
|
|
displayName: 'Currency',
|
|
name: 'Currency',
|
|
type: 'string',
|
|
default: '',
|
|
},
|
|
makeCustomFieldsFixedCollection('vendor'),
|
|
{
|
|
displayName: 'Description',
|
|
name: 'Description',
|
|
type: 'string',
|
|
default: '',
|
|
},
|
|
{
|
|
displayName: 'Email',
|
|
name: 'Email',
|
|
type: 'string',
|
|
default: '',
|
|
},
|
|
{
|
|
displayName: 'Phone',
|
|
name: 'Phone',
|
|
type: 'string',
|
|
default: '',
|
|
},
|
|
{
|
|
displayName: 'Vendor Name',
|
|
name: 'Vendor_Name',
|
|
type: 'string',
|
|
default: '',
|
|
},
|
|
{
|
|
displayName: 'Website',
|
|
name: 'Website',
|
|
type: 'string',
|
|
default: '',
|
|
},
|
|
],
|
|
},
|
|
];
|