mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
fix(Airtable Node): Do not allow to use deprecated api keys in v1 (#9171)
This commit is contained in:
@@ -10,7 +10,7 @@ export class AirtableApi implements ICredentialType {
|
|||||||
properties: INodeProperties[] = [
|
properties: INodeProperties[] = [
|
||||||
{
|
{
|
||||||
displayName:
|
displayName:
|
||||||
'API Keys will be deprecated by the end of January 2024, see <a href="https://support.airtable.com/docs/airtable-api-key-deprecation-notice" target="_blank">this article</a> for more details. We recommend to use Personal Access Token instead.',
|
"This type of connection (API Key) was deprecated and can't be used anymore. Please create a new credential of type 'Access Token' instead.",
|
||||||
name: 'deprecated',
|
name: 'deprecated',
|
||||||
type: 'notice',
|
type: 'notice',
|
||||||
default: '',
|
default: '',
|
||||||
|
|||||||
@@ -62,10 +62,6 @@ const versionDescription: INodeTypeDescription = {
|
|||||||
name: 'authentication',
|
name: 'authentication',
|
||||||
type: 'options',
|
type: 'options',
|
||||||
options: [
|
options: [
|
||||||
{
|
|
||||||
name: 'API Key',
|
|
||||||
value: 'airtableApi',
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: 'Access Token',
|
name: 'Access Token',
|
||||||
value: 'airtableTokenApi',
|
value: 'airtableTokenApi',
|
||||||
@@ -74,10 +70,26 @@ const versionDescription: INodeTypeDescription = {
|
|||||||
name: 'OAuth2',
|
name: 'OAuth2',
|
||||||
value: 'airtableOAuth2Api',
|
value: 'airtableOAuth2Api',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'API Key (Deprecated)',
|
||||||
|
value: 'airtableApi',
|
||||||
|
},
|
||||||
],
|
],
|
||||||
default: 'airtableApi',
|
default: 'airtableApi',
|
||||||
},
|
},
|
||||||
oldVersionNotice,
|
oldVersionNotice,
|
||||||
|
{
|
||||||
|
displayName:
|
||||||
|
"This type of connection (API Key) was deprecated and can't be used anymore. Please create a new credential of type 'Access Token' instead.",
|
||||||
|
name: 'deprecated',
|
||||||
|
type: 'notice',
|
||||||
|
default: '',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
authentication: ['airtableApi'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Operation',
|
displayName: 'Operation',
|
||||||
name: 'operation',
|
name: 'operation',
|
||||||
@@ -552,6 +564,13 @@ export class AirtableV1 implements INodeType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||||
|
const authentication = this.getNodeParameter('authentication', 0);
|
||||||
|
if (authentication === 'airtableApi') {
|
||||||
|
throw new NodeOperationError(
|
||||||
|
this.getNode(),
|
||||||
|
'The API Key connection was deprecated by Airtable, please use Access Token or OAuth2 instead.',
|
||||||
|
);
|
||||||
|
}
|
||||||
const items = this.getInputData();
|
const items = this.getInputData();
|
||||||
const returnData: INodeExecutionData[] = [];
|
const returnData: INodeExecutionData[] = [];
|
||||||
let responseData;
|
let responseData;
|
||||||
|
|||||||
@@ -44,16 +44,15 @@ describe('Execute Airtable Node', () => {
|
|||||||
|
|
||||||
for (const testData of tests) {
|
for (const testData of tests) {
|
||||||
test(testData.description, async () => {
|
test(testData.description, async () => {
|
||||||
// execute workflow
|
try {
|
||||||
const { result } = await executeWorkflow(testData, nodeTypes);
|
// execute workflow
|
||||||
|
await executeWorkflow(testData, nodeTypes);
|
||||||
// check if result node data matches expected test data
|
} catch (error) {
|
||||||
const resultNodeData = Helpers.getResultNodeData(result, testData);
|
expect(error).toBeUndefined();
|
||||||
resultNodeData.forEach(({ nodeName, resultData }) =>
|
expect(error.message).toEqual(
|
||||||
expect(resultData).toEqual(testData.output.nodeData[nodeName]),
|
'The API Key connection was deprecated by Airtable, please use Access Token or OAuth2 instead.',
|
||||||
);
|
);
|
||||||
|
}
|
||||||
expect(result.finished).toEqual(true);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -2127,7 +2127,7 @@ export interface WorkflowTestData {
|
|||||||
[key: string]: any[][];
|
[key: string]: any[][];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
nock: {
|
nock?: {
|
||||||
baseUrl: string;
|
baseUrl: string;
|
||||||
mocks: Array<{
|
mocks: Array<{
|
||||||
method: string;
|
method: string;
|
||||||
|
|||||||
Reference in New Issue
Block a user