n8n/packages/nodes-base/nodes/Cockpit/CollectionDescription.ts

239 lines
4 KiB
TypeScript
Raw Normal View History

2020-04-04 07:04:25 -07:00
import { INodeProperties } from 'n8n-workflow';
export const collectionOperations = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
displayOptions: {
show: {
resource: [
'collection',
2020-04-04 07:04:25 -07:00
],
},
},
options: [
{
name: 'Create an entry',
value: 'create',
2020-04-04 07:04:25 -07:00
description: 'Create a collection entry',
},
{
name: 'Get all entries',
value: 'getAll',
2020-04-04 07:04:25 -07:00
description: 'Get all collection entries',
},
{
name: 'Update an entry',
value: 'update',
description: 'Update a collection entries',
},
],
default: 'getAll',
2020-04-04 07:04:25 -07:00
description: 'The operation to perform.',
},
2020-04-04 07:04:25 -07:00
] as INodeProperties[];
export const collectionFields = [
{
displayName: 'Collection',
name: 'collection',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getCollections',
},
displayOptions: {
show: {
resource: [
'collection',
],
},
},
required: true,
description: 'Name of the collection to operate on.'
},
// Collection:entry:create
2020-04-04 07:04:25 -07:00
{
displayName: 'Data',
name: 'data',
type: 'json',
required: true,
default: '',
typeOptions: {
alwaysOpenEditWindow: true,
},
displayOptions: {
show: {
resource: [
'collection',
2020-04-04 07:04:25 -07:00
],
operation: [
'create',
2020-04-04 07:04:25 -07:00
]
},
},
description: 'The data to create.',
2020-04-04 07:04:25 -07:00
},
// Collection:entry:getAll
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
displayOptions: {
show: {
operation: [
'getAll',
],
resource: [
'collection',
],
},
},
default: false,
description: 'If all results should be returned or only up to a given limit.',
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
displayOptions: {
show: {
operation: [
'getAll',
],
resource: [
'collection',
],
returnAll: [
false,
],
},
},
typeOptions: {
minValue: 1,
maxValue: 500,
},
default: 100,
description: 'How many results to return.',
},
2020-04-04 07:04:25 -07:00
{
displayName: 'Options',
name: 'options',
2020-04-04 07:04:25 -07:00
type: 'collection',
placeholder: 'Add Option',
2020-04-04 07:04:25 -07:00
default: {},
displayOptions: {
show: {
resource: [
'collection',
2020-04-04 07:04:25 -07:00
],
operation: [
'getAll',
2020-04-04 07:04:25 -07:00
]
},
},
options: [
{
displayName: 'Fields',
name: 'fields',
type: 'json',
default: '',
typeOptions: {
alwaysOpenEditWindow: true,
},
description: 'Fields to get.',
},
{
displayName: 'Filter',
name: 'filter',
type: 'json',
default: '',
typeOptions: {
alwaysOpenEditWindow: true,
},
description: 'Filter result by fields.',
},
{
displayName: 'Language',
name: 'language',
type: 'string',
2020-04-04 07:04:25 -07:00
default: '',
description: 'Return normalized language fields.',
2020-04-04 07:04:25 -07:00
},
{
displayName: 'Populate',
name: 'populate',
type: 'boolean',
required: true,
default: true,
description: 'Resolve linked collection items.',
},
{
displayName: 'RAW Data',
name: 'rawData',
type: 'boolean',
default: false,
description: `Returns the data exactly in the way it got received from the API.`,
},
2020-04-04 07:04:25 -07:00
{
displayName: 'Skip',
name: 'skip',
type: 'number',
2020-04-04 07:04:25 -07:00
default: '',
description: 'Skip number of entries.',
},
{
displayName: 'Sort',
name: 'sort',
type: 'json',
default: '',
description: 'Sort result by fields.',
2020-04-04 07:04:25 -07:00
},
],
},
// Collection:entry:update
2020-04-04 07:04:25 -07:00
{
displayName: 'Entry ID',
name: 'id',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'collection',
2020-04-04 07:04:25 -07:00
],
operation: [
'update',
]
},
},
description: 'The entry ID.',
},
{
displayName: 'Data',
name: 'data',
type: 'json',
required: true,
default: '',
typeOptions: {
alwaysOpenEditWindow: true,
},
displayOptions: {
show: {
resource: [
'collection',
2020-04-04 07:04:25 -07:00
],
operation: [
'update',
]
},
},
description: 'The data to update.',
},
] as INodeProperties[];