n8n-nodes-couchbase 1.3.0 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/credentials/CouchbaseApi.credentials.js +2 -2
- package/dist/credentials/CouchbaseApi.credentials.js.map +1 -1
- package/dist/package.json +11 -6
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/fromAIToolFactory.d.ts +1 -3
- package/dist/utils/fromAIToolFactory.js +38 -10
- package/dist/utils/fromAIToolFactory.js.map +1 -1
- package/package.json +22 -15
|
@@ -1,7 +1,6 @@
|
|
|
1
|
+
import type { DynamicStructuredTool, DynamicTool } from '@langchain/core/tools';
|
|
1
2
|
import type { CallbackManagerForToolRun } from '@langchain/core/callbacks/manager';
|
|
2
|
-
import { DynamicStructuredTool, DynamicTool } from '@langchain/core/tools';
|
|
3
3
|
import type { FromAIArgument, IDataObject, INode, INodeParameters } from 'n8n-workflow';
|
|
4
|
-
import { z } from 'zod';
|
|
5
4
|
export type ToolFunc = (query: string | IDataObject, runManager?: CallbackManagerForToolRun) => Promise<string | IDataObject | IDataObject[]>;
|
|
6
5
|
export interface CreateToolOptions {
|
|
7
6
|
name: string;
|
|
@@ -10,5 +9,4 @@ export interface CreateToolOptions {
|
|
|
10
9
|
extraArgs?: FromAIArgument[];
|
|
11
10
|
}
|
|
12
11
|
export declare function extractFromAIParameters(nodeParameters: INodeParameters): FromAIArgument[];
|
|
13
|
-
export declare function createZodSchemaFromArgs(args: FromAIArgument[]): z.ZodObject<z.ZodRawShape>;
|
|
14
12
|
export declare function createToolFromNode(node: INode, options: CreateToolOptions): DynamicStructuredTool | DynamicTool;
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.extractFromAIParameters = extractFromAIParameters;
|
|
4
|
-
exports.createZodSchemaFromArgs = createZodSchemaFromArgs;
|
|
5
4
|
exports.createToolFromNode = createToolFromNode;
|
|
6
|
-
const tools_1 = require("@langchain/core/tools");
|
|
7
5
|
const n8n_workflow_1 = require("n8n-workflow");
|
|
8
|
-
|
|
6
|
+
function resolveN8nModules() {
|
|
7
|
+
const nwResolved = require.resolve('n8n-workflow');
|
|
8
|
+
const n8nBase = nwResolved.substring(0, nwResolved.lastIndexOf('node_modules') + 'node_modules'.length);
|
|
9
|
+
return {
|
|
10
|
+
z: require(require.resolve('zod', { paths: [n8nBase] })),
|
|
11
|
+
lcTools: require(require.resolve('@langchain/core/tools', { paths: [n8nBase] })),
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
const { z: n8nZod, lcTools: n8nLcTools } = resolveN8nModules();
|
|
9
15
|
function extractFromAIParameters(nodeParameters) {
|
|
10
16
|
const collectedArguments = [];
|
|
11
17
|
(0, n8n_workflow_1.traverseNodeParameters)(nodeParameters, collectedArguments);
|
|
@@ -15,21 +21,43 @@ function extractFromAIParameters(nodeParameters) {
|
|
|
15
21
|
}
|
|
16
22
|
return Array.from(uniqueArgsMap.values());
|
|
17
23
|
}
|
|
18
|
-
function
|
|
24
|
+
function buildN8nZodSchema(args) {
|
|
19
25
|
const schemaObj = {};
|
|
20
|
-
for (const
|
|
21
|
-
|
|
26
|
+
for (const arg of args) {
|
|
27
|
+
const type = arg.type || 'string';
|
|
28
|
+
switch (type) {
|
|
29
|
+
case 'number':
|
|
30
|
+
schemaObj[arg.key] = arg.description
|
|
31
|
+
? n8nZod.number().describe(arg.description)
|
|
32
|
+
: n8nZod.number();
|
|
33
|
+
break;
|
|
34
|
+
case 'boolean':
|
|
35
|
+
schemaObj[arg.key] = arg.description
|
|
36
|
+
? n8nZod.boolean().describe(arg.description)
|
|
37
|
+
: n8nZod.boolean();
|
|
38
|
+
break;
|
|
39
|
+
default:
|
|
40
|
+
schemaObj[arg.key] = arg.description
|
|
41
|
+
? n8nZod.string().describe(arg.description)
|
|
42
|
+
: n8nZod.string();
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
22
45
|
}
|
|
23
|
-
return
|
|
46
|
+
return n8nZod.object(schemaObj).required();
|
|
24
47
|
}
|
|
25
48
|
function createToolFromNode(node, options) {
|
|
26
49
|
const { name, description, func, extraArgs = [] } = options;
|
|
27
50
|
const collectedArguments = extractFromAIParameters(node.parameters);
|
|
28
51
|
if (collectedArguments.length === 0 && extraArgs.length === 0) {
|
|
29
|
-
return new
|
|
52
|
+
return new n8nLcTools.DynamicTool({ name, description, func });
|
|
30
53
|
}
|
|
31
54
|
const allArguments = [...collectedArguments, ...extraArgs];
|
|
32
|
-
const schema =
|
|
33
|
-
return new
|
|
55
|
+
const schema = buildN8nZodSchema(allArguments);
|
|
56
|
+
return new n8nLcTools.DynamicStructuredTool({
|
|
57
|
+
schema,
|
|
58
|
+
name,
|
|
59
|
+
description,
|
|
60
|
+
func,
|
|
61
|
+
});
|
|
34
62
|
}
|
|
35
63
|
//# sourceMappingURL=fromAIToolFactory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fromAIToolFactory.js","sourceRoot":"","sources":["../../utils/fromAIToolFactory.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"fromAIToolFactory.js","sourceRoot":"","sources":["../../utils/fromAIToolFactory.ts"],"names":[],"mappings":";;AAgDA,0DAUC;AAqCD,gDAuBC;AAnHD,+CAAsD;AAWtD,SAAS,iBAAiB;IACzB,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;IACnD,MAAM,OAAO,GAAG,UAAU,CAAC,SAAS,CACnC,CAAC,EACD,UAAU,CAAC,WAAW,CAAC,cAAc,CAAC,GAAG,cAAc,CAAC,MAAM,CAC9D,CAAC;IAEF,OAAO;QACN,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QACxD,OAAO,EAAE,OAAO,CAAC,OAA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key-Value, Query, Full-Text Search, Couchbase Search Vector Store, Couchbase Query Vector Store, and Couchbase as Chat Memory with n8n.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"n8n-community-node-package"
|
|
@@ -19,7 +19,18 @@
|
|
|
19
19
|
"node": ">=18.10",
|
|
20
20
|
"pnpm": ">=9.1"
|
|
21
21
|
},
|
|
22
|
+
"packageManager": "pnpm@9.1.4",
|
|
22
23
|
"main": "index.js",
|
|
24
|
+
"scripts": {
|
|
25
|
+
"preinstall": "npx only-allow pnpm",
|
|
26
|
+
"build": "tsc && tsc-alias && gulp build:icons",
|
|
27
|
+
"dev": "tsc --watch",
|
|
28
|
+
"dev:ui": "nodemon -w nodes -w credentials -w utils --ext ts --exec 'tsc && tsc-alias && cd $HOME/.n8n/custom && COREPACK_ENABLE_STRICT=0 pnpm install && cd - && n8n'",
|
|
29
|
+
"format": "prettier nodes credentials --write",
|
|
30
|
+
"lint": "eslint nodes credentials package.json",
|
|
31
|
+
"lintfix": "eslint nodes credentials package.json --fix",
|
|
32
|
+
"prepublishOnly": "pnpm build && pnpm lint -c .eslintrc.prepublish.js nodes credentials package.json"
|
|
33
|
+
},
|
|
23
34
|
"files": [
|
|
24
35
|
"dist"
|
|
25
36
|
],
|
|
@@ -51,23 +62,19 @@
|
|
|
51
62
|
"n8n-workflow": "^1.120.1"
|
|
52
63
|
},
|
|
53
64
|
"dependencies": {
|
|
54
|
-
"@langchain/classic": "^1.0.
|
|
55
|
-
"@langchain/community": "^1.1.
|
|
56
|
-
"@langchain/core": "^1.1.
|
|
65
|
+
"@langchain/classic": "^1.0.19",
|
|
66
|
+
"@langchain/community": "^1.1.18",
|
|
67
|
+
"@langchain/core": "^1.1.27",
|
|
57
68
|
"@langchain/textsplitters": "^1.0.1",
|
|
58
|
-
"couchbase": "^4.6.
|
|
59
|
-
"langchain": "^1.2.
|
|
69
|
+
"couchbase": "^4.6.1",
|
|
70
|
+
"langchain": "^1.2.26",
|
|
60
71
|
"tmp-promise": "^3.0.3",
|
|
61
72
|
"uuid": "^11.1.0",
|
|
62
73
|
"zod": "^3.24.2"
|
|
63
74
|
},
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
"dev:ui": "nodemon -w nodes -w credentials -w utils --ext ts --exec 'tsc && tsc-alias && cd $HOME/.n8n/custom && COREPACK_ENABLE_STRICT=0 pnpm install && cd - && n8n'",
|
|
69
|
-
"format": "prettier nodes credentials --write",
|
|
70
|
-
"lint": "eslint nodes credentials package.json",
|
|
71
|
-
"lintfix": "eslint nodes credentials package.json --fix"
|
|
75
|
+
"pnpm": {
|
|
76
|
+
"overrides": {
|
|
77
|
+
"@langchain/langgraph-sdk": "1.3.1"
|
|
78
|
+
}
|
|
72
79
|
}
|
|
73
|
-
}
|
|
80
|
+
}
|