Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into pay-356-enable-new-…
Browse files Browse the repository at this point in the history
…evaluator-config
  • Loading branch information
valya committed Sep 20, 2023
2 parents 17c0030 + 6bc477b commit 98efcbd
Show file tree
Hide file tree
Showing 11 changed files with 169 additions and 10 deletions.
9 changes: 9 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Commits of large-scale changes to exclude from `git blame` results

# Set up linting and formatting (#2120)

56c4c6991fb21ba4b7bdcd22c929f63cc1d1defe

# refactor(editor): Apply Prettier (no-changelog) #4920

5ca2148c7ed06c90f999508928b7a51f9ac7a788
1 change: 1 addition & 0 deletions packages/cli/bin/n8n
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ inspect.defaultOptions.customInspect = false;
require('express-async-errors');
require('source-map-support').install();
require('reflect-metadata');
require('dns').setDefaultResultOrder('ipv4first');

require('@oclif/command')
.run()
Expand Down
5 changes: 3 additions & 2 deletions packages/cli/src/WorkflowRunnerProcess.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
/* eslint-disable @typescript-eslint/no-unsafe-argument */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */

/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable @typescript-eslint/no-shadow */

/* eslint-disable @typescript-eslint/no-use-before-define */
/* eslint-disable @typescript-eslint/unbound-method */
import 'source-map-support/register';
import 'reflect-metadata';
import { setDefaultResultOrder } from 'dns';
setDefaultResultOrder('ipv4first');

import { Container } from 'typedi';
import type { IProcessMessage } from 'n8n-core';
import { BinaryDataManager, UserSettings, WorkflowExecute } from 'n8n-core';
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/test/integration/credentials.controller.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ describe('GET /credentials', () => {

response.body.data.forEach(validateCredential);

const savedIds = [id1, id2];
const returnedIds = response.body.data.map((c) => c.id);
const savedIds = [id1, id2].sort();
const returnedIds = response.body.data.map((c) => c.id).sort();

expect(savedIds).toEqual(returnedIds);
});
Expand Down
73 changes: 73 additions & 0 deletions packages/nodes-base/credentials/LinearOAuth2Api.credentials.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import type { ICredentialType, INodeProperties } from 'n8n-workflow';

const scopes = ['read', 'write', 'issues:create', 'comments:create'];

export class LinearOAuth2Api implements ICredentialType {
name = 'linearOAuth2Api';

extends = ['oAuth2Api'];

displayName = 'Linear OAuth2 API';

documentationUrl = 'linear';

properties: INodeProperties[] = [
{
displayName: 'Grant Type',
name: 'grantType',
type: 'hidden',
default: 'authorizationCode',
},
{
displayName: 'Authorization URL',
name: 'authUrl',
type: 'hidden',
default: 'https://linear.app/oauth/authorize',
required: true,
},
{
displayName: 'Access Token URL',
name: 'accessTokenUrl',
type: 'hidden',
default: 'https://api.linear.app/oauth/token',
required: true,
},
{
displayName: 'Actor',
name: 'actor',
type: 'options',
options: [
{
name: 'User',
value: 'user',
description: 'Resources are created as the user who authorized the application',
},
{
name: 'Application',
value: 'application',
description: 'Resources are created as the application',
},
],
default: 'user',
},
{
displayName: 'Scope',
name: 'scope',
type: 'hidden',
default: scopes.join(' '),
required: true,
},
{
displayName: 'Auth URI Query Parameters',
name: 'authQueryParameters',
type: 'hidden',
default: '={{"actor="+$self["actor"]}}',
},
{
displayName: 'Authentication',
name: 'authentication',
type: 'hidden',
default: 'body',
},
];
}
11 changes: 10 additions & 1 deletion packages/nodes-base/nodes/Html/Html.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,16 @@ export class Html implements INodeType {
table += '</tbody>';
table += '</table>';

return [[{ json: { table } }]];
return [
[
{
json: { table },
pairedItem: items.map((_item, index) => ({
item: index,
})),
},
],
];
}

