Merge pull request #535 from lowdefy/knex

This commit is contained in:
Gervwyk 2021-04-09 13:09:18 +02:00 committed by GitHub
commit 08a7f8349a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
98 changed files with 3772 additions and 883 deletions

725
.pnp.cjs generated

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -55,9 +55,15 @@
"graphql": "15.5.0",
"inquirer": "7.3.3",
"js-yaml": "4.0.0",
"mssql": "6.3.1",
"mysql": "2.18.1",
"opener": "1.5.2",
"ora": "5.3.0",
"oracledb": "5.1.0",
"pg": "8.5.1",
"reload": "3.1.1",
"saslprep": "1.0.3",
"sqlite3": "5.0.2",
"uuid": "8.3.2"
},
"devDependencies": {

View File

@ -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:
@ -48,22 +48,27 @@ _ref:
- `read: boolean`: Default: `true` - Allow reads from the bucket.
- `write: boolean`: Default: `false` - Allow writes to the bucket.
### Examples
#### Examples
Read and writes on a bucket:
###### Read and writes on a bucket:
```yaml
connections:
- id: my_bucket
type: AwsS3Bucket
properties:
accessKeyId:
_secret: my_bucket_access_key_id
_secret: S3_ACCESS_KEY_ID
secretAccessKey:
_secret: my_bucket_secret_access_key
_secret: S3_SECRET_ACCESS_KEY
region: eu-west-1
bucket: my-bucket-name
write: true
```
Environment variables:
```
LOWDEFY_SECRET_S3_ACCESS_KEY_ID = AKIAIOSFODNN7EXAMPLE
LOWDEFY_SECRET_S3_SECRET_ACCESS_KEY = wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
```
## Requests
@ -82,9 +87,9 @@ _ref:
- `responseContentType: string`: Sets the Content-Type header of the response.
- `responseContentDisposition: string`: Sets the Content-Disposition header of the response.
### Examples
#### Examples
Download a pdf and open in a new tab:
###### Download a pdf and open in a new tab:
```yaml
requests:
- id: my_file_link
@ -126,9 +131,9 @@ _ref:
- `key: string`: __Required__ - Key (or filename) under which object will be stored. If another file is saved with the same key, that file will be overwritten, so a random string in this field is probably needed.
### Examples
#### Examples
Upload a file with user filename and random id:
###### Upload a file with user filename and random id:
```yaml
- id: my_post_policy
type: AwsS3PresignedPostPolicy

View File

@ -0,0 +1,75 @@
# 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
###### Connection object:
```yaml
connections:
- id: redshift
type: Knex
properties:
client: redshift
connection:
host:
_secret: REDSHIFT_HOST
database:
_secret: REDSHIFT_DB
user:
_secret: REDSHIFT_USER
password:
_secret: REDSHIFT_PASSWORD
```
Environment variables:
```
LOWDEFY_SECRET_REDSHIFT_HOST = examplecluster.XXXXXXXXXXXX.us-west-2.redshift.amazonaws.com
LOWDEFY_SECRET_REDSHIFT_REDSHIFT_DB = db
LOWDEFY_SECRET_REDSHIFT_USER = user
LOWDEFY_SECRET_REDSHIFT_PASSWORD = password
```
- id: markdown_requests
type: MarkdownWithCode
properties:
content:
_ref: connections/KnexRequests.md

View File

@ -77,31 +77,31 @@ _ref:
- `auth: object`: Object with username and password.
### Examples
#### Examples
Properties for a AxiosHttp can be set on either the connection, the request, or both. However, both a connection and request need to be defined.
Using the connection to set baseUrl and authorization, and handle specific requests as requests.
###### Using the connection to set baseUrl and authorization, and handle specific requests as requests.
```yaml
connections:
- id: myapp_api
- id: app_api
type: AxiosHttp
properties:
baseUrl: myapp.com/api
baseUrl: app.com/api
auth:
username: lowdefy_api_user
username: api_user
password:
_secret: lowdefy_api_password
_secret: API_PASSWORD
# ...
requests:
- id: get_orders
type: AxiosHttp
connectionId: myapp_api
connectionId: app_api
properties:
url: /orders
- id: update_order
type: AxiosHttp
connectionId: myapp_api
connectionId: app_api
properties:
url:
_nunjucks: /orders/{{ order_id }}
@ -111,7 +111,7 @@ _ref:
```
Setting properties on only the connection:
###### Setting properties on only the connection:
```yaml
connections:
- id: get_count
@ -120,7 +120,7 @@ _ref:
url: myapp.com/api/count
headers:
X-Api-Key:
_secret: my_api_key
_secret: API_KEY
# ...
requests:
- id: get_count
@ -128,7 +128,7 @@ _ref:
connectionId: get_count
```
Setting properties on only the request, and using a generic connection:
###### Setting properties on only the request, and using a generic connection:
```yaml
connections:
- id: axios

View File

@ -33,7 +33,7 @@ _ref:
The `GoogleSheet` connection can be used to connect to a Google using an API key or a service account. An API key can only be used for read-only access to public sheets, so most applications should use a service account. A guide to creating a service account can be found in the [tutorial](/tutorial-requests).
This connection refers to the entire document as the 'spreadsheet', and the individual sheets in the document as 'sheets'. The spreadsheet is identified by it's spreadsheetId, and sheets can either be identified by their sheetId or their index (position in the document starting from 0).
This connection refers to the entire document as the `spreadsheet`, and the individual sheets in the document as `sheets`. The spreadsheet is identified by it's `spreadsheetId`, and sheets can either be identified by their `sheetId` or their `index` (position in the document starting from 0).
When a sheet is accessed in a browser the url either looks like:
`https://docs.google.com/spreadsheets/d/{spreadsheetId}/edit#gid={sheetId}`
@ -53,7 +53,7 @@ _ref:
#### Examples
Read only access to first sheet in a public spreadsheet:
###### Read only access to first sheet in a public spreadsheet:
```yaml
connections:
- id: public_sheet
@ -65,7 +65,7 @@ _ref:
spreadsheetId: ubQsWYNGRUq0gFB1sAp2r9oYE19lZ8yGA1T6y0yBoLPW
```
Access with a service account, with defined types:
###### Access with a service account, with defined types:
```yaml
connections:
- id: my_sheet
@ -108,7 +108,7 @@ _ref:
#### Examples
Insert a list of rows.
###### Insert a list of rows.
```yaml
requests:
- id: append_rows
@ -139,7 +139,7 @@ _ref:
#### Examples
Insert a single row:
###### Insert a single row:
```yaml
requests:
- id: insert_dva
@ -165,7 +165,7 @@ _ref:
#### Examples
Delete the row where name is "Hanzo".
###### Delete the row where name is "Hanzo".
```yaml
requests:
- id: delete_hanzo
@ -190,7 +190,7 @@ _ref:
#### Examples
Get the first 10 rows.
###### Get the first 10 rows.
```yaml
requests:
- id: get_10_rows
@ -201,7 +201,7 @@ _ref:
limit: 10
```
Pagination using limit and skip.
###### Pagination using limit and skip.
```yaml
requests:
- id: get_10_rows
@ -219,7 +219,7 @@ _ref:
_state: page_size
```
Get all records where age is greater than 25.
###### Get all records where age is greater than 25.
```yaml
requests:
- id: get_10_rows
@ -231,7 +231,7 @@ _ref:
$gt: 25
```
Use an aggregation pipeline to aggregate data.
###### Use an aggregation pipeline to aggregate data.
```yaml
requests:
- id: get_10_rows
@ -263,7 +263,7 @@ _ref:
#### Examples
Get row where name is "Zarya".
###### Get row where name is "Zarya".
```yaml
requests:
- id: get_10_rows
@ -289,7 +289,7 @@ _ref:
#### Examples
Update all rows where age is less than 18.
###### Update all rows where age is less than 18.
```yaml
requests:
- id: get_10_rows
@ -317,7 +317,7 @@ _ref:
#### Examples
Update the row for "Doomfist"
###### Update the row for "Doomfist"
```yaml
requests:
- id: get_10_rows

View File

@ -0,0 +1,181 @@
# 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: Knex
pageTitle: Knex
section: Connections
filePath: connections/Knex.yaml
content:
- 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), [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:
- Knex
### Knex
#### Properties
- `client: enum`: __Required__ - The database client to use. One of:
- `mssql`
- `mysql`
- `oracledb`
- `postgres`
- `pg` (alias of `postgres`)
- `postgresql` (alias of `postgres`)
- `redshift`
- `sqlite3`
- `sqlite` (alias of `sqlite3`)
- `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
###### MySQL with connection object:
```yaml
connections:
- id: mysql
type: Knex
properties:
client: mysql
connection:
host:
_secret: MYSQL_HOST
user:
_secret: MYSQL_USER
database:
_secret: MYSQL_DB
password:
_secret: MYSQL_PASSWORD
```
Environment variables:
```
LOWDEFY_SECRET_MYSQL_HOST = database.server.com
LOWDEFY_SECRET_MYSQL_DB = db
LOWDEFY_SECRET_MYSQL_USER = user
LOWDEFY_SECRET_MYSQL_PASSWORD = password
```
###### PostgreSQL with secret connection string:
```yaml
connections:
- id: postgres
type: Knex
properties:
client: postgres
connection:
_secret: PG_CONNECTION_STRING
```
Environment variables:
```
LOWDEFY_SECRET_PG_CONNECTION_STRING = postgresql://user:password@database.server.com:5432/db
```
- id: markdown_requests
type: MarkdownWithCode
properties:
content:
_ref: connections/KnexRequests.md

View File

@ -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
```

View File

@ -0,0 +1,90 @@
# 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
###### Connection object:
```yaml
connections:
- id: mssql
type: Knex
properties:
client: mssql
connection:
host:
_secret: MSSQL_HOST
database:
_secret: MSSQL_DB
user:
_secret: MSSQL_USER
password:
_secret: MSSQL_PASSWORD
```
Environment variables:
```
LOWDEFY_SECRET_MSSQL_HOST = database.server.com
LOWDEFY_SECRET_MSSQL_DB = db
LOWDEFY_SECRET_MSSQL_USER = user
LOWDEFY_SECRET_MSSQL_PASSWORD = password
```
###### Secret connection string:
```yaml
connections:
- id: mssql
type: Knex
properties:
client: mssql
connection:
_secret: MSSQL_CONNECTION_STRING
```
Environment variables:
```
LOWDEFY_SECRET_MSSQL_CONNECTION_STRING = mssql://user:password@database.server.com:1433/db
```
- id: markdown_requests
type: MarkdownWithCode
properties:
content:
_ref: connections/KnexRequests.md

View File

@ -0,0 +1,77 @@
# 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
###### Connection object:
```yaml
connections:
- id: mariadb
type: Knex
properties:
client: mysql
connection:
host:
_secret: MARIADB_HOST
database:
_secret: MARIADB_DB
user:
_secret: MARIADB_USER
password:
_secret: MARIADB_PASSWORD
```
Environment variables:
```
LOWDEFY_SECRET_MARIADB_HOST = database.server.com
LOWDEFY_SECRET_MARIADB_DB = db
LOWDEFY_SECRET_MARIADB_USER = user
LOWDEFY_SECRET_MARIADB_PASSWORD = password
```
- id: markdown_requests
type: MarkdownWithCode
properties:
content:
_ref: connections/KnexRequests.md

View File

@ -67,17 +67,21 @@ _ref:
#### Examples
MongoDB collection with reads and writes:
###### MongoDB collection with reads and writes:
```yaml
connections:
- id: my_collection
type: MongoDBCollection
properties:
databaseUri:
_secret: my_database_uri
_secret: MONGODB_URI
collection: my_collection_name
write: true
```
Environment variables:
```
LOWDEFY_SECRET_MONGODB_URI = mongodb+srv://username:password@server.example.com/database
```
## Requests
@ -112,7 +116,7 @@ _ref:
#### Examples
Calculate average score by region:
###### Calculate average score by region:
```yaml
requests:
- id: avg_spend_by_region
@ -149,7 +153,7 @@ _ref:
#### Examples
Delete all documents older than a specific date:
###### Delete all documents older than a specific date:
```yaml
requests:
- id: delete_old_documents
@ -178,7 +182,7 @@ _ref:
#### Examples
Delete a document by _id:
###### Delete a document by _id:
```yaml
requests:
- id: delete_selected_document
@ -210,7 +214,7 @@ _ref:
#### Examples
Find top ten scores above 90:
###### Find top ten scores above 90:
```yaml
requests:
- id: scores_top_ten_scores_above_90
@ -250,7 +254,7 @@ _ref:
#### Examples
Find a document by id:
###### Find a document by id:
```yaml
requests:
- id: find_by_id
@ -279,7 +283,7 @@ _ref:
#### Examples
Insert a set of documents:
###### Insert a set of documents:
```yaml
requests:
- id: insert_new_comment
@ -312,7 +316,7 @@ _ref:
#### Examples
Insert a document:
###### Insert a document:
```yaml
requests:
- id: insert_new_comment
@ -349,7 +353,7 @@ _ref:
#### Examples
Set a list of documents as resolved:
###### Set a list of documents as resolved:
```yaml
requests:
- id: set_resolved
@ -365,7 +369,7 @@ _ref:
resolved: true
```
Mark all documents with score less than 6 as urgent:
###### Mark all documents with score less than 6 as urgent:
```yaml
requests:
- id: set_resolved
@ -402,7 +406,7 @@ _ref:
#### Examples
Update a document:
###### Update a document:
```yaml
requests:
- id: update

View File

@ -0,0 +1,92 @@
# 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
###### Connection Object:
```yaml
connections:
- id: mysql
type: Knex
properties:
client: mysql
connection:
host:
_secret: MYSQL_HOST
user:
_secret: MYSQL_USER
database:
_secret: MYSQL_DB
password:
_secret: MYSQL_PASSWORD
```
Environment variables:
```
LOWDEFY_SECRET_MYSQL_HOST = database.server.com
LOWDEFY_SECRET_MYSQL_DB = db
LOWDEFY_SECRET_MYSQL_USER = user
LOWDEFY_SECRET_MYSQL_PASSWORD = password
```
###### Connection string:
```yaml
connections:
- id: mysql
type: Knex
properties:
client: mysql
connection:
_secret: MYSQL_CONNECTION_STRING
```
Environment variables:
```
LOWDEFY_SECRET_MYSQL_CONNECTION_STRING = mysql://user:password@database.server.com/db
```
- id: markdown_requests
type: MarkdownWithCode
properties:
content:
_ref: connections/KnexRequests.md

View File

@ -0,0 +1,73 @@
# 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
###### Connection Object:
```yaml
connections:
- id: oracledb
type: Knex
properties:
client: oracledb
connection:
user:
_secret: ORACLEDB_USER
password:
_secret:
connectString:
_secret: ORACLEDB_CONNECT_STRING
```
Environment variables:
```
LOWDEFY_SECRET_ORACLEDB_USER = user
LOWDEFY_SECRET_ORACLEDB_PASSWORD = password
LOWDEFY_SECRET_ORACLEDB_CONNECT_STRING = database.server.com/db
```
- id: markdown_requests
type: MarkdownWithCode
properties:
content:
_ref: connections/KnexRequests.md

View File

@ -0,0 +1,99 @@
# 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
###### Connection 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
```
Environment variables:
```
LOWDEFY_SECRET_PG_HOST = database.server.com
LOWDEFY_SECRET_PG_DB = db
LOWDEFY_SECRET_PG_USER = user
LOWDEFY_SECRET_PG_PASSWORD = password
```
###### 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
```
Environment variables:
```
LOWDEFY_SECRET_PG_CONNECTION_STRING = postgresql://user:password@database.server.com:5432/db
```
- id: markdown_requests
type: MarkdownWithCode
properties:
content:
_ref: connections/KnexRequests.md

View File

@ -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
```
Environment variables 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

View File

@ -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,20 +80,20 @@ _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
The following example is used to send a reminder notification to a email address when the `SendGridMailSend` request is triggered.
###### Send a reminder email
```yaml
connections:
- id: my_sendgrid
type: SendGridMail
properties:
apiKey:
_secret: example_sendgrid_api_key
apiKey:
_secret: SENDGRID_API_KEY
from: reminders@example.org
# ...
requests:
@ -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
# ...
```
```

View File

@ -47,783 +47,7 @@ connections:
url: /telemetry/docs
menus:
- id: default
links:
- id: introduction
type: MenuLink
pageId: introduction
properties:
title: Introduction
icon: CoffeeOutlined
- id: tutorial
type: MenuGroup
properties:
title: Tutorial
icon: RocketOutlined
links:
- id: tutorial-start
type: MenuLink
pageId: tutorial-start
properties:
title: Getting started
- id: tutorial-create-page
type: MenuLink
pageId: tutorial-create-page
properties:
title: Creating a page
- id: tutorial-add-blocks
type: MenuLink
pageId: tutorial-add-blocks
properties:
title: Adding blocks
- id: tutorial-actions-operators
type: MenuLink
pageId: tutorial-actions-operators
properties:
title: Interactive pages
- id: tutorial-requests
type: MenuLink
pageId: tutorial-requests
properties:
title: Requests
- id: tutorial-deploy
type: MenuLink
pageId: tutorial-deploy
properties:
title: Deploy to Netlify
- id: next-steps
type: MenuLink
pageId: next-steps
properties:
title: Next steps
- id: concepts
type: MenuGroup
properties:
title: Concepts
icon: BulbOutlined
links:
- id: overview
type: MenuLink
pageId: overview
properties:
title: Overview
- id: cli
type: MenuLink
pageId: cli
properties:
title: The CLI
- id: lowdefy-schema
type: MenuLink
pageId: lowdefy-schema
properties:
title: Lowdefy App Schema
- id: context-and-state
type: MenuLink
pageId: context-and-state
properties:
title: Context and State
- id: blocks
type: MenuLink
pageId: blocks
properties:
title: Blocks
- id: layout
type: MenuLink
pageId: layout
properties:
title: Layout
- id: connections-and-requests
type: MenuLink
pageId: connections-and-requests
properties:
title: Connections and Requests
- id: events-and-actions
type: MenuLink
pageId: events-and-actions
properties:
title: Events and Actions
- id: operators
type: MenuLink
pageId: operators
properties:
title: Operators
- id: secrets
type: MenuLink
pageId: secrets
properties:
title: Secrets
- id: deployment
type: MenuLink
pageId: deployment
properties:
title: Deployment
- id: lists
type: MenuLink
pageId: lists
properties:
title: Lists
- id: custom-blocks
type: MenuLink
pageId: custom-blocks
properties:
title: Custom Blocks
- id: blocks_input
type: MenuGroup
properties:
title: Input Blocks
icon: FormOutlined
links:
- id: AutoComplete
type: MenuLink
pageId: AutoComplete
- id: ButtonSelector
type: MenuLink
pageId: ButtonSelector
- id: CheckboxSelector
type: MenuLink
pageId: CheckboxSelector
- id: ChromeColorSelector
type: MenuLink
pageId: ChromeColorSelector
- id: CircleColorSelector
type: MenuLink
pageId: CircleColorSelector
- id: ColorSelector
type: MenuLink
pageId: ColorSelector
- id: CompactColorSelector
type: MenuLink
pageId: CompactColorSelector
- id: DateRangeSelector
type: MenuLink
pageId: DateRangeSelector
- id: DateSelector
type: MenuLink
pageId: DateSelector
- id: DateTimeSelector
type: MenuLink
pageId: DateTimeSelector
- id: GithubColorSelector
type: MenuLink
pageId: GithubColorSelector
- id: MonthSelector
type: MenuLink
pageId: MonthSelector
- id: MultipleSelector
type: MenuLink
pageId: MultipleSelector
- id: NumberInput
type: MenuLink
pageId: NumberInput
- id: Pagination
type: MenuLink
pageId: Pagination
- id: ParagraphInput
type: MenuLink
pageId: ParagraphInput
- id: RadioSelector
type: MenuLink
pageId: RadioSelector
- id: RatingSlider
type: MenuLink
pageId: RatingSlider
- id: S3UploadButton
type: MenuLink
pageId: S3UploadButton
- id: Selector
type: MenuLink
pageId: Selector
- id: SliderColorSelector
type: MenuLink
pageId: SliderColorSelector
- id: SwatchesColorSelector
type: MenuLink
pageId: SwatchesColorSelector
- id: Switch
type: MenuLink
pageId: Switch
- id: TextArea
type: MenuLink
pageId: TextArea
- id: TextInput
type: MenuLink
pageId: TextInput
- id: TitleInput
type: MenuLink
pageId: TitleInput
- id: TwitterColorSelector
type: MenuLink
pageId: TwitterColorSelector
- id: WeekSelector
type: MenuLink
pageId: WeekSelector
- id: blocks_display
type: MenuGroup
properties:
title: Display Blocks
icon: PictureOutlined
links:
- id: Alert
type: MenuLink
pageId: Alert
- id: Anchor
type: MenuLink
pageId: Anchor
- id: Avatar
type: MenuLink
pageId: Avatar
- id: Breadcrumb
type: MenuLink
pageId: Breadcrumb
- id: Button
type: MenuLink
pageId: Button
- id: DangerousHtml
type: MenuLink
pageId: DangerousHtml
- id: DangerousMarkdown
type: MenuLink
pageId: DangerousMarkdown
- id: Descriptions
type: MenuLink
pageId: Descriptions
- id: Divider
type: MenuLink
pageId: Divider
- id: EChart
type: MenuLink
pageId: EChart
- id: Html
type: MenuLink
pageId: Html
- id: Icon
type: MenuLink
pageId: Icon
- id: Markdown
type: MenuLink
pageId: Markdown
- id: MarkdownWithCode
type: MenuLink
pageId: MarkdownWithCode
- id: Menu
type: MenuLink
pageId: Menu
- id: Message
type: MenuLink
pageId: Message
- id: MobileMenu
type: MenuLink
pageId: MobileMenu
- id: Notification
type: MenuLink
pageId: Notification
- id: Paragraph
type: MenuLink
pageId: Paragraph
- id: Progress
type: MenuLink
pageId: Progress
# - id: Skeleton
# type: MenuLink
# pageId: Skeleton
- id: Statistic
type: MenuLink
pageId: Statistic
- id: Title
type: MenuLink
pageId: Title
- id: blocks_container
type: MenuGroup
properties:
title: Container Blocks
icon: ContainerOutlined
links:
- id: Affix
type: MenuLink
pageId: Affix
- id: Badge
type: MenuLink
pageId: Badge
- id: Box
type: MenuLink
pageId: Box
- id: Card
type: MenuLink
pageId: Card
- id: Collapse
type: MenuLink
pageId: Collapse
- id: Comment
type: MenuLink
pageId: Comment
- id: ConfirmModal
type: MenuLink
pageId: ConfirmModal
- id: Drawer
type: MenuLink
pageId: Drawer
- id: Label
type: MenuLink
pageId: Label
- id: Modal
type: MenuLink
pageId: Modal
- id: Result
type: MenuLink
pageId: Result
- id: Span
type: MenuLink
pageId: Span
- id: Spin
type: MenuLink
pageId: Spin
- id: Tabs
type: MenuLink
pageId: Tabs
- id: blocks_context
type: MenuGroup
properties:
title: Context Blocks
icon: GroupOutlined
links:
- id: Context
type: MenuLink
pageId: Context
- id: PageHCF
type: MenuLink
pageId: PageHCF
- id: PageHCF
type: MenuLink
pageId: PageHCF
- id: PageHCSF
type: MenuLink
pageId: PageHCSF
- id: PageHeaderMenu
type: MenuLink
pageId: PageHeaderMenu
- id: PageHSCF
type: MenuLink
pageId: PageHSCF
- id: PageSHCF
type: MenuLink
pageId: PageSHCF
- id: PageSiderMenu
type: MenuLink
pageId: PageSiderMenu
- id: blocks_list
type: MenuGroup
properties:
title: List Blocks
icon: OrderedListOutlined
links:
- id: ControlledList
type: MenuLink
pageId: ControlledList
- id: List
type: MenuLink
pageId: List
- id: connections
type: MenuGroup
properties:
title: Connections
icon: ApiOutlined
links:
- id: AWSS3
type: MenuLink
pageId: AWSS3
properties:
title: AWS S3
- id: AxiosHttp
type: MenuLink
pageId: AxiosHttp
properties:
title: Axios HTTP
- id: GoogleSheet
type: MenuLink
pageId: GoogleSheet
properties:
title: Google Sheets
- id: MongoDB
type: MenuLink
pageId: MongoDB
- id: SendGridMail
type: MenuLink
pageId: SendGridMail
- id: actions
type: MenuGroup
properties:
title: Actions
icon: ThunderboltOutlined
links:
- id: CallMethod
type: MenuLink
pageId: CallMethod
- id: Link
type: MenuLink
pageId: Link
- id: MessageAction
type: MenuLink
pageId: MessageAction # Clash with Message block
properties:
title: Message
- id: NotificationAction
type: MenuLink
pageId: NotificationAction # Clash with Notification block
properties:
title: Notification
- id: Request
type: MenuLink
pageId: Request
- id: Reset
type: MenuLink
pageId: Reset
- id: ScrollTo
type: MenuLink
pageId: ScrollTo
- id: SetGlobal
type: MenuLink
pageId: SetGlobal
- id: SetState
type: MenuLink
pageId: SetState
- id: Validate
type: MenuLink
pageId: Validate
- id: operators
type: MenuGroup
properties:
title: Operators
icon: ToolOutlined
links:
- id: _and
type: MenuLink
pageId: _and
- id: _args
type: MenuLink
pageId: _args
- id: _array
type: MenuLink
pageId: _array
- id: _base64
type: MenuLink
pageId: _base64
- id: _date
type: MenuLink
pageId: _date
- id: _diff
type: MenuLink
pageId: _diff
- id: _divide
type: MenuLink
pageId: _divide
- id: _eq
type: MenuLink
pageId: _eq
- id: _event
type: MenuLink
pageId: _event
- id: _format
type: MenuLink
pageId: _format
- id: _function
type: MenuLink
pageId: _function
- id: _get
type: MenuLink
pageId: _get
- id: _global
type: MenuLink
pageId: _global
- id: _gt
type: MenuLink
pageId: _gt
- id: _gte
type: MenuLink
pageId: _gte
- id: _if
type: MenuLink
pageId: _if
- id: _if_none
type: MenuLink
pageId: _if_none
- id: _index
type: MenuLink
pageId: _index
- id: _input
type: MenuLink
pageId: _input
- id: _json
type: MenuLink
pageId: _json
- id: _list_contexts
type: MenuLink
pageId: _list_contexts
- id: _log
type: MenuLink
pageId: _log
- id: _lt
type: MenuLink
pageId: _lt
- id: _lte
type: MenuLink
pageId: _lte
- id: _math
type: MenuLink
pageId: _math
- id: _media
type: MenuLink
pageId: _media
- id: _menu
type: MenuLink
pageId: _menu
- id: _mql
type: MenuLink
pageId: _mql
- id: _ne
type: MenuLink
pageId: _ne
- id: _not
type: MenuLink
pageId: _not
- id: _nunjucks
type: MenuLink
pageId: _nunjucks
- id: _object
type: MenuLink
pageId: _object
- id: _operator
type: MenuLink
pageId: _operator
- id: _or
type: MenuLink
pageId: _or
- id: _product
type: MenuLink
pageId: _product
- id: _random
type: MenuLink
pageId: _random
- id: _ref
type: MenuLink
pageId: _ref
- id: _regex
type: MenuLink
pageId: _regex
- id: _request
type: MenuLink
pageId: _request
- id: _secret
type: MenuLink
pageId: _secret
- id: _state
type: MenuLink
pageId: _state
- id: _string
type: MenuLink
pageId: _string
- id: _subtract
type: MenuLink
pageId: _subtract
- id: _sum
type: MenuLink
pageId: _sum
- id: _type
type: MenuLink
pageId: _type
- id: _uri
type: MenuLink
pageId: _uri
- id: _url_query
type: MenuLink
pageId: _url_query
- id: _uuid
type: MenuLink
pageId: _uuid
- id: _var
type: MenuLink
pageId: _var
- id: _yaml
type: MenuLink
pageId: _yaml
_ref: menus.yaml
pages:
- _ref: introduction.yaml
- _ref: tutorial/tutorial-start.yaml
- _ref: tutorial/tutorial-create-page.yaml
- _ref: tutorial/tutorial-create-page-config.yaml
- _ref: tutorial/tutorial-add-blocks.yaml
- _ref: tutorial/tutorial-add-blocks-config.yaml
- _ref: tutorial/tutorial-actions-operators.yaml
- _ref: tutorial/tutorial-actions-operators-config.yaml
- _ref: tutorial/tutorial-requests.yaml
- _ref: tutorial/tutorial-requests-config.yaml
- _ref: tutorial/tutorial-deploy.yaml
- _ref: tutorial/next-steps.yaml
- _ref: concepts/overview.yaml
- _ref: concepts/cli.yaml
- _ref: concepts/lowdefy-schema.yaml
- _ref: concepts/context-and-state.yaml
- _ref: concepts/blocks.yaml
- _ref: concepts/layout.yaml
- _ref: concepts/connections-and-requests.yaml
- _ref: concepts/events-and-actions.yaml
- _ref: concepts/operators.yaml
- _ref: concepts/deployment.yaml
- _ref: concepts/secrets.yaml
- _ref: concepts/deployment.yaml
- _ref: concepts/lists.yaml
- _ref: concepts/custom-blocks.yaml
- _ref: blocks/input/AutoComplete.yaml
- _ref: blocks/input/ButtonSelector.yaml
- _ref: blocks/input/CheckboxSelector.yaml
- _ref: blocks/input/ChromeColorSelector.yaml
- _ref: blocks/input/CircleColorSelector.yaml
- _ref: blocks/input/ColorSelector.yaml
- _ref: blocks/input/CompactColorSelector.yaml
- _ref: blocks/input/DateRangeSelector.yaml
- _ref: blocks/input/DateSelector.yaml
- _ref: blocks/input/DateTimeSelector.yaml
- _ref: blocks/input/GithubColorSelector.yaml
- _ref: blocks/input/MonthSelector.yaml
- _ref: blocks/input/MultipleSelector.yaml
- _ref: blocks/input/NumberInput.yaml
- _ref: blocks/input/Pagination.yaml
- _ref: blocks/input/ParagraphInput.yaml
- _ref: blocks/input/RadioSelector.yaml
- _ref: blocks/input/RatingSlider.yaml
- _ref: blocks/input/S3UploadButton.yaml
- _ref: blocks/input/Selector.yaml
- _ref: blocks/input/SliderColorSelector.yaml
- _ref: blocks/input/SwatchesColorSelector.yaml
- _ref: blocks/input/Switch.yaml
- _ref: blocks/input/TextArea.yaml
- _ref: blocks/input/TextInput.yaml
- _ref: blocks/input/TitleInput.yaml
- _ref: blocks/input/TwitterColorSelector.yaml
- _ref: blocks/input/WeekSelector.yaml
- _ref: blocks/display/Alert.yaml
- _ref: blocks/display/Anchor.yaml
- _ref: blocks/display/Avatar.yaml
- _ref: blocks/display/Breadcrumb.yaml
- _ref: blocks/display/Button.yaml
- _ref: blocks/display/DangerousHtml.yaml
- _ref: blocks/display/DangerousMarkdown.yaml
- _ref: blocks/display/Descriptions.yaml
- _ref: blocks/display/Divider.yaml
- _ref: blocks/display/EChart.yaml
- _ref: blocks/display/Html.yaml
- _ref: blocks/display/Icon.yaml
- _ref: blocks/display/Markdown.yaml
- _ref: blocks/display/MarkdownWithCode.yaml
- _ref: blocks/display/Menu.yaml
- _ref: blocks/display/Message.yaml
- _ref: blocks/display/MobileMenu.yaml
- _ref: blocks/display/Notification.yaml
- _ref: blocks/display/Paragraph.yaml
- _ref: blocks/display/Progress.yaml
# - _ref: blocks/display/Skeleton.yaml
- _ref: blocks/display/Statistic.yaml
- _ref: blocks/display/Title.yaml
- _ref: blocks/container/Affix.yaml
- _ref: blocks/container/Badge.yaml
- _ref: blocks/container/Box.yaml
- _ref: blocks/container/Card.yaml
- _ref: blocks/container/Collapse.yaml
- _ref: blocks/container/Comment.yaml
- _ref: blocks/container/ConfirmModal.yaml
- _ref: blocks/container/Drawer.yaml
- _ref: blocks/container/Label.yaml
- _ref: blocks/container/Modal.yaml
- _ref: blocks/container/Result.yaml
- _ref: blocks/container/Span.yaml
- _ref: blocks/container/Spin.yaml
- _ref: blocks/container/Tabs.yaml
- _ref: blocks/context/Context.yaml
- _ref: blocks/context/PageHCF.yaml
- _ref: blocks/context/PageHCSF.yaml
- _ref: blocks/context/PageHeaderMenu.yaml
- _ref: blocks/context/PageHSCF.yaml
- _ref: blocks/context/PageSHCF.yaml
- _ref: blocks/context/PageSiderMenu.yaml
- _ref: blocks/list/ControlledList.yaml
- _ref: blocks/list/List.yaml
# - _ref: blocks/list/TimelineList.yaml
- _ref: connections/AWSS3.yaml
- _ref: connections/AxiosHttp.yaml
- _ref: connections/GoogleSheet.yaml
- _ref: connections/MongoDB.yaml
- _ref: connections/SendGridMail.yaml
- _ref: actions/CallMethod.yaml
- _ref: actions/Link.yaml
- _ref: actions/Message.yaml
- _ref: actions/Notification.yaml
- _ref: actions/Request.yaml
- _ref: actions/Reset.yaml
- _ref: actions/ScrollTo.yaml
- _ref: actions/SetGlobal.yaml
- _ref: actions/SetState.yaml
- _ref: actions/Validate.yaml
- _ref: operators/_and.yaml
- _ref: operators/_args.yaml
- _ref: operators/_array.yaml
- _ref: operators/_base64.yaml
- _ref: operators/_date.yaml
- _ref: operators/_diff.yaml
- _ref: operators/_divide.yaml
- _ref: operators/_eq.yaml
- _ref: operators/_event.yaml
- _ref: operators/_format.yaml
- _ref: operators/_function.yaml
- _ref: operators/_get.yaml
- _ref: operators/_global.yaml
- _ref: operators/_gt.yaml
- _ref: operators/_gte.yaml
- _ref: operators/_if.yaml
- _ref: operators/_if_none.yaml
- _ref: operators/_index.yaml
- _ref: operators/_input.yaml
- _ref: operators/_json.yaml
- _ref: operators/_list_contexts.yaml
- _ref: operators/_log.yaml
- _ref: operators/_lt.yaml
- _ref: operators/_lte.yaml
- _ref: operators/_math.yaml
- _ref: operators/_media.yaml
- _ref: operators/_menu.yaml
- _ref: operators/_mql.yaml
- _ref: operators/_ne.yaml
- _ref: operators/_not.yaml
- _ref: operators/_nunjucks.yaml
- _ref: operators/_object.yaml
- _ref: operators/_operator.yaml
- _ref: operators/_or.yaml
- _ref: operators/_product.yaml
- _ref: operators/_random.yaml
- _ref: operators/_ref.yaml
- _ref: operators/_regex.yaml
- _ref: operators/_request.yaml
- _ref: operators/_secret.yaml
- _ref: operators/_state.yaml
- _ref: operators/_string.yaml
- _ref: operators/_subtract.yaml
- _ref: operators/_sum.yaml
- _ref: operators/_type.yaml
- _ref: operators/_uri.yaml
- _ref: operators/_url_query.yaml
- _ref: operators/_uuid.yaml
- _ref: operators/_var.yaml
- _ref: operators/_yaml.yaml
- _ref: 404.yaml
_ref: pages.yaml

633
packages/docs/menus.yaml Normal file
View File

@ -0,0 +1,633 @@
- id: default
links:
- id: introduction
type: MenuLink
pageId: introduction
properties:
title: Introduction
icon: CoffeeOutlined
- id: tutorial
type: MenuGroup
properties:
title: Tutorial
icon: RocketOutlined
links:
- id: tutorial-start
type: MenuLink
pageId: tutorial-start
properties:
title: Getting started
- id: tutorial-create-page
type: MenuLink
pageId: tutorial-create-page
properties:
title: Creating a page
- id: tutorial-add-blocks
type: MenuLink
pageId: tutorial-add-blocks
properties:
title: Adding blocks
- id: tutorial-actions-operators
type: MenuLink
pageId: tutorial-actions-operators
properties:
title: Interactive pages
- id: tutorial-requests
type: MenuLink
pageId: tutorial-requests
properties:
title: Requests
- id: tutorial-deploy
type: MenuLink
pageId: tutorial-deploy
properties:
title: Deploy to Netlify
- id: next-steps
type: MenuLink
pageId: next-steps
properties:
title: Next steps
- id: concepts
type: MenuGroup
properties:
title: Concepts
icon: BulbOutlined
links:
- id: overview
type: MenuLink
pageId: overview
properties:
title: Overview
- id: cli
type: MenuLink
pageId: cli
properties:
title: The CLI
- id: lowdefy-schema
type: MenuLink
pageId: lowdefy-schema
properties:
title: Lowdefy App Schema
- id: context-and-state
type: MenuLink
pageId: context-and-state
properties:
title: Context and State
- id: blocks
type: MenuLink
pageId: blocks
properties:
title: Blocks
- id: layout
type: MenuLink
pageId: layout
properties:
title: Layout
- id: connections-and-requests
type: MenuLink
pageId: connections-and-requests
properties:
title: Connections and Requests
- id: events-and-actions
type: MenuLink
pageId: events-and-actions
properties:
title: Events and Actions
- id: operators
type: MenuLink
pageId: operators
properties:
title: Operators
- id: secrets
type: MenuLink
pageId: secrets
properties:
title: Secrets
- id: deployment
type: MenuLink
pageId: deployment
properties:
title: Deployment
- id: lists
type: MenuLink
pageId: lists
properties:
title: Lists
- id: custom-blocks
type: MenuLink
pageId: custom-blocks
properties:
title: Custom Blocks
- id: blocks_input
type: MenuGroup
properties:
title: Input Blocks
icon: FormOutlined
links:
- id: AutoComplete
type: MenuLink
pageId: AutoComplete
- id: ButtonSelector
type: MenuLink
pageId: ButtonSelector
- id: CheckboxSelector
type: MenuLink
pageId: CheckboxSelector
- id: ChromeColorSelector
type: MenuLink
pageId: ChromeColorSelector
- id: CircleColorSelector
type: MenuLink
pageId: CircleColorSelector
- id: ColorSelector
type: MenuLink
pageId: ColorSelector
- id: CompactColorSelector
type: MenuLink
pageId: CompactColorSelector
- id: DateRangeSelector
type: MenuLink
pageId: DateRangeSelector
- id: DateSelector
type: MenuLink
pageId: DateSelector
- id: DateTimeSelector
type: MenuLink
pageId: DateTimeSelector
- id: GithubColorSelector
type: MenuLink
pageId: GithubColorSelector
- id: MonthSelector
type: MenuLink
pageId: MonthSelector
- id: MultipleSelector
type: MenuLink
pageId: MultipleSelector
- id: NumberInput
type: MenuLink
pageId: NumberInput
- id: Pagination
type: MenuLink
pageId: Pagination
- id: ParagraphInput
type: MenuLink
pageId: ParagraphInput
- id: RadioSelector
type: MenuLink
pageId: RadioSelector
- id: RatingSlider
type: MenuLink
pageId: RatingSlider
- id: S3UploadButton
type: MenuLink
pageId: S3UploadButton
- id: Selector
type: MenuLink
pageId: Selector
- id: SliderColorSelector
type: MenuLink
pageId: SliderColorSelector
- id: SwatchesColorSelector
type: MenuLink
pageId: SwatchesColorSelector
- id: Switch
type: MenuLink
pageId: Switch
- id: TextArea
type: MenuLink
pageId: TextArea
- id: TextInput
type: MenuLink
pageId: TextInput
- id: TitleInput
type: MenuLink
pageId: TitleInput
- id: TwitterColorSelector
type: MenuLink
pageId: TwitterColorSelector
- id: WeekSelector
type: MenuLink
pageId: WeekSelector
- id: blocks_display
type: MenuGroup
properties:
title: Display Blocks
icon: PictureOutlined
links:
- id: Alert
type: MenuLink
pageId: Alert
- id: Anchor
type: MenuLink
pageId: Anchor
- id: Avatar
type: MenuLink
pageId: Avatar
- id: Breadcrumb
type: MenuLink
pageId: Breadcrumb
- id: Button
type: MenuLink
pageId: Button
- id: DangerousHtml
type: MenuLink
pageId: DangerousHtml
- id: DangerousMarkdown
type: MenuLink
pageId: DangerousMarkdown
- id: Descriptions
type: MenuLink
pageId: Descriptions
- id: Divider
type: MenuLink
pageId: Divider
- id: EChart
type: MenuLink
pageId: EChart
- id: Html
type: MenuLink
pageId: Html
- id: Icon
type: MenuLink
pageId: Icon
- id: Markdown
type: MenuLink
pageId: Markdown
- id: MarkdownWithCode
type: MenuLink
pageId: MarkdownWithCode
- id: Menu
type: MenuLink
pageId: Menu
- id: Message
type: MenuLink
pageId: Message
- id: MobileMenu
type: MenuLink
pageId: MobileMenu
- id: Notification
type: MenuLink
pageId: Notification
- id: Paragraph
type: MenuLink
pageId: Paragraph
- id: Progress
type: MenuLink
pageId: Progress
# - id: Skeleton
# type: MenuLink
# pageId: Skeleton
- id: Statistic
type: MenuLink
pageId: Statistic
- id: Title
type: MenuLink
pageId: Title
- id: blocks_container
type: MenuGroup
properties:
title: Container Blocks
icon: ContainerOutlined
links:
- id: Affix
type: MenuLink
pageId: Affix
- id: Badge
type: MenuLink
pageId: Badge
- id: Box
type: MenuLink
pageId: Box
- id: Card
type: MenuLink
pageId: Card
- id: Collapse
type: MenuLink
pageId: Collapse
- id: Comment
type: MenuLink
pageId: Comment
- id: ConfirmModal
type: MenuLink
pageId: ConfirmModal
- id: Drawer
type: MenuLink
pageId: Drawer
- id: Label
type: MenuLink
pageId: Label
- id: Modal
type: MenuLink
pageId: Modal
- id: Result
type: MenuLink
pageId: Result
- id: Span
type: MenuLink
pageId: Span
- id: Spin
type: MenuLink
pageId: Spin
- id: Tabs
type: MenuLink
pageId: Tabs
- id: blocks_context
type: MenuGroup
properties:
title: Context Blocks
icon: GroupOutlined
links:
- id: Context
type: MenuLink
pageId: Context
- id: PageHCF
type: MenuLink
pageId: PageHCF
- id: PageHCF
type: MenuLink
pageId: PageHCF
- id: PageHCSF
type: MenuLink
pageId: PageHCSF
- id: PageHeaderMenu
type: MenuLink
pageId: PageHeaderMenu
- id: PageHSCF
type: MenuLink
pageId: PageHSCF
- id: PageSHCF
type: MenuLink
pageId: PageSHCF
- id: PageSiderMenu
type: MenuLink
pageId: PageSiderMenu
- id: blocks_list
type: MenuGroup
properties:
title: List Blocks
icon: OrderedListOutlined
links:
- id: ControlledList
type: MenuLink
pageId: ControlledList
- id: List
type: MenuLink
pageId: List
- id: connections
type: MenuGroup
properties:
title: Connections
icon: ApiOutlined
links:
- id: AmazonRedshift
type: MenuLink
pageId: AmazonRedshift
properties:
title: Amazon Redshift
- id: AWSS3
type: MenuLink
pageId: AWSS3
properties:
title: Amazon S3
- id: AxiosHttp
type: MenuLink
pageId: AxiosHttp
properties:
title: Axios HTTP
- id: GoogleSheet
type: MenuLink
pageId: GoogleSheet
properties:
title: Google Sheets
- id: Knex
type: MenuLink
pageId: 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:
title: Actions
icon: ThunderboltOutlined
links:
- id: CallMethod
type: MenuLink
pageId: CallMethod
- id: Link
type: MenuLink
pageId: Link
- id: MessageAction
type: MenuLink
pageId: MessageAction # Clash with Message block
properties:
title: Message
- id: NotificationAction
type: MenuLink
pageId: NotificationAction # Clash with Notification block
properties:
title: Notification
- id: Request
type: MenuLink
pageId: Request
- id: Reset
type: MenuLink
pageId: Reset
- id: ScrollTo
type: MenuLink
pageId: ScrollTo
- id: SetGlobal
type: MenuLink
pageId: SetGlobal
- id: SetState
type: MenuLink
pageId: SetState
- id: Validate
type: MenuLink
pageId: Validate
- id: operators
type: MenuGroup
properties:
title: Operators
icon: ToolOutlined
links:
- id: _and
type: MenuLink
pageId: _and
- id: _args
type: MenuLink
pageId: _args
- id: _array
type: MenuLink
pageId: _array
- id: _base64
type: MenuLink
pageId: _base64
- id: _date
type: MenuLink
pageId: _date
- id: _diff
type: MenuLink
pageId: _diff
- id: _divide
type: MenuLink
pageId: _divide
- id: _eq
type: MenuLink
pageId: _eq
- id: _event
type: MenuLink
pageId: _event
- id: _format
type: MenuLink
pageId: _format
- id: _function
type: MenuLink
pageId: _function
- id: _get
type: MenuLink
pageId: _get
- id: _global
type: MenuLink
pageId: _global
- id: _gt
type: MenuLink
pageId: _gt
- id: _gte
type: MenuLink
pageId: _gte
- id: _if
type: MenuLink
pageId: _if
- id: _if_none
type: MenuLink
pageId: _if_none
- id: _index
type: MenuLink
pageId: _index
- id: _input
type: MenuLink
pageId: _input
- id: _json
type: MenuLink
pageId: _json
- id: _list_contexts
type: MenuLink
pageId: _list_contexts
- id: _log
type: MenuLink
pageId: _log
- id: _lt
type: MenuLink
pageId: _lt
- id: _lte
type: MenuLink
pageId: _lte
- id: _math
type: MenuLink
pageId: _math
- id: _media
type: MenuLink
pageId: _media
- id: _menu
type: MenuLink
pageId: _menu
- id: _mql
type: MenuLink
pageId: _mql
- id: _ne
type: MenuLink
pageId: _ne
- id: _not
type: MenuLink
pageId: _not
- id: _nunjucks
type: MenuLink
pageId: _nunjucks
- id: _object
type: MenuLink
pageId: _object
- id: _operator
type: MenuLink
pageId: _operator
- id: _or
type: MenuLink
pageId: _or
- id: _product
type: MenuLink
pageId: _product
- id: _random
type: MenuLink
pageId: _random
- id: _ref
type: MenuLink
pageId: _ref
- id: _regex
type: MenuLink
pageId: _regex
- id: _request
type: MenuLink
pageId: _request
- id: _secret
type: MenuLink
pageId: _secret
- id: _state
type: MenuLink
pageId: _state
- id: _string
type: MenuLink
pageId: _string
- id: _subtract
type: MenuLink
pageId: _subtract
- id: _sum
type: MenuLink
pageId: _sum
- id: _type
type: MenuLink
pageId: _type
- id: _uri
type: MenuLink
pageId: _uri
- id: _url_query
type: MenuLink
pageId: _url_query
- id: _uuid
type: MenuLink
pageId: _uuid
- id: _var
type: MenuLink
pageId: _var
- id: _yaml
type: MenuLink
pageId: _yaml

185
packages/docs/pages.yaml Normal file
View File

@ -0,0 +1,185 @@
- _ref: introduction.yaml
- _ref: tutorial/tutorial-start.yaml
- _ref: tutorial/tutorial-create-page.yaml
- _ref: tutorial/tutorial-create-page-config.yaml
- _ref: tutorial/tutorial-add-blocks.yaml
- _ref: tutorial/tutorial-add-blocks-config.yaml
- _ref: tutorial/tutorial-actions-operators.yaml
- _ref: tutorial/tutorial-actions-operators-config.yaml
- _ref: tutorial/tutorial-requests.yaml
- _ref: tutorial/tutorial-requests-config.yaml
- _ref: tutorial/tutorial-deploy.yaml
- _ref: tutorial/next-steps.yaml
- _ref: concepts/overview.yaml
- _ref: concepts/cli.yaml
- _ref: concepts/lowdefy-schema.yaml
- _ref: concepts/context-and-state.yaml
- _ref: concepts/blocks.yaml
- _ref: concepts/layout.yaml
- _ref: concepts/connections-and-requests.yaml
- _ref: concepts/events-and-actions.yaml
- _ref: concepts/operators.yaml
- _ref: concepts/deployment.yaml
- _ref: concepts/secrets.yaml
- _ref: concepts/deployment.yaml
- _ref: concepts/lists.yaml
- _ref: concepts/custom-blocks.yaml
- _ref: blocks/input/AutoComplete.yaml
- _ref: blocks/input/ButtonSelector.yaml
- _ref: blocks/input/CheckboxSelector.yaml
- _ref: blocks/input/ChromeColorSelector.yaml
- _ref: blocks/input/CircleColorSelector.yaml
- _ref: blocks/input/ColorSelector.yaml
- _ref: blocks/input/CompactColorSelector.yaml
- _ref: blocks/input/DateRangeSelector.yaml
- _ref: blocks/input/DateSelector.yaml
- _ref: blocks/input/DateTimeSelector.yaml
- _ref: blocks/input/GithubColorSelector.yaml
- _ref: blocks/input/MonthSelector.yaml
- _ref: blocks/input/MultipleSelector.yaml
- _ref: blocks/input/NumberInput.yaml
- _ref: blocks/input/Pagination.yaml
- _ref: blocks/input/ParagraphInput.yaml
- _ref: blocks/input/RadioSelector.yaml
- _ref: blocks/input/RatingSlider.yaml
- _ref: blocks/input/S3UploadButton.yaml
- _ref: blocks/input/Selector.yaml
- _ref: blocks/input/SliderColorSelector.yaml
- _ref: blocks/input/SwatchesColorSelector.yaml
- _ref: blocks/input/Switch.yaml
- _ref: blocks/input/TextArea.yaml
- _ref: blocks/input/TextInput.yaml
- _ref: blocks/input/TitleInput.yaml
- _ref: blocks/input/TwitterColorSelector.yaml
- _ref: blocks/input/WeekSelector.yaml
- _ref: blocks/display/Alert.yaml
- _ref: blocks/display/Anchor.yaml
- _ref: blocks/display/Avatar.yaml
- _ref: blocks/display/Breadcrumb.yaml
- _ref: blocks/display/Button.yaml
- _ref: blocks/display/DangerousHtml.yaml
- _ref: blocks/display/DangerousMarkdown.yaml
- _ref: blocks/display/Descriptions.yaml
- _ref: blocks/display/Divider.yaml
- _ref: blocks/display/EChart.yaml
- _ref: blocks/display/Html.yaml
- _ref: blocks/display/Icon.yaml
- _ref: blocks/display/Markdown.yaml
- _ref: blocks/display/MarkdownWithCode.yaml
- _ref: blocks/display/Menu.yaml
- _ref: blocks/display/Message.yaml
- _ref: blocks/display/MobileMenu.yaml
- _ref: blocks/display/Notification.yaml
- _ref: blocks/display/Paragraph.yaml
- _ref: blocks/display/Progress.yaml
# - _ref: blocks/display/Skeleton.yaml
- _ref: blocks/display/Statistic.yaml
- _ref: blocks/display/Title.yaml
- _ref: blocks/container/Affix.yaml
- _ref: blocks/container/Badge.yaml
- _ref: blocks/container/Box.yaml
- _ref: blocks/container/Card.yaml
- _ref: blocks/container/Collapse.yaml
- _ref: blocks/container/Comment.yaml
- _ref: blocks/container/ConfirmModal.yaml
- _ref: blocks/container/Drawer.yaml
- _ref: blocks/container/Label.yaml
- _ref: blocks/container/Modal.yaml
- _ref: blocks/container/Result.yaml
- _ref: blocks/container/Span.yaml
- _ref: blocks/container/Spin.yaml
- _ref: blocks/container/Tabs.yaml
- _ref: blocks/context/Context.yaml
- _ref: blocks/context/PageHCF.yaml
- _ref: blocks/context/PageHCSF.yaml
- _ref: blocks/context/PageHeaderMenu.yaml
- _ref: blocks/context/PageHSCF.yaml
- _ref: blocks/context/PageSHCF.yaml
- _ref: blocks/context/PageSiderMenu.yaml
- _ref: blocks/list/ControlledList.yaml
- _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
- _ref: actions/Message.yaml
- _ref: actions/Notification.yaml
- _ref: actions/Request.yaml
- _ref: actions/Reset.yaml
- _ref: actions/ScrollTo.yaml
- _ref: actions/SetGlobal.yaml
- _ref: actions/SetState.yaml
- _ref: actions/Validate.yaml
- _ref: operators/_and.yaml
- _ref: operators/_args.yaml
- _ref: operators/_array.yaml
- _ref: operators/_base64.yaml
- _ref: operators/_date.yaml
- _ref: operators/_diff.yaml
- _ref: operators/_divide.yaml
- _ref: operators/_eq.yaml
- _ref: operators/_event.yaml
- _ref: operators/_format.yaml
- _ref: operators/_function.yaml
- _ref: operators/_get.yaml
- _ref: operators/_global.yaml
- _ref: operators/_gt.yaml
- _ref: operators/_gte.yaml
- _ref: operators/_if.yaml
- _ref: operators/_if_none.yaml
- _ref: operators/_index.yaml
- _ref: operators/_input.yaml
- _ref: operators/_json.yaml
- _ref: operators/_list_contexts.yaml
- _ref: operators/_log.yaml
- _ref: operators/_lt.yaml
- _ref: operators/_lte.yaml
- _ref: operators/_math.yaml
- _ref: operators/_media.yaml
- _ref: operators/_menu.yaml
- _ref: operators/_mql.yaml
- _ref: operators/_ne.yaml
- _ref: operators/_not.yaml
- _ref: operators/_nunjucks.yaml
- _ref: operators/_object.yaml
- _ref: operators/_operator.yaml
- _ref: operators/_or.yaml
- _ref: operators/_product.yaml
- _ref: operators/_random.yaml
- _ref: operators/_ref.yaml
- _ref: operators/_regex.yaml
- _ref: operators/_request.yaml
- _ref: operators/_secret.yaml
- _ref: operators/_state.yaml
- _ref: operators/_string.yaml
- _ref: operators/_subtract.yaml
- _ref: operators/_sum.yaml
- _ref: operators/_type.yaml
- _ref: operators/_uri.yaml
- _ref: operators/_url_query.yaml
- _ref: operators/_uuid.yaml
- _ref: operators/_var.yaml
- _ref: operators/_yaml.yaml
- _ref: 404.yaml

View File

@ -13,7 +13,19 @@ module.exports = {
mode: 'production',
target: 'node',
node: false,
externals: ['fs', 'path', 'chokidar'],
externals: [
'fs',
'path',
'chokidar',
'oracledb',
'mssql',
'mysql',
'mysql2',
'pg',
'pg-query-stream',
'sqlite3',
'tedious',
],
module: {
rules: [
{

View File

@ -55,11 +55,17 @@
"graphql": "15.5.0",
"graphql-type-json": "0.3.2",
"jsonwebtoken": "8.5.1",
"knex": "0.95.4",
"mingo": "4.1.2",
"moment": "2.29.1",
"mongodb": "3.6.4",
"mssql": "6.3.1",
"mysql": "2.18.1",
"openid-client": "4.6.0",
"saslprep": "1.0.3"
"oracledb": "5.1.0",
"pg": "8.5.1",
"saslprep": "1.0.3",
"sqlite3": "5.0.2"
},
"devDependencies": {
"@babel/cli": "7.12.16",

View File

@ -0,0 +1,27 @@
/*
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.
*/
import schema from './KnexSchema.json';
import KnexBuilder from './KnexBuilder/KnexBuilder';
import KnexRaw from './KnexRaw/KnexRaw';
export default {
schema,
requests: {
KnexBuilder,
KnexRaw,
},
};

View File

@ -0,0 +1,60 @@
/*
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.
*/
import { validate } from '@lowdefy/ajv';
import Knex from './Knex';
const { schema } = Knex;
test('All requests are present', () => {
expect(Knex.requests.KnexRaw).toBeDefined();
expect(Knex.requests.KnexBuilder).toBeDefined();
});
test('valid connection schema, string connection', () => {
const connection = {
client: 'pg',
connection: 'postgresql://user:password@database.server.com:5432/db',
};
expect(validate({ schema, data: connection })).toEqual({ valid: true });
});
test('valid connection schema, object connection', () => {
const connection = {
client: 'pg',
connection: {
host: 'database.server.com',
user: 'user',
password: 'password',
database: 'db',
},
};
expect(validate({ schema, data: connection })).toEqual({ valid: true });
});
test('client missing', () => {
const connection = { connection: 'postgresql://user:password@database.server.com:5432/db' };
expect(() => validate({ schema, data: connection })).toThrow(
'Knex connection should have required property "client".'
);
});
test('client missing', () => {
const connection = { client: 'pg' };
expect(() => validate({ schema, data: connection })).toThrow(
'Knex connection should have required property "connection".'
);
});

View File

@ -0,0 +1,51 @@
/*
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.
*/
import knex from 'knex';
import { type } from '@lowdefy/helpers';
import schema from './KnexBuilderSchema.json';
async function knexBuilder({ request, connection }) {
let client = knex(connection);
if (request.tableName) {
client = client(request.tableName);
}
for (const method of request.query) {
if (Object.keys(method).length !== 1) {
throw new Error(
`Invalid query, more than one method defined in a method object, received ${JSON.stringify(
Object.keys(method)
)}.`
);
}
const methodName = Object.keys(method)[0];
const methodArgs = method[methodName];
if (!type.isArray(methodArgs)) {
throw new Error(
`Invalid query, method "${methodName}" arguments should be an array, received ${JSON.stringify(
methodArgs
)}.`
);
}
if (!type.isFunction(client[methodName])) {
throw new Error(`Invalid query builder method "${methodName}".`);
}
client = client[methodName](...methodArgs);
}
return client;
}
export default { resolver: knexBuilder, schema, checkRead: false, checkWrite: false };

View File

@ -0,0 +1,146 @@
/*
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.
*/
import { validate } from '@lowdefy/ajv';
import knex from 'knex';
import KnexBuilder from './KnexBuilder';
const mockKnexClient = jest.fn(() => mockKnexClient);
mockKnexClient.select = jest.fn(() => mockKnexClient);
mockKnexClient.from = jest.fn(() => mockKnexClient);
mockKnexClient.where = jest.fn(() => mockKnexClient);
jest.mock('knex', () => jest.fn(() => mockKnexClient));
const { resolver, schema } = KnexBuilder;
const connection = {
client: 'pg',
connection: 'connection',
};
test('KnexBuilder with tableName', async () => {
mockKnexClient.where.mockImplementationOnce(() =>
Promise.resolve([
{
name: 'steve',
},
])
);
const request = {
query: [{ select: ['*'] }, { where: ['name', 'steve'] }],
tableName: 'table',
};
const res = await resolver({ request, connection });
expect(knex.mock.calls).toEqual([
[
{
client: 'pg',
connection: 'connection',
},
],
]);
expect(mockKnexClient.mock.calls).toEqual([['table']]);
expect(mockKnexClient.select.mock.calls).toEqual([['*']]);
expect(mockKnexClient.where.mock.calls).toEqual([['name', 'steve']]);
expect(res).toEqual([
{
name: 'steve',
},
]);
});
test('KnexBuilder', async () => {
mockKnexClient.where.mockImplementationOnce(() =>
Promise.resolve([
{
name: 'steve',
},
])
);
const request = {
query: [{ select: ['*'] }, { from: ['table'] }, { where: ['name', 'steve'] }],
};
const res = await resolver({ request, connection });
expect(knex.mock.calls).toEqual([
[
{
client: 'pg',
connection: 'connection',
},
],
]);
expect(mockKnexClient.select.mock.calls).toEqual([['*']]);
expect(mockKnexClient.from.mock.calls).toEqual([['table']]);
expect(mockKnexClient.where.mock.calls).toEqual([['name', 'steve']]);
expect(res).toEqual([
{
name: 'steve',
},
]);
});
test('KnexBuilder, invalid method', async () => {
const request = {
query: [{ invalid: ['*'] }],
};
await expect(resolver({ request, connection })).rejects.toThrow(
'Invalid query builder method "invalid".'
);
});
test('KnexBuilder, more than one method', async () => {
const request = {
query: [{ select: ['*'], where: ['name', 'steve'] }],
};
await expect(resolver({ request, connection })).rejects.toThrow(
'Invalid query, more than one method defined in a method object, received ["select","where"].'
);
});
test('KnexBuilder, method args not an array', async () => {
const request = {
query: [{ select: '*' }],
};
await expect(resolver({ request, connection })).rejects.toThrow(
'Invalid query, method "select" arguments should be an array, received "*".'
);
});
test('valid request', () => {
let request = {
query: [{ select: ['*'] }, { from: ['table'] }],
};
expect(validate({ schema, data: request })).toEqual({ valid: true });
request = {
query: [{ select: ['*'] }],
tableName: 'table',
};
expect(validate({ schema, data: request })).toEqual({ valid: true });
request = {
query: [{ select: ['*'] }],
tableName: { t: 'table' },
};
expect(validate({ schema, data: request })).toEqual({ valid: true });
});
test('query missing', () => {
const request = {};
expect(() => validate({ schema, data: request })).toThrow(
'KnexBuilder request should have required property "query".'
);
});

View File

@ -0,0 +1,28 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Lowdefy Request Schema - KnexBuilder",
"type": "object",
"required": ["query"],
"properties": {
"query": {
"type": "array",
"description": "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.",
"errorMessage": {
"type": "KnexBuilder request property \"query\" should be an array."
}
},
"tableName": {
"type": ["string", "object"],
"description": "The name of the table to query from.",
"errorMessage": {
"type": "KnexBuilder request property \"tableName\" should be a string or object"
}
}
},
"errorMessage": {
"type": "KnexBuilder request properties should be an object.",
"required": {
"query": "KnexBuilder request should have required property \"query\"."
}
}
}

View File

@ -0,0 +1,31 @@
/*
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.
*/
import knex from 'knex';
import schema from './KnexRawSchema.json';
async function knexRaw({ request, connection }) {
const client = knex(connection);
const res = await client.raw(request.query, request.parameters);
Object.keys(res).forEach((key) => {
if (key.startsWith('_')) {
delete res[key];
}
});
return res;
}
export default { resolver: knexRaw, schema, checkRead: false, checkWrite: false };

View File

@ -0,0 +1,91 @@
/*
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.
*/
import { validate } from '@lowdefy/ajv';
import knex from 'knex';
import KnexRaw from './KnexRaw';
const mockRaw = jest.fn(() => {
return Promise.resolve({ rows: [{ name: 'name' }], _types: 'types' });
});
jest.mock('knex', () =>
jest.fn(() => ({
raw: mockRaw,
}))
);
const { resolver, schema } = KnexRaw;
const request = {
query: 'SELECT * FROM "table" WHERE "name" = :name',
parameters: { name: 'name' },
};
const connection = {
client: 'pg',
connection: 'connection',
};
test('knexRaw', async () => {
const res = await resolver({ request, connection });
expect(knex.mock.calls).toEqual([
[
{
client: 'pg',
connection: 'connection',
},
],
]);
expect(mockRaw.mock.calls).toEqual([
[
'SELECT * FROM "table" WHERE "name" = :name',
{
name: 'name',
},
],
]);
expect(res).toEqual({
rows: [
{
name: 'name',
},
],
});
});
test('valid request', () => {
let request = {
query: 'SELECT * FROM "table"',
};
expect(validate({ schema, data: request })).toEqual({ valid: true });
request = {
query: 'SELECT * FROM "table" WHERE "name" = :name',
parameters: { name: 'name' },
};
expect(validate({ schema, data: request })).toEqual({ valid: true });
request = {
query: 'SELECT * FROM "table" WHERE "name" = ?',
parameters: ['name'],
};
expect(validate({ schema, data: request })).toEqual({ valid: true });
});
test('query missing', () => {
const request = {};
expect(() => validate({ schema, data: request })).toThrow(
'KnexRaw request should have required property "query".'
);
});

View File

@ -0,0 +1,28 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Lowdefy Request Schema - KnexRaw",
"type": "object",
"required": ["query"],
"properties": {
"query": {
"type": "string",
"description": "SQL query string.",
"errorMessage": {
"type": "KnexRaw request property \"query\" should be a string."
}
},
"parameters": {
"type": ["string","number", "array", "object"],
"description": "SQL query parameters.",
"errorMessage": {
"type": "KnexRaw request property \"parameters\" should be a string, number, array, or object."
}
}
},
"errorMessage": {
"type": "KnexRaw request properties should be an object.",
"required": {
"query": "KnexRaw request should have required property \"query\"."
}
}
}

View File

@ -0,0 +1,43 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Lowdefy Connection Schema - Knex",
"type": "object",
"required": ["client", "connection"],
"properties": {
"client": {
"type": "string",
"description": "SQL query string.",
"errorMessage": {
"type": "Knex connection property \"client\" should be a string."
}
},
"connection": {
"type": ["string", "object"],
"description": "SQL query string.",
"errorMessage": {
"type": "Knex connection property \"connection\" should be a string or object."
}
},
"searchPath": {
"type": "string",
"description": "Set PostgreSQL search path.",
"errorMessage": {
"type": "Knex connection property \"searchPath\" should be a string."
}
},
"version": {
"type": "string",
"description": "Set database version.",
"errorMessage": {
"type": "Knex connection property \"version\" should be a string."
}
}
},
"errorMessage": {
"type": "Knex connection properties should be an object.",
"required": {
"client": "Knex connection should have required property \"client\".",
"connection": "Knex connection should have required property \"connection\"."
}
}
}

View File

@ -17,6 +17,7 @@
import AwsS3Bucket from './AwsS3Bucket/AwsS3Bucket';
import AxiosHttp from './AxiosHttp/AxiosHttp';
import GoogleSheet from './GoogleSheet/GoogleSheet';
import Knex from './Knex/Knex';
import MongoDBCollection from './MongoDBCollection/MongoDBCollection';
import SendGridMail from './SendGridMail/SendGridMail';
@ -24,6 +25,7 @@ const resolvers = {
AwsS3Bucket,
AxiosHttp,
GoogleSheet,
Knex,
MongoDBCollection,
SendGridMail,
};

View File

@ -21,6 +21,8 @@ import { ComponentController } from '../controllers/componentController';
const mockLog = jest.fn();
const mockSet = jest.fn();
const logger = {
log: mockLog,
};
@ -33,7 +35,7 @@ const config = {
getSecrets: mockGetSecrets,
};
const input = { req: { headers: { host: 'host' } } };
const input = { req: { headers: { host: 'host' } }, res: { set: mockSet } };
/* TODO:
- secrets can only be accessed where they should be
@ -91,5 +93,6 @@ test('setHeaders', async () => {
const contextFn = createContext(config);
const context = await contextFn(input);
const openIDController = context.getController('openId');
expect(openIDController.setHeaders).toBe(context.setHeaders);
openIDController.setHeader('key', 'value');
expect(mockSet.mock.calls).toEqual([['key', 'value']]);
});

View File

@ -777,3 +777,39 @@ describe('filter menus', () => {
});
});
});
test('Filter invalid menu item types', async () => {
mockLoadComponent.mockImplementation((id) => {
if (id === 'menus') {
return [
{
menuId: 'default',
links: [
{
id: 'menuitem:default:1',
menuItemId: '1',
type: 'MenuItem',
pageId: 'page',
auth: 'protected',
},
],
},
];
}
if (id === 'config') {
return {};
}
return null;
});
const controller = createComponentController(context);
const res = await controller.getMenus();
expect(res).toEqual({
homePageId: null,
menus: [
{
menuId: 'default',
links: [],
},
],
});
});

View File

@ -2,9 +2,7 @@ const path = require('path');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const { dependencies, devDependencies } = require('./package.json');
const externals = [...Object.keys(dependencies), ...Object.keys(devDependencies)].filter(
(name) => name !== 'saslprep'
);
const externals = [...Object.keys(dependencies), ...Object.keys(devDependencies)];
module.exports = {
entry: './src/index.js',

View File

@ -101,7 +101,9 @@ const RootQuery = ({ children, lowdefy }) => {
// User is authenticated but has removed idToken from localStorage.
lowdefy.auth.logout();
}
lowdefy.user = parseJwt(idToken);
// eslint-disable-next-line no-unused-vars
const { iat, exp, aud, iss, ...user } = parseJwt(idToken);
lowdefy.user = user;
}
return <>{children}</>;
};

723
yarn.lock

File diff suppressed because it is too large Load Diff