n8n/packages/nodes-base/nodes/KoBoToolbox/SubmissionDescription.ts
Iván Ovejero 88dea330b9
refactor: Apply more eslint-plugin-n8n-nodes-base rules (#3534)
*  Update `lintfix` script

*  Run baseline `lintfix`

* 🔥 Remove unneeded exceptions (#3538)

* 🔥 Remove exceptions for `node-param-default-wrong-for-simplify`

* 🔥 Remove exceptions for `node-param-placeholder-miscased-id`

*  Update version

* 👕 Apply `node-param-placeholder-missing` (#3542)

* 👕 Apply `filesystem-wrong-cred-filename` (#3543)

* 👕 Apply `node-param-description-missing-from-dynamic-options` (#3545)

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

* 👕 Apply `node-class-description-empty-string` (#3546)

* 👕 Apply `node-class-description-icon-not-svg` (#3548)

* 👕 Apply `filesystem-wrong-node-filename` (#3549)

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

* 👕 Expand lintings to credentials (#3550)

* 👕 Apply `node-param-multi-options-type-unsorted-items` (#3552)

*  fix

*  Minor fixes

Co-authored-by: Michael Kret <michael.k@radency.com>

* 👕 Apply `node-param-description-wrong-for-dynamic-multi-options` (#3541)

*  Add new lint rule, node-param-description-wrong-for-dynamic-multi-options

*  Fix with updated linting rules

*  Minor fixes

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

* 👕 Apply `node-param-description-boolean-without-whether` (#3553)

*  fix

* Update packages/nodes-base/nodes/Clockify/ProjectDescription.ts

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

* 👕 Apply node-param-display-name-wrong-for-dynamic-multi-options (#3537)

* 👕 Add exceptions

* 👕 Add exception

* ✏️ Alphabetize rules

*  Restore `lintfix` command

Co-authored-by: agobrech <45268029+agobrech@users.noreply.github.com>
Co-authored-by: Omar Ajoue <krynble@gmail.com>
Co-authored-by: Michael Kret <michael.k@radency.com>
Co-authored-by: brianinoa <54530642+brianinoa@users.noreply.github.com>
Co-authored-by: Michael Kret <88898367+michael-radency@users.noreply.github.com>
2022-06-20 07:54:01 -07:00

398 lines
8 KiB
TypeScript

import {
INodeProperties,
} from 'n8n-workflow';
export const submissionOperations: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
displayOptions: {
show: {
resource: [
'submission',
],
},
},
options: [
{
name: 'Delete',
value: 'delete',
description: 'Delete a single submission',
},
{
name: 'Get',
value: 'get',
description: 'Get a single submission',
},
{
name: 'Get All',
value: 'getAll',
description: 'Get all submissions',
},
{
name: 'Get Validation Status',
value: 'getValidation',
description: 'Get the validation status for the submission',
},
{
name: 'Update Validation Status',
value: 'setValidation',
description: 'Set the validation status of the submission',
},
],
default: 'getAll',
},
];
export const submissionFields: INodeProperties[] = [
/* -------------------------------------------------------------------------- */
/* submission:get */
/* -------------------------------------------------------------------------- */
{
displayName: 'Form Name or ID',
name: 'formId',
type: 'options',
typeOptions: {
loadOptionsMethod: 'loadForms',
},
required: true,
default: '',
displayOptions: {
show: {
resource: [
'submission',
],
operation: [
'get',
'delete',
'getValidation',
'setValidation',
],
},
},
description: 'Form ID (e.g. aSAvYreNzVEkrWg5Gdcvg). Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>.',
},
{
displayName: 'Submission ID',
name: 'submissionId',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'submission',
],
operation: [
'get',
'delete',
'getValidation',
'setValidation',
],
},
},
description: 'Submission ID (number, e.g. 245128)',
},
{
displayName: 'Validation Status',
name: 'validationStatus',
type: 'options',
required: true,
displayOptions: {
show: {
resource: [
'submission',
],
operation: [
'setValidation',
],
},
},
default: '',
options: [
{
name: 'Approved',
value: 'validation_status_approved',
},
{
name: 'Not Approved',
value: 'validation_status_not_approved',
},
{
name: 'On Hold',
value: 'validation_status_on_hold',
},
],
description: 'Desired Validation Status',
},
/* -------------------------------------------------------------------------- */
/* submission:getAll */
/* -------------------------------------------------------------------------- */
{
displayName: 'Form Name or ID',
name: 'formId',
type: 'options',
typeOptions: {
loadOptionsMethod: 'loadForms',
},
required: true,
default: '',
displayOptions: {
show: {
resource: [
'submission',
],
operation: [
'getAll',
],
},
},
description: 'Form ID (e.g. aSAvYreNzVEkrWg5Gdcvg). Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>.',
},
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
required: true,
default: false,
displayOptions: {
show: {
resource: [
'submission',
],
operation: [
'getAll',
],
},
},
description: 'Whether to return all results or only up to a given limit',
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
typeOptions: {
maxValue: 3000,
},
displayOptions: {
show: {
resource: [
'submission',
],
operation: [
'getAll',
],
returnAll: [
false,
],
},
},
default: 100,
description: 'Max number of results to return',
},
{
displayName: 'Filter',
name: 'filterType',
type: 'options',
default: 'none',
displayOptions: {
show: {
resource: [
'submission',
],
operation: [
'getAll',
],
},
},
options: [
{
name: 'None',
value: 'none',
},
{
name: 'JSON',
value: 'json',
},
],
},
{
displayName: 'See <a href="https://github.com/SEL-Columbia/formhub/wiki/Formhub-Access-Points-(API)#api-parameters" target="_blank">Formhub API docs</a> to creating filters, using the MongoDB JSON format - e.g. {"_submission_time":{"$lt":"2021-10-01T01:02:03"}}',
name: 'jsonNotice',
type: 'notice',
displayOptions: {
show: {
resource: [
'submission',
],
operation: [
'getAll',
],
filterType: [
'json',
],
},
},
default: '',
},
{
displayName: 'Filters (JSON)',
name: 'filterJson',
type: 'string',
default: '',
typeOptions: {
// alwaysOpenEditWindow: true,
},
displayOptions: {
show: {
resource: [
'submission',
],
operation: [
'getAll',
],
filterType: [
'json',
],
},
},
},
{
displayName: 'Options',
name: 'options',
type: 'collection',
displayOptions: {
show: {
resource: [
'submission',
],
operation: [
'get',
'getAll',
],
},
},
default: {},
placeholder: 'Add Option',
options: [
{
displayName: 'Download Attachments',
name: 'download',
type: 'boolean',
default: false,
description: 'Whether to download submitted attachments',
},
{
displayName: 'Attachments Naming Scheme',
name: 'binaryNamingScheme',
type: 'options',
default: 'sequence',
displayOptions: {
show: {
download: [
true,
],
},
},
options: [
{
name: 'Sequence (e.g. attachment_N)',
value: 'sequence',
},
{
name: 'Use Original Form Question ID',
value: 'question',
},
],
},
{
displayName: 'Attachments Prefix',
name: 'dataPropertyAttachmentsPrefixName',
type: 'string',
displayOptions: {
show: {
download: [
true,
],
binaryNamingScheme: [
'sequence',
],
},
},
default: 'attachment_',
description: 'Prefix for name of the binary property to which to write the attachments. An index starting with 0 will be added. So if name is "attachment_" the first attachment is saved to "attachment_0"',
},
{
displayName: 'Fields to Retrieve',
name: 'fields',
type: 'string',
default: '',
description: 'Comma-separated list of fields to retrieve (e.g. _submission_time,_submitted_by). If left blank, all fields are retrieved.',
},
{
displayName: 'File Size',
name: 'version',
type: 'options',
displayOptions: {
show: {
download: [
true,
],
},
},
default: 'download_url',
description: 'Attachment size to retrieve, if multiple versions are available',
options: [
{
name: 'Original',
value: 'download_url',
},
{
name: 'Small',
value: 'download_small_url',
},
{
name: 'Medium',
value: 'download_medium_url',
},
{
name: 'Large',
value: 'download_large_url',
},
],
},
{
displayName: 'Multiselect Mask',
name: 'selectMask',
type: 'string',
default: 'select_*',
description: 'Comma-separated list of wildcard-style selectors for fields that should be treated as multiselect fields, i.e. parsed as arrays.',
},
{
displayName: 'Number Mask',
name: 'numberMask',
type: 'string',
default: 'n_*, f_*',
description: 'Comma-separated list of wildcard-style selectors for fields that should be treated as numbers',
},
{
displayName: 'Reformat',
name: 'reformat',
type: 'boolean',
default: false,
description: 'Whether to apply some reformatting to the submission data, such as parsing GeoJSON coordinates',
},
{
displayName: 'Sort',
name: 'sort',
type: 'json',
default: '',
description: 'Sort predicates, in MongoDB JSON format (e.g. {"_submission_time":1})',
},
],
},
];