Skip to content

Commit

Permalink
Merge branch 'master' into ask-assistant
Browse files Browse the repository at this point in the history
* master:
  refactor(core): Centralize scaling mode (no-changelog) (#9835)
  fix(editor): Remove body padding from storybook previews (no-changelog) (#10317)
  feat(MySQL Node): Return decimal types as numbers (#10313)
  🚀 Release 1.54.0 (#10315)
  feat(Elasticsearch Node): Add bulk operations for Elasticsearch (#9940)
  feat(Stripe Trigger Node): Add Stripe webhook descriptions based on the workflow ID and name (#9956)
  feat(MongoDB Node): Add projection to query options on Find (#9972)
  fix(Invoice Ninja Node): Fix payment types (#10196)
  feat(HTTP Request Tool Node): Use DynamicStructuredTool with models supporting it (no-changelog) (#10246)
  feat: Return scopes on executions (no-changelog) (#10310)
  feat(Webflow Node): Update to use the v2 API (#9996)
  feat(Lemlist Trigger Node): Update Trigger events (#10311)
  feat(Calendly Trigger Node): Update event names (no-changelog) (#10129)
  refactor(core): Reorganize webhook related components under src/webhooks (no-changelog) (#10296)
  docs: Fix links to license files in readme (no-changelog) (#10257)
  fix(editor): Update design system Avatar component to show initials also when only firstName or lastName is given (#10308)
  fix(editor): Update tags filter/editor to not show non existing tag as a selectable option (#10297)
  fix(editor): Update project tabs test (no-changelog) (#10300)
  fix(core): VM2 sandbox should not throw on `new Promise` (#10298)

# Conflicts:
#	packages/design-system/src/components/N8nAvatar/Avatar.vue
  • Loading branch information
MiloradFilipovic committed Aug 7, 2024
2 parents 626d57b + 171173c commit cb8144b
Show file tree
Hide file tree
Showing 120 changed files with 3,560 additions and 1,327 deletions.
41 changes: 41 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,44 @@
# [1.54.0](https://github.com/n8n-io/n8n/compare/[email protected]@1.54.0) (2024-08-07)


### Bug Fixes

* **core:** Ensure OAuth token data is not stubbed in source control ([#10302](https://github.com/n8n-io/n8n/issues/10302)) ([98115e9](https://github.com/n8n-io/n8n/commit/98115e95df8289a8ec400a570a7f256382f8e286))
* **core:** Fix expressions in webhook nodes(Form, Webhook) to access previous node's data ([#10247](https://github.com/n8n-io/n8n/issues/10247)) ([88a1701](https://github.com/n8n-io/n8n/commit/88a170176a3447e7f847e9cf145aeb867b1c5fcf))
* **core:** Fix user telemetry bugs ([#10293](https://github.com/n8n-io/n8n/issues/10293)) ([42a0b59](https://github.com/n8n-io/n8n/commit/42a0b594d6ea2527c55a2aa9976c904cf70ecf92))
* **core:** Make execution and its data creation atomic ([#10276](https://github.com/n8n-io/n8n/issues/10276)) ([ae50bb9](https://github.com/n8n-io/n8n/commit/ae50bb95a8e5bf1cdbf9483da54b84094b82e260))
* **core:** Make OAuth1/OAuth2 callback not require auth ([#10263](https://github.com/n8n-io/n8n/issues/10263)) ([a8e2774](https://github.com/n8n-io/n8n/commit/a8e2774f5382e202556b5506c7788265786aa973))
* **core:** Revert transactions until we remove the legacy sqlite driver ([#10299](https://github.com/n8n-io/n8n/issues/10299)) ([1eba7c3](https://github.com/n8n-io/n8n/commit/1eba7c3c763ac5b6b28c1c6fc43fc8c215249292))
* **core:** Surface enterprise trial error message ([#10267](https://github.com/n8n-io/n8n/issues/10267)) ([432ac1d](https://github.com/n8n-io/n8n/commit/432ac1da59e173ce4c0f2abbc416743d9953ba70))
* **core:** Upgrade tournament to address some XSS vulnerabilities ([#10277](https://github.com/n8n-io/n8n/issues/10277)) ([43ae159](https://github.com/n8n-io/n8n/commit/43ae159ea40c574f8e41bdfd221ab2bf3268eee7))
* **core:** VM2 sandbox should not throw on `new Promise` ([#10298](https://github.com/n8n-io/n8n/issues/10298)) ([7e95f9e](https://github.com/n8n-io/n8n/commit/7e95f9e2e40a99871f1b6abcdacb39ac5f857332))
* **core:** Webhook and form baseUrl missing ([#10290](https://github.com/n8n-io/n8n/issues/10290)) ([8131d66](https://github.com/n8n-io/n8n/commit/8131d66f8ca1b1da00597a12859ee4372148a0c9))
* **editor:** Enable moving resources only if team projects are available by the license ([#10271](https://github.com/n8n-io/n8n/issues/10271)) ([42ba884](https://github.com/n8n-io/n8n/commit/42ba8841c401126c77158a53dc8fcbb45dfce8fd))
* **editor:** Fix execution retry button ([#10275](https://github.com/n8n-io/n8n/issues/10275)) ([55f2ffe](https://github.com/n8n-io/n8n/commit/55f2ffe256c91a028cee95c3bbb37a093a1c0f81))
* **editor:** Update design system Avatar component to show initials also when only firstName or lastName is given ([#10308](https://github.com/n8n-io/n8n/issues/10308)) ([46bbf09](https://github.com/n8n-io/n8n/commit/46bbf09beacad12472d91786b91d845fe2afb26d))
* **editor:** Update tags filter/editor to not show non existing tag as a selectable option ([#10297](https://github.com/n8n-io/n8n/issues/10297)) ([557a76e](https://github.com/n8n-io/n8n/commit/557a76ec2326de72fb7a8b46fc4353f8fd9b591d))
* **Invoice Ninja Node:** Fix payment types ([#10196](https://github.com/n8n-io/n8n/issues/10196)) ([c5acbb7](https://github.com/n8n-io/n8n/commit/c5acbb7ec0d24ec9b30c221fa3b2fb615fb9ec7f))
* Loop node no input data shown ([#10224](https://github.com/n8n-io/n8n/issues/10224)) ([c8ee852](https://github.com/n8n-io/n8n/commit/c8ee852159207be0cfe2c3e0ee8e7b29d838aa35))


### Features

* **core:** Allow filtering executions and users by project in Public API ([#10250](https://github.com/n8n-io/n8n/issues/10250)) ([7056e50](https://github.com/n8n-io/n8n/commit/7056e50b006bda665f64ce6234c5c1967891c415))
* **core:** Allow transferring credentials in Public API ([#10259](https://github.com/n8n-io/n8n/issues/10259)) ([07d7b24](https://github.com/n8n-io/n8n/commit/07d7b247f02a9d7185beca7817deb779a3d665dd))
* **core:** Show sub-node error on the logs pane. Open logs pane on sub-node error ([#10248](https://github.com/n8n-io/n8n/issues/10248)) ([57d1c9a](https://github.com/n8n-io/n8n/commit/57d1c9a99e97308f2f1b8ae05ac3861a835e8e5a))
* **core:** Support community packages in scaling-mode ([#10228](https://github.com/n8n-io/n8n/issues/10228)) ([88086a4](https://github.com/n8n-io/n8n/commit/88086a41ff5b804b35aa9d9503dc2d48836fe4ec))
* **core:** Support create, delete, edit role for users in Public API ([#10279](https://github.com/n8n-io/n8n/issues/10279)) ([84efbd9](https://github.com/n8n-io/n8n/commit/84efbd9b9c51f536b21a4f969ab607d277bef692))
* **core:** Support create, read, update, delete projects in Public API ([#10269](https://github.com/n8n-io/n8n/issues/10269)) ([489ce10](https://github.com/n8n-io/n8n/commit/489ce100634c3af678fb300e9a39d273042542e6))
* **editor:** Auto-add LLM chain for new LLM nodes on empty canvas ([#10245](https://github.com/n8n-io/n8n/issues/10245)) ([06419d9](https://github.com/n8n-io/n8n/commit/06419d9483ae916e79aace6d8c17e265b419b15d))
* **Elasticsearch Node:** Add bulk operations for Elasticsearch ([#9940](https://github.com/n8n-io/n8n/issues/9940)) ([bf8f848](https://github.com/n8n-io/n8n/commit/bf8f848645dfd31527713a55bd1fc93865327017))
* **Lemlist Trigger Node:** Update Trigger events ([#10311](https://github.com/n8n-io/n8n/issues/10311)) ([15f10ec](https://github.com/n8n-io/n8n/commit/15f10ec325cb5eda0f952bed3a5f171dd91bc639))
* **MongoDB Node:** Add projection to query options on Find ([#9972](https://github.com/n8n-io/n8n/issues/9972)) ([0a84e0d](https://github.com/n8n-io/n8n/commit/0a84e0d8b047669f5cf023c21383d01c929c5b4f))
* **Postgres Chat Memory, Redis Chat Memory, Xata:** Add support for context window length ([#10203](https://github.com/n8n-io/n8n/issues/10203)) ([e3edeaa](https://github.com/n8n-io/n8n/commit/e3edeaa03526f041d15d1099ea91869e38a0decc))
* **Stripe Trigger Node:** Add Stripe webhook descriptions based on the workflow ID and name ([#9956](https://github.com/n8n-io/n8n/issues/9956)) ([3433465](https://github.com/n8n-io/n8n/commit/34334651e0e6874736a437a894176bed4590e5a7))
* **Webflow Node:** Update to use the v2 API ([#9996](https://github.com/n8n-io/n8n/issues/9996)) ([6d8323f](https://github.com/n8n-io/n8n/commit/6d8323fadea8af04483eb1a873df0cf3ccc2a891))



# [1.53.0](https://github.com/n8n-io/n8n/compare/[email protected]@1.53.0) (2024-07-31)


Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ development environment ready in minutes.
## License

n8n is [fair-code](https://faircode.io) distributed under the
[**Sustainable Use License**](https://github.com/n8n-io/n8n/blob/master/packages/cli/LICENSE.md) and the
[**n8n Enterprise License**](https://github.com/n8n-io/n8n/blob/master/packages/cli/LICENSE_EE.md).
[**Sustainable Use License**](https://github.com/n8n-io/n8n/blob/master/LICENSE.md) and the
[**n8n Enterprise License**](https://github.com/n8n-io/n8n/blob/master/LICENSE_EE.md).

Proprietary licenses are available for enterprise customers. [Get in touch](mailto:[email protected])

Expand Down
17 changes: 17 additions & 0 deletions cypress/e2e/17-workflow-tags.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { WorkflowPage } from '../pages';
import { getVisibleSelect } from '../utils';

const wf = new WorkflowPage();

Expand Down Expand Up @@ -70,4 +71,20 @@ describe('Workflow tags', () => {
wf.getters.workflowTags().click();
wf.getters.tagPills().should('have.length', TEST_TAGS.length - 1);
});

it('should not show non existing tag as a selectable option', () => {
const NON_EXISTING_TAG = 'My Test Tag';

wf.getters.createTagButton().click();
wf.actions.addTags(TEST_TAGS);
cy.get('body').click(0, 0);
wf.getters.workflowTags().click();
wf.getters.tagsDropdown().find('input:focus').type(NON_EXISTING_TAG);

getVisibleSelect()
.find('li')
.should('have.length', 2)
.filter(`:contains("${NON_EXISTING_TAG}")`)
.should('not.have.length');
});
});
4 changes: 1 addition & 3 deletions docker/images/n8n/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,4 @@ Before you upgrade to the latest version make sure to check here if there are an

## License

n8n is [fair-code](https://faircode.io) distributed under the [**Sustainable Use License**](https://github.com/n8n-io/n8n/blob/master/packages/cli/LICENSE.md).

Additional information about the license can be found in the [docs](https://docs.n8n.io/reference/license/).
You can find the license information [here](https://github.com/n8n-io/n8n/blob/master/README.md#license)
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "n8n-monorepo",
"version": "1.53.0",
"version": "1.54.0",
"private": true,
"engines": {
"node": ">=20.15",
Expand Down
7 changes: 1 addition & 6 deletions packages/@n8n/chat/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,10 +260,5 @@ body,
```

## License
n8n Chat is [fair-code](https://faircode.io) distributed under the
[**Sustainable Use License**](https://github.com/n8n-io/n8n/blob/master/packages/cli/LICENSE.md).

Proprietary licenses are available for enterprise customers. [Get in touch](mailto:[email protected])

Additional information about the license model can be found in the
[docs](https://docs.n8n.io/reference/license/).
You can find the license information [here](https://github.com/n8n-io/n8n/blob/master/README.md#license)
2 changes: 1 addition & 1 deletion packages/@n8n/chat/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@n8n/chat",
"version": "0.22.0",
"version": "0.23.0",
"scripts": {
"dev": "pnpm run storybook",
"build": "pnpm build:vite && pnpm build:bundle",
Expand Down
2 changes: 1 addition & 1 deletion packages/@n8n/config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@n8n/config",
"version": "1.3.0",
"version": "1.4.0",
"scripts": {
"clean": "rimraf dist .turbo",
"dev": "pnpm watch",
Expand Down
4 changes: 1 addition & 3 deletions packages/@n8n/nodes-langchain/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,4 @@ These nodes are still in Beta state and are only compatible with the Docker imag

## License

n8n is [fair-code](https://faircode.io) distributed under the [**Sustainable Use License**](https://github.com/n8n-io/n8n/blob/master/packages/cli/LICENSE.md).

Additional information about the license can be found in the [docs](https://docs.n8n.io/reference/license/).
You can find the license information [here](https://github.com/n8n-io/n8n/blob/master/README.md#license)
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export async function openAiFunctionsAgentExecute(
const memory = (await this.getInputConnectionData(NodeConnectionType.AiMemory, 0)) as
| BaseChatMemory
| undefined;
const tools = await getConnectedTools(this, nodeVersion >= 1.5);
const tools = await getConnectedTools(this, nodeVersion >= 1.5, false);
const outputParsers = await getOptionalOutputParsers(this);
const options = this.getNodeParameter('options', 0, {}) as {
systemMessage?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export async function toolsAgentExecute(this: IExecuteFunctions): Promise<INodeE
| BaseChatMemory
| undefined;

const tools = (await getConnectedTools(this, true)) as Array<DynamicStructuredTool | Tool>;
const tools = (await getConnectedTools(this, true, false)) as Array<DynamicStructuredTool | Tool>;
const outputParser = (await getOptionalOutputParsers(this))?.[0];
let structuredOutputParserTool: DynamicStructuredTool | undefined;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ export class OpenAiAssistant implements INodeType {

async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
const nodeVersion = this.getNode().typeVersion;
const tools = await getConnectedTools(this, nodeVersion > 1);
const tools = await getConnectedTools(this, nodeVersion > 1, false);
const credentials = await this.getCredentials('openAiApi');

const items = this.getInputData();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ import { NodeConnectionType, NodeOperationError, tryToParseAlphanumericString }
import { DynamicTool } from '@langchain/core/tools';
import { getConnectionHintNoticeField } from '../../../utils/sharedFields';

import { N8nTool } from '../../../utils/N8nTool';
import {
configureHttpRequestFunction,
configureResponseOptimizer,
extractParametersFromText,
prepareToolDescription,
configureToolFunction,
updateParametersAndOptions,
makeToolInputSchema,
} from './utils';

import {
Expand All @@ -38,7 +40,7 @@ export class ToolHttpRequest implements INodeType {
name: 'toolHttpRequest',
icon: { light: 'file:httprequest.svg', dark: 'file:httprequest.dark.svg' },
group: ['output'],
version: 1,
version: [1, 1.1],
description: 'Makes an HTTP request and returns the response data',
subtitle: '={{ $parameter.toolDescription }}',
defaults: {
Expand Down Expand Up @@ -394,9 +396,24 @@ export class ToolHttpRequest implements INodeType {
optimizeResponse,
);

const description = prepareToolDescription(toolDescription, toolParameters);
let tool: DynamicTool | N8nTool;

const tool = new DynamicTool({ name, description, func });
// If the node version is 1.1 or higher, we use the N8nTool wrapper:
// it allows to use tool as a DynamicStructuredTool and have a fallback to DynamicTool
if (this.getNode().typeVersion >= 1.1) {
const schema = makeToolInputSchema(toolParameters);

tool = new N8nTool(this, {
name,
description: toolDescription,
func,
schema,
});
} else {
// Keep the old behavior for nodes with version 1.0
const description = prepareToolDescription(toolDescription, toolParameters);
tool = new DynamicTool({ name, description, func });
}

return {
response: tool,
Expand Down
67 changes: 55 additions & 12 deletions packages/@n8n/nodes-langchain/nodes/tools/ToolHttpRequest/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ import type {
SendIn,
ToolParameter,
} from './interfaces';
import type { DynamicZodObject } from '../../../types/zod.types';
import { z } from 'zod';

const genericCredentialRequest = async (ctx: IExecuteFunctions, itemIndex: number) => {
const genericType = ctx.getNodeParameter('genericAuthType', itemIndex) as string;
Expand Down Expand Up @@ -566,7 +568,7 @@ export const configureToolFunction = (
httpRequest: (options: IHttpRequestOptions) => Promise<any>,
optimizeResponse: (response: string) => string,
) => {
return async (query: string): Promise<string> => {
return async (query: string | IDataObject): Promise<string> => {
const { index } = ctx.addInputData(NodeConnectionType.AiTool, [[{ json: { query } }]]);

let response: string = '';
Expand All @@ -581,18 +583,22 @@ export const configureToolFunction = (
if (query) {
let dataFromModel;

try {
dataFromModel = jsonParse<IDataObject>(query);
} catch (error) {
if (toolParameters.length === 1) {
dataFromModel = { [toolParameters[0].name]: query };
} else {
throw new NodeOperationError(
ctx.getNode(),
`Input is not a valid JSON: ${error.message}`,
{ itemIndex },
);
if (typeof query === 'string') {
try {
dataFromModel = jsonParse<IDataObject>(query);
} catch (error) {
if (toolParameters.length === 1) {
dataFromModel = { [toolParameters[0].name]: query };
} else {
throw new NodeOperationError(
ctx.getNode(),
`Input is not a valid JSON: ${error.message}`,
{ itemIndex },
);
}
}
} else {
dataFromModel = query;
}

for (const parameter of toolParameters) {
Expand Down Expand Up @@ -727,6 +733,8 @@ export const configureToolFunction = (
}
}
} catch (error) {
console.error(error);

const errorMessage = 'Input provided by model is not valid';

if (error instanceof NodeOperationError) {
Expand Down Expand Up @@ -765,3 +773,38 @@ export const configureToolFunction = (
return response;
};
};

function makeParameterZodSchema(parameter: ToolParameter) {
let schema: z.ZodTypeAny;

if (parameter.type === 'string') {
schema = z.string();
} else if (parameter.type === 'number') {
schema = z.number();
} else if (parameter.type === 'boolean') {
schema = z.boolean();
} else if (parameter.type === 'json') {
schema = z.record(z.any());
} else {
schema = z.string();
}

if (!parameter.required) {
schema = schema.optional();
}

if (parameter.description) {
schema = schema.describe(parameter.description);
}

return schema;
}

export function makeToolInputSchema(parameters: ToolParameter[]): DynamicZodObject {
const schemaEntries = parameters.map((parameter) => [
parameter.name,
makeParameterZodSchema(parameter),
]);

return z.object(Object.fromEntries(schemaEntries));
}
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ export class ToolWorkflow implements INodeType {
if (useSchema) {
try {
// We initialize these even though one of them will always be empty
// it makes it easer to navigate the ternary operator
// it makes it easier to navigate the ternary operator
const jsonExample = this.getNodeParameter('jsonSchemaExample', itemIndex, '') as string;
const inputSchema = this.getNodeParameter('inputSchema', itemIndex, '') as string;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ export async function execute(this: IExecuteFunctions, i: number): Promise<INode

const agent = new OpenAIAssistantRunnable({ assistantId, client, asAgent: true });

const tools = await getConnectedTools(this, nodeVersion > 1);
const tools = await getConnectedTools(this, nodeVersion > 1, false);
let assistantTools;

if (tools.length) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ export async function execute(this: IExecuteFunctions, i: number): Promise<INode

if (hideTools !== 'hide') {
const enforceUniqueNames = nodeVersion > 1;
externalTools = await getConnectedTools(this, enforceUniqueNames);
externalTools = await getConnectedTools(this, enforceUniqueNames, false);
}

if (externalTools.length) {
Expand Down
4 changes: 2 additions & 2 deletions packages/@n8n/nodes-langchain/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@n8n/n8n-nodes-langchain",
"version": "1.53.0",
"version": "1.54.0",
"description": "",
"main": "index.js",
"scripts": {
Expand Down Expand Up @@ -153,7 +153,7 @@
"@langchain/textsplitters": "0.0.3",
"@mozilla/readability": "^0.5.0",
"@n8n/typeorm": "0.3.20-10",
"@n8n/vm2": "3.9.24",
"@n8n/vm2": "3.9.25",
"@pinecone-database/pinecone": "3.0.0",
"@qdrant/js-client-rest": "1.9.0",
"@supabase/supabase-js": "2.43.4",
Expand Down
Loading

0 comments on commit cb8144b

Please sign in to comment.