n8n-nodes-couchbase 0.1.5 → 1.0.0
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/README.md +133 -65
- package/dist/credentials/CouchbaseApi.credentials.d.ts +8 -0
- package/dist/credentials/CouchbaseApi.credentials.js +39 -0
- package/dist/credentials/CouchbaseApi.credentials.js.map +1 -0
- package/dist/credentials/ExampleCredentialsApi.credentials.d.ts +8 -0
- package/dist/credentials/ExampleCredentialsApi.credentials.js +46 -0
- package/dist/credentials/ExampleCredentialsApi.credentials.js.map +1 -0
- package/dist/credentials/HttpBinApi.credentials.d.ts +9 -0
- package/dist/credentials/HttpBinApi.credentials.js +43 -0
- package/dist/credentials/HttpBinApi.credentials.js.map +1 -0
- package/dist/nodes/Couchbase/Couchbase.node.d.ts +35 -0
- package/dist/nodes/Couchbase/Couchbase.node.js +303 -0
- package/dist/nodes/Couchbase/Couchbase.node.js.map +1 -0
- package/dist/nodes/Couchbase/Couchbase.node.json +18 -0
- package/dist/nodes/Couchbase/CouchbaseProperties.d.ts +16 -0
- package/dist/nodes/Couchbase/CouchbaseProperties.js +478 -0
- package/dist/nodes/Couchbase/CouchbaseProperties.js.map +1 -0
- package/dist/nodes/Couchbase/couchbase.dark.svg +14 -0
- package/dist/nodes/Couchbase/couchbase.svg +14 -0
- package/dist/nodes/ExampleNode/ExampleNode.node.d.ts +5 -0
- package/dist/nodes/ExampleNode/ExampleNode.node.js +59 -0
- package/dist/nodes/ExampleNode/ExampleNode.node.js.map +1 -0
- package/dist/nodes/HttpBin/HttpBin.node.d.ts +4 -0
- package/dist/nodes/HttpBin/HttpBin.node.js +55 -0
- package/dist/nodes/HttpBin/HttpBin.node.js.map +1 -0
- package/dist/nodes/HttpBin/HttpBin.node.json +18 -0
- package/dist/nodes/HttpBin/HttpVerbDescription.d.ts +3 -0
- package/dist/nodes/HttpBin/HttpVerbDescription.js +236 -0
- package/dist/nodes/HttpBin/HttpVerbDescription.js.map +1 -0
- package/dist/nodes/vector_store/VectorStoreCouchbase/VectorStoreCouchbase.node.d.ts +16 -0
- package/dist/nodes/vector_store/VectorStoreCouchbase/VectorStoreCouchbase.node.js +407 -0
- package/dist/nodes/vector_store/VectorStoreCouchbase/VectorStoreCouchbase.node.js.map +1 -0
- package/dist/nodes/vector_store/VectorStoreCouchbase/mongodb.dark.svg +3 -0
- package/dist/nodes/vector_store/VectorStoreCouchbase/mongodb.svg +3 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/__tests__/utils.test.d.ts +0 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/__tests__/utils.test.js +2 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/__tests__/utils.test.js.map +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/constants.d.ts +4 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/constants.js +45 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/constants.js.map +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/createVectorStoreNode.d.ts +15 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/createVectorStoreNode.js +227 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/createVectorStoreNode.js.map +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/createVectorStoreNode.test.d.ts +0 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/createVectorStoreNode.test.js +2 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/createVectorStoreNode.test.js.map +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/methods/listSearch.d.ts +0 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/methods/listSearch.js +2 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/methods/listSearch.js.map +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/__tests__/insertOperation.test.d.ts +0 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/__tests__/insertOperation.test.js +2 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/__tests__/insertOperation.test.js.map +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/__tests__/loadOperation.test.d.ts +0 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/__tests__/loadOperation.test.js +2 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/__tests__/loadOperation.test.js.map +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/__tests__/operationHandlers.test.d.ts +0 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/__tests__/operationHandlers.test.js +2 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/__tests__/operationHandlers.test.js.map +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/__tests__/retrieveAsToolOperation.test.d.ts +0 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/__tests__/retrieveAsToolOperation.test.js +2 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/__tests__/retrieveAsToolOperation.test.js.map +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/__tests__/retrieveOperation.test.d.ts +0 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/__tests__/retrieveOperation.test.js +2 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/__tests__/retrieveOperation.test.js.map +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/__tests__/updateOperation.test.d.ts +0 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/__tests__/updateOperation.test.js +2 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/__tests__/updateOperation.test.js.map +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/index.d.ts +5 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/index.js +22 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/index.js.map +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/insertOperation.d.ts +5 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/insertOperation.js +36 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/insertOperation.js.map +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/loadOperation.d.ts +5 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/loadOperation.js +34 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/loadOperation.js.map +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/retrieveAsToolOperation.d.ts +5 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/retrieveAsToolOperation.js +43 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/retrieveAsToolOperation.js.map +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/retrieveOperation.d.ts +5 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/retrieveOperation.js +17 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/retrieveOperation.js.map +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/updateOperation.d.ts +5 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/updateOperation.js +40 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/updateOperation.js.map +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/types.d.ts +31 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/types.js +3 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/types.js.map +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/utils.d.ts +6 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/utils.js +22 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/utils.js.map +1 -0
- package/dist/nodes/vector_store/shared/processDocuments.d.ts +25 -0
- package/dist/nodes/vector_store/shared/processDocuments.js +46 -0
- package/dist/nodes/vector_store/shared/processDocuments.js.map +1 -0
- package/dist/package.json +29 -19
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/N8nBinaryLoader.d.ts +18 -0
- package/dist/utils/N8nBinaryLoader.js +159 -0
- package/dist/utils/N8nBinaryLoader.js.map +1 -0
- package/dist/utils/N8nJsonLoader.d.ts +11 -0
- package/dist/utils/N8nJsonLoader.js +67 -0
- package/dist/utils/N8nJsonLoader.js.map +1 -0
- package/dist/utils/N8nTool.d.ts +10 -0
- package/dist/utils/N8nTool.js +86 -0
- package/dist/utils/N8nTool.js.map +1 -0
- package/dist/utils/helpers.d.ts +23 -0
- package/dist/utils/helpers.js +172 -0
- package/dist/utils/helpers.js.map +1 -0
- package/dist/utils/logWrapper.d.ts +27 -0
- package/dist/utils/logWrapper.js +297 -0
- package/dist/utils/logWrapper.js.map +1 -0
- package/dist/utils/sharedFields.d.ts +6 -0
- package/dist/utils/sharedFields.js +122 -0
- package/dist/utils/sharedFields.js.map +1 -0
- package/package.json +35 -27
- package/dist/credentials/CouchbaseCredentialsApi.credentials.d.ts +0 -7
- package/dist/credentials/CouchbaseCredentialsApi.credentials.js +0 -50
- package/dist/credentials/CouchbaseCredentialsApi.credentials.js.map +0 -1
- package/dist/nodes/CouchbaseDB/CouchbaseNode.node.d.ts +0 -6
- package/dist/nodes/CouchbaseDB/CouchbaseNode.node.js +0 -206
- package/dist/nodes/CouchbaseDB/CouchbaseNode.node.js.map +0 -1
- package/dist/nodes/CouchbaseNode/CouchbaseNode.node.d.ts +0 -6
- package/dist/nodes/CouchbaseNode/CouchbaseNode.node.js +0 -293
- package/dist/nodes/CouchbaseNode/CouchbaseNode.node.js.map +0 -1
- /package/dist/nodes/{CouchbaseDB → Couchbase}/CBLogomark.svg +0 -0
- /package/dist/nodes/{CouchbaseNode/CBLogomark.svg → vector_store/VectorStoreCouchbase/couchbase.svg} +0 -0
package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/retrieveAsToolOperation.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handleRetrieveAsToolOperation = handleRetrieveAsToolOperation;
|
|
4
|
+
const tools_1 = require("langchain/tools");
|
|
5
|
+
const helpers_1 = require("../../../../../utils/helpers");
|
|
6
|
+
const logWrapper_1 = require("../../../../../utils/logWrapper");
|
|
7
|
+
async function handleRetrieveAsToolOperation(context, args, embeddings, itemIndex) {
|
|
8
|
+
const toolDescription = context.getNodeParameter('toolDescription', itemIndex);
|
|
9
|
+
const toolName = context.getNodeParameter('toolName', itemIndex);
|
|
10
|
+
const topK = context.getNodeParameter('topK', itemIndex, 4);
|
|
11
|
+
const includeDocumentMetadata = context.getNodeParameter('includeDocumentMetadata', itemIndex, true);
|
|
12
|
+
const filter = (0, helpers_1.getMetadataFiltersValues)(context, itemIndex);
|
|
13
|
+
const vectorStoreTool = new tools_1.DynamicTool({
|
|
14
|
+
name: toolName,
|
|
15
|
+
description: toolDescription,
|
|
16
|
+
func: async (input) => {
|
|
17
|
+
var _a;
|
|
18
|
+
const vectorStore = await args.getVectorStoreClient(context, undefined, embeddings, itemIndex);
|
|
19
|
+
try {
|
|
20
|
+
const embeddedPrompt = await embeddings.embedQuery(input);
|
|
21
|
+
const documents = await vectorStore.similaritySearchVectorWithScore(embeddedPrompt, topK, filter);
|
|
22
|
+
return documents
|
|
23
|
+
.map((document) => {
|
|
24
|
+
if (includeDocumentMetadata) {
|
|
25
|
+
return { type: 'text', text: JSON.stringify(document[0]) };
|
|
26
|
+
}
|
|
27
|
+
return {
|
|
28
|
+
type: 'text',
|
|
29
|
+
text: JSON.stringify({ pageContent: document[0].pageContent }),
|
|
30
|
+
};
|
|
31
|
+
})
|
|
32
|
+
.filter((document) => !!document);
|
|
33
|
+
}
|
|
34
|
+
finally {
|
|
35
|
+
(_a = args.releaseVectorStoreClient) === null || _a === void 0 ? void 0 : _a.call(args, vectorStore);
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
return {
|
|
40
|
+
response: (0, logWrapper_1.logWrapper)(vectorStoreTool, context),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=retrieveAsToolOperation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retrieveAsToolOperation.js","sourceRoot":"","sources":["../../../../../../nodes/vector_store/shared/createVectorStoreNode/operations/retrieveAsToolOperation.ts"],"names":[],"mappings":";;AAcA,sEAoEC;AAhFD,2CAA8C;AAG9C,4CAA0D;AAC1D,kDAA+C;AAQxC,KAAK,UAAU,6BAA6B,CAClD,OAA6B,EAC7B,IAAuC,EACvC,UAAsB,EACtB,SAAiB;IAGjB,MAAM,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC,iBAAiB,EAAE,SAAS,CAAW,CAAC;IACzF,MAAM,QAAQ,GAAG,OAAO,CAAC,gBAAgB,CAAC,UAAU,EAAE,SAAS,CAAW,CAAC;IAC3E,MAAM,IAAI,GAAG,OAAO,CAAC,gBAAgB,CAAC,MAAM,EAAE,SAAS,EAAE,CAAC,CAAW,CAAC;IACtE,MAAM,uBAAuB,GAAG,OAAO,CAAC,gBAAgB,CACvD,yBAAyB,EACzB,SAAS,EACT,IAAI,CACO,CAAC;IAGb,MAAM,MAAM,GAAG,IAAA,kCAAwB,EAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IAG5D,MAAM,eAAe,GAAG,IAAI,mBAAW,CAAC;QACvC,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,eAAe;QAC5B,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;;YAIrB,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,oBAAoB,CAClD,OAAO,EACP,SAAS,EACT,UAAU,EACV,SAAS,CACT,CAAC;YAEF,IAAI,CAAC;gBAEJ,MAAM,cAAc,GAAG,MAAM,UAAU,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;gBAG1D,MAAM,SAAS,GAAG,MAAM,WAAW,CAAC,+BAA+B,CAClE,cAAc,EACd,IAAI,EACJ,MAAM,CACN,CAAC;gBAGF,OAAO,SAAS;qBACd,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE;oBACjB,IAAI,uBAAuB,EAAE,CAAC;wBAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;oBAC5D,CAAC;oBACD,OAAO;wBACN,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;qBAC9D,CAAC;gBACH,CAAC,CAAC;qBACD,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;YACpC,CAAC;oBAAS,CAAC;gBAEV,MAAA,IAAI,CAAC,wBAAwB,qDAAG,WAAW,CAAC,CAAC;YAC9C,CAAC;QACF,CAAC;KACD,CAAC,CAAC;IAGH,OAAO;QACN,QAAQ,EAAE,IAAA,uBAAU,EAAC,eAAe,EAAE,OAAO,CAAC;KAC9C,CAAC;AACH,CAAC"}
|
package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/retrieveOperation.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Embeddings } from '@langchain/core/embeddings';
|
|
2
|
+
import type { VectorStore } from '@langchain/core/vectorstores';
|
|
3
|
+
import type { ISupplyDataFunctions, SupplyData } from 'n8n-workflow';
|
|
4
|
+
import type { VectorStoreNodeConstructorArgs } from '../types';
|
|
5
|
+
export declare function handleRetrieveOperation<T extends VectorStore = VectorStore>(context: ISupplyDataFunctions, args: VectorStoreNodeConstructorArgs<T>, embeddings: Embeddings, itemIndex: number): Promise<SupplyData>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handleRetrieveOperation = handleRetrieveOperation;
|
|
4
|
+
const helpers_1 = require("../../../../../utils/helpers");
|
|
5
|
+
const logWrapper_1 = require("../../../../../utils/logWrapper");
|
|
6
|
+
async function handleRetrieveOperation(context, args, embeddings, itemIndex) {
|
|
7
|
+
const filter = (0, helpers_1.getMetadataFiltersValues)(context, itemIndex);
|
|
8
|
+
const vectorStore = await args.getVectorStoreClient(context, filter, embeddings, itemIndex);
|
|
9
|
+
return {
|
|
10
|
+
response: (0, logWrapper_1.logWrapper)(vectorStore, context),
|
|
11
|
+
closeFunction: async () => {
|
|
12
|
+
var _a;
|
|
13
|
+
(_a = args.releaseVectorStoreClient) === null || _a === void 0 ? void 0 : _a.call(args, vectorStore);
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=retrieveOperation.js.map
|
package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/retrieveOperation.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retrieveOperation.js","sourceRoot":"","sources":["../../../../../../nodes/vector_store/shared/createVectorStoreNode/operations/retrieveOperation.ts"],"names":[],"mappings":";;AAaA,0DAoBC;AA7BD,4CAA0D;AAC1D,kDAA+C;AAQxC,KAAK,UAAU,uBAAuB,CAC5C,OAA6B,EAC7B,IAAuC,EACvC,UAAsB,EACtB,SAAiB;IAGjB,MAAM,MAAM,GAAG,IAAA,kCAAwB,EAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IAG5D,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;IAG5F,OAAO;QACN,QAAQ,EAAE,IAAA,uBAAU,EAAC,WAAW,EAAE,OAAO,CAAC;QAC1C,aAAa,EAAE,KAAK,IAAI,EAAE;;YAEzB,MAAA,IAAI,CAAC,wBAAwB,qDAAG,WAAW,CAAC,CAAC;QAC9C,CAAC;KACD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Embeddings } from '@langchain/core/embeddings';
|
|
2
|
+
import type { VectorStore } from '@langchain/core/vectorstores';
|
|
3
|
+
import type { IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
|
|
4
|
+
import type { VectorStoreNodeConstructorArgs } from '../types';
|
|
5
|
+
export declare function handleUpdateOperation<T extends VectorStore = VectorStore>(context: IExecuteFunctions, args: VectorStoreNodeConstructorArgs<T>, embeddings: Embeddings): Promise<INodeExecutionData[]>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handleUpdateOperation = handleUpdateOperation;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const helpers_1 = require("../../../../../utils/helpers");
|
|
6
|
+
const N8nJsonLoader_1 = require("../../../../../utils/N8nJsonLoader");
|
|
7
|
+
const processDocuments_1 = require("../../processDocuments");
|
|
8
|
+
const utils_1 = require("../utils");
|
|
9
|
+
async function handleUpdateOperation(context, args, embeddings) {
|
|
10
|
+
var _a;
|
|
11
|
+
if (!(0, utils_1.isUpdateSupported)(args)) {
|
|
12
|
+
throw new n8n_workflow_1.NodeOperationError(context.getNode(), 'Update operation is not implemented for this Vector Store');
|
|
13
|
+
}
|
|
14
|
+
const items = context.getInputData();
|
|
15
|
+
const loader = new N8nJsonLoader_1.N8nJsonLoader(context);
|
|
16
|
+
const resultData = [];
|
|
17
|
+
for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
|
|
18
|
+
const itemData = items[itemIndex];
|
|
19
|
+
const documentId = context.getNodeParameter('id', itemIndex, '', {
|
|
20
|
+
extractValue: true,
|
|
21
|
+
});
|
|
22
|
+
const vectorStore = await args.getVectorStoreClient(context, undefined, embeddings, itemIndex);
|
|
23
|
+
try {
|
|
24
|
+
const { processedDocuments, serializedDocuments } = await (0, processDocuments_1.processDocument)(loader, itemData, itemIndex);
|
|
25
|
+
if ((processedDocuments === null || processedDocuments === void 0 ? void 0 : processedDocuments.length) !== 1) {
|
|
26
|
+
throw new n8n_workflow_1.NodeOperationError(context.getNode(), 'Single document per item expected');
|
|
27
|
+
}
|
|
28
|
+
resultData.push(...serializedDocuments);
|
|
29
|
+
await vectorStore.addDocuments(processedDocuments, {
|
|
30
|
+
ids: [documentId],
|
|
31
|
+
});
|
|
32
|
+
(0, helpers_1.logAiEvent)(context, 'ai-vector-store-updated');
|
|
33
|
+
}
|
|
34
|
+
finally {
|
|
35
|
+
(_a = args.releaseVectorStoreClient) === null || _a === void 0 ? void 0 : _a.call(args, vectorStore);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return resultData;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=updateOperation.js.map
|
package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/updateOperation.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"updateOperation.js","sourceRoot":"","sources":["../../../../../../nodes/vector_store/shared/createVectorStoreNode/operations/updateOperation.ts"],"names":[],"mappings":";;AAgBA,sDA8DC;AA3ED,+CAAkD;AAElD,4CAA4C;AAC5C,wDAAqD;AAErD,6DAAyD;AAEzD,oCAA6C;AAMtC,KAAK,UAAU,qBAAqB,CAC1C,OAA0B,EAC1B,IAAuC,EACvC,UAAsB;;IAGtB,IAAI,CAAC,IAAA,yBAAiB,EAAC,IAAI,CAAC,EAAE,CAAC;QAC9B,MAAM,IAAI,iCAAkB,CAC3B,OAAO,CAAC,OAAO,EAAE,EACjB,2DAA2D,CAC3D,CAAC;IACH,CAAC;IAGD,MAAM,KAAK,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;IAErC,MAAM,MAAM,GAAG,IAAI,6BAAa,CAAC,OAAO,CAAC,CAAC;IAE1C,MAAM,UAAU,GAAyB,EAAE,CAAC;IAG5C,KAAK,IAAI,SAAS,GAAG,CAAC,EAAE,SAAS,GAAG,KAAK,CAAC,MAAM,EAAE,SAAS,EAAE,EAAE,CAAC;QAC/D,MAAM,QAAQ,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC;QAGlC,MAAM,UAAU,GAAG,OAAO,CAAC,gBAAgB,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE;YAChE,YAAY,EAAE,IAAI;SAClB,CAAW,CAAC;QAGb,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,oBAAoB,CAAC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;QAE/F,IAAI,CAAC;YAEJ,MAAM,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,GAAG,MAAM,IAAA,kCAAe,EACxE,MAAM,EACN,QAAQ,EACR,SAAS,CACT,CAAC;YAGF,IAAI,CAAA,kBAAkB,aAAlB,kBAAkB,uBAAlB,kBAAkB,CAAE,MAAM,MAAK,CAAC,EAAE,CAAC;gBACtC,MAAM,IAAI,iCAAkB,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,mCAAmC,CAAC,CAAC;YACtF,CAAC;YAGD,UAAU,CAAC,IAAI,CAAC,GAAG,mBAAmB,CAAC,CAAC;YAGxC,MAAM,WAAW,CAAC,YAAY,CAAC,kBAAkB,EAAE;gBAClD,GAAG,EAAE,CAAC,UAAU,CAAC;aACjB,CAAC,CAAC;YAGH,IAAA,oBAAU,EAAC,OAAO,EAAE,yBAAyB,CAAC,CAAC;QAChD,CAAC;gBAAS,CAAC;YAEV,MAAA,IAAI,CAAC,wBAAwB,qDAAG,WAAW,CAAC,CAAC;QAC9C,CAAC;IACF,CAAC;IAED,OAAO,UAAU,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Document } from '@langchain/core/documents';
|
|
2
|
+
import type { Embeddings } from '@langchain/core/embeddings';
|
|
3
|
+
import type { VectorStore } from '@langchain/core/vectorstores';
|
|
4
|
+
import type { IExecuteFunctions, INodeCredentialDescription, INodeProperties, ILoadOptionsFunctions, INodeListSearchResult, Icon, ISupplyDataFunctions, ThemeIconColor } from 'n8n-workflow';
|
|
5
|
+
export type NodeOperationMode = 'insert' | 'load' | 'retrieve' | 'update' | 'retrieve-as-tool';
|
|
6
|
+
export interface NodeMeta {
|
|
7
|
+
displayName: string;
|
|
8
|
+
name: string;
|
|
9
|
+
description: string;
|
|
10
|
+
docsUrl: string;
|
|
11
|
+
icon: Icon;
|
|
12
|
+
iconColor?: ThemeIconColor;
|
|
13
|
+
credentials?: INodeCredentialDescription[];
|
|
14
|
+
operationModes?: NodeOperationMode[];
|
|
15
|
+
}
|
|
16
|
+
export interface VectorStoreNodeConstructorArgs<T extends VectorStore = VectorStore> {
|
|
17
|
+
meta: NodeMeta;
|
|
18
|
+
methods?: {
|
|
19
|
+
listSearch?: {
|
|
20
|
+
[key: string]: (this: ILoadOptionsFunctions, filter?: string, paginationToken?: string) => Promise<INodeListSearchResult>;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
sharedFields: INodeProperties[];
|
|
24
|
+
insertFields?: INodeProperties[];
|
|
25
|
+
loadFields?: INodeProperties[];
|
|
26
|
+
retrieveFields?: INodeProperties[];
|
|
27
|
+
updateFields?: INodeProperties[];
|
|
28
|
+
populateVectorStore: (context: IExecuteFunctions | ISupplyDataFunctions, embeddings: Embeddings, documents: Array<Document<Record<string, unknown>>>, itemIndex: number) => Promise<void>;
|
|
29
|
+
getVectorStoreClient: (context: IExecuteFunctions | ISupplyDataFunctions, filter: Record<string, never> | undefined, embeddings: Embeddings, itemIndex: number) => Promise<T>;
|
|
30
|
+
releaseVectorStoreClient?: (vectorStore: T) => void;
|
|
31
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../nodes/vector_store/shared/createVectorStoreNode/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { VectorStore } from '@langchain/core/vectorstores';
|
|
2
|
+
import type { INodeProperties, INodePropertyOptions } from 'n8n-workflow';
|
|
3
|
+
import type { NodeOperationMode, VectorStoreNodeConstructorArgs } from './types';
|
|
4
|
+
export declare function transformDescriptionForOperationMode(fields: INodeProperties[], mode: NodeOperationMode | NodeOperationMode[]): INodeProperties[];
|
|
5
|
+
export declare function isUpdateSupported<T extends VectorStore>(args: VectorStoreNodeConstructorArgs<T>): boolean;
|
|
6
|
+
export declare function getOperationModeOptions<T extends VectorStore>(args: VectorStoreNodeConstructorArgs<T>): INodePropertyOptions[];
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformDescriptionForOperationMode = transformDescriptionForOperationMode;
|
|
4
|
+
exports.isUpdateSupported = isUpdateSupported;
|
|
5
|
+
exports.getOperationModeOptions = getOperationModeOptions;
|
|
6
|
+
const constants_1 = require("./constants");
|
|
7
|
+
function transformDescriptionForOperationMode(fields, mode) {
|
|
8
|
+
return fields.map((field) => ({
|
|
9
|
+
...field,
|
|
10
|
+
displayOptions: { show: { mode: Array.isArray(mode) ? mode : [mode] } },
|
|
11
|
+
}));
|
|
12
|
+
}
|
|
13
|
+
function isUpdateSupported(args) {
|
|
14
|
+
var _a, _b;
|
|
15
|
+
return (_b = (_a = args.meta.operationModes) === null || _a === void 0 ? void 0 : _a.includes('update')) !== null && _b !== void 0 ? _b : false;
|
|
16
|
+
}
|
|
17
|
+
function getOperationModeOptions(args) {
|
|
18
|
+
var _a;
|
|
19
|
+
const enabledOperationModes = (_a = args.meta.operationModes) !== null && _a !== void 0 ? _a : constants_1.DEFAULT_OPERATION_MODES;
|
|
20
|
+
return constants_1.OPERATION_MODE_DESCRIPTIONS.filter(({ value }) => enabledOperationModes.includes(value));
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../nodes/vector_store/shared/createVectorStoreNode/utils.ts"],"names":[],"mappings":";;AAUA,oFAQC;AAMD,8CAIC;AAMD,0DAQC;AAvCD,2CAAmF;AAOnF,SAAgB,oCAAoC,CACnD,MAAyB,EACzB,IAA6C;IAE7C,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAC7B,GAAG,KAAK;QACR,cAAc,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE;KACvE,CAAC,CAAC,CAAC;AACL,CAAC;AAMD,SAAgB,iBAAiB,CAChC,IAAuC;;IAEvC,OAAO,MAAA,MAAA,IAAI,CAAC,IAAI,CAAC,cAAc,0CAAE,QAAQ,CAAC,QAAQ,CAAC,mCAAI,KAAK,CAAC;AAC9D,CAAC;AAMD,SAAgB,uBAAuB,CACtC,IAAuC;;IAEvC,MAAM,qBAAqB,GAAG,MAAA,IAAI,CAAC,IAAI,CAAC,cAAc,mCAAI,mCAAuB,CAAC;IAElF,OAAO,uCAA2B,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CACvD,qBAAqB,CAAC,QAAQ,CAAC,KAA0B,CAAC,CAC1D,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Document } from '@langchain/core/documents';
|
|
2
|
+
import type { INodeExecutionData } from 'n8n-workflow';
|
|
3
|
+
import { N8nBinaryLoader } from '../../../utils/N8nBinaryLoader';
|
|
4
|
+
import { N8nJsonLoader } from '../../../utils/N8nJsonLoader';
|
|
5
|
+
export declare function processDocuments(documentInput: N8nJsonLoader | N8nBinaryLoader | Array<Document<Record<string, unknown>>>, inputItems: INodeExecutionData[]): Promise<{
|
|
6
|
+
processedDocuments: Document<Record<string, any>>[];
|
|
7
|
+
serializedDocuments: {
|
|
8
|
+
json: {
|
|
9
|
+
metadata: Record<string, any>;
|
|
10
|
+
pageContent: string;
|
|
11
|
+
};
|
|
12
|
+
}[];
|
|
13
|
+
}>;
|
|
14
|
+
export declare function processDocument(documentInput: N8nJsonLoader | N8nBinaryLoader | Array<Document<Record<string, unknown>>>, inputItem: INodeExecutionData, itemIndex: number): Promise<{
|
|
15
|
+
processedDocuments: Document<Record<string, any>>[];
|
|
16
|
+
serializedDocuments: {
|
|
17
|
+
json: {
|
|
18
|
+
metadata: Record<string, any>;
|
|
19
|
+
pageContent: string;
|
|
20
|
+
};
|
|
21
|
+
pairedItem: {
|
|
22
|
+
item: number;
|
|
23
|
+
};
|
|
24
|
+
}[];
|
|
25
|
+
}>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.processDocuments = processDocuments;
|
|
4
|
+
exports.processDocument = processDocument;
|
|
5
|
+
const N8nBinaryLoader_1 = require("../../../utils/N8nBinaryLoader");
|
|
6
|
+
const N8nJsonLoader_1 = require("../../../utils/N8nJsonLoader");
|
|
7
|
+
async function processDocuments(documentInput, inputItems) {
|
|
8
|
+
let processedDocuments;
|
|
9
|
+
if (documentInput instanceof N8nJsonLoader_1.N8nJsonLoader || documentInput instanceof N8nBinaryLoader_1.N8nBinaryLoader) {
|
|
10
|
+
processedDocuments = await documentInput.processAll(inputItems);
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
processedDocuments = documentInput;
|
|
14
|
+
}
|
|
15
|
+
const serializedDocuments = processedDocuments.map(({ metadata, pageContent }) => ({
|
|
16
|
+
json: { metadata, pageContent },
|
|
17
|
+
}));
|
|
18
|
+
return {
|
|
19
|
+
processedDocuments,
|
|
20
|
+
serializedDocuments,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
async function processDocument(documentInput, inputItem, itemIndex) {
|
|
24
|
+
let processedDocuments;
|
|
25
|
+
console.log(typeof documentInput);
|
|
26
|
+
console.log(documentInput instanceof N8nJsonLoader_1.N8nJsonLoader);
|
|
27
|
+
console.log(documentInput instanceof N8nBinaryLoader_1.N8nBinaryLoader);
|
|
28
|
+
console.log(documentInput.constructor.name);
|
|
29
|
+
if (documentInput.constructor.name === 'N8nJsonLoader' || documentInput.constructor.name === 'N8nBinaryLoader') {
|
|
30
|
+
processedDocuments = await documentInput.processItem(inputItem, itemIndex);
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
processedDocuments = documentInput;
|
|
34
|
+
}
|
|
35
|
+
const serializedDocuments = processedDocuments.map(({ metadata, pageContent }) => ({
|
|
36
|
+
json: { metadata, pageContent },
|
|
37
|
+
pairedItem: {
|
|
38
|
+
item: itemIndex,
|
|
39
|
+
},
|
|
40
|
+
}));
|
|
41
|
+
return {
|
|
42
|
+
processedDocuments,
|
|
43
|
+
serializedDocuments,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=processDocuments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"processDocuments.js","sourceRoot":"","sources":["../../../../nodes/vector_store/shared/processDocuments.ts"],"names":[],"mappings":";;AAMA,4CAoBC;AACD,0CAgCC;AAxDD,4DAAyD;AACzD,wDAAqD;AAE9C,KAAK,UAAU,gBAAgB,CACrC,aAAyF,EACzF,UAAgC;IAEhC,IAAI,kBAA8B,CAAC;IAEnC,IAAI,aAAa,YAAY,6BAAa,IAAI,aAAa,YAAY,iCAAe,EAAE,CAAC;QACxF,kBAAkB,GAAG,MAAM,aAAa,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;IACjE,CAAC;SAAM,CAAC;QACP,kBAAkB,GAAG,aAAa,CAAC;IACpC,CAAC;IAED,MAAM,mBAAmB,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC,CAAC;QAClF,IAAI,EAAE,EAAE,QAAQ,EAAE,WAAW,EAAE;KAC/B,CAAC,CAAC,CAAC;IAEJ,OAAO;QACN,kBAAkB;QAClB,mBAAmB;KACnB,CAAC;AACH,CAAC;AACM,KAAK,UAAU,eAAe,CACpC,aAAyF,EACzF,SAA6B,EAC7B,SAAiB;IAEjB,IAAI,kBAA8B,CAAC;IACnC,OAAO,CAAC,GAAG,CAAC,OAAO,aAAa,CAAC,CAAA;IACjC,OAAO,CAAC,GAAG,CAAC,aAAa,YAAY,6BAAa,CAAC,CAAA;IACnD,OAAO,CAAC,GAAG,CAAC,aAAa,YAAY,iCAAe,CAAC,CAAA;IACrD,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,WAAW,CAAC,IAAI,CAAC,CAAA;IAI3C,IAAI,aAAa,CAAC,WAAW,CAAC,IAAI,KAAK,eAAe,IAAI,aAAa,CAAC,WAAW,CAAC,IAAI,KAAK,iBAAiB,EAAE,CAAC;QAEhH,kBAAkB,GAAG,MAAM,aAAa,CAAC,WAAW,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IAC5E,CAAC;SAAM,CAAC;QAEP,kBAAkB,GAAG,aAAa,CAAC;IACpC,CAAC;IAED,MAAM,mBAAmB,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC,CAAC;QAClF,IAAI,EAAE,EAAE,QAAQ,EAAE,WAAW,EAAE;QAC/B,UAAU,EAAE;YACX,IAAI,EAAE,SAAS;SACf;KACD,CAAC,CAAC,CAAC;IAEJ,OAAO;QACN,kBAAkB;QAClB,mBAAmB;KACnB,CAAC;AACH,CAAC"}
|
package/dist/package.json
CHANGED
|
@@ -1,28 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-couchbase",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Community node for using Couchbase Key-Value, Query, and Full-Text Search with n8n.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"n8n-community-node-package"
|
|
7
7
|
],
|
|
8
8
|
"license": "MIT",
|
|
9
|
-
"homepage": "",
|
|
9
|
+
"homepage": "https://github.com/Couchbase-Ecosystem/n8n-nodes-couchbase#readme",
|
|
10
10
|
"author": {
|
|
11
|
-
"name": "
|
|
12
|
-
"email": "
|
|
11
|
+
"name": "Elliot Scribner",
|
|
12
|
+
"email": "elliot.scribner@couchbase.com"
|
|
13
13
|
},
|
|
14
14
|
"repository": {
|
|
15
15
|
"type": "git",
|
|
16
|
-
"url": "https://github.com/
|
|
16
|
+
"url": "https://github.com/Couchbase-Ecosystem/n8n-nodes-couchbase.git"
|
|
17
17
|
},
|
|
18
|
+
"engines": {
|
|
19
|
+
"node": ">=18.10",
|
|
20
|
+
"pnpm": ">=9.1"
|
|
21
|
+
},
|
|
22
|
+
"packageManager": "pnpm@9.1.4",
|
|
18
23
|
"main": "index.js",
|
|
19
24
|
"scripts": {
|
|
25
|
+
"preinstall": "npx only-allow pnpm",
|
|
20
26
|
"build": "tsc && gulp build:icons",
|
|
21
27
|
"dev": "tsc --watch",
|
|
28
|
+
"dev:ui": "nodemon -w nodes -w credentials --ext ts --exec 'tsc && cd $HOME/.n8n/custom && COREPACK_ENABLE_STRICT=0 pnpm install && cd - && n8n'",
|
|
22
29
|
"format": "prettier nodes credentials --write",
|
|
23
30
|
"lint": "eslint nodes credentials package.json",
|
|
24
31
|
"lintfix": "eslint nodes credentials package.json --fix",
|
|
25
|
-
"prepublishOnly": "
|
|
32
|
+
"prepublishOnly": "pnpm build && pnpm lint -c .eslintrc.prepublish.js nodes credentials package.json"
|
|
26
33
|
},
|
|
27
34
|
"files": [
|
|
28
35
|
"dist"
|
|
@@ -30,25 +37,28 @@
|
|
|
30
37
|
"n8n": {
|
|
31
38
|
"n8nNodesApiVersion": 1,
|
|
32
39
|
"credentials": [
|
|
33
|
-
"dist/credentials/
|
|
40
|
+
"dist/credentials/CouchbaseApi.credentials.js"
|
|
34
41
|
],
|
|
35
42
|
"nodes": [
|
|
36
|
-
"dist/nodes/
|
|
43
|
+
"dist/nodes/Couchbase/Couchbase.node.js"
|
|
37
44
|
]
|
|
38
45
|
},
|
|
39
46
|
"devDependencies": {
|
|
40
|
-
"@types/
|
|
41
|
-
"@
|
|
42
|
-
"
|
|
43
|
-
"eslint-plugin-n8n-nodes-base": "^1.
|
|
47
|
+
"@types/node": "^22.13.5",
|
|
48
|
+
"@typescript-eslint/parser": "^7.15.0",
|
|
49
|
+
"eslint": "^8.56.0",
|
|
50
|
+
"eslint-plugin-n8n-nodes-base": "^1.16.1",
|
|
44
51
|
"gulp": "^4.0.2",
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
52
|
+
"nodemon": "^3.1.9",
|
|
53
|
+
"prettier": "^3.3.2",
|
|
54
|
+
"typescript": "^5.5.3",
|
|
55
|
+
"sqlite3": "^5.1.7"
|
|
56
|
+
},
|
|
57
|
+
"peerDependencies": {
|
|
58
|
+
"n8n-workflow": "*"
|
|
49
59
|
},
|
|
50
60
|
"dependencies": {
|
|
51
|
-
"couchbase": "^4.
|
|
52
|
-
"
|
|
61
|
+
"couchbase": "^4.4.5",
|
|
62
|
+
"uuid": "^11.1.0"
|
|
53
63
|
}
|
|
54
64
|
}
|