mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
Merge 142ba47ff7
into d2dd1796a8
This commit is contained in:
commit
a91af1e82c
|
@ -54,6 +54,7 @@ describe('Test AirtableV2, create operation', () => {
|
|||
],
|
||||
},
|
||||
options: {
|
||||
returnFieldsByFieldId: true,
|
||||
typecast: true,
|
||||
ignoreFields: 'spam',
|
||||
},
|
||||
|
@ -89,6 +90,7 @@ describe('Test AirtableV2, create operation', () => {
|
|||
foo: 'foo 1',
|
||||
bar: 'bar 1',
|
||||
},
|
||||
returnFieldsByFieldId: true,
|
||||
typecast: true,
|
||||
});
|
||||
expect(transport.apiRequest).toHaveBeenCalledWith('POST', 'appYoLbase/tblltable', {
|
||||
|
@ -96,6 +98,7 @@ describe('Test AirtableV2, create operation', () => {
|
|||
foo: 'foo 2',
|
||||
bar: 'bar 2',
|
||||
},
|
||||
returnFieldsByFieldId: true,
|
||||
typecast: true,
|
||||
});
|
||||
});
|
||||
|
@ -151,6 +154,7 @@ describe('Test AirtableV2, create operation', () => {
|
|||
foo: 'foo 1',
|
||||
bar: 'bar 1',
|
||||
},
|
||||
returnFieldsByFieldId: false,
|
||||
typecast: false,
|
||||
});
|
||||
});
|
||||
|
|
|
@ -42,7 +42,12 @@ describe('Test AirtableV2, create operation', () => {
|
|||
);
|
||||
|
||||
expect(transport.apiRequest).toHaveBeenCalledTimes(1);
|
||||
expect(transport.apiRequest).toHaveBeenCalledWith('GET', 'appYoLbase/tblltable/recXXX');
|
||||
expect(transport.apiRequest).toHaveBeenCalledWith(
|
||||
'GET',
|
||||
'appYoLbase/tblltable/recXXX',
|
||||
{},
|
||||
{ returnFieldsByFieldId: false },
|
||||
);
|
||||
|
||||
expect(responce).toEqual([
|
||||
{
|
||||
|
|
|
@ -90,6 +90,7 @@ describe('Test AirtableV2, search operation', () => {
|
|||
{
|
||||
fields: ['foo', 'bar'],
|
||||
filterByFormula: 'foo',
|
||||
returnFieldsByFieldId: false,
|
||||
sort: [{ direction: 'desc', field: 'bar' }],
|
||||
view: 'viwView',
|
||||
},
|
||||
|
@ -136,7 +137,12 @@ describe('Test AirtableV2, search operation', () => {
|
|||
'GET',
|
||||
'appYoLbase/tblltable',
|
||||
{},
|
||||
{ fields: ['foo', 'bar'], filterByFormula: 'foo', maxRecords: 1 },
|
||||
{
|
||||
fields: ['foo', 'bar'],
|
||||
filterByFormula: 'foo',
|
||||
maxRecords: 1,
|
||||
returnFieldsByFieldId: false,
|
||||
},
|
||||
);
|
||||
|
||||
expect(result).toHaveLength(1);
|
||||
|
|
|
@ -67,7 +67,7 @@ describe('Test AirtableV2, update operation', () => {
|
|||
|
||||
expect(transport.batchUpdate).toHaveBeenCalledWith(
|
||||
'appYoLbase/tblltable',
|
||||
{ typecast: false },
|
||||
{ returnFieldsByFieldId: false, typecast: false },
|
||||
[{ fields: { bar: 'bar 1', foo: 'foo 1' }, id: 'recXXX' }],
|
||||
);
|
||||
});
|
||||
|
@ -101,7 +101,7 @@ describe('Test AirtableV2, update operation', () => {
|
|||
|
||||
expect(transport.batchUpdate).toHaveBeenCalledWith(
|
||||
'appYoLbase/tblltable',
|
||||
{ typecast: false },
|
||||
{ returnFieldsByFieldId: false, typecast: false },
|
||||
[{ fields: { bar: 'bar 1', foo: 'foo 1', id: 'recXXX' }, id: 'recXXX' }],
|
||||
);
|
||||
});
|
||||
|
|
|
@ -202,6 +202,14 @@ export const insertUpdateOptions: INodeProperties[] = [
|
|||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Return Fields By Field ID',
|
||||
name: 'returnFieldsByFieldId',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description:
|
||||
'Whether to return fields keyed by field ID instead of field name in the response',
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
|
|
@ -65,6 +65,7 @@ export async function execute(
|
|||
const options = this.getNodeParameter('options', i, {});
|
||||
|
||||
const body: IDataObject = {
|
||||
returnFieldsByFieldId: options.returnFieldsByFieldId ? true : false,
|
||||
typecast: options.typecast ? true : false,
|
||||
};
|
||||
|
||||
|
|
|
@ -44,6 +44,14 @@ const properties: INodeProperties[] = [
|
|||
// eslint-disable-next-line n8n-nodes-base/node-param-description-wrong-for-dynamic-multi-options
|
||||
description: "The fields of type 'attachment' that should be downloaded",
|
||||
},
|
||||
{
|
||||
displayName: 'Return Fields By Field ID',
|
||||
name: 'returnFieldsByFieldId',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description:
|
||||
'Whether to return fields keyed by field ID instead of field name in the response',
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
@ -69,10 +77,13 @@ export async function execute(
|
|||
let id;
|
||||
try {
|
||||
id = this.getNodeParameter('id', i) as string;
|
||||
const options = this.getNodeParameter('options', i, {});
|
||||
|
||||
const responseData = await apiRequest.call(this, 'GET', `${base}/${table}/${id}`);
|
||||
const query: IDataObject = {
|
||||
returnFieldsByFieldId: options.returnFieldsByFieldId ? true : false,
|
||||
};
|
||||
|
||||
const options = this.getNodeParameter('options', 0, {});
|
||||
const responseData = await apiRequest.call(this, 'GET', `${base}/${table}/${id}`, {}, query);
|
||||
|
||||
if (options.downloadFields) {
|
||||
const itemWithAttachments = await downloadRecordAttachments.call(
|
||||
|
|
|
@ -80,6 +80,14 @@ const properties: INodeProperties[] = [
|
|||
description: 'The fields you want to include in the output',
|
||||
},
|
||||
viewRLC,
|
||||
{
|
||||
displayName: 'Return Fields By Field ID',
|
||||
name: 'returnFieldsByFieldId',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description:
|
||||
'Whether to return fields keyed by field ID instead of field name in the response',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -172,7 +180,9 @@ export async function execute(
|
|||
const filterByFormula = this.getNodeParameter('filterByFormula', i) as string;
|
||||
|
||||
const body: IDataObject = {};
|
||||
const qs: IDataObject = {};
|
||||
const qs: IDataObject = {
|
||||
returnFieldsByFieldId: options.returnFieldsByFieldId ? true : false,
|
||||
};
|
||||
|
||||
if (filterByFormula) {
|
||||
qs.filterByFormula = filterByFormula;
|
||||
|
|
|
@ -127,7 +127,10 @@ export async function execute(
|
|||
}
|
||||
}
|
||||
|
||||
const body: IDataObject = { typecast: options.typecast ? true : false };
|
||||
const body: IDataObject = {
|
||||
returnFieldsByFieldId: options.returnFieldsByFieldId ? true : false,
|
||||
typecast: options.typecast ? true : false,
|
||||
};
|
||||
|
||||
const responseData = await batchUpdate.call(this, endpoint, body, records);
|
||||
|
||||
|
|
|
@ -94,6 +94,7 @@ export async function execute(
|
|||
}
|
||||
|
||||
const body: IDataObject = {
|
||||
returnFieldsByFieldId: options.returnFieldsByFieldId ? true : false,
|
||||
typecast: options.typecast ? true : false,
|
||||
};
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ export async function getColumns(this: ILoadOptionsFunctions): Promise<ResourceM
|
|||
const isReadOnly = airtableReadOnlyFields.includes(field.type);
|
||||
const options = constructOptions(field);
|
||||
fields.push({
|
||||
id: field.name,
|
||||
id: field.id,
|
||||
displayName: field.name,
|
||||
required: false,
|
||||
defaultMatch: false,
|
||||
|
|
Loading…
Reference in a new issue