diff --git a/docs/docs/data-sources/couchdb.md b/docs/docs/data-sources/couchdb.md new file mode 100644 index 0000000000..b78b99a5b4 --- /dev/null +++ b/docs/docs/data-sources/couchdb.md @@ -0,0 +1,304 @@ +--- +sidebar_position: 1 +--- + +# Couchdb + + +ToolJet can connect to CouchDB databases to read and write data. CocuhDB uses basic auth for authentication , username and password for the database is required to create an CouchDB data source on ToolJet. For more info visit https://docs.couchdb.org/en/stable/ + +ToolJet - Data source - CouchDb + +Supported queries: + +- Listing records +- Retrieving a record +- Creating a record +- Updating a record +- Deleting a record +- Find +- Retrieving a view + +:::info +NOTE: Record ID is same as document ID("_id") . +::: +## Listing records + +This query lists all the records in a database. + +Optional parameters: + +- Descending order +- Limit +- Skip +- Include docs + + +:::info +descending (boolean) – Return the documents in descending order by key. Default is false. + +limit (number) – Limit the number of the returned documents to the specified number. + +skip (number) – Skip this number of records before starting to return the results. Default is 0. + +include_docs (boolean) – include_docs key is set to false by default , if true it returns the document data along with the default fields. + +::: + +ToolJet - CouchDb Delete Operarion + + +Example response from CouchDb: + +```json +{ + "total_rows": 3, + "offset": 0, + "rows": [ + { + "id": "23212104e60a71edb42ebc509f000dc2", + "key": "23212104e60a71edb42ebc509f000dc2", + "value": { + "rev": "1-0cc7f48876f15883394e5c139c628123" + } + }, + { + "id": "23212104e60a71edb42ebc509f00216e", + "key": "23212104e60a71edb42ebc509f00216e", + "value": { + "rev": "1-b3c45696b10cb08221a335ff7cbd8b7a" + } + }, + { + "id": "23212104e60a71edb42ebc509f00282a", + "key": "23212104e60a71edb42ebc509f00282a", + "value": { + "rev": "1-da5732beb913ecbded309321cac892d2" + } + }, + ] +} +``` + +## Retrieving a record + +Required parameters: + +- Record ID + + +ToolJet - Data source - CouchDb Retrieve Operation + + +Example response from CouchDb: + +```json +{ + "_id": "e33dc4e209689cb0400d095fc401a1e0", + "_rev": "1-a62af8e14451af88c150e7e718b7a0e8", + "0": { + "name": "test data" + } +} +``` +The returned JSON is the JSON of the document, including the document ID and revision number: + + +## Creating a record + +ToolJet - Data source - CouchDb Create Operarion + +#### Example Records: + +```json + + [{"name":"tooljet"}] + + +``` + + +Click on the `run` button to run the query. + +:::info +NOTE: Query must be saved before running. +::: + +Example response from CouchDb: +```json + + { + "ok": true, + "id": "23212104e60a71edb42ebc509f0049a2", + "rev": "1-b0a625abc4e21ee554737920156e911f" +} + +``` + +## Updating a record + +You can get the revision id value, by sending a GET request to get the document details. +You get the document as JSON in the response. For each update to the document, the revision field "_rev" gets changed. + + +Required parameters: +- Revision ID +- Record ID + +ToolJet - Data source - CouchDb Update Operarion + +#### Example body: + +```json + + [{"name":"tooljet"}] + + +``` + + +Click on the `run` button to run the query. + +:::info +NOTE: Query must be saved before running. +::: + +Example response from CouchDb: +```json + + { + "ok": true, + "id": "23212104e60a71edb42ebc509f0049a2", + "rev": "2-b0a625abc4e21ee554737920156e911f" +} +``` + +## Deleting a record + +Required parameters: +- Revision ID +- Record ID + +ToolJet - CouchDb Delete Operarion + + +Click on the `run` button to run the query. + + +Example response from CouchDb: + +```json +{ + "ok": true, + "id": "rev_id=2-3d01e0e87139c57e9bd083e48ecde13d&record_id=e33dc4e209689cb0400d095fc401a1e0", + "rev": "1-2b99ef28c03e68ea70bb668ee55ffb7b" +} +``` + +## Find + +Find documents using a declarative JSON querying syntax. + +Required parameters: +- Selector + +:::info +NOTE: +selector syntax: https://pouchdb.com/guides/mango-queries.html +::: + +ToolJet - Data source - CouchDb Find Operarion + +#### Example body: + +```json +{ + "selector": { + "year": {"$gte": 2015} + }, + "fields": ["year"] +} +``` + + +Click on the `run` button to run the query. + +:::info +NOTE: +selector (json) – JSON object describing criteria used to select documents. + +More information : https://docs.couchdb.org/en/stable/api/database/find.html +::: + +Example response from CouchDb: +ToolJet - Data source - CouchDb Find Operarion + +## Retrieving a view + +Views are the primary tool used for querying and reporting on CouchDB documents. + +Required parameters: +- View url + +Reference for view :https://docs.couchdb.org/en/3.2.0/ddocs/views/intro.html#what-is-a-view + +ToolJet - Data source - CouchDb View Operarion + + +Optional parameters: + +- Start key +- End key +- Limit +- Skip + +Click on the `run` button to run the query. + +:::info +startkey (json) – Return records starting with the specified key. + +endkey (json) – Stop returning records when the specified key is reached. + +limit (number) – Limit the number of the returned documents to the specified number. + +skip (number) – Skip this number of records before starting to return the results. Default is 0. +::: + +Example response from CouchDb: +```json +{ + "total_rows": 4, + "offset": 0, + "rows": [ + { + "id": "23212104e60a71edb42ebc509f000dc2", + "key": "23212104e60a71edb42ebc509f000dc2", + "value": { + "rev": "1-0cc7f48876f15883394e5c139c628123" + } + }, + { + "id": "23212104e60a71edb42ebc509f00216e", + "key": "23212104e60a71edb42ebc509f00216e", + "value": { + "rev": "1-b3c45696b10cb08221a335ff7cbd8b7a" + } + }, + { + "id": "23212104e60a71edb42ebc509f00282a", + "key": "23212104e60a71edb42ebc509f00282a", + "value": { + "rev": "1-da5732beb913ecbded309321cac892d2" + } + }, + { + "id": "23212104e60a71edb42ebc509f002cbd", + "key": "23212104e60a71edb42ebc509f002cbd", + "value": { + "rev": "1-ca5bb3c0767eb42ea6c33eee3d395b59" + } + + } + ] +} +``` \ No newline at end of file diff --git a/docs/static/img/datasource-reference/couchdb/auth_couch.gif b/docs/static/img/datasource-reference/couchdb/auth_couch.gif new file mode 100644 index 0000000000..97bde74df7 Binary files /dev/null and b/docs/static/img/datasource-reference/couchdb/auth_couch.gif differ diff --git a/docs/static/img/datasource-reference/couchdb/create.png b/docs/static/img/datasource-reference/couchdb/create.png new file mode 100644 index 0000000000..3934e6a2f7 Binary files /dev/null and b/docs/static/img/datasource-reference/couchdb/create.png differ diff --git a/docs/static/img/datasource-reference/couchdb/delete.png b/docs/static/img/datasource-reference/couchdb/delete.png new file mode 100644 index 0000000000..64ed60fa5c Binary files /dev/null and b/docs/static/img/datasource-reference/couchdb/delete.png differ diff --git a/docs/static/img/datasource-reference/couchdb/find.png b/docs/static/img/datasource-reference/couchdb/find.png new file mode 100644 index 0000000000..192588c945 Binary files /dev/null and b/docs/static/img/datasource-reference/couchdb/find.png differ diff --git a/docs/static/img/datasource-reference/couchdb/find_response.png b/docs/static/img/datasource-reference/couchdb/find_response.png new file mode 100644 index 0000000000..8bd126a7dd Binary files /dev/null and b/docs/static/img/datasource-reference/couchdb/find_response.png differ diff --git a/docs/static/img/datasource-reference/couchdb/list.png b/docs/static/img/datasource-reference/couchdb/list.png new file mode 100644 index 0000000000..2cc586da9d Binary files /dev/null and b/docs/static/img/datasource-reference/couchdb/list.png differ diff --git a/docs/static/img/datasource-reference/couchdb/retreive.png b/docs/static/img/datasource-reference/couchdb/retreive.png new file mode 100644 index 0000000000..968ba82fd3 Binary files /dev/null and b/docs/static/img/datasource-reference/couchdb/retreive.png differ diff --git a/docs/static/img/datasource-reference/couchdb/update.png b/docs/static/img/datasource-reference/couchdb/update.png new file mode 100644 index 0000000000..8dd5a4ea41 Binary files /dev/null and b/docs/static/img/datasource-reference/couchdb/update.png differ diff --git a/docs/static/img/datasource-reference/couchdb/view.png b/docs/static/img/datasource-reference/couchdb/view.png new file mode 100644 index 0000000000..1dd1aa6e0c Binary files /dev/null and b/docs/static/img/datasource-reference/couchdb/view.png differ diff --git a/frontend/package-lock.json b/frontend/package-lock.json index ef1d94c761..d5084eabed 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -111,6 +111,7 @@ "@tooljet-plugins/airtable": "file:packages/airtable", "@tooljet-plugins/bigquery": "file:packages/bigquery", "@tooljet-plugins/common": "file:packages/common", + "@tooljet-plugins/couchdb": "file:packages/couchdb", "@tooljet-plugins/dynamodb": "file:packages/dynamodb", "@tooljet-plugins/elasticsearch": "file:packages/elasticsearch", "@tooljet-plugins/firestore": "file:packages/firestore", @@ -22612,6 +22613,7 @@ "@tooljet-plugins/airtable": "file:packages/airtable", "@tooljet-plugins/bigquery": "file:packages/bigquery", "@tooljet-plugins/common": "file:packages/common", + "@tooljet-plugins/couchdb": "file:packages/couchdb", "@tooljet-plugins/dynamodb": "file:packages/dynamodb", "@tooljet-plugins/elasticsearch": "file:packages/elasticsearch", "@tooljet-plugins/firestore": "file:packages/firestore", diff --git a/package-lock.json b/package-lock.json index cbe16be7b1..eeb2fbe784 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,5 @@ { - "name": "ToolJet", + "name": "tooljet", "lockfileVersion": 2, "requires": true, "packages": { diff --git a/package.json b/package.json index 7d391fc51a..b4c6a59488 100644 --- a/package.json +++ b/package.json @@ -21,13 +21,13 @@ "@babel/preset-env": "^7.4.3", "@babel/preset-react": "^7.0.0", "babel-loader": "^8.0.5", + "eslint": "^7.25.0", "html-webpack-plugin": "^5.3.2", + "husky": "^7.0.2", "lint-staged": "^11.2.3", "path": "^0.12.7", "webpack": "^5.55.1", - "webpack-cli": "^4.8.0", - "eslint": "^7.25.0", - "husky": "^7.0.2" + "webpack-cli": "^4.8.0" }, "dependencies": { "@nestjs/cli": "^8.1.0", diff --git a/plugins/package-lock.json b/plugins/package-lock.json index e5afdb3449..09d2df90f9 100644 --- a/plugins/package-lock.json +++ b/plugins/package-lock.json @@ -11,6 +11,7 @@ "@tooljet-plugins/airtable": "file:packages/airtable", "@tooljet-plugins/bigquery": "file:packages/bigquery", "@tooljet-plugins/common": "file:packages/common", + "@tooljet-plugins/couchdb": "file:packages/couchdb", "@tooljet-plugins/dynamodb": "file:packages/dynamodb", "@tooljet-plugins/elasticsearch": "file:packages/elasticsearch", "@tooljet-plugins/firestore": "file:packages/firestore", @@ -4497,6 +4498,10 @@ "resolved": "packages/common", "link": true }, + "node_modules/@tooljet-plugins/couchdb": { + "resolved": "packages/couchdb", + "link": true + }, "node_modules/@tooljet-plugins/dynamodb": { "resolved": "packages/dynamodb", "link": true @@ -16313,6 +16318,14 @@ "rimraf": "^3.0.2" } }, + "packages/couchdb": { + "name": "@tooljet-plugins/couchdb", + "version": "1.0.0", + "dependencies": { + "@tooljet-plugins/common": "file:../common", + "react": "^17.0.2" + } + }, "packages/dynamodb": { "name": "@tooljet-plugins/dynamodb", "version": "1.0.0", @@ -20034,6 +20047,13 @@ "rimraf": "^3.0.2" } }, + "@tooljet-plugins/couchdb": { + "version": "file:packages/couchdb", + "requires": { + "@tooljet-plugins/common": "file:../common", + "react": "^17.0.2" + } + }, "@tooljet-plugins/dynamodb": { "version": "file:packages/dynamodb", "requires": { diff --git a/plugins/package.json b/plugins/package.json index 24ad21935c..bd7914054f 100644 --- a/plugins/package.json +++ b/plugins/package.json @@ -21,6 +21,7 @@ "@tooljet-plugins/airtable": "file:packages/airtable", "@tooljet-plugins/bigquery": "file:packages/bigquery", "@tooljet-plugins/common": "file:packages/common", + "@tooljet-plugins/couchdb": "file:packages/couchdb", "@tooljet-plugins/dynamodb": "file:packages/dynamodb", "@tooljet-plugins/elasticsearch": "file:packages/elasticsearch", "@tooljet-plugins/firestore": "file:packages/firestore", diff --git a/plugins/packages/couchdb/.gitignore b/plugins/packages/couchdb/.gitignore new file mode 100644 index 0000000000..4c5f09d7c4 --- /dev/null +++ b/plugins/packages/couchdb/.gitignore @@ -0,0 +1,4 @@ +node_modules +lib/*.d.* +lib/*.js +lib/*.js.map \ No newline at end of file diff --git a/plugins/packages/couchdb/README.md b/plugins/packages/couchdb/README.md new file mode 100644 index 0000000000..a59d535fa4 --- /dev/null +++ b/plugins/packages/couchdb/README.md @@ -0,0 +1,4 @@ + +# CouchDB + +Documentation on: https://docs.tooljet.com/docs/data-sources/couchdb \ No newline at end of file diff --git a/plugins/packages/couchdb/__tests_/index.js b/plugins/packages/couchdb/__tests_/index.js new file mode 100644 index 0000000000..d43df77028 --- /dev/null +++ b/plugins/packages/couchdb/__tests_/index.js @@ -0,0 +1,7 @@ +'use strict'; + +const couchdb = require('../lib'); + +describe('couchdb', () => { + it.todo('needs tests'); +}); \ No newline at end of file diff --git a/plugins/packages/couchdb/lib/icon.svg b/plugins/packages/couchdb/lib/icon.svg new file mode 100644 index 0000000000..665e174310 --- /dev/null +++ b/plugins/packages/couchdb/lib/icon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/plugins/packages/couchdb/lib/index.ts b/plugins/packages/couchdb/lib/index.ts new file mode 100644 index 0000000000..640f5bf840 --- /dev/null +++ b/plugins/packages/couchdb/lib/index.ts @@ -0,0 +1,178 @@ +import { + QueryError, + QueryResult, + QueryService, + ConnectionTestResult, +} from "@tooljet-plugins/common"; +import { SourceOptions, QueryOptions } from "./types"; +import got from "got"; +const JSON5 = require("json5"); +export default class Couchdb implements QueryService { + async run( + sourceOptions: SourceOptions, + queryOptions: QueryOptions + ): Promise { + let result = {}; + let response = null; + const { + operation, + record_id, + limit, + view_url, + start_key, + end_key, + skip, + descending, + include_docs + } = queryOptions; + const { username, password, port, host, database, protocol } = + sourceOptions; + const revision_id = queryOptions.rev_id; + + const authHeader = () => { + const combined = `${username}:${password}`; + const key = Buffer.from(combined).toString("base64"); + return { Authorization: `Basic ${key}` }; + }; + + try { + switch (operation) { + case "list_records": { + response = await got( + `${protocol}://${host}:${port}/${database}/_all_docs`, + { + method: "get", + headers: authHeader(), + searchParams: { + ...(limit?.length > 0 && { limit }), + ...(skip?.length > 0 && { skip }), + ...(descending && { descending }), + ...(include_docs && { include_docs }), + }, + } + ); + result = this.parseJSON(response.body); + break; + } + + case "retrieve_record": { + response = await got( + `${protocol}://${host}:${port}/${database}/${record_id}`, + { + headers: authHeader(), + method: "get", + } + ); + result = this.parseJSON(response.body); + break; + } + + case "create_record": { + response = await got(`${protocol}://${host}:${port}/${database}`, { + method: "post", + headers: authHeader(), + json: { + records: this.parseJSON(queryOptions.body), + }, + }); + result = this.parseJSON(response.body); + break; + } + + case "update_record": { + response = await got( + `${protocol}://${host}:${port}/${database}/${record_id}`, + { + method: "put", + headers: authHeader(), + json: { + _rev: revision_id, + records: this.parseJSON(queryOptions.body), + }, + } + ); + result = this.parseJSON(response.body); + break; + } + + case "delete_record": { + response = await got( + `${protocol}://${host}:${port}/${database}/${record_id}`, + { + method: "delete", + headers: authHeader(), + searchParams: { + rev: revision_id, + }, + } + ); + result = this.parseJSON(response.body); + break; + } + + case "find": { + response = await got( + `${protocol}://${host}:${port}/${database}/_find`, + { + method: "post", + headers: authHeader(), + json: this.parseJSON(queryOptions.body), + } + ); + result = this.parseJSON(response.body); + break; + } + + case "get_view": { + response = await got(`${view_url}`, { + method: "get", + headers: authHeader(), + searchParams: { + ...(limit?.length > 0 && { limit }), + ...(skip?.length > 0 && { skip }), + ...(descending && { descending }), + ...(start_key?.length > 0 && { start_key }), + ...(end_key?.length > 0 && { end_key }), + }, + }); + result = this.parseJSON(response.body); + break; + } + } + } catch (error) { + console.log(error); + throw new QueryError("Query could not be completed", error.message, {}); + } + + return { + status: "ok", + data: result, + }; + } + + async testConnection( + sourceOptions: SourceOptions + ): Promise { + const { username, password, port, host, database, protocol } = + sourceOptions; + const combined = `${username}:${password}`; + const key = Buffer.from(combined).toString("base64"); + const client = await got(`${protocol}://${host}:${port}/_all_dbs`, { + method: "get", + headers: { Authorization: `Basic ${key}` }, + }); + if (!client) { + throw new Error("Error"); + } + + return { + status: "ok", + }; + } + + private parseJSON(json?: string): object { + if (!json) return {}; + + return JSON5.parse(json); + } +} diff --git a/plugins/packages/couchdb/lib/manifest.json b/plugins/packages/couchdb/lib/manifest.json new file mode 100644 index 0000000000..00f92318d9 --- /dev/null +++ b/plugins/packages/couchdb/lib/manifest.json @@ -0,0 +1,107 @@ +{ + "$schema": "https://raw.githubusercontent.com/ToolJet/ToolJet/develop/plugins/schemas/manifest.schema.json", + "title": "CouchDB datasource", + "description": "A schema defining CouchDB datasource", + "type": "database", + "source": { + "name": "CouchDB", + "kind": "couchdb", + "exposedVariables": { + "isLoading": false, + "data": {}, + "rawData": {}, + "customTesting": false + }, + "options": { + "password": { + "type": "string", + "encrypted": true + }, + "database": { + "type": "string" + }, + "port": { + "type": "string" + }, + "host": { + "type": "string" + }, + "protocol": { + "type": "string" + } + } + }, + "defaults": { + "username": { + "value": "" + }, + "password": { + "value": "" + }, + "database": { + "value": "" + }, + "port": { + "value": "5984" + }, + "host": { + "value": "" + }, + "protocol": { + "type": "HTTP" + } + }, + "properties": { + "host": { + "label": "Host", + "key": "host", + "type": "text", + "description": "" + }, + "port": { + "label": "Port", + "key": "port", + "type": "text", + "description": "5984 ", + "helpText": "" + }, + "username": { + "label": "Username", + "key": "username", + "type": "text", + "description": "username for couchDB", + "helpText": "" + }, + "password": { + "label": "Password", + "key": "password", + "type": "password", + "description": "password for couchDB", + "helpText": "" + }, + "database": { + "label": "Database Name", + "key": "database", + "type": "text", + "description": "database name", + "helpText": "" + }, + "protocol": { + "label": "Protocol", + "key": "protocol", + "type": "dropdown", + "list": [ + { + "name": "HTTP", + "value": "http" + }, + { + "name": "HTTPS", + "value": "https" + } + ], + "description": "Enter protocol" + } + }, + "required": ["username", "password", "database", "port", "host", "protocol"] +} diff --git a/plugins/packages/couchdb/lib/operations.json b/plugins/packages/couchdb/lib/operations.json new file mode 100644 index 0000000000..c38340cf3a --- /dev/null +++ b/plugins/packages/couchdb/lib/operations.json @@ -0,0 +1,237 @@ +{ + "$schema": "https://raw.githubusercontent.com/ToolJet/ToolJet/develop/plugins/schemas/operations.schema.json", + "title": "CouchDB datasource", + "description": "A schema defining CouchDB datasource", + "type": "database", + "defaults": {}, + "properties": { + "operation": { + "label": "Operation", + "key": "operation", + "type": "dropdown-component-flip", + "description": "Single select dropdown for operation", + "list": [ + { + "value": "list_records", + "name": "List records" + }, + { + "value": "retrieve_record", + "name": "Retrieve record" + }, + { + "value": "create_record", + "name": "Create record" + }, + { + "value": "update_record", + "name": "Update record" + }, + { + "value": "delete_record", + "name": "Delete record" + }, + { + "value": "find", + "name": "Find" + }, + { + "value": "get_view", + "name": "Get view" + } + ] + }, + "list_records": { + "include_docs": { + "label": "include_docs", + "key": "include_docs", + "type": "codehinter", + "lineNumbers": false, + "description": "Enter true/false", + "width": "320px", + "height": "36px", + "className": "codehinter-plugins", + "placeholder": "false" + }, + "descending": { + "label": "descending order", + "key": "descending", + "type": "codehinter", + "lineNumbers": false, + "description": "Enter true/false", + "width": "320px", + "height": "36px", + "className": "codehinter-plugins", + "placeholder": "true" + }, + "limit": { + "label": "limit", + "key": "limit", + "type": "codehinter", + "lineNumbers": false, + "description": "Enter limit", + "width": "320px", + "height": "36px", + "className": "codehinter-plugins", + "placeholder": "" + }, + "skip": { + "label": "skip", + "key": "skip", + "type": "codehinter", + "lineNumbers": false, + "description": "Enter skip", + "width": "320px", + "height": "36px", + "className": "codehinter-plugins", + "placeholder": "" + } + }, + "retrieve_record": { + "record_id": { + "label": "Record ID", + "key": "record_id", + "type": "codehinter", + "lineNumbers": false, + "description": "Enter record id", + "width": "320px", + "height": "36px", + "className": "codehinter-plugins", + "placeholder": "" + } + }, + "create_record": { + "body": { + "label": "Records", + "key": "body", + "type": "codehinter", + "description": "Enter list of records", + "height": "150px", + "placeholder": "[{ \"fields\": \"value\"}]" + } + }, + "update_record": { + "record_id": { + "label": "Record ID", + "key": "record_id", + "type": "codehinter", + "lineNumbers": false, + "description": "Enter record id", + "width": "320px", + "height": "36px", + "className": "codehinter-plugins", + "placeholder": "" + }, + "rev_id": { + "label": "Revision ID", + "key": "rev_id", + "type": "codehinter", + "lineNumbers": false, + "description": "Enter revision id", + "width": "320px", + "height": "36px", + "className": "codehinter-plugins", + "placeholder": "" + }, + "body": { + "label": "Body", + "key": "body", + "type": "codehinter", + "description": "Enter body", + "height": "150px", + "placeholder": "[{ \"fields\": \"value\"}]" + } + }, + "delete_record": { + "record_id": { + "label": "Record ID", + "key": "record_id", + "type": "codehinter", + "lineNumbers": false, + "description": "Enter record id", + "width": "320px", + "height": "36px", + "className": "codehinter-plugins", + "placeholder": "" + }, + "rev_id": { + "label": "Revision ID", + "key": "rev_id", + "type": "codehinter", + "lineNumbers": false, + "description": "Enter revision id", + "width": "320px", + "height": "36px", + "className": "codehinter-plugins", + "placeholder": "" + } + }, + "find": { + "body": { + "label": "Mangoquery", + "key": "body", + "type": "codehinter", + "description": "", + "height": "150px", + "placeholder": "" + } + }, + "get_view": { + "view_url": { + "label": "View url", + "key": "view_url", + "type": "codehinter", + "lineNumbers": false, + "description": "Enter view url", + "width": "320px", + "height": "36px", + "className": "codehinter-plugins", + "placeholder": "" + }, + "start_key": { + "label": "Start key", + "key": "start_key", + "type": "codehinter", + "lineNumbers": false, + "description": "Enter start key", + "width": "320px", + "height": "36px", + "className": "codehinter-plugins", + "placeholder": "" + }, + "end_key": { + "label": "End key", + "key": "end_key", + "type": "codehinter", + "lineNumbers": false, + "description": "Enter end key", + "width": "320px", + "height": "36px", + "className": "codehinter-plugins", + "placeholder": "" + }, + "limit": { + "label": "limit", + "key": "limit", + "type": "codehinter", + "lineNumbers": false, + "description": "Enter limit", + "width": "320px", + "height": "36px", + "className": "codehinter-plugins", + "placeholder": "" + }, + "skip": { + "label": "skip", + "key": "skip", + "type": "codehinter", + "lineNumbers": false, + "description": "Enter skip", + "width": "320px", + "height": "36px", + "className": "codehinter-plugins", + "placeholder": "" + } + } + } +} diff --git a/plugins/packages/couchdb/lib/types.ts b/plugins/packages/couchdb/lib/types.ts new file mode 100644 index 0000000000..abe7f7e1e6 --- /dev/null +++ b/plugins/packages/couchdb/lib/types.ts @@ -0,0 +1,22 @@ +export type SourceOptions = { + username: string; + password: string; + database: string; + port: string; + host:string; + protocol: string; +}; +export type QueryOptions = { + operation: string; + record_id: string; + body: string; + rev_id:string; + view_url:string; + start_key?:string; + end_key?:string; + limit?:string; + skip?:string; + descending?:boolean; + include_docs?:boolean; + +}; diff --git a/plugins/packages/couchdb/package.json b/plugins/packages/couchdb/package.json new file mode 100644 index 0000000000..7ce8c8cb09 --- /dev/null +++ b/plugins/packages/couchdb/package.json @@ -0,0 +1,23 @@ +{ + "name": "@tooljet-plugins/couchdb", + "version": "1.0.0", + "main": "dist/index.js", + "types": "dist/index.d.ts", + "directories": { + "lib": "lib", + "test": "__tests__" + }, + "files": [ + "lib" + ], + "scripts": { + "test": "echo \"Error: run tests from root\" && exit 1", + "build": "tsc -b", + "clean": "rimraf ./dist && rimraf tsconfig.tsbuildinfo" + }, + "homepage": "https://github.com/tooljet/tooljet#readme", + "dependencies": { + "@tooljet-plugins/common": "file:../common", + "react": "^17.0.2" + } +} diff --git a/plugins/packages/couchdb/tsconfig.json b/plugins/packages/couchdb/tsconfig.json new file mode 100644 index 0000000000..a18a801b14 --- /dev/null +++ b/plugins/packages/couchdb/tsconfig.json @@ -0,0 +1,11 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "outDir": "dist", + "rootDir": "lib" + }, + "exclude": [ + "node_modules", + "dist" + ] +} \ No newline at end of file diff --git a/server/package-lock.json b/server/package-lock.json index e2148d6cb7..37dab2b838 100644 --- a/server/package-lock.json +++ b/server/package-lock.json @@ -93,6 +93,7 @@ "@tooljet-plugins/airtable": "file:packages/airtable", "@tooljet-plugins/bigquery": "file:packages/bigquery", "@tooljet-plugins/common": "file:packages/common", + "@tooljet-plugins/couchdb": "file:packages/couchdb", "@tooljet-plugins/dynamodb": "file:packages/dynamodb", "@tooljet-plugins/elasticsearch": "file:packages/elasticsearch", "@tooljet-plugins/firestore": "file:packages/firestore", @@ -103,12 +104,15 @@ "@tooljet-plugins/mongodb": "file:packages/mongodb", "@tooljet-plugins/mssql": "file:packages/mssql", "@tooljet-plugins/mysql": "file:packages/mysql", + "@tooljet-plugins/n8n": "file:packages/n8n", "@tooljet-plugins/postgresql": "file:packages/postgresql", "@tooljet-plugins/redis": "file:packages/redis", "@tooljet-plugins/restapi": "file:packages/restapi", "@tooljet-plugins/s3": "file:packages/s3", "@tooljet-plugins/sendgrid": "file:packages/sendgrid", "@tooljet-plugins/slack": "file:packages/slack", + "@tooljet-plugins/smtp": "file:packages/smtp", + "@tooljet-plugins/snowflake": "file:packages/snowflake", "@tooljet-plugins/stripe": "file:packages/stripe", "@tooljet-plugins/twilio": "file:packages/twilio", "@tooljet-plugins/typesense": "file:packages/typesense" @@ -14297,6 +14301,7 @@ "@tooljet-plugins/airtable": "file:packages/airtable", "@tooljet-plugins/bigquery": "file:packages/bigquery", "@tooljet-plugins/common": "file:packages/common", + "@tooljet-plugins/couchdb": "file:packages/couchdb", "@tooljet-plugins/dynamodb": "file:packages/dynamodb", "@tooljet-plugins/elasticsearch": "file:packages/elasticsearch", "@tooljet-plugins/firestore": "file:packages/firestore", @@ -14307,12 +14312,15 @@ "@tooljet-plugins/mongodb": "file:packages/mongodb", "@tooljet-plugins/mssql": "file:packages/mssql", "@tooljet-plugins/mysql": "file:packages/mysql", + "@tooljet-plugins/n8n": "file:packages/n8n", "@tooljet-plugins/postgresql": "file:packages/postgresql", "@tooljet-plugins/redis": "file:packages/redis", "@tooljet-plugins/restapi": "file:packages/restapi", "@tooljet-plugins/s3": "file:packages/s3", "@tooljet-plugins/sendgrid": "file:packages/sendgrid", "@tooljet-plugins/slack": "file:packages/slack", + "@tooljet-plugins/smtp": "file:packages/smtp", + "@tooljet-plugins/snowflake": "file:packages/snowflake", "@tooljet-plugins/stripe": "file:packages/stripe", "@tooljet-plugins/twilio": "file:packages/twilio", "@tooljet-plugins/typesense": "file:packages/typesense",