From 1b45b01a647e8710bfa3a60e1a0142226a2f60e2 Mon Sep 17 00:00:00 2001 From: SamTolmay Date: Thu, 8 Apr 2021 14:36:43 +0200 Subject: [PATCH] feat: Update Knex docs for all suported databases. --- packages/docs/connections/AWSS3.yaml | 2 +- packages/docs/connections/AmazonRedshift.yaml | 83 ++++++++ packages/docs/connections/Knex.yaml | 177 +++++++++--------- packages/docs/connections/KnexRequests.md | 121 ++++++++++++ packages/docs/connections/MSSQL.yaml | 103 ++++++++++ packages/docs/connections/MariaDB.yaml | 104 ++++++++++ packages/docs/connections/MySQL.yaml | 104 ++++++++++ packages/docs/connections/OracleDB.yaml | 80 ++++++++ packages/docs/connections/PostgreSQL.yaml | 116 ++++++++++++ packages/docs/connections/SQLite.yaml | 94 ++++++++++ packages/docs/connections/SendGridMail.yaml | 18 +- packages/docs/menus.yaml | 33 +++- packages/docs/pages.yaml | 7 + 13 files changed, 944 insertions(+), 98 deletions(-) create mode 100644 packages/docs/connections/AmazonRedshift.yaml create mode 100644 packages/docs/connections/KnexRequests.md create mode 100644 packages/docs/connections/MSSQL.yaml create mode 100644 packages/docs/connections/MariaDB.yaml create mode 100644 packages/docs/connections/MySQL.yaml create mode 100644 packages/docs/connections/OracleDB.yaml create mode 100644 packages/docs/connections/PostgreSQL.yaml create mode 100644 packages/docs/connections/SQLite.yaml diff --git a/packages/docs/connections/AWSS3.yaml b/packages/docs/connections/AWSS3.yaml index 654fdc1bc..cda916397 100644 --- a/packages/docs/connections/AWSS3.yaml +++ b/packages/docs/connections/AWSS3.yaml @@ -16,7 +16,7 @@ _ref: path: templates/general.yaml.njk vars: pageId: AWSS3 - pageTitle: AWSS3 + pageTitle: Amazon S3 section: Connections filePath: connections/AWSS3.yaml content: diff --git a/packages/docs/connections/AmazonRedshift.yaml b/packages/docs/connections/AmazonRedshift.yaml new file mode 100644 index 000000000..6936f7e87 --- /dev/null +++ b/packages/docs/connections/AmazonRedshift.yaml @@ -0,0 +1,83 @@ +# Copyright 2020-2021 Lowdefy, Inc + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at + +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +_ref: + path: templates/general.yaml.njk + vars: + pageId: AmazonRedshift + pageTitle: Amazon Redshift + section: Connections + filePath: connections/AmazonRedshift.yaml + content: + - id: markdown_intro + type: Markdown + properties: + content: | + The [Knex](/Knex) connection can be used to connect to a [Amazon Redshift](https://aws.amazon.com/redshift) database. + + - id: markdown_connection + type: MarkdownWithCode + properties: + content: | + ## Connections + + Connection types: + - Knex + + ### Knex + + #### Properties + - `client: enum`: __Required__ - Should be `redshift` to connect to Amazon Redshift. + - `connection: object | string`: __Required__ - Connection string or object to pass to the [`pg`](https://www.npmjs.com/package/pg) database client. + - `useNullAsDefault: boolean`: If true, undefined keys are replaced with NULL instead of DEFAULT. + + #### Examples + + Object: + ```yaml + connections: + - id: redshift + type: Knex + properties: + client: redshift + connection: + user: dbuser + host: database.server.com + database: mydb + password: secretpassword + ``` + + Secret object: + ```yaml + connections: + - id: redshift + type: Knex + properties: + client: redshift + connection: + user: + _secret: REDSHIFT_USER + host: + _secret: REDSHIFT_HOST + database: + _secret: REDSHIFT_DB + password: + _secret: REDSHIFT_PASSWORD + ``` + + - id: markdown_requests + type: MarkdownWithCode + properties: + content: + _ref: connections/KnexRequests.md diff --git a/packages/docs/connections/Knex.yaml b/packages/docs/connections/Knex.yaml index a82dc7306..90e8ec159 100644 --- a/packages/docs/connections/Knex.yaml +++ b/packages/docs/connections/Knex.yaml @@ -20,14 +20,96 @@ _ref: section: Connections filePath: connections/Knex.yaml content: - - id: markdown + - id: markdown_intro type: MarkdownWithCode properties: content: | - [`Knex.js`](http://knexjs.org) is a SQL query builder that can be used to connect to [PostgreSQL](/PostgreSQL), [MSSQL](/MSSQL), [MySQL](/MySQL), [MariaDB](/MariaDB), [SQLite](/SQLite), [Oracle](/Oracle), and [Amazon Redshift](/AmazonRedshift) databases. + [`Knex.js`](http://knexjs.org) is a SQL query builder that can be used to connect to [PostgreSQL](/PostgreSQL), [MS SQL Server](/MSSQL), [MySQL](/MySQL), [MariaDB](/MariaDB), [SQLite](/SQLite), [Oracle](/Oracle), and [Amazon Redshift](/AmazonRedshift) databases. The Knex connection can be used to execute raw SQL queries using the `KnexRaw` requests, or the Knex query builder can be used with the `KnexBuilder` request. + For more details on specific databases, see the database documentation: + - id: amazon_redshift_link + type: Anchor + properties: + title: Amazon Redshift + icon: LinkOutlined + events: + onClick: + - id: link, + type: Link + params: + pageId: AmazonRedshift + - id: mariadb_link + type: Anchor + properties: + title: MariaDB + icon: LinkOutlined + events: + onClick: + - id: link, + type: Link + params: + pageId: MariaDB + - id: mssql_link + type: Anchor + properties: + title: MS SQL Server + icon: LinkOutlined + events: + onClick: + - id: link, + type: Link + params: + pageId: MSSQL + - id: mysql_link + type: Anchor + properties: + title: MySQL + icon: LinkOutlined + events: + onClick: + - id: link, + type: Link + params: + pageId: MySQL + - id: oracle_link + type: Anchor + properties: + title: Oracle Database + icon: LinkOutlined + events: + onClick: + - id: link, + type: Link + params: + pageId: OracleDB + - id: postgresql_link + type: Anchor + properties: + title: PostgreSQL + icon: LinkOutlined + events: + onClick: + - id: link, + type: Link + params: + pageId: PostgreSQL + - id: sqlite_link + type: Anchor + properties: + title: SQLite + icon: LinkOutlined + events: + onClick: + - id: link, + type: Link + params: + pageId: SQLite + - id: markdown_connection + type: MarkdownWithCode + properties: + content: | ## Connections Connection types: @@ -39,7 +121,6 @@ _ref: - `client: enum`: __Required__ - The database client to use. One of: - `mssql` - `mysql` - - `mysql2` - `oracledb` - `postgres` - `pg` (alias of `postgres`) @@ -50,6 +131,7 @@ _ref: - `connection: object | string`: __Required__ - Connection string or object to pass to the database client. See the specific client documentation for more details. - `searchPath: string`: Set PostgreSQL search path. - `version: string`: Set database version. + - `useNullAsDefault: boolean`: If true, undefined keys are replaced with NULL instead of DEFAULT. #### Examples @@ -59,7 +141,7 @@ _ref: - id: mysql type: Knex properties: - client: postgres + client: mysql connection: host: '127.0.0.1' user : my_database_user @@ -67,7 +149,7 @@ _ref: database : my_database ``` - PostgreSQL with connection string: + PostgreSQL with secret connection string: ```yaml connections: - id: postgres @@ -77,83 +159,8 @@ _ref: connection: _secret: PG_CONNECTION_STRING ``` - - ## Requests - - Request types: - - KnexBuilder - - KnexRaw - - ### KnexBuilder - - #### Properties - - `query: object[]`: __Required__ - SQL query builder array. An array of objects, with a single key which is the name of the knex builder function. The value should be an array of arguments to pass to the builder function. - - `tableName: string | object`: The name of the table to query from. - - #### Examples - - Build a query: - ```yaml - id: knexBuilder - type: KnexBuilder - connectionId: knex - properties: - query: - - select: - - '*' - - from: - - users - - where: - - name - - _state: name - ``` - - ### KnexRaw - - #### Properties - - `query: string`: __Required__ - SQL query string. - - `parameters: string | number | array | object`: SQL query parameters. - - #### Examples - - Simple raw query: - ```yaml - id: knexRaw - type: KnexRaw - connectionId: knex - properties: - query: SELECT * FROM "my_table"; - ``` - - Query with named parameters: - ```yaml - id: knexRaw - type: KnexRaw - connectionId: knex - properties: - query: select * from users where name = :name - parameters: - name: - _state: selected_name - ``` - - Query with positional parameters: - ```yaml - id: knexRaw - type: KnexRaw - connectionId: knex - properties: - query: select * from users where name = ? - parameters: - - _state: selected_name - ``` - - Reference a `.sql` file: - ```yaml - id: knexRaw - type: KnexRaw - connectionId: knex - properties: - query: - _ref: my_query.sql - ``` + - id: markdown_requests + type: MarkdownWithCode + properties: + content: + _ref: connections/KnexRequests.md diff --git a/packages/docs/connections/KnexRequests.md b/packages/docs/connections/KnexRequests.md new file mode 100644 index 000000000..3bdd2e2af --- /dev/null +++ b/packages/docs/connections/KnexRequests.md @@ -0,0 +1,121 @@ +## Requests + +Request types: + +- KnexBuilder +- KnexRaw + +### KnexBuilder + +#### Properties + +- `query: object[]`: **Required** - SQL query builder array. An array of objects, with a single key which is the name of the knex builder function. The value should be an array of arguments to pass to the builder function. +- `tableName: string | object`: The name of the table to query from. + +#### Examples + +Build a query: + +```yaml +id: knexBuilder +type: KnexBuilder +connectionId: knex +properties: + query: + - select: + - '*' + - from: + - users + - where: + - name + - _state: name +``` + +Using `tableName`: + +```yaml +id: knexBuilder +type: KnexBuilder +connectionId: knex +properties: + tableName: users + query: + - select: + - '*' + - where: + - name + - _state: name +``` + +Aliases: + +```yaml +id: knexBuilder +type: KnexBuilder +connectionId: knex +properties: + tableName: + a: tableA + b: tableB + query: + - select: + - aField: 'a.field' + - bField: 'b.field' + - limit: + - 1 +``` + +### KnexRaw + +#### Properties + +- `query: string`: **Required** - SQL query string. +- `parameters: string | number | array | object`: SQL query parameters. + +#### Examples + +Simple raw query: + +```yaml +id: knexRaw +type: KnexRaw +connectionId: knex +properties: + query: SELECT * FROM "my_table"; +``` + +Query with named parameters: + +```yaml +id: knexRaw +type: KnexRaw +connectionId: knex +properties: + query: select * from users where name = :name + parameters: + name: + _state: selected_name +``` + +Query with positional parameters: + +```yaml +id: knexRaw +type: KnexRaw +connectionId: knex +properties: + query: select * from users where name = ? + parameters: + - _state: selected_name +``` + +Reference a `.sql` file: + +```yaml +id: knexRaw +type: KnexRaw +connectionId: knex +properties: + query: + _ref: my_query.sql +``` diff --git a/packages/docs/connections/MSSQL.yaml b/packages/docs/connections/MSSQL.yaml new file mode 100644 index 000000000..53411f63a --- /dev/null +++ b/packages/docs/connections/MSSQL.yaml @@ -0,0 +1,103 @@ +# Copyright 2020-2021 Lowdefy, Inc + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at + +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +_ref: + path: templates/general.yaml.njk + vars: + pageId: MSSQL + pageTitle: Microsoft SQL Server + section: Connections + filePath: connections/MSSQL.yaml + content: + - id: markdown_intro + type: Markdown + properties: + content: | + The [Knex](/Knex) connection can be used to connect to [Microsoft SQL Server](https://www.microsoft.com/en-us/sql-server/sql-server-2019). + + - id: markdown_connection + type: MarkdownWithCode + properties: + content: | + ## Connections + + Connection types: + - Knex + + ### Knex + + #### Properties + - `client: enum`: __Required__ - Should be `mssql` to connect to Microsoft SQL Server. + - `connection: object | string `: __Required__ - Connection object or string to pass to the [`mssql`](https://www.npmjs.com/package/mssql) database client. + - `useNullAsDefault: boolean`: If true, undefined keys are replaced with NULL instead of DEFAULT. + + #### Examples + + Object: + ```yaml + connections: + - id: mssql + type: Knex + properties: + client: mssql + connection: + user: dbuser + host: database.server.com + database: mydb + password: secretpassword + ``` + + Secret object: + ```yaml + connections: + - id: mssql + type: Knex + properties: + client: mssql + connection: + user: + _secret: MSSQL_USER + host: + _secret: MSSQL_HOST + database: + _secret: MSSQL_DB + password: + _secret: MSSQL_PASSWORD + ``` + + Connection string: + ```yaml + connections: + - id: mssql + type: Knex + properties: + client: mssql + connection: mssql://username:password@localhost:1433/database + ``` + + Secret connection string: + ```yaml + connections: + - id: mssql + type: Knex + properties: + client: mssql + connection: + _secret: MSSQL_CONNECTION_STRING + + - id: markdown_requests + type: MarkdownWithCode + properties: + content: + _ref: connections/KnexRequests.md diff --git a/packages/docs/connections/MariaDB.yaml b/packages/docs/connections/MariaDB.yaml new file mode 100644 index 000000000..97b51e9b1 --- /dev/null +++ b/packages/docs/connections/MariaDB.yaml @@ -0,0 +1,104 @@ +# Copyright 2020-2021 Lowdefy, Inc + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at + +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +_ref: + path: templates/general.yaml.njk + vars: + pageId: MariaDB + pageTitle: MariaDB + section: Connections + filePath: connections/MariaDB.yaml + content: + - id: markdown_intro + type: Markdown + properties: + content: | + The [Knex](/Knex) connection can be used to connect to a [MariaDB](https://www.mysql.com) database. To connect to a MariaDB database, use the `mysql` client. + + - id: markdown_connection + type: MarkdownWithCode + properties: + content: | + ## Connections + + Connection types: + - Knex + + ### Knex + + #### Properties + - `client: enum`: __Required__ - Use the `mysql` client to connect to MariaDB. + - `connection: object | string `: __Required__ - Connection object or string to pass to the [`mysql`](https://www.npmjs.com/package/mysql) database client. + - `version: string`: Set database version. + - `useNullAsDefault: boolean`: If true, undefined keys are replaced with NULL instead of DEFAULT. + + #### Examples + + Object: + ```yaml + connections: + - id: mariadb + type: Knex + properties: + client: mysql + connection: + user: dbuser + host: database.server.com + database: mydb + password: secretpassword + ``` + + Secret object: + ```yaml + connections: + - id: mariadb + type: Knex + properties: + client: mysql + connection: + user: + _secret: MYSQL_USER + host: + _secret: MYSQL_HOST + database: + _secret: MYSQL_DB + password: + _secret: MYSQL_PASSWORD + ``` + + Connection string: + ```yaml + connections: + - id: mariadb + type: Knex + properties: + client: mysql + connection: mysql://user:pass@host/db?debug=true + ``` + + Secret connection string: + ```yaml + connections: + - id: mariadb + type: Knex + properties: + client: mysql + connection: + _secret: MYSQL_CONNECTION_STRING + + - id: markdown_requests + type: MarkdownWithCode + properties: + content: + _ref: connections/KnexRequests.md diff --git a/packages/docs/connections/MySQL.yaml b/packages/docs/connections/MySQL.yaml new file mode 100644 index 000000000..52fbedb1a --- /dev/null +++ b/packages/docs/connections/MySQL.yaml @@ -0,0 +1,104 @@ +# Copyright 2020-2021 Lowdefy, Inc + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at + +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +_ref: + path: templates/general.yaml.njk + vars: + pageId: MySQL + pageTitle: MySQL + section: Connections + filePath: connections/MySQL.yaml + content: + - id: markdown_intro + type: Markdown + properties: + content: | + The [Knex](/Knex) connection can be used to connect to a [MySQL](https://www.mysql.com) database. + + - id: markdown_connection + type: MarkdownWithCode + properties: + content: | + ## Connections + + Connection types: + - Knex + + ### Knex + + #### Properties + - `client: enum`: __Required__ - Should be `mysql` to connect to MySQL. + - `connection: object | string `: __Required__ - Connection object or string to pass to the [`mysql`](https://www.npmjs.com/package/mysql) database client. + - `version: string`: Set database version. + - `useNullAsDefault: boolean`: If true, undefined keys are replaced with NULL instead of DEFAULT. + + #### Examples + + Object: + ```yaml + connections: + - id: mysql + type: Knex + properties: + client: mysql + connection: + user: dbuser + host: database.server.com + database: mydb + password: secretpassword + ``` + + Secret object: + ```yaml + connections: + - id: mysql + type: Knex + properties: + client: mysql + connection: + user: + _secret: MYSQL_USER + host: + _secret: MYSQL_HOST + database: + _secret: MYSQL_DB + password: + _secret: MYSQL_PASSWORD + ``` + + Connection string: + ```yaml + connections: + - id: mysql + type: Knex + properties: + client: mysql + connection: mysql://user:pass@host/db?debug=true + ``` + + Secret connection string: + ```yaml + connections: + - id: mysql + type: Knex + properties: + client: mysql + connection: + _secret: MYSQL_CONNECTION_STRING + + - id: markdown_requests + type: MarkdownWithCode + properties: + content: + _ref: connections/KnexRequests.md diff --git a/packages/docs/connections/OracleDB.yaml b/packages/docs/connections/OracleDB.yaml new file mode 100644 index 000000000..c4d8c1932 --- /dev/null +++ b/packages/docs/connections/OracleDB.yaml @@ -0,0 +1,80 @@ +# Copyright 2020-2021 Lowdefy, Inc + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at + +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +_ref: + path: templates/general.yaml.njk + vars: + pageId: OracleDB + pageTitle: Oracle Database + section: Connections + filePath: connections/OracleDB.yaml + content: + - id: markdown_intro + type: Markdown + properties: + content: | + The [Knex](/Knex) connection can be used to connect to a [Oracle Database](https://www.oracle.com/database/). + + - id: markdown_connection + type: MarkdownWithCode + properties: + content: | + ## Connections + + Connection types: + - Knex + + ### Knex + + #### Properties + - `client: enum`: __Required__ - Should be `oracledb` to connect to Oracle Database. + - `connection: object | string `: __Required__ - Connection object or string to pass to the [`oracledb`](https://www.npmjs.com/package/oracledb) database client. + - `useNullAsDefault: boolean`: If true, undefined keys are replaced with NULL instead of DEFAULT. + + #### Examples + + Object: + ```yaml + connections: + - id: oracledb + type: Knex + properties: + client: oracledb + connection: + user: dbuser + password: secretpassword + connectString: mydbmachine.example.com/orclpdb1 + ``` + + Secret object: + ```yaml + connections: + - id: oracledb + type: Knex + properties: + client: oracledb + connection: + user: + _secret: ORACLEDB_USER + password: + _secret: ORACLEDB_PASSWORD + connectString: + _secret: ORACLEDB_CONNECT_STRING + ``` + + - id: markdown_requests + type: MarkdownWithCode + properties: + content: + _ref: connections/KnexRequests.md diff --git a/packages/docs/connections/PostgreSQL.yaml b/packages/docs/connections/PostgreSQL.yaml new file mode 100644 index 000000000..b82857bb2 --- /dev/null +++ b/packages/docs/connections/PostgreSQL.yaml @@ -0,0 +1,116 @@ +# Copyright 2020-2021 Lowdefy, Inc + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at + +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +_ref: + path: templates/general.yaml.njk + vars: + pageId: PostgreSQL + pageTitle: PostgreSQL + section: Connections + filePath: connections/PostgreSQL.yaml + content: + - id: markdown_intro + type: Markdown + properties: + content: | + The [Knex](/Knex) connection can be used to connect to a [PostgreSQL](https://www.postgresql.org) database. + + - id: markdown_connection + type: MarkdownWithCode + properties: + content: | + ## Connections + + Connection types: + - Knex + + ### Knex + + #### Properties + - `client: enum`: __Required__ - The database client to use. To connect to PostgreSQL, use one of: + - `postgres` + - `pg` (alias of `postgres`) + - `postgresql` (alias of `postgres`) + - `connection: object | string`: __Required__ - Connection string or object to pass to the [`pg`](https://www.npmjs.com/package/pg) database client. + - `searchPath: string`: Set PostgreSQL search path. + - `version: string`: Set database version. + - `useNullAsDefault: boolean`: If true, undefined keys are replaced with NULL instead of DEFAULT. + + #### Examples + + Object: + ```yaml + connections: + - id: postgres + type: Knex + properties: + client: postgres + connection: + user: dbuser + host: database.server.com + database: mydb + password: secretpassword + port: 5432 + ``` + + Secret object: + ```yaml + connections: + - id: postgres + type: Knex + properties: + client: postgres + connection: + user: + _secret: PG_USER + host: + _secret: PG_HOST + database: + _secret: PG_DB + password: + _secret: PG_PASSWORD + port: + _secret: PG_PORT + ``` + + Connection string: + ```yaml + connections: + - id: postgres + type: Knex + properties: + client: postgres + connection: postgresql://dbuser:secretpassword@database.server.com:5432/mydb + ``` + + Secret connection string, with version and searchPath: + ```yaml + connections: + - id: postgres + type: Knex + properties: + client: postgres + connection: + _secret: PG_CONNECTION_STRING + version: '7.2' + searchPath: + - knex + - public + ``` + + - id: markdown_requests + type: MarkdownWithCode + properties: + content: + _ref: connections/KnexRequests.md diff --git a/packages/docs/connections/SQLite.yaml b/packages/docs/connections/SQLite.yaml new file mode 100644 index 000000000..e6a841627 --- /dev/null +++ b/packages/docs/connections/SQLite.yaml @@ -0,0 +1,94 @@ +# Copyright 2020-2021 Lowdefy, Inc + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at + +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +_ref: + path: templates/general.yaml.njk + vars: + pageId: SQLite + pageTitle: SQLite + section: Connections + filePath: connections/SQLite.yaml + content: + - id: markdown_intro + type: Markdown + properties: + content: | + The [Knex](/Knex) connection can be used to connect to a [SQLite](https://www.sqlite.org) database. + - id: warning + type: Alert + properties: + type: warning + showIcon: false + description: | + SQLite is best suited as a development database when used with Lowdefy. Using SQLite in a serverless environment is not recommended, and not supported by the current Lowdefy deployment options. See the example below on how to configure different database connections based on the environment. + + - id: markdown_connection + type: MarkdownWithCode + properties: + content: | + ## Connections + + Connection types: + - Knex + + ### Knex + + #### Properties + - `client: enum`: __Required__ - Should be `sqlite3` or `sqlite` to connect to SQLite. + - `connection: object`: + - `filename: string`: __Required__ - The path to the SQLite file (relative to the project root). + - `useNullAsDefault: boolean`: If true, undefined keys are replaced with NULL instead of DEFAULT. + + + #### Examples + + ##### Specify filename: + ```yaml + connections: + - id: sqlite + type: Knex + properties: + client: sqlite + connection: + filename: ./mydb.sqlite + ``` + + ##### Different connections in deployment and production environments: + ```yaml + connections: + - id: knex + type: Knex + properties: + client: + _secret: KNEX_CLIENT + connection: + _json.parse: + _secret: KNEX_CONNECTION + ``` + `.env` in development: + ``` + LOWDEFY_SECRET_KNEX_CLIENT = sqlite + LOWDEFY_SECRET_KNEX_CONNECTION = {"filename": "./mydb.sqlite"} + ``` + Environment variables in production: + ``` + LOWDEFY_SECRET_KNEX_CLIENT = postgres + LOWDEFY_SECRET_KNEX_CONNECTION = {"user": "dbuser", "host": "database.server.com", "database": "mydb", "password": "secretpassword"} + ``` + + - id: markdown_requests + type: MarkdownWithCode + properties: + content: + _ref: connections/KnexRequests.md diff --git a/packages/docs/connections/SendGridMail.yaml b/packages/docs/connections/SendGridMail.yaml index de3a46187..903b72aa1 100644 --- a/packages/docs/connections/SendGridMail.yaml +++ b/packages/docs/connections/SendGridMail.yaml @@ -16,7 +16,7 @@ _ref: path: templates/general.yaml.njk vars: pageId: SendGridMail - pageTitle: SendGridMail + pageTitle: SendGrid Email section: Connections filePath: connections/SendGridMail.yaml content: @@ -24,14 +24,14 @@ _ref: type: MarkdownWithCode properties: content: | - [SendGrid](https://sendgrid.com/) is a popular email API provider which allows you to easily setup a email service. The `SendGridMail` connection can be used to connect to an existing SendGrid API account. + [SendGrid](https://sendgrid.com/) is a popular email API provider which allows you to easily setup a email service. The `SendGridMail` connection can be used to connect to an existing SendGrid API account. The `SendGridMail` connector uses the [@sendgrid/mail](https://github.com/@sendgrid/mail) library. - In order to use the `SendGridMail` connector, you first need to create a [SendGrid](https://sendgrid.com/) account and setup an API key. + In order to use the `SendGridMail` connector, you first need to create a [SendGrid](https://sendgrid.com/) account and setup an API key. > Secrets like API keys should be stored using the [`_secret`](operators/secret.md) operator. - + In order to send from your custom domain your will need to [authenticate your domain](https://app.sendgrid.com/settings/sender_auth) through SendGrid. See the [SendGrid Docs](https://sendgrid.com/docs) for help on getting started with SendGrid. ## Connections @@ -80,9 +80,9 @@ _ref: - `content: string`: __Required__ - Base 64 encoded attachment content. - `filename: string`: __Required__ - Name of the attachment file. - `type: string`: The mime type of the content you are attaching. For example, `text/plain` or `text/html`. - + ##### array - An array of `mail description` objects can also be provided. + An array of `mail description` objects can also be provided. ### Examples @@ -92,7 +92,7 @@ _ref: - id: my_sendgrid type: SendGridMail properties: - apiKey: + apiKey: _secret: example_sendgrid_api_key from: reminders@example.org # ... @@ -106,8 +106,8 @@ _ref: text: | Hi Harry - Please remember to water the magic plants today :) + Please remember to water the magic plants today :) Thank you # ... - ``` \ No newline at end of file + ``` diff --git a/packages/docs/menus.yaml b/packages/docs/menus.yaml index 6808eaf20..38e3a566b 100644 --- a/packages/docs/menus.yaml +++ b/packages/docs/menus.yaml @@ -382,11 +382,16 @@ title: Connections icon: ApiOutlined links: + - id: AmazonRedshift + type: MenuLink + pageId: AmazonRedshift + properties: + title: Amazon Redshift - id: AWSS3 type: MenuLink pageId: AWSS3 properties: - title: AWS S3 + title: Amazon S3 - id: AxiosHttp type: MenuLink pageId: AxiosHttp @@ -400,14 +405,36 @@ - id: Knex type: MenuLink pageId: Knex - properties: - title: Knex + - id: MariaDB + type: MenuLink + pageId: MariaDB - id: MongoDB type: MenuLink pageId: MongoDB + - id: MSSQL + type: MenuLink + pageId: MSSQL + properties: + title: Microsoft SQL Server + - id: MySQL + type: MenuLink + pageId: MySQL + - id: OracleDB + type: MenuLink + pageId: OracleDB + properties: + title: Oracle Database + - id: PostgreSQL + type: MenuLink + pageId: PostgreSQL - id: SendGridMail type: MenuLink pageId: SendGridMail + properties: + title: SendGrid Email + - id: SQLite + type: MenuLink + pageId: SQLite - id: actions type: MenuGroup properties: diff --git a/packages/docs/pages.yaml b/packages/docs/pages.yaml index b4ccedbd0..79d923e24 100644 --- a/packages/docs/pages.yaml +++ b/packages/docs/pages.yaml @@ -106,12 +106,19 @@ - _ref: blocks/list/List.yaml # - _ref: blocks/list/TimelineList.yaml +- _ref: connections/AmazonRedshift.yaml - _ref: connections/AWSS3.yaml - _ref: connections/AxiosHttp.yaml - _ref: connections/GoogleSheet.yaml - _ref: connections/Knex.yaml +- _ref: connections/MariaDB.yaml - _ref: connections/MongoDB.yaml +- _ref: connections/MSSQL.yaml +- _ref: connections/MySQL.yaml +- _ref: connections/OracleDB.yaml +- _ref: connections/PostgreSQL.yaml - _ref: connections/SendGridMail.yaml +- _ref: connections/SQLite.yaml - _ref: actions/CallMethod.yaml - _ref: actions/Link.yaml