let item: INodeExecutionData;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ import type {

import {
BINARY_ENCODING,
jsonParse,
NodeApiError,
NodeOperationError,
sleep,
jsonParse,
removeCircularRefs,
sleep,
} from 'n8n-workflow';

import { keysToLowercase } from '@utils/utilities';
Expand Down Expand Up @@ -1152,8 +1152,8 @@ export class HttpRequestV3 implements INodeType {
if (timeout) {
requestOptions.timeout = timeout;
} else {
// set default timeout to 1 hour
requestOptions.timeout = 3600000;
// set default timeout to 5 minutes
requestOptions.timeout = 300_000;
}
if (sendQuery && queryParameterArrays) {
Object.assign(requestOptions, {
Expand Down
7 changes: 6 additions & 1 deletion packages/nodes-base/nodes/Linear/GenericFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export async function linearApiRequest(
option: IDataObject = {},
): Promise<any> {
const endpoint = 'https://api.linear.app/graphql';
const authenticationMethod = this.getNodeParameter('authentication', 0, 'apiToken') as string;

let options: OptionsWithUri = {
headers: {
Expand All @@ -35,7 +36,11 @@ export async function linearApiRequest(
};
options = Object.assign({}, options, option);
try {
return await this.helpers.requestWithAuthentication.call(this, 'linearApi', options);
return await this.helpers.requestWithAuthentication.call(
this,
authenticationMethod === 'apiToken' ? 'linearApi' : 'linearOAuth2Api',
options,
);
} catch (error) {
throw new NodeApiError(this.getNode(), error as JsonObject);
}
Expand Down
30 changes: 30 additions & 0 deletions packages/nodes-base/nodes/Linear/Linear.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,39 @@ export class Linear implements INodeType {
name: 'linearApi',
required: true,
testedBy: 'linearApiTest',
displayOptions: {
show: {
authentication: ['apiToken'],
},
},
},
{
name: 'linearOAuth2Api',
required: true,
displayOptions: {
show: {
authentication: ['oAuth2'],
},
},
},
],
properties: [
{
displayName: 'Authentication',
name: 'authentication',
type: 'options',
options: [
{
name: 'API Token',
value: 'apiToken',
},
{
name: 'OAuth2',
value: 'oAuth2',
},
],
default: 'apiToken',
},
{
displayName: 'Resource',
name: 'resource',
Expand Down
30 changes: 30 additions & 0 deletions packages/nodes-base/nodes/Linear/LinearTrigger.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,20 @@ export class LinearTrigger implements INodeType {
name: 'linearApi',
required: true,
testedBy: 'linearApiTest',
displayOptions: {
show: {
authentication: ['apiToken'],
},
},
},
{
name: 'linearOAuth2Api',
required: true,
displayOptions: {
show: {
authentication: ['oAuth2'],
},
},
},
],
webhooks: [
Expand All @@ -40,6 +54,22 @@ export class LinearTrigger implements INodeType {
},
],
properties: [
{
displayName: 'Authentication',
name: 'authentication',
type: 'options',
options: [
{
name: 'API Token',
value: 'apiToken',
},
{
name: 'OAuth2',
value: 'oAuth2',
},
],
default: 'apiToken',
},
{
displayName: 'Team Name or ID',
name: 'teamId',
Expand Down
1 change: 1 addition & 0 deletions packages/nodes-base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@
"dist/credentials/Ldap.credentials.js",
"dist/credentials/LemlistApi.credentials.js",
"dist/credentials/LinearApi.credentials.js",
"dist/credentials/LinearOAuth2Api.credentials.js",
"dist/credentials/LineNotifyOAuth2Api.credentials.js",
"dist/credentials/LingvaNexApi.credentials.js",
"dist/credentials/LinkedInOAuth2Api.credentials.js",
Expand Down

0 comments on commit 98efcbd

Please sign in to comment.