diff --git a/packages/nodes-base/nodes/Contentful/AssetDescription.ts b/packages/nodes-base/nodes/Contentful/AssetDescription.ts index a753f6dbdc..30b1677136 100644 --- a/packages/nodes-base/nodes/Contentful/AssetDescription.ts +++ b/packages/nodes-base/nodes/Contentful/AssetDescription.ts @@ -192,26 +192,6 @@ export const fields = [ default: '', description: ' Full-text search is case insensitive and might return more results than expected. A query will only take values with more than 1 character.', }, - ], - }, - { - displayName: 'Options', - name: 'options', - type: 'collection', - placeholder: 'Select Option', - default: {}, - displayOptions: { - show: { - resource: [ - resource.value, - ], - operation: [ - 'getAll', - 'get' - ], - }, - }, - options: [ { displayName: 'RAW Data', name: 'rawData', diff --git a/packages/nodes-base/nodes/Contentful/ContentTypeDescription.ts b/packages/nodes-base/nodes/Contentful/ContentTypeDescription.ts index 9c31a32f48..05e18b1373 100644 --- a/packages/nodes-base/nodes/Contentful/ContentTypeDescription.ts +++ b/packages/nodes-base/nodes/Contentful/ContentTypeDescription.ts @@ -67,10 +67,10 @@ export const fields = [ }, }, { - displayName: 'Options', - name: 'options', + displayName: 'Additional Fields', + name: 'additionalFields', type: 'collection', - placeholder: 'Select Option', + placeholder: 'Add Field', default: {}, displayOptions: { show: { diff --git a/packages/nodes-base/nodes/Contentful/Contentful.node.ts b/packages/nodes-base/nodes/Contentful/Contentful.node.ts index 0ad0a96bb6..b4dde2ba0e 100644 --- a/packages/nodes-base/nodes/Contentful/Contentful.node.ts +++ b/packages/nodes-base/nodes/Contentful/Contentful.node.ts @@ -118,11 +118,11 @@ export class Contentful implements INodeType { const id = this.getNodeParameter('contentTypeId', 0) as string; - const options = this.getNodeParameter('options', i) as IDataObject; + const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject; responseData = await contentfulApiRequest.call(this, 'GET', `/spaces/${credentials?.spaceId}/environments/${env}/content_types/${id}`); - if (!options.rawData) { + if (!additionalFields.rawData) { responseData = responseData.fields; } } @@ -137,11 +137,11 @@ export class Contentful implements INodeType { const id = this.getNodeParameter('entryId', 0) as string; - const options = this.getNodeParameter('options', i) as IDataObject; + const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject; responseData = await contentfulApiRequest.call(this, 'GET', `/spaces/${credentials?.spaceId}/environments/${env}/entries/${id}`, {}, qs); - if (!options.rawData) { + if (!additionalFields.rawData) { responseData = responseData.fields; } @@ -151,11 +151,11 @@ export class Contentful implements INodeType { const returnAll = this.getNodeParameter('returnAll', 0) as boolean; const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject; + const rawData = additionalFields.rawData; + additionalFields.rawData = undefined; const env = this.getNodeParameter('environmentId', i) as string; - const options = this.getNodeParameter('options', i) as IDataObject; - Object.assign(qs, additionalFields); if (qs.equal) { @@ -185,7 +185,7 @@ export class Contentful implements INodeType { if (returnAll) { responseData = await contenfulApiRequestAllItems.call(this, 'items', 'GET', `/spaces/${credentials?.spaceId}/environments/${env}/entries`, {}, qs); - if (!options.rawData) { + if (!rawData) { const assets : IDataObject[] = []; // tslint:disable-next-line: no-any responseData.map((asset : any) => { @@ -199,7 +199,7 @@ export class Contentful implements INodeType { responseData = await contentfulApiRequest.call(this, 'GET', `/spaces/${credentials?.spaceId}/environments/${env}/entries`, {}, qs); responseData = responseData.items; - if (!options.rawData) { + if (!rawData) { const assets : IDataObject[] = []; // tslint:disable-next-line: no-any responseData.map((asset : any) => { @@ -219,11 +219,11 @@ export class Contentful implements INodeType { const id = this.getNodeParameter('assetId', 0) as string; - const options = this.getNodeParameter('options', i) as IDataObject; + const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject; responseData = await contentfulApiRequest.call(this, 'GET', `/spaces/${credentials?.spaceId}/environments/${env}/assets/${id}`, {}, qs); - if (!options.rawData) { + if (!additionalFields.rawData) { responseData = responseData.fields; } @@ -234,11 +234,11 @@ export class Contentful implements INodeType { const returnAll = this.getNodeParameter('returnAll', 0) as boolean; const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject; + const rawData = additionalFields.rawData; + additionalFields.rawData = undefined; const env = this.getNodeParameter('environmentId', i) as string; - const options = this.getNodeParameter('options', i) as IDataObject; - Object.assign(qs, additionalFields); if (qs.equal) { @@ -268,7 +268,7 @@ export class Contentful implements INodeType { if (returnAll) { responseData = await contenfulApiRequestAllItems.call(this, 'items', 'GET', `/spaces/${credentials?.spaceId}/environments/${env}/assets`, {}, qs); - if (!options.rawData) { + if (!rawData) { const assets : IDataObject[] = []; // tslint:disable-next-line: no-any responseData.map((asset : any) => { @@ -277,12 +277,12 @@ export class Contentful implements INodeType { responseData = assets; } } else { - const limit = this.getNodeParameter('limit', 0) as number; + const limit = this.getNodeParameter('limit', i) as number; qs.limit = limit; responseData = await contentfulApiRequest.call(this, 'GET', `/spaces/${credentials?.spaceId}/environments/${env}/assets`, {}, qs); responseData = responseData.items; - if (!options.rawData) { + if (!rawData) { const assets : IDataObject[] = []; // tslint:disable-next-line: no-any responseData.map((asset : any) => { diff --git a/packages/nodes-base/nodes/Contentful/EntryDescription.ts b/packages/nodes-base/nodes/Contentful/EntryDescription.ts index fbbee25123..dcce1d7c62 100644 --- a/packages/nodes-base/nodes/Contentful/EntryDescription.ts +++ b/packages/nodes-base/nodes/Contentful/EntryDescription.ts @@ -182,6 +182,13 @@ export const fields = [ default: '', description: ' Full-text search is case insensitive and might return more results than expected. A query will only take values with more than 1 character.', }, + { + displayName: 'RAW Data', + name: 'rawData', + type: 'boolean', + default: false, + description: 'If the data should be returned RAW instead of parsed.', + }, ], }, { @@ -201,31 +208,4 @@ export const fields = [ }, }, }, - { - displayName: 'Options', - name: 'options', - type: 'collection', - placeholder: 'Select Option', - default: {}, - displayOptions: { - show: { - resource: [ - resource.value, - ], - operation: [ - 'get', - 'getAll', - ], - }, - }, - options: [ - { - displayName: 'RAW Data', - name: 'rawData', - type: 'boolean', - default: false, - description: 'If the data should be returned RAW instead of parsed.', - }, - ], - }, ] as INodeProperties[];