n8n/packages/nodes-base/nodes/Orbit/MemberDescription.ts
Iván Ovejero 6dcdb30bf4
refactor: Apply more nodelinting rules (#3324)
* ✏️ Alphabetize lint rules

* 🔥 Remove duplicates

*  Update `lintfix` script

* 👕 Apply `node-param-operation-without-no-data-expression` (#3329)

* 👕 Apply `node-param-operation-without-no-data-expression`

* 👕 Add exceptions

* 👕 Apply `node-param-description-weak` (#3328)

Co-authored-by: Iván Ovejero <ivov.src@gmail.com>

* 👕 Apply `node-param-option-value-duplicate` (#3331)

* 👕 Apply `node-param-description-miscased-json` (#3337)

* 👕 Apply `node-param-display-name-excess-inner-whitespace` (#3335)

Co-authored-by: Iván Ovejero <ivov.src@gmail.com>

* 👕 Apply `node-param-type-options-missing-from-limit` (#3336)

* Rule workig as intended

* ✏️ Uncomment rules

Co-authored-by: Iván Ovejero <ivov.src@gmail.com>

* 👕 Apply `node-param-option-name-duplicate` (#3338)

Co-authored-by: Iván Ovejero <ivov.src@gmail.com>

* 👕 Apply `node-param-description-wrong-for-simplify` (#3334)

*  fix

*  exceptions

*  changed rule ignoring from file to line

* 👕 Apply `node-param-resource-without-no-data-expression` (#3339)

* 👕 Apply `node-param-display-name-untrimmed` (#3341)

* 👕 Apply `node-param-display-name-miscased-id` (#3340)

Co-authored-by: Iván Ovejero <ivov.src@gmail.com>

* 👕 Apply `node-param-resource-with-plural-option` (#3342)

* 👕 Apply `node-param-description-wrong-for-upsert` (#3333)

*  fix

*  replaced record with contact in description

*  fix

Co-authored-by: Iván Ovejero <ivov.src@gmail.com>

* 👕 Apply `node-param-option-description-identical-to-name` (#3343)

* 👕 Apply `node-param-option-name-containing-star` (#3347)

* 👕 Apply `node-param-display-name-wrong-for-update-fields` (#3348)

* 👕 Apply `node-param-option-name-wrong-for-get-all` (#3345)

*  fix

*  exceptions

* 👕 Apply node-param-display-name-wrong-for-simplify (#3344)

* Rule working as intended

* Uncomented other rules

* 👕 Undo and add exceptions

Co-authored-by: Iván Ovejero <ivov.src@gmail.com>

*  Alphabetize lint rules

*  Restore `lintfix` script

Co-authored-by: Michael Kret <88898367+michael-radency@users.noreply.github.com>
Co-authored-by: agobrech <45268029+agobrech@users.noreply.github.com>
2022-05-20 23:47:24 +02:00

876 lines
15 KiB
TypeScript

import {
INodeProperties,
} from 'n8n-workflow';
export const memberOperations: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
displayOptions: {
show: {
resource: [
'member',
],
},
},
options: [
{
name: 'Delete',
value: 'delete',
description: 'Delete a member',
},
{
name: 'Get',
value: 'get',
description: 'Get a member',
},
{
name: 'Get All',
value: 'getAll',
description: 'Get all members in a workspace',
},
{
name: 'Lookup',
value: 'lookup',
description: 'Lookup a member by identity',
},
{
name: 'Update',
value: 'update',
description: 'Update a member',
},
{
name: 'Upsert',
value: 'upsert',
description: 'Create a new member, or update the current one if it already exists (upsert)',
},
],
default: 'get',
},
];
export const memberFields: INodeProperties[] = [
/* -------------------------------------------------------------------------- */
/* member:delete */
/* -------------------------------------------------------------------------- */
{
displayName: 'Workspace',
name: 'workspaceId',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getWorkspaces',
},
default: '',
required: true,
displayOptions: {
show: {
resource: [
'member',
],
operation: [
'delete',
],
},
},
},
{
displayName: 'Member ID',
name: 'memberId',
type: 'string',
default: '',
required: true,
displayOptions: {
show: {
resource: [
'member',
],
operation: [
'delete',
],
},
},
},
/* -------------------------------------------------------------------------- */
/* member:get */
/* -------------------------------------------------------------------------- */
{
displayName: 'Workspace',
name: 'workspaceId',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getWorkspaces',
},
default: '',
required: true,
displayOptions: {
show: {
resource: [
'member',
],
operation: [
'get',
],
},
},
},
{
displayName: 'Member ID',
name: 'memberId',
type: 'string',
default: '',
required: true,
displayOptions: {
show: {
resource: [
'member',
],
operation: [
'get',
],
},
},
},
{
displayName: 'Resolve Identities',
name: 'resolveIdentities',
type: 'boolean',
displayOptions: {
show: {
operation: [
'get',
],
resource: [
'member',
],
},
},
default: false,
description: 'By default, the response just includes the reference of the identity. When set to true the identities will be resolved automatically.',
},
/* -------------------------------------------------------------------------- */
/* member:getAll */
/* -------------------------------------------------------------------------- */
{
displayName: 'Workspace',
name: 'workspaceId',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getWorkspaces',
},
default: '',
required: true,
displayOptions: {
show: {
resource: [
'member',
],
operation: [
'getAll',
],
},
},
},
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
displayOptions: {
show: {
operation: [
'getAll',
],
resource: [
'member',
],
},
},
default: false,
description: 'Whether to return all results or only up to a given limit',
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
displayOptions: {
show: {
operation: [
'getAll',
],
resource: [
'member',
],
returnAll: [
false,
],
},
},
typeOptions: {
minValue: 1,
maxValue: 500,
},
default: 100,
description: 'Max number of results to return',
},
{
displayName: 'Resolve Identities',
name: 'resolveIdentities',
type: 'boolean',
displayOptions: {
show: {
operation: [
'getAll',
],
resource: [
'member',
],
},
},
default: false,
description: 'By default, the response just includes the reference of the identity. When set to true the identities will be resolved automatically.',
},
{
displayName: 'Options',
name: 'options',
type: 'collection',
placeholder: 'Add Option',
default: {},
displayOptions: {
show: {
resource: [
'member',
],
operation: [
'getAll',
],
},
},
options: [
{
displayName: 'Sort By',
name: 'sort',
type: 'string',
default: '',
description: 'Name of the field the response will be sorted by',
},
{
displayName: 'Sort Direction',
name: 'direction',
type: 'options',
options: [
{
name: 'ASC',
value: 'ASC',
},
{
name: 'DESC',
value: 'DESC',
},
],
default: '',
},
],
},
/* -------------------------------------------------------------------------- */
/* member:lookup */
/* -------------------------------------------------------------------------- */
{
displayName: 'Workspace',
name: 'workspaceId',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getWorkspaces',
},
default: '',
required: true,
displayOptions: {
show: {
resource: [
'member',
],
operation: [
'lookup',
],
},
},
},
{
displayName: 'Source',
name: 'source',
type: 'options',
options: [
{
name: 'Discourse',
value: 'discourse',
},
{
name: 'Email',
value: 'email',
},
{
name: 'GitHub',
value: 'github',
},
{
name: 'Twitter',
value: 'twitter',
},
],
default: '',
required: true,
displayOptions: {
show: {
resource: [
'member',
],
operation: [
'lookup',
],
},
},
description: 'Set to github, twitter, email, discourse or the source of any identities you\'ve manually created',
},
{
displayName: 'Search By',
name: 'searchBy',
type: 'options',
options: [
{
name: 'Username',
value: 'username',
},
{
name: 'ID',
value: 'id',
},
],
default: '',
required: true,
displayOptions: {
show: {
resource: [
'member',
],
operation: [
'lookup',
],
source: [
'discourse',
'github',
'twitter',
],
},
},
},
{
displayName: 'ID',
name: 'id',
type: 'string',
default: '',
required: true,
displayOptions: {
show: {
resource: [
'member',
],
operation: [
'lookup',
],
searchBy: [
'id',
],
source: [
'discourse',
'github',
'twitter',
],
},
},
description: 'The username at the source',
},
{
displayName: 'Username',
name: 'username',
type: 'string',
default: '',
required: true,
displayOptions: {
show: {
resource: [
'member',
],
operation: [
'lookup',
],
searchBy: [
'username',
],
source: [
'discourse',
'github',
'twitter',
],
},
},
description: 'The username at the source',
},
{
displayName: 'Email',
name: 'email',
type: 'string',
default: '',
required: true,
displayOptions: {
show: {
resource: [
'member',
],
operation: [
'lookup',
],
source: [
'email',
],
},
},
description: 'The email address',
},
{
displayName: 'Host',
name: 'host',
type: 'string',
default: '',
required: true,
displayOptions: {
show: {
resource: [
'member',
],
operation: [
'lookup',
],
source: [
'discourse',
],
},
},
},
/* -------------------------------------------------------------------------- */
/* member:update */
/* -------------------------------------------------------------------------- */
{
displayName: 'Workspace',
name: 'workspaceId',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getWorkspaces',
},
default: '',
required: true,
displayOptions: {
show: {
resource: [
'member',
],
operation: [
'update',
],
},
},
},
{
displayName: 'Member ID',
name: 'memberId',
type: 'string',
default: '',
required: true,
displayOptions: {
show: {
resource: [
'member',
],
operation: [
'update',
],
},
},
},
{
displayName: 'Update Fields',
name: 'updateFields',
type: 'collection',
placeholder: 'Add Field',
displayOptions: {
show: {
resource: [
'member',
],
operation: [
'update',
],
},
},
default: {},
options: [
{
displayName: 'Bio',
name: 'bio',
type: 'string',
default: '',
},
{
displayName: 'Birthday',
name: 'birthday',
type: 'dateTime',
default: '',
},
{
displayName: 'Company',
name: 'company',
type: 'string',
default: '',
},
{
displayName: 'Location',
name: 'location',
type: 'string',
default: '',
},
{
displayName: 'Name',
name: 'name',
type: 'string',
default: '',
},
{
displayName: 'Pronouns',
name: 'pronouns',
type: 'string',
default: '',
},
{
displayName: 'Shipping Address',
name: 'shippingAddress',
type: 'string',
default: '',
},
{
displayName: 'Slug',
name: 'slug',
type: 'string',
default: '',
},
{
displayName: 'Tags to Add',
name: 'tagsToAdd',
type: 'string',
default: '',
description: 'Adds tags to member; comma-separated string or array',
},
{
displayName: 'Tag List',
name: 'tagList',
type: 'string',
default: '',
description: 'Replaces all tags for the member; comma-separated string or array',
},
{
displayName: 'T-Shirt',
name: 'tShirt',
type: 'string',
default: '',
},
{
displayName: 'Teammate',
name: 'teammate',
type: 'boolean',
default: false,
},
{
displayName: 'URL',
name: 'url',
type: 'string',
default: '',
},
],
},
/* -------------------------------------------------------------------------- */
/* member:upsert */
/* -------------------------------------------------------------------------- */
{
displayName: 'Workspace',
name: 'workspaceId',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getWorkspaces',
},
default: '',
required: true,
displayOptions: {
show: {
resource: [
'member',
],
operation: [
'upsert',
],
},
},
},
{
displayName: 'Identity',
name: 'identityUi',
type: 'fixedCollection',
description: 'The identity is used to find the member. If no member exists, a new member will be created and linked to the provided identity.',
typeOptions: {
multipleValues: false,
},
placeholder: 'Add Identity',
default: {},
displayOptions: {
show: {
resource: [
'member',
],
operation: [
'upsert',
],
},
},
options: [
{
displayName: 'Identity',
name: 'identityValue',
values: [
{
displayName: 'Source',
name: 'source',
type: 'options',
options: [
{
name: 'Discourse',
value: 'discourse',
},
{
name: 'Email',
value: 'email',
},
{
name: 'GitHub',
value: 'github',
},
{
name: 'Twitter',
value: 'twitter',
},
],
default: '',
description: 'Set to github, twitter, email, discourse or the source of any identities you\'ve manually created',
},
{
displayName: 'Search By',
name: 'searchBy',
type: 'options',
options: [
{
name: 'Username',
value: 'username',
},
{
name: 'ID',
value: 'id',
},
],
default: '',
required: true,
displayOptions: {
show: {
source: [
'discourse',
'github',
'twitter',
],
},
},
},
{
displayName: 'ID',
name: 'id',
type: 'string',
default: '',
required: true,
displayOptions: {
show: {
searchBy: [
'id',
],
source: [
'discourse',
'github',
'twitter',
],
},
},
description: 'The username at the source',
},
{
displayName: 'Username',
name: 'username',
type: 'string',
default: '',
required: true,
displayOptions: {
show: {
searchBy: [
'username',
],
source: [
'discourse',
'github',
'twitter',
],
},
},
description: 'The username at the source',
},
{
displayName: 'Email',
name: 'email',
type: 'string',
default: '',
required: true,
displayOptions: {
show: {
source: [
'email',
],
},
},
},
{
displayName: 'Host',
name: 'host',
type: 'string',
default: '',
required: true,
displayOptions: {
show: {
source: [
'discourse',
],
},
},
},
],
},
],
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
displayOptions: {
show: {
resource: [
'member',
],
operation: [
'upsert',
],
},
},
default: {},
options: [
{
displayName: 'Bio',
name: 'bio',
type: 'string',
default: '',
},
{
displayName: 'Birthday',
name: 'birthday',
type: 'dateTime',
default: '',
},
{
displayName: 'Company',
name: 'company',
type: 'string',
default: '',
},
{
displayName: 'Location',
name: 'location',
type: 'string',
default: '',
},
{
displayName: 'Name',
name: 'name',
type: 'string',
default: '',
},
{
displayName: 'Pronouns',
name: 'pronouns',
type: 'string',
default: '',
},
{
displayName: 'Shipping Address',
name: 'shippingAddress',
type: 'string',
default: '',
},
{
displayName: 'Slug',
name: 'slug',
type: 'string',
default: '',
},
{
displayName: 'Tags to Add',
name: 'tagsToAdd',
type: 'string',
default: '',
description: 'Adds tags to member; comma-separated string or array',
},
{
displayName: 'Tag List',
name: 'tagList',
type: 'string',
default: '',
description: 'Replaces all tags for the member; comma-separated string or array',
},
{
displayName: 'T-Shirt',
name: 'tShirt',
type: 'string',
default: '',
},
{
displayName: 'Teammate',
name: 'teammate',
type: 'boolean',
default: false,
},
{
displayName: 'URL',
name: 'url',
type: 'string',
default: '',
},
],
},
];