n8n-nodes-couchbase 0.1.5 → 1.1.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 +26 -52
- 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/nodes/Couchbase/Couchbase.node.d.ts +14 -0
- package/dist/nodes/Couchbase/Couchbase.node.js +173 -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 +511 -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/icons/couchbase.dark.svg +14 -0
- package/dist/nodes/icons/couchbase.svg +14 -0
- package/dist/nodes/vector_store/VectorStoreCouchbaseSearch/VectorStoreCouchbaseSearch.node.d.ts +16 -0
- package/dist/nodes/vector_store/VectorStoreCouchbaseSearch/VectorStoreCouchbaseSearch.node.js +335 -0
- package/dist/nodes/vector_store/VectorStoreCouchbaseSearch/VectorStoreCouchbaseSearch.node.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/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 +16 -0
- package/dist/nodes/vector_store/shared/processDocuments.js +28 -0
- package/dist/nodes/vector_store/shared/processDocuments.js.map +1 -0
- package/dist/package.json +37 -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/couchbase/connectToCouchbase.d.ts +6 -0
- package/dist/utils/couchbase/connectToCouchbase.js +88 -0
- package/dist/utils/couchbase/connectToCouchbase.js.map +1 -0
- package/dist/utils/couchbase/populateCouchbaseRLs.d.ts +25 -0
- package/dist/utils/couchbase/populateCouchbaseRLs.js +121 -0
- package/dist/utils/couchbase/populateCouchbaseRLs.js.map +1 -0
- package/dist/utils/couchbase/validateBucketScopeCollection.d.ts +2 -0
- package/dist/utils/couchbase/validateBucketScopeCollection.js +53 -0
- package/dist/utils/couchbase/validateBucketScopeCollection.js.map +1 -0
- package/dist/utils/helpers.d.ts +10 -0
- package/dist/utils/helpers.js +61 -0
- package/dist/utils/helpers.js.map +1 -0
- package/dist/utils/logWrapper.d.ts +20 -0
- package/dist/utils/logWrapper.js +285 -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 +43 -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/CBLogomark.svg +0 -350
- 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/CBLogomark.svg +0 -350
- 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/README.md
CHANGED
|
@@ -1,66 +1,40 @@
|
|
|
1
|
-
|
|
1
|
+
# n8n-nodes-couchbase
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This is a collection of n8n community nodes for using Couchbase services within n8n workflows.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Couchbase is a distributed NoSQL cloud database that offers the robustness of a relational database with the flexibility of a JSON document database, featuring key-value operations, SQL++ querying, and powerful search capabilities including vector search.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
[n8n](https://n8n.io/) is a [fair-code licensed](https://docs.n8n.io/reference/license/) workflow automation platform.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
[Nodes](#nodes)
|
|
10
|
+
[Installation](#installation)
|
|
11
|
+
[Credentials](#credentials)
|
|
12
|
+
[Compatibility](#compatibility)
|
|
12
13
|
|
|
13
|
-
|
|
14
|
+
## Nodes
|
|
15
|
+
Click on the node name to view its detailed documentation.
|
|
16
|
+
- [**Couchbase**](nodes/Couchbase/README.md): This node allows you to perform operations on The Couchbase KV, Query, and Search services. It supports creating, reading, updating, and deleting documents, as well as executing SQL++ queries and full-text searches.
|
|
17
|
+
- [**Couchbase Search Vector Store**](nodes/vector_store/VectorStoreCouchbaseSearch/README.md): This node allows you to perform vector search operations using the Couchbase Search Service. It supports retrieving, updating, and inserting documents in a vector database, as well as using the vector store as a tool for AI agents.
|
|
14
18
|
|
|
15
|
-
|
|
19
|
+
## Installation
|
|
16
20
|
|
|
17
|
-
|
|
18
|
-
• Read documents
|
|
19
|
-
• Update documents
|
|
20
|
-
• Delete documents
|
|
21
|
-
• Import documents
|
|
22
|
-
• Query documents
|
|
21
|
+
Follow the [installation guide](https://docs.n8n.io/integrations/community-nodes/installation/) in the n8n community nodes documentation.
|
|
23
22
|
|
|
23
|
+
## Credentials
|
|
24
24
|
|
|
25
|
-
Couchbase
|
|
25
|
+
To use the Couchbase node, you'll need to set up Couchbase credentials in n8n:
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
1. **Prerequisites**:
|
|
28
|
+
- A running Couchbase cluster (using [Couchbase Capella](https://cloud.couchbase.com/) in the cloud, or Couchbase Server)
|
|
29
|
+
- [Database credentials](https://docs.couchbase.com/cloud/clusters/manage-database-users.html#create-database-credentials) with appropriate permissions for the operations you want to perform
|
|
30
|
+
- [Allow IP address](https://docs.couchbase.com/cloud/clusters/allow-ip-address.html) for your n8n instance
|
|
28
31
|
|
|
29
|
-
|
|
32
|
+
2. **Credential Parameters**:
|
|
33
|
+
- **Connection String**: The connection string to your Couchbase server (e.g., `couchbase://localhost`)
|
|
34
|
+
- **Username**: Database access username
|
|
35
|
+
- **Password**: Database access password
|
|
30
36
|
|
|
31
|
-
|
|
37
|
+
## Compatibility
|
|
32
38
|
|
|
33
|
-
|
|
39
|
+
This node has been tested with n8n version 1.86.0.
|
|
34
40
|
|
|
35
|
-
• Username
|
|
36
|
-
• Password
|
|
37
|
-
• Bucket
|
|
38
|
-
• Scope
|
|
39
|
-
• Collection
|
|
40
|
-
|
|
41
|
-
Those credentials are needed in order for you to connect to Couchbase.
|
|
42
|
-
|
|
43
|
-
Example Usage
|
|
44
|
-
|
|
45
|
-
This workflow allows you to insert a document into a Couchbase. This example usage workflow would use the following three nodes. - Start - Set - Couchbase
|
|
46
|
-
|
|
47
|
-
The final workflow should look like the following image.
|
|
48
|
-
|
|
49
|
-
<img width="468" alt="image" src="https://github.com/maruakinu/n8n-nodes-couchbase/assets/100325935/b7947dde-af19-4b40-9c85-b1c5716fa332">
|
|
50
|
-
|
|
51
|
-
1. Start node
|
|
52
|
-
The start node exists by default when you create a new workflow.
|
|
53
|
-
|
|
54
|
-
2. Set node
|
|
55
|
-
|
|
56
|
-
1. Click on the Add Value button and select 'String' from the dropdown list.
|
|
57
|
-
2. Enter the Property Name of the Value in the Name field.
|
|
58
|
-
3. Enter the value for the name in the Value field.
|
|
59
|
-
4. Click on Execute Node to run the node.
|
|
60
|
-
|
|
61
|
-
3. Couchbase node (Inserting Data)
|
|
62
|
-
|
|
63
|
-
1. Select 'Insert' from the Operation dropdown list.
|
|
64
|
-
2. You will have to enter credentials for the Couchbase. Click the Couchbase Node and enter your credentials.
|
|
65
|
-
3. At the bottom, enter the value that you want to insert in Couchbase.
|
|
66
|
-
4. Click on Execute Node to run the node.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CouchbaseApi = void 0;
|
|
4
|
+
class CouchbaseApi {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.name = 'couchbaseApi';
|
|
7
|
+
this.displayName = 'Couchbase Credentials API';
|
|
8
|
+
this.documentationUrl = 'https://github.com/Couchbase-Ecosystem/n8n-nodes-couchbase?tab=readme-ov-file#credentials';
|
|
9
|
+
this.icon = {
|
|
10
|
+
light: 'file:../nodes/Couchbase/couchbase.svg',
|
|
11
|
+
dark: 'file:../nodes/Couchbase/couchbase.dark.svg',
|
|
12
|
+
};
|
|
13
|
+
this.properties = [
|
|
14
|
+
{
|
|
15
|
+
displayName: 'Connection String',
|
|
16
|
+
name: 'couchbaseConnectionString',
|
|
17
|
+
type: 'string',
|
|
18
|
+
default: '',
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
displayName: 'Username',
|
|
22
|
+
name: 'couchbaseUsername',
|
|
23
|
+
type: 'string',
|
|
24
|
+
default: '',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
displayName: 'Password',
|
|
28
|
+
name: 'couchbasePassword',
|
|
29
|
+
type: 'string',
|
|
30
|
+
typeOptions: {
|
|
31
|
+
password: true,
|
|
32
|
+
},
|
|
33
|
+
default: '',
|
|
34
|
+
},
|
|
35
|
+
];
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.CouchbaseApi = CouchbaseApi;
|
|
39
|
+
//# sourceMappingURL=CouchbaseApi.credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CouchbaseApi.credentials.js","sourceRoot":"","sources":["../../credentials/CouchbaseApi.credentials.ts"],"names":[],"mappings":";;;AAEA,MAAa,YAAY;IAAzB;QACC,SAAI,GAAG,cAAc,CAAC;QACtB,gBAAW,GAAG,2BAA2B,CAAC;QAC1C,qBAAgB,GACf,2FAA2F,CAAC;QAC7F,SAAI,GAAS;YACZ,KAAK,EAAE,uCAAuC;YAC9C,IAAI,EAAE,4CAA4C;SAClD,CAAC;QACF,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,mBAAmB;gBAChC,IAAI,EAAE,2BAA2B;gBACjC,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;aACX;YACD;gBACC,WAAW,EAAE,UAAU;gBACvB,IAAI,EAAE,mBAAmB;gBACzB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;aACX;YACD;gBACC,WAAW,EAAE,UAAU;gBACvB,IAAI,EAAE,mBAAmB;gBACzB,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE;oBACZ,QAAQ,EAAE,IAAI;iBACd;gBACD,OAAO,EAAE,EAAE;aACX;SACD,CAAC;IACH,CAAC;CAAA;AAhCD,oCAgCC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
2
|
+
import { populateCouchbaseBucketRL, populateCouchbaseCollectionRL, populateCouchbaseScopeRL, populateCouchbaseSearchIndexesRL } from '../../utils/couchbase/populateCouchbaseRLs';
|
|
3
|
+
export declare class Couchbase implements INodeType {
|
|
4
|
+
description: INodeTypeDescription;
|
|
5
|
+
methods: {
|
|
6
|
+
listSearch: {
|
|
7
|
+
populateCouchbaseBucketRL: typeof populateCouchbaseBucketRL;
|
|
8
|
+
populateCouchbaseScopeRL: typeof populateCouchbaseScopeRL;
|
|
9
|
+
populateCouchbaseCollectionRL: typeof populateCouchbaseCollectionRL;
|
|
10
|
+
populateCouchbaseSearchIndexesRL: typeof populateCouchbaseSearchIndexesRL;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.Couchbase = void 0;
|
|
27
|
+
const couchbase_1 = require("couchbase");
|
|
28
|
+
const uuid = __importStar(require("uuid"));
|
|
29
|
+
const CouchbaseProperties_1 = require("./CouchbaseProperties");
|
|
30
|
+
const populateCouchbaseRLs_1 = require("../../utils/couchbase/populateCouchbaseRLs");
|
|
31
|
+
const connectToCouchbase_1 = require("../../utils/couchbase/connectToCouchbase");
|
|
32
|
+
function processSearchResults(rows) {
|
|
33
|
+
const processedData = rows.map((row) => Object.fromEntries(Object.entries(row).filter(([_, v]) => v !== undefined && !(v && typeof v === 'object' && Object.keys(v).length === 0))));
|
|
34
|
+
return processedData.length > 0 ? processedData : [{ message: 'No results found' }];
|
|
35
|
+
}
|
|
36
|
+
function transformRawJsonQueryToValidSearchOptions(rawJsonQuery) {
|
|
37
|
+
const { raw, ...topLevelFields } = rawJsonQuery;
|
|
38
|
+
if (raw) {
|
|
39
|
+
return rawJsonQuery;
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
raw: { ...topLevelFields },
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
class Couchbase {
|
|
46
|
+
constructor() {
|
|
47
|
+
this.description = {
|
|
48
|
+
displayName: 'Couchbase',
|
|
49
|
+
name: 'couchbase',
|
|
50
|
+
icon: { light: 'file:../icons/couchbase.svg', dark: 'file:../icons/couchbase.dark.svg' },
|
|
51
|
+
group: ['input'],
|
|
52
|
+
version: [1.0, 1.1],
|
|
53
|
+
subtitle: '={{$parameter["resource"] + ": " + $parameter["operation"]}}',
|
|
54
|
+
description: 'Couchbase node to insert, update, retrieve, and delete data from a Couchbase database using KV, Query and Search services',
|
|
55
|
+
defaults: {
|
|
56
|
+
name: 'Couchbase',
|
|
57
|
+
},
|
|
58
|
+
inputs: ['main'],
|
|
59
|
+
outputs: ['main'],
|
|
60
|
+
credentials: [
|
|
61
|
+
{
|
|
62
|
+
name: 'couchbaseApi',
|
|
63
|
+
required: true,
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
properties: CouchbaseProperties_1.nodeProperties,
|
|
67
|
+
};
|
|
68
|
+
this.methods = {
|
|
69
|
+
listSearch: {
|
|
70
|
+
populateCouchbaseBucketRL: populateCouchbaseRLs_1.populateCouchbaseBucketRL,
|
|
71
|
+
populateCouchbaseScopeRL: populateCouchbaseRLs_1.populateCouchbaseScopeRL,
|
|
72
|
+
populateCouchbaseCollectionRL: populateCouchbaseRLs_1.populateCouchbaseCollectionRL,
|
|
73
|
+
populateCouchbaseSearchIndexesRL: populateCouchbaseRLs_1.populateCouchbaseSearchIndexesRL,
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
async execute() {
|
|
78
|
+
const operation = this.getNodeParameter('operation', 0);
|
|
79
|
+
const { cluster, collection } = await (0, connectToCouchbase_1.connectToCouchbase)(this);
|
|
80
|
+
const returnItems = [];
|
|
81
|
+
let responseData = [];
|
|
82
|
+
if (operation === CouchbaseProperties_1.DOCUMENT_OPS.CREATE) {
|
|
83
|
+
const documentToInsert = this.getNodeParameter('documentValue', 0, '');
|
|
84
|
+
const isSpecifyDocumentId = this.getNodeParameter('isSpecifyDocumentId', 0, false);
|
|
85
|
+
let id;
|
|
86
|
+
if (!isSpecifyDocumentId) {
|
|
87
|
+
id = uuid.v4();
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
const specifiedDocumentId = this.getNodeParameter('documentId', 0, '');
|
|
91
|
+
id = specifiedDocumentId.trim();
|
|
92
|
+
}
|
|
93
|
+
await collection.insert(id, documentToInsert);
|
|
94
|
+
responseData = [{ id: id, value: documentToInsert }];
|
|
95
|
+
}
|
|
96
|
+
else if (operation === CouchbaseProperties_1.DOCUMENT_OPS.UPSERT) {
|
|
97
|
+
const newDocumentValue = this.getNodeParameter('documentValue', 0, '');
|
|
98
|
+
const id = this.getNodeParameter('documentId', 0, '');
|
|
99
|
+
await collection.upsert(id, newDocumentValue);
|
|
100
|
+
responseData = [{ id, value: newDocumentValue }];
|
|
101
|
+
}
|
|
102
|
+
else if (operation === CouchbaseProperties_1.DOCUMENT_OPS.DELETE) {
|
|
103
|
+
const documentId = this.getNodeParameter('documentId', 0, '');
|
|
104
|
+
const removeResult = await collection.remove(documentId);
|
|
105
|
+
responseData = [{ id: documentId, value: removeResult }];
|
|
106
|
+
}
|
|
107
|
+
else if (operation === CouchbaseProperties_1.DOCUMENT_OPS.READ) {
|
|
108
|
+
const documentId = this.getNodeParameter('documentId', 0, '');
|
|
109
|
+
const getResult = await collection.get(documentId);
|
|
110
|
+
const responseJson = JSON.stringify(getResult.content);
|
|
111
|
+
responseData = [{ id: documentId, value: responseJson }];
|
|
112
|
+
}
|
|
113
|
+
else if (operation === CouchbaseProperties_1.DOCUMENT_OPS.QUERY) {
|
|
114
|
+
const query = this.getNodeParameter('query', 0, '');
|
|
115
|
+
const selectedBucket = this.getNodeParameter('couchbaseBucket', 0);
|
|
116
|
+
const selectedScope = this.getNodeParameter('couchbaseScope', 0);
|
|
117
|
+
const queryOptions = {};
|
|
118
|
+
if (selectedBucket.value) {
|
|
119
|
+
queryOptions.queryContext = `default:${selectedBucket.value}`;
|
|
120
|
+
if (selectedScope.value) {
|
|
121
|
+
queryOptions.queryContext += `.${selectedScope.value}`;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
const queryResult = await cluster.query(query, queryOptions);
|
|
125
|
+
responseData = queryResult.rows;
|
|
126
|
+
}
|
|
127
|
+
else if (operation === CouchbaseProperties_1.SEARCH_OPS.RETRIEVE) {
|
|
128
|
+
const isAdvancedMode = this.getNodeParameter('advancedMode', 0);
|
|
129
|
+
const indexName = this.getNodeParameter('indexName', 0, '', {
|
|
130
|
+
extractValue: true,
|
|
131
|
+
});
|
|
132
|
+
if (isAdvancedMode) {
|
|
133
|
+
const rawQuery = this.getNodeParameter('rawQuery', 0);
|
|
134
|
+
const transformedQuerySearchOptions = transformRawJsonQueryToValidSearchOptions(rawQuery);
|
|
135
|
+
const searchResult = await cluster.searchQuery(indexName, couchbase_1.SearchQuery.matchNone(), transformedQuerySearchOptions);
|
|
136
|
+
responseData = processSearchResults(searchResult.rows);
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
const fieldsToReturn = this.getNodeParameter('fieldsToReturn', 0);
|
|
140
|
+
const fieldsArray = fieldsToReturn
|
|
141
|
+
? fieldsToReturn.split(',').map((field) => field.trim())
|
|
142
|
+
: [];
|
|
143
|
+
const searchQuery = this.getNodeParameter('searchQuery', 0);
|
|
144
|
+
const includeLocations = this.getNodeParameter('includeLocations', 0);
|
|
145
|
+
const resultsLimit = this.getNodeParameter('resultsLimit', 0);
|
|
146
|
+
const searchOptions = {
|
|
147
|
+
limit: resultsLimit,
|
|
148
|
+
fields: fieldsArray,
|
|
149
|
+
includeLocations,
|
|
150
|
+
};
|
|
151
|
+
const searchResult = await cluster.searchQuery(indexName, couchbase_1.SearchQuery.match(searchQuery), searchOptions);
|
|
152
|
+
responseData = processSearchResults(searchResult.rows);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
else if (operation === CouchbaseProperties_1.SEARCH_OPS.CREATE_INDEX) {
|
|
156
|
+
const indexDefinition = this.getNodeParameter('indexDefinition', 0);
|
|
157
|
+
await cluster.searchIndexes().upsertIndex(indexDefinition);
|
|
158
|
+
responseData = [{ message: 'Index created successfully' }];
|
|
159
|
+
}
|
|
160
|
+
const items = this.getInputData();
|
|
161
|
+
const itemData = generatePairedItemData(items.length);
|
|
162
|
+
const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData });
|
|
163
|
+
returnItems.push(...executionData);
|
|
164
|
+
return [returnItems];
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
exports.Couchbase = Couchbase;
|
|
168
|
+
function generatePairedItemData(length) {
|
|
169
|
+
return Array.from({ length }, (_, item) => ({
|
|
170
|
+
item,
|
|
171
|
+
}));
|
|
172
|
+
}
|
|
173
|
+
//# sourceMappingURL=Couchbase.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Couchbase.node.js","sourceRoot":"","sources":["../../../nodes/Couchbase/Couchbase.node.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,yCAOmB;AAEnB,2CAA6B;AAE7B,+DAI+B;AAC/B,gFAK+C;AAC/C,4EAAyE;AAEzE,SAAS,oBAAoB,CAAC,IAAW;IACxC,MAAM,aAAa,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CACtC,MAAM,CAAC,WAAW,CACjB,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,CACzB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,SAAS,IAAI,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,CAC3F,CACD,CACgB,CAAC;IAEnB,OAAO,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,kBAAkB,EAAE,CAAC,CAAC;AACrF,CAAC;AAMD,SAAS,yCAAyC,CAAC,YAAiB;IACnE,MAAM,EAAE,GAAG,EAAE,GAAG,cAAc,EAAE,GAAG,YAAY,CAAC;IAGhD,IAAI,GAAG,EAAE,CAAC;QACT,OAAO,YAAkC,CAAC;IAC3C,CAAC;IAGD,OAAO;QAEN,GAAG,EAAE,EAAE,GAAG,cAAc,EAAE;KACJ,CAAC;AACzB,CAAC;AAED,MAAa,SAAS;IAAtB;QACC,gBAAW,GAAyB;YACnC,WAAW,EAAE,WAAW;YACxB,IAAI,EAAE,WAAW;YACjB,IAAI,EAAE,EAAE,KAAK,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AAG,oBAAoB,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;YACxD,CAAC;QACF,CAAC;aAAM,IAAI,SAAS,KAAK,gCAAU,CAAC,YAAY,EAAE,CAAC;YAClD,MAAM,eAAe,GAAG,IAAI,CAAC,gBAAgB,CAAC,iBAAiB,EAAE,CAAC,CAAC,CAAC;YACpE,MAAM,OAAO,CAAC,aAAa,EAAE,CAAC,WAAW,CAAC,eAA+B,CAAC,CAAC;YAC3E,YAAY,GAAG,CAAC,EAAE,OAAO,EAAE,4BAA4B,EAAE,CAAC,CAAC;QAC5D,CAAC;QAED,MAAM,KAAK,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;QAClC,MAAM,QAAQ,GAAG,sBAAsB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAEtD,MAAM,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,0BAA0B,CAC5D,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,YAAY,CAAC,EAC1C,EAAE,QAAQ,EAAE,CACZ,CAAC;QAEF,WAAW,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC,CAAC;QAEnC,OAAO,CAAC,WAAW,CAAC,CAAC;IACtB,CAAC;CACD;AArJD,8BAqJC;AAED,SAAS,sBAAsB,CAAC,MAAc;IAC7C,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;QAC3C,IAAI;KACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"node": "n8n-nodes-base.couchbase",
|
|
3
|
+
"nodeVersion": "1.1",
|
|
4
|
+
"codexVersion": "1.0",
|
|
5
|
+
"categories": ["Development", "Data & Storage"],
|
|
6
|
+
"resources": {
|
|
7
|
+
"credentialDocumentation": [
|
|
8
|
+
{
|
|
9
|
+
"url": "https://github.com/Couchbase-Ecosystem/n8n-nodes-couchbase?tab=readme-ov-file#credentials"
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
"primaryDocumentation": [
|
|
13
|
+
{
|
|
14
|
+
"url": "https://github.com/Couchbase-Ecosystem/n8n-nodes-couchbase/blob/master/nodes/Couchbase/README.md"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export declare const DOCUMENT_OPS: {
|
|
3
|
+
readonly CREATE: "create";
|
|
4
|
+
readonly QUERY: "query";
|
|
5
|
+
readonly READ: "read";
|
|
6
|
+
readonly UPSERT: "upsert";
|
|
7
|
+
readonly DELETE: "delete";
|
|
8
|
+
};
|
|
9
|
+
export declare const SEARCH_OPS: {
|
|
10
|
+
readonly CREATE_INDEX: "createIndex";
|
|
11
|
+
readonly RETRIEVE: "retrieve";
|
|
12
|
+
};
|
|
13
|
+
export declare const SEARCH_TYPES: {
|
|
14
|
+
readonly SEARCH_FULL_TEXT: "searchFullText";
|
|
15
|
+
};
|
|
16
|
+
export declare const nodeProperties: INodeProperties[];
|