Compare commits
275 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
85a3558074 | ||
|
|
73a9ae1c9c | ||
|
|
2222ede420 | ||
|
|
c6d80a9b0e | ||
|
|
23c4414398 | ||
|
|
8b9320bbf9 | ||
|
|
a8ac288f17 | ||
|
|
ffe7de6774 | ||
|
|
d87a826493 | ||
|
|
645fe29060 | ||
|
|
4db738a7f6 | ||
|
|
253c2c4317 | ||
|
|
49755303f7 | ||
|
|
1e137f0bd8 | ||
|
|
c2579b1850 | ||
|
|
577d5215cd | ||
|
|
0870fa7e8f | ||
|
|
ddb3795985 | ||
|
|
45e98cd5b7 | ||
|
|
4a99b7a3f2 | ||
|
|
985132da78 | ||
|
|
315edea5ca | ||
|
|
27e0ef4e38 | ||
|
|
8090d8be5a | ||
|
|
8c8fd98bd5 | ||
|
|
6f724b5bec | ||
|
|
909cbd1f0c | ||
|
|
094de0ca21 | ||
|
|
af8ca4af9e | ||
|
|
709e788f5f | ||
|
|
1a4a1f7f8b | ||
|
|
ff0bde059a | ||
|
|
ac671110a3 | ||
|
|
30c95da90e | ||
|
|
0b52a1bd01 | ||
|
|
3fc7fce9ca | ||
|
|
f8df7987b8 | ||
|
|
697594b63e | ||
|
|
7be3923224 | ||
|
|
5b913aa30a | ||
|
|
da9cb7d6eb | ||
|
|
aca19f7f73 | ||
|
|
faf151cd62 | ||
|
|
675cd4de2a | ||
|
|
74ebe492c5 | ||
|
|
254fcecf33 | ||
|
|
a334864980 | ||
|
|
b6b377c209 | ||
|
|
5f76aa02dd | ||
|
|
0ba0c998e9 | ||
|
|
2e54216469 | ||
|
|
56dbe62cad | ||
|
|
048db60a10 | ||
|
|
f3b1b2254f | ||
|
|
e705aaa2f6 | ||
|
|
1f80f843ba | ||
|
|
02a76418fc | ||
|
|
d1245705de | ||
|
|
6d74f7c64d | ||
|
|
bf1076b7d2 | ||
|
|
7175d92eaf | ||
|
|
f30ac46672 | ||
|
|
0970db3295 | ||
|
|
5d24216124 | ||
|
|
9a55333ce8 | ||
|
|
cb58ab5fb7 | ||
|
|
5d9ed13003 | ||
|
|
5b51cb30f5 | ||
|
|
d8c5850eaa | ||
|
|
4839b100cb | ||
|
|
469050914b | ||
|
|
8036d20bf9 | ||
|
|
f04597335f | ||
|
|
3d26ca6cc2 | ||
|
|
ec3454291b | ||
|
|
21e2f394a9 | ||
|
|
dd9f69e4cd | ||
|
|
f7e8cb24ee | ||
|
|
3b5a77ec22 | ||
|
|
16715129d1 | ||
|
|
3aafaabda6 | ||
|
|
279abfedfd | ||
|
|
e77580dd35 | ||
|
|
9cde662092 | ||
|
|
862734c572 | ||
|
|
61dc611588 | ||
|
|
03368e2cca | ||
|
|
6382325280 | ||
|
|
a5b0910b60 | ||
|
|
ba1e1ef20c | ||
|
|
dd8bab299d | ||
|
|
1125f31810 | ||
|
|
ef3c93a907 | ||
|
|
89bcaa96ed | ||
|
|
ce1eecf82e | ||
|
|
3164663b4f | ||
|
|
4f99bc36d0 | ||
|
|
179c0a39d4 | ||
|
|
0fefa4e43a | ||
|
|
d4e8eb276d | ||
|
|
fd3c26ad73 | ||
|
|
d9f9056515 | ||
|
|
d326b5a36a | ||
|
|
8c4970b550 | ||
|
|
51ccdf3577 | ||
|
|
f79245d24a | ||
|
|
e8d8a5e89d | ||
|
|
b1dddcb511 | ||
|
|
af45b8a1e4 | ||
|
|
2c8b60ab9b | ||
|
|
75196cbf84 | ||
|
|
5d80fd523c | ||
|
|
22dc61f39b | ||
|
|
f4611d88cd | ||
|
|
346a706e41 | ||
|
|
3c62f182ab | ||
|
|
67964192de | ||
|
|
c6f62fd078 | ||
|
|
8ea547c1d7 | ||
|
|
c5fedda195 | ||
|
|
8300a4b6df | ||
|
|
32e77de8bb | ||
|
|
e1c080f237 | ||
|
|
6995323a45 | ||
|
|
46bfc597ec | ||
|
|
0abc614a78 | ||
|
|
7518456fe8 | ||
|
|
4ab76e7507 | ||
|
|
1cf5a88582 | ||
|
|
14a8551e82 | ||
|
|
4b0916a214 | ||
|
|
e451dd2262 | ||
|
|
2e4ecfab16 | ||
|
|
8c343abac5 | ||
|
|
39ac3ff4c2 | ||
|
|
677880c633 | ||
|
|
bd2f2cbf64 | ||
|
|
4129264d1d | ||
|
|
f9133a6e96 | ||
|
|
57a23946cc | ||
|
|
6faa45ac16 | ||
|
|
bf62ebd20a | ||
|
|
687c6a09bc | ||
|
|
77a7df1cff | ||
|
|
05ce3edb80 | ||
|
|
2564d7d976 | ||
|
|
2f06cda82b | ||
|
|
945b777c3c | ||
|
|
d2a6c45fd6 | ||
|
|
b5436fe7fa | ||
|
|
82e3b40e7c | ||
|
|
0f4f36c654 | ||
|
|
d83e8dabf8 | ||
|
|
397926f994 | ||
|
|
8d8a9f7c78 | ||
|
|
40b8860e7c | ||
|
|
9978241329 | ||
|
|
666a1ab81e | ||
|
|
1d6ed8d9d0 | ||
|
|
34e2c77934 | ||
|
|
f47d912074 | ||
|
|
f25b67c81c | ||
|
|
08e60e6961 | ||
|
|
c393a80185 | ||
|
|
8e28ec491c | ||
|
|
2e391cc651 | ||
|
|
2e0b2191c0 | ||
|
|
4240849a2a | ||
|
|
a0f0db1dd4 | ||
|
|
e455497596 | ||
|
|
bb99dd82ba | ||
|
|
48ccddb555 | ||
|
|
23f56e4deb | ||
|
|
ef27c9348b | ||
|
|
cb664b563d | ||
|
|
53f38c583a | ||
|
|
12622e2045 | ||
|
|
36dfedbaab | ||
|
|
d3a059d759 | ||
|
|
9ba1351a3b | ||
|
|
399f8ed1db | ||
|
|
d36b5e8091 | ||
|
|
fc616e818a | ||
|
|
edd438c37f | ||
|
|
92e5ae0ebd | ||
|
|
d3e13c30a6 | ||
|
|
6bf0e799a1 | ||
|
|
166dda4a4b | ||
|
|
901605fd9c | ||
|
|
e3e8f570f8 | ||
|
|
6fdfdefe5c | ||
|
|
5cc1afa6de | ||
|
|
4398570583 | ||
|
|
2e5b354f49 | ||
|
|
11f96e8039 | ||
|
|
7ae1a079ea | ||
|
|
b6d2624c4a | ||
|
|
51d6362863 | ||
|
|
e30bfe67ed | ||
|
|
c5bcebad9a | ||
|
|
5deead7f94 | ||
|
|
2cff284122 | ||
|
|
5c78e6e7bf | ||
|
|
e8b06e9b78 | ||
|
|
d67db9c63e | ||
|
|
0dfdbc809c | ||
|
|
adddf23ae3 | ||
|
|
eac3fd24a1 | ||
|
|
599c0f8cfc | ||
|
|
b1ec8467a6 | ||
|
|
d2b8d2beff | ||
|
|
a415c7ef4e | ||
|
|
1faf86a9cb | ||
|
|
3b7d2e9238 | ||
|
|
829d0cafe9 | ||
|
|
a103ca9747 | ||
|
|
81c41ef5ee | ||
|
|
10e2794ff9 | ||
|
|
6d3606abf0 | ||
|
|
bbace2b2c1 | ||
|
|
5aa937f56a | ||
|
|
44159af83e | ||
|
|
98041b7af2 | ||
|
|
72e1fe3c21 | ||
|
|
af8d1190c5 | ||
|
|
b07e564a23 | ||
|
|
4b8ac0ff9c | ||
|
|
0d479426ed | ||
|
|
e956b2d959 | ||
|
|
580e97ffe3 | ||
|
|
1cb951056a | ||
|
|
a973887db2 | ||
|
|
86ae81526a | ||
|
|
9d62a552fe | ||
|
|
5497084b57 | ||
|
|
39b7effc26 | ||
|
|
2c847f62af | ||
|
|
01ac26de8c | ||
|
|
c579eebd16 | ||
|
|
47afd60ddf | ||
|
|
f432e72253 | ||
|
|
d572623552 | ||
|
|
3a129557e0 | ||
|
|
49fac8f147 | ||
|
|
3140fb2435 | ||
|
|
22cea145f8 | ||
|
|
6c93d46ec1 | ||
|
|
3c73064b19 | ||
|
|
247ac1f96f | ||
|
|
642f32ab4e | ||
|
|
41cb1c71c7 | ||
|
|
41de2aa769 | ||
|
|
e9e7b679f4 | ||
|
|
c9022f4208 | ||
|
|
0a4877993d | ||
|
|
ca74fa626a | ||
|
|
608038cbcc | ||
|
|
bf009ae13b | ||
|
|
bdb7a1b840 | ||
|
|
d2b0a57064 | ||
|
|
dbceed563a | ||
|
|
cbf1d86c26 | ||
|
|
06a2014bc1 | ||
|
|
ad46b3eea3 | ||
|
|
5df7867b6d | ||
|
|
ceea962464 | ||
|
|
72386bc589 | ||
|
|
34068a8188 | ||
|
|
414d521588 | ||
|
|
d15e3d4c36 | ||
|
|
81b850c1f7 | ||
|
|
527dfe6971 | ||
|
|
d681d06de1 | ||
|
|
9fe8ef0238 | ||
|
|
99640b3d73 |
@ -10,7 +10,7 @@
|
||||
|
||||
There are other existing solutions in the market, like Zapier and Integromat, so you might be wondering why you should use Automatisch.
|
||||
|
||||
✅ The most significant advantage of having Automatisch is keeping your data on your own servers. Not all companies want to use an automation service in the cloud, and the current open-source or self-hosted solutions mainly focus on developers rather than a user without a technical background.
|
||||
✅ One of the main benefits of using Automatisch is that it allows you to store your data on your own servers, which is essential for businesses that handle sensitive user information and cannot risk sharing it with external cloud services. This is especially relevant for industries such as healthcare and finance, as well as for European companies that must adhere to the General Data Protection Regulation (GDPR).
|
||||
|
||||
🤓 Your contributions are vital to the development of Automatisch. As an open-source software, anyone can have an impact on how it is being developed.
|
||||
|
||||
@ -27,13 +27,15 @@ The official documentation can be found here: [https://automatisch.io/docs](http
|
||||
git clone git@github.com:automatisch/automatisch.git
|
||||
|
||||
# Go to the repository folder
|
||||
cd automatisch/docker/compose
|
||||
cd automatisch
|
||||
|
||||
# Start
|
||||
docker compose up
|
||||
```
|
||||
|
||||
You can use `user@automatisch.io` email address and `sample` password to login to Automatisch. You can also change your email and password later on from the settings page.
|
||||
You can use `user@automatisch.io` email address and `sample` password to login to Automatisch. Please do not forget to change your email and password from the settings page.
|
||||
|
||||
For other installation types, you can check the [installation](https://automatisch.io/docs/guide/installation) guide.
|
||||
|
||||
## Community Links
|
||||
|
||||
|
||||
70
docker-compose.yml
Normal file
70
docker-compose.yml
Normal file
@ -0,0 +1,70 @@
|
||||
version: '3.9'
|
||||
services:
|
||||
main:
|
||||
build:
|
||||
context: ./docker
|
||||
dockerfile: Dockerfile.compose
|
||||
entrypoint: /compose-entrypoint.sh
|
||||
ports:
|
||||
- '3000:3000'
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_started
|
||||
environment:
|
||||
- HOST=localhost
|
||||
- PROTOCOL=http
|
||||
- PORT=3000
|
||||
- APP_ENV=production
|
||||
- REDIS_HOST=redis
|
||||
- POSTGRES_HOST=postgres
|
||||
- POSTGRES_DATABASE=automatisch
|
||||
- POSTGRES_USERNAME=automatisch_user
|
||||
- POSTGRES_PASSWORD=automatisch_password
|
||||
- ENCRYPTION_KEY
|
||||
- WEBHOOK_SECRET_KEY
|
||||
- APP_SECRET_KEY
|
||||
volumes:
|
||||
- automatisch_storage:/automatisch/storage
|
||||
worker:
|
||||
build:
|
||||
context: ./docker
|
||||
dockerfile: Dockerfile.compose
|
||||
entrypoint: /compose-entrypoint.sh
|
||||
depends_on:
|
||||
- main
|
||||
environment:
|
||||
- APP_ENV=production
|
||||
- REDIS_HOST=redis
|
||||
- POSTGRES_HOST=postgres
|
||||
- POSTGRES_DATABASE=automatisch
|
||||
- POSTGRES_USERNAME=automatisch_user
|
||||
- POSTGRES_PASSWORD=automatisch_password
|
||||
- ENCRYPTION_KEY
|
||||
- WEBHOOK_SECRET_KEY
|
||||
- APP_SECRET_KEY
|
||||
- WORKER=true
|
||||
volumes:
|
||||
- automatisch_storage:/automatisch/storage
|
||||
postgres:
|
||||
image: 'postgres:14.5'
|
||||
environment:
|
||||
- POSTGRES_DB=automatisch
|
||||
- POSTGRES_USER=automatisch_user
|
||||
- POSTGRES_PASSWORD=automatisch_password
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ['CMD-SHELL', 'pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}']
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
redis:
|
||||
image: 'redis:7.0.4'
|
||||
volumes:
|
||||
- redis_data:/data
|
||||
volumes:
|
||||
automatisch_storage:
|
||||
postgres_data:
|
||||
redis_data:
|
||||
14
docker/Dockerfile
Normal file
14
docker/Dockerfile
Normal file
@ -0,0 +1,14 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
FROM node:16-alpine
|
||||
WORKDIR /automatisch
|
||||
|
||||
RUN apk --no-cache add --virtual build-dependencies python3 build-base
|
||||
|
||||
COPY ./entrypoint.sh /entrypoint.sh
|
||||
|
||||
RUN yarn global add @automatisch/cli@0.4.0 --network-timeout 1000000
|
||||
|
||||
RUN apk del build-dependencies python3 build-base
|
||||
|
||||
EXPOSE 3000
|
||||
ENTRYPOINT ["sh", "/entrypoint.sh"]
|
||||
11
docker/Dockerfile.compose
Normal file
11
docker/Dockerfile.compose
Normal file
@ -0,0 +1,11 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
FROM automatischio/automatisch:0.4.0
|
||||
WORKDIR /automatisch
|
||||
|
||||
RUN apk add --no-cache openssl dos2unix
|
||||
|
||||
COPY ./compose-entrypoint.sh /compose-entrypoint.sh
|
||||
RUN dos2unix /compose-entrypoint.sh
|
||||
|
||||
EXPOSE 3000
|
||||
ENTRYPOINT ["sh", "/compose-entrypoint.sh"]
|
||||
26
docker/compose-entrypoint.sh
Executable file
26
docker/compose-entrypoint.sh
Executable file
@ -0,0 +1,26 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
if [ ! -f /automatisch/storage/.env ]; then
|
||||
>&2 echo "Saving environment variables"
|
||||
ENCRYPTION_KEY="${ENCRYPTION_KEY:-$(openssl rand -base64 36)}"
|
||||
WEBHOOK_SECRET_KEY="${WEBHOOK_SECRET_KEY:-$(openssl rand -base64 36)}"
|
||||
APP_SECRET_KEY="${APP_SECRET_KEY:-$(openssl rand -base64 36)}"
|
||||
echo "ENCRYPTION_KEY=$ENCRYPTION_KEY" >> /automatisch/storage/.env
|
||||
echo "WEBHOOK_SECRET_KEY=$WEBHOOK_SECRET_KEY" >> /automatisch/storage/.env
|
||||
echo "APP_SECRET_KEY=$APP_SECRET_KEY" >> /automatisch/storage/.env
|
||||
fi
|
||||
|
||||
# initiate env. vars. from /automatisch/storage/.env file
|
||||
export $(grep -v '^#' /automatisch/storage/.env | xargs)
|
||||
|
||||
# migration for webhook secret key, will be removed in the future.
|
||||
if [[ -z "${WEBHOOK_SECRET_KEY}" ]]; then
|
||||
WEBHOOK_SECRET_KEY="$(openssl rand -base64 36)"
|
||||
echo "WEBHOOK_SECRET_KEY=$WEBHOOK_SECRET_KEY" >> /automatisch/storage/.env
|
||||
fi
|
||||
|
||||
echo "Environment variables have been set!"
|
||||
|
||||
sh /entrypoint.sh
|
||||
@ -1,47 +0,0 @@
|
||||
version: '3.9'
|
||||
services:
|
||||
main:
|
||||
build:
|
||||
context: ../images/wait-for-postgres
|
||||
network: host
|
||||
ports:
|
||||
- '3000:3000'
|
||||
depends_on:
|
||||
- postgres
|
||||
- redis
|
||||
environment:
|
||||
- HOST=localhost
|
||||
- PROTOCOL=http
|
||||
- PORT=3000
|
||||
- APP_ENV=production
|
||||
- REDIS_HOST=redis
|
||||
- POSTGRES_HOST=postgres
|
||||
- POSTGRES_DATABASE=automatisch
|
||||
- POSTGRES_USERNAME=automatisch_user
|
||||
volumes:
|
||||
- automatisch_storage:/automatisch/storage
|
||||
worker:
|
||||
build:
|
||||
context: ../images/plain
|
||||
network: host
|
||||
depends_on:
|
||||
- main
|
||||
environment:
|
||||
- APP_ENV=production
|
||||
- REDIS_HOST=redis
|
||||
- POSTGRES_HOST=postgres
|
||||
- POSTGRES_DATABASE=automatisch
|
||||
- POSTGRES_USERNAME=automatisch_user
|
||||
command: automatisch start-worker --env-file /automatisch/storage/.env
|
||||
volumes:
|
||||
- automatisch_storage:/automatisch/storage
|
||||
postgres:
|
||||
image: 'postgres:14.5'
|
||||
environment:
|
||||
POSTGRES_HOST_AUTH_METHOD: trust
|
||||
POSTGRES_DB: automatisch
|
||||
POSTGRES_USER: automatisch_user
|
||||
redis:
|
||||
image: 'redis:7.0.4'
|
||||
volumes:
|
||||
automatisch_storage:
|
||||
9
docker/entrypoint.sh
Executable file
9
docker/entrypoint.sh
Executable file
@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
if [ -n "$WORKER" ]; then
|
||||
automatisch start-worker
|
||||
else
|
||||
automatisch start
|
||||
fi
|
||||
@ -1,5 +0,0 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
FROM node:16
|
||||
WORKDIR /automatisch
|
||||
|
||||
RUN yarn global add @automatisch/cli@0.1.5
|
||||
@ -1,15 +0,0 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
FROM node:16
|
||||
WORKDIR /automatisch
|
||||
|
||||
RUN apt-get update && apt-get install -y postgresql-client
|
||||
COPY ./wait-for-postgres.sh /automatisch/wait-for-postgres.sh
|
||||
|
||||
RUN mkdir -p /automatisch/storage
|
||||
RUN touch /automatisch/storage/.env
|
||||
RUN echo "ENCRYPTION_KEY=$(openssl rand -base64 36)" >> /automatisch/storage/.env
|
||||
RUN echo "APP_SECRET_KEY=$(openssl rand -base64 36)" >> /automatisch/storage/.env
|
||||
RUN yarn global add @automatisch/cli@0.1.5
|
||||
|
||||
EXPOSE 3000
|
||||
CMD sh /automatisch/wait-for-postgres.sh automatisch start --env-file=/automatisch/storage/.env
|
||||
@ -1,11 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
until psql -h "$POSTGRES_HOST" -U "$POSTGRES_USERNAME" -d "$POSTGRES_HOST" -c '\q'; do
|
||||
>&2 echo "Postgres is unavailable - sleeping"
|
||||
sleep 1
|
||||
done
|
||||
|
||||
>&2 echo "Postgres is up - executing command"
|
||||
exec "$@"
|
||||
@ -1,6 +1,8 @@
|
||||
{
|
||||
"packages": ["packages/*"],
|
||||
"version": "0.1.5",
|
||||
"packages": [
|
||||
"packages/*"
|
||||
],
|
||||
"version": "0.4.0",
|
||||
"npmClient": "yarn",
|
||||
"useWorkspaces": true,
|
||||
"command": {
|
||||
|
||||
@ -2,6 +2,7 @@ HOST=localhost
|
||||
PROTOCOL=http
|
||||
PORT=3000
|
||||
WEB_APP_URL=http://localhost:3001
|
||||
WEBHOOK_URL=http://localhost:3000
|
||||
APP_ENV=development
|
||||
POSTGRES_DATABASE=automatisch_development
|
||||
POSTGRES_PORT=5432
|
||||
@ -10,8 +11,12 @@ POSTGRES_USERNAME=automatish_development_user
|
||||
POSTGRES_PASSWORD=
|
||||
POSTGRES_ENABLE_SSL=false
|
||||
ENCRYPTION_KEY=sample-encryption-key
|
||||
WEBHOOK_SECRET_KEY=sample-webhook-key
|
||||
APP_SECRET_KEY=sample-app-secret-key
|
||||
REDIS_PORT=6379
|
||||
REDIS_HOST=127.0.0.1
|
||||
REDIS_USERNAME=redis_username
|
||||
REDIS_PASSWORD=redis_password
|
||||
REDIS_TLS=true
|
||||
ENABLE_BULLMQ_DASHBOARD=false
|
||||
SERVE_WEB_APP_SEPARATELY=true
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@automatisch/backend",
|
||||
"version": "0.1.5",
|
||||
"version": "0.4.0",
|
||||
"license": "AGPL-3.0",
|
||||
"description": "The open source Zapier alternative. Build workflow automation without spending time and money.",
|
||||
"scripts": {
|
||||
@ -22,7 +22,7 @@
|
||||
"prebuild": "rm -rf ./dist"
|
||||
},
|
||||
"dependencies": {
|
||||
"@automatisch/web": "^0.1.5",
|
||||
"@automatisch/web": "^0.4.0",
|
||||
"@bull-board/express": "^3.10.1",
|
||||
"@graphql-tools/graphql-file-loader": "^7.3.4",
|
||||
"@graphql-tools/load": "^7.5.2",
|
||||
@ -37,7 +37,7 @@
|
||||
"crypto-js": "^4.1.1",
|
||||
"debug": "~2.6.9",
|
||||
"dotenv": "^10.0.0",
|
||||
"express": "~4.16.1",
|
||||
"express": "~4.18.2",
|
||||
"express-basic-auth": "^1.2.1",
|
||||
"express-graphql": "^0.12.0",
|
||||
"fast-xml-parser": "^4.0.11",
|
||||
@ -46,11 +46,12 @@
|
||||
"graphql-tools": "^8.2.0",
|
||||
"graphql-type-json": "^0.3.2",
|
||||
"http-errors": "~1.6.3",
|
||||
"jsonwebtoken": "^8.5.1",
|
||||
"knex": "^0.95.11",
|
||||
"jsonwebtoken": "^9.0.0",
|
||||
"knex": "^2.4.0",
|
||||
"lodash.get": "^4.4.2",
|
||||
"luxon": "2.3.1",
|
||||
"luxon": "2.5.2",
|
||||
"morgan": "^1.10.0",
|
||||
"multer": "1.4.5-lts.1",
|
||||
"nodemailer": "6.7.0",
|
||||
"oauth-1.0a": "^2.2.6",
|
||||
"objection": "^3.0.0",
|
||||
@ -93,16 +94,17 @@
|
||||
"url": "https://github.com/automatisch/automatisch/issues"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@automatisch/types": "^0.1.5",
|
||||
"@automatisch/types": "^0.4.0",
|
||||
"@types/bcrypt": "^5.0.0",
|
||||
"@types/bull": "^3.15.8",
|
||||
"@types/cors": "^2.8.12",
|
||||
"@types/crypto-js": "^4.0.2",
|
||||
"@types/express": "^4.17.13",
|
||||
"@types/express": "^4.17.15",
|
||||
"@types/http-errors": "^1.8.1",
|
||||
"@types/jsonwebtoken": "^8.5.8",
|
||||
"@types/lodash.get": "^4.4.6",
|
||||
"@types/morgan": "^1.9.3",
|
||||
"@types/multer": "1.4.7",
|
||||
"@types/node": "^16.10.2",
|
||||
"@types/nodemailer": "^6.4.4",
|
||||
"@types/pg": "^8.6.1",
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
import createError from 'http-errors';
|
||||
import express, { Request, Response, NextFunction } from 'express';
|
||||
import express from 'express';
|
||||
import cors from 'cors';
|
||||
import corsOptions from './config/cors-options';
|
||||
import graphQLInstance from './helpers/graphql-instance';
|
||||
import morgan from './helpers/morgan';
|
||||
import appAssetsHandler from './helpers/app-assets-handler';
|
||||
import webUIHandler from './helpers/web-ui-handler';
|
||||
@ -13,6 +12,8 @@ import {
|
||||
serverAdapter,
|
||||
} from './helpers/create-bull-board-handler';
|
||||
import injectBullBoardHandler from './helpers/inject-bull-board-handler';
|
||||
import router from './routes';
|
||||
import { IRequest } from '@automatisch/types';
|
||||
|
||||
createBullBoardHandler(serverAdapter);
|
||||
|
||||
@ -23,15 +24,26 @@ injectBullBoardHandler(app, serverAdapter);
|
||||
appAssetsHandler(app);
|
||||
|
||||
app.use(morgan);
|
||||
app.use(express.json());
|
||||
app.use(express.urlencoded({ extended: false }));
|
||||
app.use(
|
||||
express.json({
|
||||
verify(req, res, buf) {
|
||||
(req as IRequest).rawBody = buf;
|
||||
},
|
||||
})
|
||||
);
|
||||
app.use(express.urlencoded({
|
||||
extended: false,
|
||||
verify(req, res, buf) {
|
||||
(req as IRequest).rawBody = buf;
|
||||
},
|
||||
}));
|
||||
app.use(cors(corsOptions));
|
||||
app.use('/graphql', graphQLInstance);
|
||||
app.use('/', router);
|
||||
|
||||
webUIHandler(app);
|
||||
|
||||
// catch 404 and forward to error handler
|
||||
app.use(function (req: Request, res: Response, next: NextFunction) {
|
||||
app.use(function (req, res, next) {
|
||||
next(createError(404));
|
||||
});
|
||||
|
||||
|
||||
3
packages/backend/src/apps/deepl/actions/index.ts
Normal file
3
packages/backend/src/apps/deepl/actions/index.ts
Normal file
@ -0,0 +1,3 @@
|
||||
import translateText from './translate-text';
|
||||
|
||||
export default [translateText];
|
||||
@ -0,0 +1,77 @@
|
||||
import qs from 'qs';
|
||||
import defineAction from '../../../../helpers/define-action';
|
||||
|
||||
export default defineAction({
|
||||
name: 'Translate Text',
|
||||
key: 'translateText',
|
||||
description: 'Translates text from one language to another.',
|
||||
arguments: [
|
||||
{
|
||||
label: 'Text',
|
||||
key: 'text',
|
||||
type: 'string' as const,
|
||||
required: true,
|
||||
description: 'Text to be translated.',
|
||||
variables: true,
|
||||
},
|
||||
{
|
||||
label: 'Target Language',
|
||||
key: 'targetLanguage',
|
||||
type: 'dropdown' as const,
|
||||
required: true,
|
||||
description: 'Language to translate the text to.',
|
||||
variables: false,
|
||||
value: '',
|
||||
options: [
|
||||
{ label: 'Bulgarian', value: 'BG' },
|
||||
{ label: 'Chinese (simplified)', value: 'ZH' },
|
||||
{ label: 'Czech', value: 'CS' },
|
||||
{ label: 'Danish', value: 'DA' },
|
||||
{ label: 'Dutch', value: 'NL' },
|
||||
{ label: 'English', value: 'EN' },
|
||||
{ label: 'English (American)', value: 'EN-US' },
|
||||
{ label: 'English (British)', value: 'EN-GB' },
|
||||
{ label: 'Estonian', value: 'ET' },
|
||||
{ label: 'Finnish', value: 'FI' },
|
||||
{ label: 'French', value: 'FR' },
|
||||
{ label: 'German', value: 'DE' },
|
||||
{ label: 'Greek', value: 'EL' },
|
||||
{ label: 'Hungarian', value: 'HU' },
|
||||
{ label: 'Indonesian', value: 'ID' },
|
||||
{ label: 'Italian', value: 'IT' },
|
||||
{ label: 'Japanese', value: 'JA' },
|
||||
{ label: 'Latvian', value: 'LV' },
|
||||
{ label: 'Lithuanian', value: 'LT' },
|
||||
{ label: 'Polish', value: 'PL' },
|
||||
{ label: 'Portuguese', value: 'PT' },
|
||||
{ label: 'Portuguese (Brazilian)', value: 'PT-BR' },
|
||||
{
|
||||
label:
|
||||
'Portuguese (all Portuguese varieties excluding Brazilian Portuguese)',
|
||||
value: 'PT-PT',
|
||||
},
|
||||
{ label: 'Romanian', value: 'RO' },
|
||||
{ label: 'Russian', value: 'RU' },
|
||||
{ label: 'Slovak', value: 'SK' },
|
||||
{ label: 'Slovenian', value: 'SL' },
|
||||
{ label: 'Spanish', value: 'ES' },
|
||||
{ label: 'Swedish', value: 'SV' },
|
||||
{ label: 'Turkish', value: 'TR' },
|
||||
{ label: 'Ukrainian', value: 'UK' },
|
||||
],
|
||||
},
|
||||
],
|
||||
|
||||
async run($) {
|
||||
const stringifiedBody = qs.stringify({
|
||||
text: $.step.parameters.text,
|
||||
target_lang: $.step.parameters.targetLanguage,
|
||||
});
|
||||
|
||||
const response = await $.http.post('/v2/translate', stringifiedBody);
|
||||
|
||||
$.setActionItem({
|
||||
raw: response.data,
|
||||
});
|
||||
},
|
||||
});
|
||||
39
packages/backend/src/apps/deepl/assets/favicon.svg
Normal file
39
packages/backend/src/apps/deepl/assets/favicon.svg
Normal file
@ -0,0 +1,39 @@
|
||||
<svg width="128" height="128" xmlns="http://www.w3.org/2000/svg">
|
||||
<metadata id="metadata4177">image/svg+xml</metadata>
|
||||
<defs>
|
||||
<clipPath id="clipPath4187" clipPathUnits="userSpaceOnUse">
|
||||
<path id="path4189" d="m70.850157,393.069981l708.661,0l0,-425.197l-708.661,0l0,425.197z"/>
|
||||
</clipPath>
|
||||
</defs>
|
||||
<g>
|
||||
<title>background</title>
|
||||
<rect fill="#ffffff" id="canvas_background" height="130" width="130" y="-1" x="-1"/>
|
||||
</g>
|
||||
<g>
|
||||
<title>Layer 1</title>
|
||||
<g fill="#FFF" transform="matrix(1.36265596065192,0,0,-1.3395561298863794,-403.63320244005325,311.0674198374575) " id="g4179">
|
||||
<g fill="#FFF" id="g4183">
|
||||
<g fill="#FFF" clip-path="url(#clipPath4187)" id="g4185">
|
||||
<g fill="#FFF" id="g4191">
|
||||
<path fill="#000000" fill-rule="nonzero" id="path4193" d="m411.83557,185.452083c0,-2.425 -0.463,-4.637 -1.3,-6.226c-1.009,-1.905 -2.173,-3.234 -3.366,-3.843c-1.641,-0.835 -3.707,-1.69 -6.586,-1.69l-4.044,0l0,22.753l3.221,0c4.28,0 7.213,-0.841 8.971,-2.572c2.09,-2.059 3.104,-4.814 3.104,-8.422m-1.89,15.206c-2.434,1.24 -6.053,1.24 -10.633,1.24l-7.069,0c-1.158,0 -2.097,-0.939 -2.097,-2.097l0,-29.463c0,-1.157 0.939,-2.096 2.097,-2.096l6.662,0c3.78,0 7.209,0.393 9.411,1.079c1.585,0.491 3.181,1.529 5.022,3.27c1.559,1.472 2.785,3.317 3.642,5.484c0.886,2.243 1.318,4.609 1.318,7.232c0,3.66 -0.771,6.809 -2.359,9.622c-1.441,2.558 -3.344,4.377 -5.994,5.729"/>
|
||||
</g>
|
||||
<g fill="#FFF" id="g4195">
|
||||
<path fill="#000000" fill-rule="nonzero" id="path4197" d="m533.882353,173.693278l-10.436,0l0,27.36c0,0.467 -0.38,0.845 -0.845,0.845l-4.702,0c-0.466,0 -0.845,-0.378 -0.845,-0.845l0,-31.966c0,-0.467 0.379,-0.846 0.845,-0.846l15.983,0c0.465,0 0.848,0.379 0.848,0.846l0,3.759c0,0.469 -0.383,0.847 -0.848,0.847"/>
|
||||
</g>
|
||||
<g fill="#FFF" id="g4199">
|
||||
<path fill="#000000" fill-rule="nonzero" id="path4201" d="m506.182158,181.465785c0,-2.225 -0.685,-4.08 -2.034,-5.516c-1.35,-1.437 -3.039,-2.167 -5.017,-2.167c-2.038,0 -3.751,0.718 -5.096,2.13c-1.34,1.415 -2.022,3.291 -2.022,5.576c0,2.242 0.682,4.081 2.024,5.471c1.343,1.391 3.056,2.096 5.094,2.096c2.026,0 3.724,-0.716 5.05,-2.132c1.326,-1.412 2.001,-3.249 2.001,-5.458m-5.813,13.324c-1.536,0 -3.091,-0.305 -4.385,-0.862c-1.508,-0.646 -2.894,-1.553 -3.903,-2.554l-0.601,-0.48l-2.708,2.543l-2.843,0c-0.465,0 -0.842,-0.377 -0.842,-0.842l0,-32.911c0,-0.467 0.378,-0.845 0.845,-0.845l4.701,0c0.467,0 0.847,0.379 0.847,0.847l0,12.166l0.598,-0.455c1.287,-1.204 2.95,-2.034 4.125,-2.52c1.249,-0.516 2.621,-0.78 4.076,-0.78c3.306,0 6.085,1.248 8.499,3.812c2.408,2.557 3.581,5.661 3.581,9.488c0,3.886 -1.176,7.13 -3.505,9.64c-2.302,2.491 -5.157,3.753 -8.485,3.753"/>
|
||||
</g>
|
||||
<g fill="#FFF" id="g4203">
|
||||
<path fill="#000000" fill-rule="nonzero" id="path4205" d="m460.078642,184.036586l0.149,0.387c0.847,1.866 1.627,3.045 2.381,3.604c1.364,1.009 2.965,1.522 4.765,1.522c1.543,0 3.024,-0.499 4.396,-1.485c1.209,-0.865 2.09,-2.13 2.533,-3.616l0.101,-0.412l-14.325,0zm6.978,10.753c-3.801,0 -6.871,-1.255 -9.39,-3.836c-2.52,-2.584 -3.745,-5.741 -3.745,-9.651c0,-3.815 1.228,-6.902 3.757,-9.439c2.526,-2.535 5.709,-3.766 9.73,-3.766c2.584,0 4.824,0.454 6.656,1.348c1.543,0.752 2.915,1.843 4.079,3.243c0.167,0.203 0.233,0.472 0.172,0.728c-0.056,0.257 -0.23,0.472 -0.469,0.583l-3.782,1.739c-0.3,0.138 -0.656,0.089 -0.907,-0.128c-1.691,-1.459 -3.641,-2.2 -5.797,-2.2c-2.156,0 -3.793,0.489 -5.008,1.493c-1.29,1.072 -2.003,2.191 -2.332,3.679l19.696,0c0.466,0 0.842,0.375 0.844,0.841l0.007,0.835c0,4.359 -1.369,8.256 -3.757,10.695c-2.529,2.581 -5.718,3.836 -9.754,3.836"/>
|
||||
</g>
|
||||
<g fill="#FFF" id="g4207">
|
||||
<path fill="#000000" fill-rule="nonzero" id="path4209" d="m428.942961,184.036586l0.148,0.386c0.854,1.871 1.635,3.05 2.387,3.605c1.36,1.009 2.963,1.522 4.763,1.522c1.542,0 3.022,-0.5 4.396,-1.485c1.208,-0.865 2.088,-2.13 2.533,-3.615l0.099,-0.413l-14.326,0zm6.979,10.753c-3.798,0 -6.871,-1.255 -9.39,-3.836c-2.521,-2.584 -3.745,-5.741 -3.745,-9.651c0,-3.816 1.227,-6.904 3.757,-9.439c2.526,-2.535 5.709,-3.766 9.73,-3.766c2.584,0 4.824,0.454 6.656,1.348c1.544,0.752 2.915,1.843 4.079,3.244c0.168,0.202 0.231,0.471 0.172,0.728c-0.056,0.256 -0.231,0.471 -0.469,0.582l-3.782,1.739c-0.298,0.138 -0.655,0.089 -0.907,-0.128c-1.688,-1.459 -3.639,-2.2 -5.797,-2.2c-2.156,0 -3.793,0.489 -5.005,1.494c-1.29,1.071 -2.006,2.189 -2.335,3.678l19.696,0c0.465,0 0.844,0.375 0.847,0.841l0.004,0.835c0,4.358 -1.369,8.254 -3.757,10.695c-2.526,2.581 -5.715,3.836 -9.754,3.836"/>
|
||||
</g>
|
||||
<g fill="#FFF" id="g4211">
|
||||
<path fill="#000000" fill-rule="nonzero" id="path4213" d="m355.595244,180.065883c-2.797,0 -5.063,2.266 -5.063,5.063c0,0.295 0.025,0.584 0.075,0.865l-12.108,6.972c-0.881,-0.744 -2.02,-1.193 -3.263,-1.193c-2.797,0 -5.064,2.267 -5.064,5.063c0,2.796 2.267,5.063 5.064,5.063c2.797,0 5.064,-2.267 5.064,-5.063c0,-0.322 -0.033,-0.637 -0.091,-0.943l12.064,-6.946c0.889,0.775 2.051,1.245 3.322,1.245c2.795,0 5.062,-2.267 5.062,-5.063c0,-2.797 -2.267,-5.063 -5.062,-5.063m-15.357,-6.724c0,-2.796 -2.266,-5.063 -5.063,-5.063c-2.795,0 -5.062,2.267 -5.062,5.063c0,2.797 2.267,5.064 5.062,5.064c1.257,0 2.405,-0.459 3.29,-1.217l8.827,5.073c0.377,-1.089 0.963,-2.081 1.708,-2.929l-8.843,-5.083c0.052,-0.295 0.081,-0.598 0.081,-0.908m30.444,30.899l-24.042,13.738c-1.637,0.935 -3.647,0.935 -5.284,0l-24.04,-13.738c-1.66,-0.948 -2.684,-2.714 -2.684,-4.624l0,-27.946c0,-1.902 1.015,-3.661 2.663,-4.612l41.387,-23.889l0.007,16.968l12.01,6.921c1.65,0.951 2.666,2.71 2.666,4.614l0,27.944c0,1.91 -1.024,3.676 -2.683,4.624"/>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 5.4 KiB |
33
packages/backend/src/apps/deepl/auth/index.ts
Normal file
33
packages/backend/src/apps/deepl/auth/index.ts
Normal file
@ -0,0 +1,33 @@
|
||||
import verifyCredentials from './verify-credentials';
|
||||
import isStillVerified from './is-still-verified';
|
||||
|
||||
export default {
|
||||
fields: [
|
||||
{
|
||||
key: 'screenName',
|
||||
label: 'Screen Name',
|
||||
type: 'string' as const,
|
||||
required: true,
|
||||
readOnly: false,
|
||||
value: null,
|
||||
placeholder: null,
|
||||
description:
|
||||
'Screen name of your connection to be used on Automatisch UI.',
|
||||
clickToCopy: false,
|
||||
},
|
||||
{
|
||||
key: 'authenticationKey',
|
||||
label: 'Authentication Key',
|
||||
type: 'string' as const,
|
||||
required: true,
|
||||
readOnly: false,
|
||||
value: null,
|
||||
placeholder: null,
|
||||
description: 'DeepL authentication key of your account.',
|
||||
clickToCopy: false,
|
||||
},
|
||||
],
|
||||
|
||||
verifyCredentials,
|
||||
isStillVerified,
|
||||
};
|
||||
@ -0,0 +1,9 @@
|
||||
import { IGlobalVariable } from '@automatisch/types';
|
||||
import verifyCredentials from './verify-credentials';
|
||||
|
||||
const isStillVerified = async ($: IGlobalVariable) => {
|
||||
await verifyCredentials($);
|
||||
return true;
|
||||
};
|
||||
|
||||
export default isStillVerified;
|
||||
11
packages/backend/src/apps/deepl/auth/verify-credentials.ts
Normal file
11
packages/backend/src/apps/deepl/auth/verify-credentials.ts
Normal file
@ -0,0 +1,11 @@
|
||||
import { IGlobalVariable } from '@automatisch/types';
|
||||
|
||||
const verifyCredentials = async ($: IGlobalVariable) => {
|
||||
await $.http.get('/v2/usage');
|
||||
|
||||
await $.auth.set({
|
||||
screenName: $.auth.data.screenName,
|
||||
});
|
||||
};
|
||||
|
||||
export default verifyCredentials;
|
||||
12
packages/backend/src/apps/deepl/common/add-auth-header.ts
Normal file
12
packages/backend/src/apps/deepl/common/add-auth-header.ts
Normal file
@ -0,0 +1,12 @@
|
||||
import { TBeforeRequest } from '@automatisch/types';
|
||||
|
||||
const addAuthHeader: TBeforeRequest = ($, requestConfig) => {
|
||||
if ($.auth.data?.authenticationKey) {
|
||||
const authorizationHeader = `DeepL-Auth-Key ${$.auth.data.authenticationKey}`;
|
||||
requestConfig.headers.Authorization = authorizationHeader;
|
||||
}
|
||||
|
||||
return requestConfig;
|
||||
};
|
||||
|
||||
export default addAuthHeader;
|
||||
0
packages/backend/src/apps/deepl/index.d.ts
vendored
Normal file
0
packages/backend/src/apps/deepl/index.d.ts
vendored
Normal file
18
packages/backend/src/apps/deepl/index.ts
Normal file
18
packages/backend/src/apps/deepl/index.ts
Normal file
@ -0,0 +1,18 @@
|
||||
import defineApp from '../../helpers/define-app';
|
||||
import addAuthHeader from './common/add-auth-header';
|
||||
import auth from './auth';
|
||||
import actions from './actions';
|
||||
|
||||
export default defineApp({
|
||||
name: 'DeepL',
|
||||
key: 'deepl',
|
||||
iconUrl: '{BASE_URL}/apps/deepl/assets/favicon.svg',
|
||||
authDocUrl: 'https://automatisch.io/docs/apps/deepl/connection',
|
||||
supportsConnections: true,
|
||||
baseUrl: 'https://deepl.com',
|
||||
apiBaseUrl: 'https://api.deepl.com',
|
||||
primaryColor: '0d2d45',
|
||||
beforeRequest: [addAuthHeader],
|
||||
auth,
|
||||
actions,
|
||||
});
|
||||
56
packages/backend/src/apps/delay/actions/delay-for/index.ts
Normal file
56
packages/backend/src/apps/delay/actions/delay-for/index.ts
Normal file
@ -0,0 +1,56 @@
|
||||
import defineAction from '../../../../helpers/define-action';
|
||||
|
||||
export default defineAction({
|
||||
name: 'Delay For',
|
||||
key: 'delayFor',
|
||||
description:
|
||||
'Delays the execution of the next action by a specified amount of time.',
|
||||
arguments: [
|
||||
{
|
||||
label: 'Delay for unit',
|
||||
key: 'delayForUnit',
|
||||
type: 'dropdown' as const,
|
||||
required: true,
|
||||
value: null,
|
||||
description: 'Delay for unit, e.g. minutes, hours, days, weeks.',
|
||||
variables: false,
|
||||
options: [
|
||||
{
|
||||
label: 'Minutes',
|
||||
value: 'minutes',
|
||||
},
|
||||
{
|
||||
label: 'Hours',
|
||||
value: 'hours',
|
||||
},
|
||||
{
|
||||
label: 'Days',
|
||||
value: 'days',
|
||||
},
|
||||
{
|
||||
label: 'Weeks',
|
||||
value: 'weeks',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
label: 'Delay for value',
|
||||
key: 'delayForValue',
|
||||
type: 'string' as const,
|
||||
required: true,
|
||||
description: 'Delay for value, use a number, e.g. 1, 2, 3.',
|
||||
variables: true,
|
||||
},
|
||||
],
|
||||
|
||||
async run($) {
|
||||
const { delayForUnit, delayForValue } = $.step.parameters;
|
||||
|
||||
const dataItem = {
|
||||
delayForUnit,
|
||||
delayForValue,
|
||||
};
|
||||
|
||||
$.setActionItem({ raw: dataItem });
|
||||
},
|
||||
});
|
||||
28
packages/backend/src/apps/delay/actions/delay-until/index.ts
Normal file
28
packages/backend/src/apps/delay/actions/delay-until/index.ts
Normal file
@ -0,0 +1,28 @@
|
||||
import defineAction from '../../../../helpers/define-action';
|
||||
|
||||
export default defineAction({
|
||||
name: 'Delay Until',
|
||||
key: 'delayUntil',
|
||||
description:
|
||||
'Delays the execution of the next action until a specified date.',
|
||||
arguments: [
|
||||
{
|
||||
label: 'Delay until (Date)',
|
||||
key: 'delayUntil',
|
||||
type: 'string' as const,
|
||||
required: true,
|
||||
description: 'Delay until the date. E.g. 2022-12-18',
|
||||
variables: true,
|
||||
},
|
||||
],
|
||||
|
||||
async run($) {
|
||||
const { delayUntil } = $.step.parameters;
|
||||
|
||||
const dataItem = {
|
||||
delayUntil,
|
||||
};
|
||||
|
||||
$.setActionItem({ raw: dataItem });
|
||||
},
|
||||
});
|
||||
4
packages/backend/src/apps/delay/actions/index.ts
Normal file
4
packages/backend/src/apps/delay/actions/index.ts
Normal file
@ -0,0 +1,4 @@
|
||||
import delayFor from './delay-for';
|
||||
import delayUntil from './delay-until';
|
||||
|
||||
export default [delayFor, delayUntil];
|
||||
7
packages/backend/src/apps/delay/assets/favicon.svg
Normal file
7
packages/backend/src/apps/delay/assets/favicon.svg
Normal file
@ -0,0 +1,7 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Layer_1" x="0px" y="0px" viewBox="0 0 122.88 100.6" style="enable-background:new 0 0 122.88 100.6" xml:space="preserve">
|
||||
<style type="text/css">.st0{fill:#272727;} .st1{fill-rule:evenodd;clip-rule:evenodd;fill:#000000;}</style>
|
||||
<g>
|
||||
<path class="st0" d="M72.58,0c6.8,0,13.3,1.36,19.23,3.81c6.16,2.55,11.7,6.29,16.33,10.92l0,0c4.63,4.63,8.37,10.17,10.92,16.34 c2.46,5.93,3.81,12.43,3.81,19.23c0,6.8-1.36,13.3-3.81,19.23c-2.55,6.16-6.29,11.7-10.92,16.33l0,0 c-4.63,4.63-10.17,8.37-16.34,10.92c-5.93,2.46-12.43,3.81-19.23,3.81c-6.8,0-13.3-1.36-19.23-3.81 c-6.15-2.55-11.69-6.28-16.33-10.92l-0.01-0.01c-4.64-4.64-8.37-10.17-10.92-16.33c-0.79-1.91-1.47-3.87-2.02-5.89 c1.05,0.1,2.12,0.15,3.2,0.15c2.05,0,4.05-0.19,6-0.54c0.32,0.97,0.67,1.93,1.06,2.87c2.09,5.05,5.17,9.6,8.99,13.43 c3.82,3.82,8.38,6.9,13.43,8.99c4.87,2.02,10.21,3.13,15.83,3.13c5.62,0,10.96-1.11,15.83-3.13c5.05-2.09,9.6-5.17,13.43-8.99 c3.82-3.82,6.9-8.38,8.99-13.43c2.02-4.87,3.13-10.21,3.13-15.83c0-5.62-1.11-10.96-3.13-15.83c-2.09-5.05-5.17-9.6-8.99-13.43 c-3.82-3.82-8.38-6.9-13.43-8.99c-4.87-2.02-10.21-3.13-15.83-3.13c-5.62,0-10.96,1.11-15.83,3.13c-0.44,0.18-0.87,0.37-1.3,0.56 c-1.65-2.61-3.66-4.97-5.95-7.02c1.25-0.65,2.53-1.24,3.84-1.79C59.28,1.36,65.78,0,72.58,0L72.58,0z M66.8,26.39 c0-1.23,0.5-2.35,1.31-3.16c0.81-0.81,1.93-1.31,3.16-1.31c1.23,0,2.35,0.5,3.16,1.31c0.81,0.81,1.31,1.93,1.31,3.16v23.47 l17.54,10.4c1.05,0.62,1.76,1.62,2.05,2.73c0.28,1.1,0.15,2.31-0.47,3.37l0,0.01l0,0c-0.62,1.05-1.62,1.76-2.73,2.05 c-1.1,0.28-2.31,0.15-3.37-0.47l-0.01,0l0,0L69.1,56.29c-0.67-0.38-1.24-0.92-1.64-1.57c-0.42-0.68-0.66-1.48-0.66-2.32V26.39 L66.8,26.39z"/>
|
||||
<path class="st1" d="M27.27,3.18c15.06,0,27.27,12.21,27.27,27.27c0,15.06-12.21,27.27-27.27,27.27C12.21,57.73,0,45.52,0,30.45 C0,15.39,12.21,3.18,27.27,3.18L27.27,3.18z M24.35,41.34h5.82v5.16h-5.82V41.34L24.35,41.34L24.35,41.34z M30.17,37.77h-5.82 c-0.58-7.07-1.8-11.56-1.8-18.63c0-2.61,2.12-4.72,4.72-4.72c2.61,0,4.72,2.12,4.72,4.72C32,26.2,30.76,30.7,30.17,37.77 L30.17,37.77L30.17,37.77L30.17,37.77z"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.1 KiB |
0
packages/backend/src/apps/delay/index.d.ts
vendored
Normal file
0
packages/backend/src/apps/delay/index.d.ts
vendored
Normal file
14
packages/backend/src/apps/delay/index.ts
Normal file
14
packages/backend/src/apps/delay/index.ts
Normal file
@ -0,0 +1,14 @@
|
||||
import defineApp from '../../helpers/define-app';
|
||||
import actions from './actions';
|
||||
|
||||
export default defineApp({
|
||||
name: 'Delay',
|
||||
key: 'delay',
|
||||
iconUrl: '{BASE_URL}/apps/delay/assets/favicon.svg',
|
||||
authDocUrl: 'https://automatisch.io/docs/apps/delay/connection',
|
||||
supportsConnections: false,
|
||||
baseUrl: '',
|
||||
apiBaseUrl: '',
|
||||
primaryColor: '001F52',
|
||||
actions,
|
||||
});
|
||||
@ -14,7 +14,7 @@ export default defineAction({
|
||||
variables: false,
|
||||
source: {
|
||||
type: 'query',
|
||||
name: 'getData',
|
||||
name: 'getDynamicData',
|
||||
arguments: [
|
||||
{
|
||||
name: 'key',
|
||||
|
||||
@ -1,28 +0,0 @@
|
||||
import { IField, IGlobalVariable } from '@automatisch/types';
|
||||
import { URLSearchParams } from 'url';
|
||||
import scopes from '../common/scopes';
|
||||
|
||||
export default async function createAuthData($: IGlobalVariable) {
|
||||
try {
|
||||
const oauthRedirectUrlField = $.app.auth.fields.find(
|
||||
(field: IField) => field.key == 'oAuthRedirectUrl'
|
||||
);
|
||||
const callbackUrl = oauthRedirectUrlField.value as string;
|
||||
|
||||
const searchParams = new URLSearchParams({
|
||||
client_id: $.auth.data.consumerKey as string,
|
||||
redirect_uri: callbackUrl,
|
||||
response_type: 'code',
|
||||
permissions: '2146958591',
|
||||
scope: scopes.join(' '),
|
||||
});
|
||||
|
||||
const url = `${
|
||||
$.app.apiBaseUrl
|
||||
}/oauth2/authorize?${searchParams.toString()}`;
|
||||
|
||||
await $.auth.set({ url });
|
||||
} catch (error) {
|
||||
throw new Error(`Error occured while verifying credentials: ${error}`);
|
||||
}
|
||||
}
|
||||
22
packages/backend/src/apps/discord/auth/generate-auth-url.ts
Normal file
22
packages/backend/src/apps/discord/auth/generate-auth-url.ts
Normal file
@ -0,0 +1,22 @@
|
||||
import { IField, IGlobalVariable } from '@automatisch/types';
|
||||
import { URLSearchParams } from 'url';
|
||||
import scopes from '../common/scopes';
|
||||
|
||||
export default async function generateAuthUrl($: IGlobalVariable) {
|
||||
const oauthRedirectUrlField = $.app.auth.fields.find(
|
||||
(field: IField) => field.key == 'oAuthRedirectUrl'
|
||||
);
|
||||
const callbackUrl = oauthRedirectUrlField.value as string;
|
||||
|
||||
const searchParams = new URLSearchParams({
|
||||
client_id: $.auth.data.consumerKey as string,
|
||||
redirect_uri: callbackUrl,
|
||||
response_type: 'code',
|
||||
permissions: '2146958591',
|
||||
scope: scopes.join(' '),
|
||||
});
|
||||
|
||||
const url = `${$.app.apiBaseUrl}/oauth2/authorize?${searchParams.toString()}`;
|
||||
|
||||
await $.auth.set({ url });
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
import createAuthData from './create-auth-data';
|
||||
import generateAuthUrl from './generate-auth-url';
|
||||
import verifyCredentials from './verify-credentials';
|
||||
import isStillVerified from './is-still-verified';
|
||||
|
||||
@ -54,88 +54,8 @@ export default {
|
||||
clickToCopy: false,
|
||||
},
|
||||
],
|
||||
authenticationSteps: [
|
||||
{
|
||||
type: 'mutation' as const,
|
||||
name: 'createConnection',
|
||||
arguments: [
|
||||
{
|
||||
name: 'key',
|
||||
value: '{key}',
|
||||
},
|
||||
{
|
||||
name: 'formattedData',
|
||||
value: null,
|
||||
properties: [
|
||||
{
|
||||
name: 'consumerKey',
|
||||
value: '{fields.consumerKey}',
|
||||
},
|
||||
{
|
||||
name: 'consumerSecret',
|
||||
value: '{fields.consumerSecret}',
|
||||
},
|
||||
{
|
||||
name: 'botToken',
|
||||
value: '{fields.botToken}',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'mutation' as const,
|
||||
name: 'createAuthData',
|
||||
arguments: [
|
||||
{
|
||||
name: 'id',
|
||||
value: '{createConnection.id}',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'openWithPopup' as const,
|
||||
name: 'openAuthPopup',
|
||||
arguments: [
|
||||
{
|
||||
name: 'url',
|
||||
value: '{createAuthData.url}',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'mutation' as const,
|
||||
name: 'updateConnection',
|
||||
arguments: [
|
||||
{
|
||||
name: 'id',
|
||||
value: '{createConnection.id}',
|
||||
},
|
||||
{
|
||||
name: 'formattedData',
|
||||
value: null,
|
||||
properties: [
|
||||
{
|
||||
name: 'oauthVerifier',
|
||||
value: '{openAuthPopup.code}',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'mutation' as const,
|
||||
name: 'verifyConnection',
|
||||
arguments: [
|
||||
{
|
||||
name: 'id',
|
||||
value: '{createConnection.id}',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
||||
createAuthData,
|
||||
generateAuthUrl,
|
||||
verifyCredentials,
|
||||
isStillVerified,
|
||||
};
|
||||
|
||||
@ -2,13 +2,9 @@ import { IGlobalVariable } from '@automatisch/types';
|
||||
import getCurrentUser from '../common/get-current-user';
|
||||
|
||||
const isStillVerified = async ($: IGlobalVariable) => {
|
||||
try {
|
||||
await getCurrentUser($);
|
||||
await getCurrentUser($);
|
||||
|
||||
return true;
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
export default isStillVerified;
|
||||
|
||||
@ -14,7 +14,7 @@ const verifyCredentials = async ($: IGlobalVariable) => {
|
||||
response_type: 'code',
|
||||
scope: scopes.join(' '),
|
||||
client_secret: $.auth.data.consumerSecret as string,
|
||||
code: $.auth.data.oauthVerifier as string,
|
||||
code: $.auth.data.code as string,
|
||||
grant_type: 'authorization_code',
|
||||
});
|
||||
const { data: verifiedCredentials } = await $.http.post(
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import defineApp from '../../helpers/define-app';
|
||||
import addAuthHeader from './common/add-auth-header';
|
||||
import auth from './auth';
|
||||
import data from './data';
|
||||
import dynamicData from './dynamic-data';
|
||||
import actions from './actions';
|
||||
import triggers from './triggers';
|
||||
|
||||
@ -16,7 +16,7 @@ export default defineApp({
|
||||
primaryColor: '5865f2',
|
||||
beforeRequest: [addAuthHeader],
|
||||
auth,
|
||||
data,
|
||||
dynamicData,
|
||||
triggers,
|
||||
actions,
|
||||
});
|
||||
|
||||
@ -1,31 +0,0 @@
|
||||
import { IJSONObject, IField, IGlobalVariable } from '@automatisch/types';
|
||||
import { URLSearchParams } from 'url';
|
||||
|
||||
export default async function createAuthData($: IGlobalVariable) {
|
||||
try {
|
||||
const oauthRedirectUrlField = $.app.auth.fields.find(
|
||||
(field: IField) => field.key == 'oAuthRedirectUrl'
|
||||
);
|
||||
|
||||
const callbackUrl = oauthRedirectUrlField.value;
|
||||
const requestPath = '/oauth/request_token';
|
||||
const data = { oauth_callback: callbackUrl };
|
||||
|
||||
const response = await $.http.post(requestPath, data);
|
||||
const responseData = Object.fromEntries(new URLSearchParams(response.data));
|
||||
|
||||
await $.auth.set({
|
||||
url: `${$.app.apiBaseUrl}/oauth/authorize?oauth_token=${responseData.oauth_token}&perms=delete`,
|
||||
accessToken: responseData.oauth_token,
|
||||
accessSecret: responseData.oauth_token_secret,
|
||||
});
|
||||
} catch (error) {
|
||||
const errorMessages = error.response.data.errors
|
||||
.map((error: IJSONObject) => error.message)
|
||||
.join(' ');
|
||||
|
||||
throw new Error(
|
||||
`Error occured while verifying credentials: ${errorMessages}`
|
||||
);
|
||||
}
|
||||
}
|
||||
21
packages/backend/src/apps/flickr/auth/generate-auth-url.ts
Normal file
21
packages/backend/src/apps/flickr/auth/generate-auth-url.ts
Normal file
@ -0,0 +1,21 @@
|
||||
import { IField, IGlobalVariable } from '@automatisch/types';
|
||||
import { URLSearchParams } from 'url';
|
||||
|
||||
export default async function generateAuthUrl($: IGlobalVariable) {
|
||||
const oauthRedirectUrlField = $.app.auth.fields.find(
|
||||
(field: IField) => field.key == 'oAuthRedirectUrl'
|
||||
);
|
||||
|
||||
const callbackUrl = oauthRedirectUrlField.value;
|
||||
const requestPath = '/oauth/request_token';
|
||||
const data = { oauth_callback: callbackUrl };
|
||||
|
||||
const response = await $.http.post(requestPath, data);
|
||||
const responseData = Object.fromEntries(new URLSearchParams(response.data));
|
||||
|
||||
await $.auth.set({
|
||||
url: `${$.app.apiBaseUrl}/oauth/authorize?oauth_token=${responseData.oauth_token}&perms=delete`,
|
||||
accessToken: responseData.oauth_token,
|
||||
accessSecret: responseData.oauth_token_secret,
|
||||
});
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
import createAuthData from './create-auth-data';
|
||||
import generateAuthUrl from './generate-auth-url';
|
||||
import verifyCredentials from './verify-credentials';
|
||||
import isStillVerified from './is-still-verified';
|
||||
|
||||
@ -42,84 +42,7 @@ export default {
|
||||
clickToCopy: false,
|
||||
},
|
||||
],
|
||||
authenticationSteps: [
|
||||
{
|
||||
type: 'mutation' as const,
|
||||
name: 'createConnection',
|
||||
arguments: [
|
||||
{
|
||||
name: 'key',
|
||||
value: '{key}',
|
||||
},
|
||||
{
|
||||
name: 'formattedData',
|
||||
value: null,
|
||||
properties: [
|
||||
{
|
||||
name: 'consumerKey',
|
||||
value: '{fields.consumerKey}',
|
||||
},
|
||||
{
|
||||
name: 'consumerSecret',
|
||||
value: '{fields.consumerSecret}',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'mutation' as const,
|
||||
name: 'createAuthData',
|
||||
arguments: [
|
||||
{
|
||||
name: 'id',
|
||||
value: '{createConnection.id}',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'openWithPopup' as const,
|
||||
name: 'openAuthPopup',
|
||||
arguments: [
|
||||
{
|
||||
name: 'url',
|
||||
value: '{createAuthData.url}',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'mutation' as const,
|
||||
name: 'updateConnection',
|
||||
arguments: [
|
||||
{
|
||||
name: 'id',
|
||||
value: '{createConnection.id}',
|
||||
},
|
||||
{
|
||||
name: 'formattedData',
|
||||
value: null,
|
||||
properties: [
|
||||
{
|
||||
name: 'oauthVerifier',
|
||||
value: '{openAuthPopup.oauth_verifier}',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'mutation' as const,
|
||||
name: 'verifyConnection',
|
||||
arguments: [
|
||||
{
|
||||
name: 'id',
|
||||
value: '{createConnection.id}',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
||||
createAuthData,
|
||||
generateAuthUrl,
|
||||
verifyCredentials,
|
||||
isStillVerified,
|
||||
};
|
||||
|
||||
@ -1,17 +1,13 @@
|
||||
import { IGlobalVariable } from '@automatisch/types';
|
||||
|
||||
const isStillVerified = async ($: IGlobalVariable) => {
|
||||
try {
|
||||
const params = {
|
||||
method: 'flickr.test.login',
|
||||
format: 'json',
|
||||
nojsoncallback: 1,
|
||||
};
|
||||
const response = await $.http.get('/rest', { params });
|
||||
return !!response.data.user.id;
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
const params = {
|
||||
method: 'flickr.test.login',
|
||||
format: 'json',
|
||||
nojsoncallback: 1,
|
||||
};
|
||||
const response = await $.http.get('/rest', { params });
|
||||
return !!response.data.user.id;
|
||||
};
|
||||
|
||||
export default isStillVerified;
|
||||
|
||||
@ -2,25 +2,21 @@ import { IGlobalVariable } from '@automatisch/types';
|
||||
import { URLSearchParams } from 'url';
|
||||
|
||||
const verifyCredentials = async ($: IGlobalVariable) => {
|
||||
try {
|
||||
const response = await $.http.post(
|
||||
`/oauth/access_token?oauth_verifier=${$.auth.data.oauthVerifier}&oauth_token=${$.auth.data.accessToken}`,
|
||||
null
|
||||
);
|
||||
const response = await $.http.post(
|
||||
`/oauth/access_token?oauth_verifier=${$.auth.data.oauth_verifier}&oauth_token=${$.auth.data.accessToken}`,
|
||||
null
|
||||
);
|
||||
|
||||
const responseData = Object.fromEntries(new URLSearchParams(response.data));
|
||||
const responseData = Object.fromEntries(new URLSearchParams(response.data));
|
||||
|
||||
await $.auth.set({
|
||||
consumerKey: $.auth.data.consumerKey,
|
||||
consumerSecret: $.auth.data.consumerSecret,
|
||||
accessToken: responseData.oauth_token,
|
||||
accessSecret: responseData.oauth_token_secret,
|
||||
userId: responseData.user_nsid,
|
||||
screenName: responseData.fullname,
|
||||
});
|
||||
} catch (error) {
|
||||
throw new Error(error.response.data);
|
||||
}
|
||||
await $.auth.set({
|
||||
consumerKey: $.auth.data.consumerKey,
|
||||
consumerSecret: $.auth.data.consumerSecret,
|
||||
accessToken: responseData.oauth_token,
|
||||
accessSecret: responseData.oauth_token_secret,
|
||||
userId: responseData.user_nsid,
|
||||
screenName: responseData.fullname,
|
||||
});
|
||||
};
|
||||
|
||||
export default verifyCredentials;
|
||||
|
||||
@ -2,7 +2,7 @@ import defineApp from '../../helpers/define-app';
|
||||
import addAuthHeader from './common/add-auth-header';
|
||||
import auth from './auth';
|
||||
import triggers from './triggers';
|
||||
import data from './data';
|
||||
import dynamicData from './dynamic-data';
|
||||
|
||||
export default defineApp({
|
||||
name: 'Flickr',
|
||||
@ -17,5 +17,5 @@ export default defineApp({
|
||||
beforeRequest: [addAuthHeader],
|
||||
auth,
|
||||
triggers,
|
||||
data,
|
||||
dynamicData,
|
||||
});
|
||||
|
||||
@ -15,7 +15,7 @@ export default defineTrigger({
|
||||
variables: false,
|
||||
source: {
|
||||
type: 'query',
|
||||
name: 'getData',
|
||||
name: 'getDynamicData',
|
||||
arguments: [
|
||||
{
|
||||
name: 'key',
|
||||
|
||||
@ -0,0 +1,12 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="762.564" height="769.312" viewBox="0 0 772772" fill="none">
|
||||
<g clip-path="url(#clip0_493_7535)">
|
||||
<path d="M747.782 474.701C725.051 423.2 683.614 383.657 631.048 363.294L413.561 279.117L429.189 369.569L602.633 436.697C670.591 462.98 704.451 539.58 678.168 607.537C651.885 675.494 575.285 709.354 507.328 683.071C473.231 669.811 446.711 643.883 432.741 610.023C429.426 601.854 426.939 593.33 425.164 584.569L358.509 636.07C358.982 637.372 359.338 638.674 359.811 639.858C382.069 693.963 424.216 735.282 478.795 756.356C503.776 765.946 529.349 770.563 554.566 770.563C639.098 770.563 719.131 719.299 751.334 635.833C771.697 583.267 770.277 526.083 747.545 474.583L747.782 474.701Z" fill="#02AFC7"/>
|
||||
<path d="M440.91 419.881L294.459 533.064C287.119 538.628 279.187 543.482 270.781 547.507C237.631 563.254 200.693 564.556 166.477 551.414C133.564 538.628 107.636 513.884 93.3109 481.563C78.9854 449.242 78.1567 413.369 90.943 380.456C103.729 347.543 128.473 321.615 160.794 307.29C190.866 294.03 224.134 292.491 255.271 302.672L241.064 219.206C147.061 207.13 53.2943 259.815 17.6583 352.042C-2.70517 404.608 -1.28446 461.792 21.4468 513.292C44.1781 564.793 85.6154 604.336 138.181 624.699C162.57 634.171 188.38 638.788 214.189 638.788C245.208 638.788 276.227 632.039 304.641 618.543C318.019 612.268 330.687 604.454 342.29 595.575L527.81 452.083L440.91 419.762V419.881Z" fill="#31DEA4"/>
|
||||
<path d="M624.42 193.396C629.629 229.624 619.921 265.379 597.19 294.148C594.822 297.108 592.335 299.831 589.731 302.554L665.62 333.454C696.402 289.649 709.899 235.307 702.203 182.149C694.153 126.386 665.028 77.135 619.921 43.3933C574.932 9.76989 519.406 -4.43717 463.643 3.49511C407.88 11.5458 358.629 40.6703 324.888 85.7777C291.146 130.885 276.939 186.411 284.989 242.055L323.23 457.529L393.673 404.371L362.773 230.334C357.919 195.646 366.798 161.075 387.872 133.016C409.064 104.72 439.846 86.488 474.89 81.3972C509.935 76.4247 544.623 85.3041 572.801 106.378C601.096 127.57 619.329 158.47 624.42 193.396V193.396Z" fill="#FF5986"/>
|
||||
</g>
|
||||
<defs>
|
||||
<clipPath id="clip0_493_7535">
|
||||
<rect width="762.564" height="769.312" fill="white" transform="translate(3.33301 1.36719)"/>
|
||||
</clipPath>
|
||||
</defs>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.2 KiB |
43
packages/backend/src/apps/flowers-software/auth/index.ts
Normal file
43
packages/backend/src/apps/flowers-software/auth/index.ts
Normal file
@ -0,0 +1,43 @@
|
||||
import verifyCredentials from './verify-credentials';
|
||||
import isStillVerified from './is-still-verified';
|
||||
|
||||
export default {
|
||||
fields: [
|
||||
{
|
||||
key: 'username',
|
||||
label: 'Username',
|
||||
type: 'string' as const,
|
||||
required: true,
|
||||
readOnly: false,
|
||||
value: null,
|
||||
placeholder: null,
|
||||
description: null,
|
||||
clickToCopy: false,
|
||||
},
|
||||
{
|
||||
key: 'password',
|
||||
label: 'Password',
|
||||
type: 'string' as const,
|
||||
required: true,
|
||||
readOnly: false,
|
||||
value: null,
|
||||
placeholder: null,
|
||||
description: null,
|
||||
clickToCopy: false,
|
||||
},
|
||||
{
|
||||
key: 'apiKey',
|
||||
label: 'API Key',
|
||||
type: 'string' as const,
|
||||
required: true,
|
||||
readOnly: false,
|
||||
value: null,
|
||||
placeholder: null,
|
||||
description: null,
|
||||
clickToCopy: false,
|
||||
},
|
||||
],
|
||||
|
||||
verifyCredentials,
|
||||
isStillVerified,
|
||||
};
|
||||
@ -0,0 +1,10 @@
|
||||
import { IGlobalVariable } from '@automatisch/types';
|
||||
import verifyCredentials from './verify-credentials';
|
||||
|
||||
const isStillVerified = async ($: IGlobalVariable) => {
|
||||
await verifyCredentials($);
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
export default isStillVerified;
|
||||
@ -0,0 +1,20 @@
|
||||
import { IGlobalVariable } from '@automatisch/types';
|
||||
import getWebhooks from '../common/get-webhooks';
|
||||
|
||||
const verifyCredentials = async ($: IGlobalVariable) => {
|
||||
const response = await getWebhooks($);
|
||||
const successful = Array.isArray(response.data);
|
||||
|
||||
if (!successful) {
|
||||
throw new Error('Failed while authorizing!');
|
||||
}
|
||||
|
||||
await $.auth.set({
|
||||
screenName: $.auth.data.username,
|
||||
username: $.auth.data.username,
|
||||
password: $.auth.data.password,
|
||||
apiKey: $.auth.data.apiKey,
|
||||
});
|
||||
};
|
||||
|
||||
export default verifyCredentials;
|
||||
@ -0,0 +1,18 @@
|
||||
import { TBeforeRequest } from '@automatisch/types';
|
||||
|
||||
const addAuthHeader: TBeforeRequest = ($, requestConfig) => {
|
||||
const { data } = $.auth;
|
||||
|
||||
if (data?.username && data.password && data.apiKey) {
|
||||
requestConfig.headers['x-api-key'] = data.apiKey as string;
|
||||
|
||||
requestConfig.auth = {
|
||||
username: data.username as string,
|
||||
password: data.password as string,
|
||||
};
|
||||
}
|
||||
|
||||
return requestConfig;
|
||||
};
|
||||
|
||||
export default addAuthHeader;
|
||||
@ -0,0 +1,5 @@
|
||||
import type { IGlobalVariable } from "@automatisch/types";
|
||||
|
||||
export default async function getWebhooks($: IGlobalVariable) {
|
||||
return await $.http.get('/v2/public/api/webhooks');
|
||||
}
|
||||
@ -0,0 +1,488 @@
|
||||
const webhookFilters = [
|
||||
{
|
||||
label: "Contact Company Created",
|
||||
value: "CONTACT_COMPANY_CREATED"
|
||||
},
|
||||
{
|
||||
label: "Contact Company Deleted",
|
||||
value: "CONTACT_COMPANY_DELETED"
|
||||
},
|
||||
{
|
||||
label: "Contact Company Updated",
|
||||
value: "CONTACT_COMPANY_UPDATED"
|
||||
},
|
||||
{
|
||||
label: "Contact Created",
|
||||
value: "CONTACT_CREATED"
|
||||
},
|
||||
{
|
||||
label: "Contact Deleted",
|
||||
value: "CONTACT_DELETED"
|
||||
},
|
||||
{
|
||||
label: "Contact Updated",
|
||||
value: "CONTACT_UPDATED"
|
||||
},
|
||||
{
|
||||
label: "Customer Created",
|
||||
value: "CUSTOMER_CREATED"
|
||||
},
|
||||
{
|
||||
label: "Customer Updated",
|
||||
value: "CUSTOMER_UPDATED"
|
||||
},
|
||||
{
|
||||
label: "Document Deleted",
|
||||
value: "DOCUMENT_DELETED"
|
||||
},
|
||||
{
|
||||
label: "Document Downloaded",
|
||||
value: "DOCUMENT_DOWNLOADED"
|
||||
},
|
||||
{
|
||||
label: "Document Saved",
|
||||
value: "DOCUMENT_SAVED"
|
||||
},
|
||||
{
|
||||
label: "Document Updated",
|
||||
value: "DOCUMENT_UPDATED"
|
||||
},
|
||||
{
|
||||
label: "Flow Archived",
|
||||
value: "FLOW_ARCHIVED"
|
||||
},
|
||||
{
|
||||
label: "Flow Created",
|
||||
value: "FLOW_CREATED"
|
||||
},
|
||||
{
|
||||
label: "Flow Object Automation Action Created",
|
||||
value: "FLOW_OBJECT_AUTOMATION_ACTION_CREATED"
|
||||
},
|
||||
{
|
||||
label: "Flow Object Automation Action Deleted",
|
||||
value: "FLOW_OBJECT_AUTOMATION_ACTION_DELETED"
|
||||
},
|
||||
{
|
||||
label: "Flow Object Automation Created",
|
||||
value: "FLOW_OBJECT_AUTOMATION_CREATED"
|
||||
},
|
||||
{
|
||||
label: "Flow Object Automation Deleted",
|
||||
value: "FLOW_OBJECT_AUTOMATION_DELETED"
|
||||
},
|
||||
{
|
||||
label: "Flow Object Automation Updated",
|
||||
value: "FLOW_OBJECT_AUTOMATION_UPDATED"
|
||||
},
|
||||
{
|
||||
label: "Flow Object Automation Webdav Created",
|
||||
value: "FLOW_OBJECT_AUTOMATION_WEBDAV_CREATED"
|
||||
},
|
||||
{
|
||||
label: "Flow Object Automation Webdav Deleted",
|
||||
value: "FLOW_OBJECT_AUTOMATION_WEBDAV_DELETED"
|
||||
},
|
||||
{
|
||||
label: "Flow Object Automation Webdav Updated",
|
||||
value: "FLOW_OBJECT_AUTOMATION_WEBDAV_UPDATED"
|
||||
},
|
||||
{
|
||||
label: "Flow Object Created",
|
||||
value: "FLOW_OBJECT_CREATED"
|
||||
},
|
||||
{
|
||||
label: "Flow Object Deleted",
|
||||
value: "FLOW_OBJECT_DELETED"
|
||||
},
|
||||
{
|
||||
label: "Flow Object Document Added",
|
||||
value: "FLOW_OBJECT_DOCUMENT_ADDED"
|
||||
},
|
||||
{
|
||||
label: "Flow Object Document Removed",
|
||||
value: "FLOW_OBJECT_DOCUMENT_REMOVED"
|
||||
},
|
||||
{
|
||||
label: "Flow Object Resource Created",
|
||||
value: "FLOW_OBJECT_RESOURCE_CREATED"
|
||||
},
|
||||
{
|
||||
label: "Flow Object Resource Deleted",
|
||||
value: "FLOW_OBJECT_RESOURCE_DELETED"
|
||||
},
|
||||
{
|
||||
label: "Flow Object Resource Updated",
|
||||
value: "FLOW_OBJECT_RESOURCE_UPDATED"
|
||||
},
|
||||
{
|
||||
label: "Flow Object Task Condition Created",
|
||||
value: "FLOW_OBJECT_TASK_CONDITION_CREATED"
|
||||
},
|
||||
{
|
||||
label: "Flow Object Task Condition Deleted",
|
||||
value: "FLOW_OBJECT_TASK_CONDITION_DELETED"
|
||||
},
|
||||
{
|
||||
label: "Flow Object Task Condition Updated",
|
||||
value: "FLOW_OBJECT_TASK_CONDITION_UPDATED"
|
||||
},
|
||||
{
|
||||
label: "Flow Object Task Created",
|
||||
value: "FLOW_OBJECT_TASK_CREATED"
|
||||
},
|
||||
{
|
||||
label: "Flow Object Task Deleted",
|
||||
value: "FLOW_OBJECT_TASK_DELETED"
|
||||
},
|
||||
{
|
||||
label: "Flow Object Task Updated",
|
||||
value: "FLOW_OBJECT_TASK_UPDATED"
|
||||
},
|
||||
{
|
||||
label: "Flow Object Updated",
|
||||
value: "FLOW_OBJECT_UPDATED"
|
||||
},
|
||||
{
|
||||
label: "Flow Objects Connection Created",
|
||||
value: "FLOW_OBJECTS_CONNECTION_CREATED"
|
||||
},
|
||||
{
|
||||
label: "Flow Objects Connection Deleted",
|
||||
value: "FLOW_OBJECTS_CONNECTION_DELETED"
|
||||
},
|
||||
{
|
||||
label: "Flow Objects Connection Updated",
|
||||
value: "FLOW_OBJECTS_CONNECTION_UPDATED"
|
||||
},
|
||||
{
|
||||
label: "Flow Objects External Connection Created",
|
||||
value: "FLOW_OBJECTS_EXTERNAL_CONNECTION_CREATED"
|
||||
},
|
||||
{
|
||||
label: "Flow Objects External Connection Deleted",
|
||||
value: "FLOW_OBJECTS_EXTERNAL_CONNECTION_DELETED"
|
||||
},
|
||||
{
|
||||
label: "Flow Objects External Connection Updated",
|
||||
value: "FLOW_OBJECTS_EXTERNAL_CONNECTION_UPDATED"
|
||||
},
|
||||
{
|
||||
label: "Flow Objects External Connections Group Created",
|
||||
value: "FLOW_OBJECTS_EXTERNAL_CONNECTIONS_GROUP_CREATED"
|
||||
},
|
||||
{
|
||||
label: "Flow Objects External Connections Group Deleted",
|
||||
value: "FLOW_OBJECTS_EXTERNAL_CONNECTIONS_GROUP_DELETED"
|
||||
},
|
||||
{
|
||||
label: "Flow Objects External Connections Group Updated",
|
||||
value: "FLOW_OBJECTS_EXTERNAL_CONNECTIONS_GROUP_UPDATED"
|
||||
},
|
||||
{
|
||||
label: "Flow Unarchived",
|
||||
value: "FLOW_UNARCHIVED"
|
||||
},
|
||||
{
|
||||
label: "Flow Updated",
|
||||
value: "FLOW_UPDATED"
|
||||
},
|
||||
{
|
||||
label: "Note Created",
|
||||
value: "NOTE_CREATED"
|
||||
},
|
||||
{
|
||||
label: "Note Deleted",
|
||||
value: "NOTE_DELETED"
|
||||
},
|
||||
{
|
||||
label: "Note Updated",
|
||||
value: "NOTE_UPDATED"
|
||||
},
|
||||
{
|
||||
label: "Team Created",
|
||||
value: "TEAM_CREATED"
|
||||
},
|
||||
{
|
||||
label: "Team Deleted",
|
||||
value: "TEAM_DELETED"
|
||||
},
|
||||
{
|
||||
label: "Team Updated",
|
||||
value: "TEAM_UPDATED"
|
||||
},
|
||||
{
|
||||
label: "User Added To Team",
|
||||
value: "USER_ADDED_TO_TEAM"
|
||||
},
|
||||
{
|
||||
label: "User Added To Teamleads",
|
||||
value: "USER_ADDED_TO_TEAMLEADS"
|
||||
},
|
||||
{
|
||||
label: "User Archived",
|
||||
value: "USER_ARCHIVED"
|
||||
},
|
||||
{
|
||||
label: "User Changed Password",
|
||||
value: "USER_CHANGED_PASSWORD"
|
||||
},
|
||||
{
|
||||
label: "User Created",
|
||||
value: "USER_CREATED"
|
||||
},
|
||||
{
|
||||
label: "User Forgot Password",
|
||||
value: "USER_FORGOT_PASSWORD"
|
||||
},
|
||||
{
|
||||
label: "User Invited",
|
||||
value: "USER_INVITED"
|
||||
},
|
||||
{
|
||||
label: "User Logged In",
|
||||
value: "USER_LOGGED_IN"
|
||||
},
|
||||
{
|
||||
label: "User Notification Settings Changed",
|
||||
value: "USER_NOTIFICATION_SETTINGS_CHANGED"
|
||||
},
|
||||
{
|
||||
label: "User Profile Updated",
|
||||
value: "USER_PROFILE_UPDATED"
|
||||
},
|
||||
{
|
||||
label: "User Removed From Team",
|
||||
value: "USER_REMOVED_FROM_TEAM"
|
||||
},
|
||||
{
|
||||
label: "User Removed From Teamleads",
|
||||
value: "USER_REMOVED_FROM_TEAMLEADS"
|
||||
},
|
||||
{
|
||||
label: "User Unarchived",
|
||||
value: "USER_UNARCHIVED"
|
||||
},
|
||||
{
|
||||
label: "Workflow Archived",
|
||||
value: "WORKFLOW_ARCHIVED"
|
||||
},
|
||||
{
|
||||
label: "Workflow Completed",
|
||||
value: "WORKFLOW_COMPLETED"
|
||||
},
|
||||
{
|
||||
label: "Workflow Created",
|
||||
value: "WORKFLOW_CREATED"
|
||||
},
|
||||
{
|
||||
label: "Workflow Creation Failed",
|
||||
value: "WORKFLOW_CREATION_FAILED"
|
||||
},
|
||||
{
|
||||
label: "Workflow Object Automation Api Get Completed",
|
||||
value: "WORKFLOW_OBJECT_AUTOMATION_API_GET_COMPLETED"
|
||||
},
|
||||
{
|
||||
label: "Workflow Object Automation Api Get Failed",
|
||||
value: "WORKFLOW_OBJECT_AUTOMATION_API_GET_FAILED"
|
||||
},
|
||||
{
|
||||
label: "Workflow Object Automation Api Post Completed",
|
||||
value: "WORKFLOW_OBJECT_AUTOMATION_API_POST_COMPLETED"
|
||||
},
|
||||
{
|
||||
label: "Workflow Object Automation Api Post Failed",
|
||||
value: "WORKFLOW_OBJECT_AUTOMATION_API_POST_FAILED"
|
||||
},
|
||||
{
|
||||
label: "Workflow Object Automation Datev Completed",
|
||||
value: "WORKFLOW_OBJECT_AUTOMATION_DATEV_COMPLETED"
|
||||
},
|
||||
{
|
||||
label: "Workflow Object Automation Datev Failed",
|
||||
value: "WORKFLOW_OBJECT_AUTOMATION_DATEV_FAILED"
|
||||
},
|
||||
{
|
||||
label: "Workflow Object Automation Email Completed",
|
||||
value: "WORKFLOW_OBJECT_AUTOMATION_EMAIL_COMPLETED"
|
||||
},
|
||||
{
|
||||
label: "Workflow Object Automation Email Failed",
|
||||
value: "WORKFLOW_OBJECT_AUTOMATION_EMAIL_FAILED"
|
||||
},
|
||||
{
|
||||
label: "Workflow Object Automation Lexoffice Completed",
|
||||
value: "WORKFLOW_OBJECT_AUTOMATION_LEXOFFICE_COMPLETED"
|
||||
},
|
||||
{
|
||||
label: "Workflow Object Automation Lexoffice Failed",
|
||||
value: "WORKFLOW_OBJECT_AUTOMATION_LEXOFFICE_FAILED"
|
||||
},
|
||||
{
|
||||
label: "Workflow Object Automation Rejected",
|
||||
value: "WORKFLOW_OBJECT_AUTOMATION_REJECTED"
|
||||
},
|
||||
{
|
||||
label: "Workflow Object Automation Retried",
|
||||
value: "WORKFLOW_OBJECT_AUTOMATION_RETRIED"
|
||||
},
|
||||
{
|
||||
label: "Workflow Object Automation Sevdesk Completed",
|
||||
value: "WORKFLOW_OBJECT_AUTOMATION_SEVDESK_COMPLETED"
|
||||
},
|
||||
{
|
||||
label: "Workflow Object Automation Sevdesk Failed",
|
||||
value: "WORKFLOW_OBJECT_AUTOMATION_SEVDESK_FAILED"
|
||||
},
|
||||
{
|
||||
label: "Workflow Object Automation Stamp Completed",
|
||||
value: "WORKFLOW_OBJECT_AUTOMATION_STAMP_COMPLETED"
|
||||
},
|
||||
{
|
||||
label: "Workflow Object Automation Stamp Failed",
|
||||
value: "WORKFLOW_OBJECT_AUTOMATION_STAMP_FAILED"
|
||||
},
|
||||
{
|
||||
label: "Workflow Object Automation Task Completed",
|
||||
value: "WORKFLOW_OBJECT_AUTOMATION_TASK_COMPLETED"
|
||||
},
|
||||
{
|
||||
label: "Workflow Object Automation Task Failed",
|
||||
value: "WORKFLOW_OBJECT_AUTOMATION_TASK_FAILED"
|
||||
},
|
||||
{
|
||||
label: "Workflow Object Automation Template Completed",
|
||||
value: "WORKFLOW_OBJECT_AUTOMATION_TEMPLATE_COMPLETED"
|
||||
},
|
||||
{
|
||||
label: "Workflow Object Automation Template Failed",
|
||||
value: "WORKFLOW_OBJECT_AUTOMATION_TEMPLATE_FAILED"
|
||||
},
|
||||
{
|
||||
label: "Workflow Object Automation Webdav Document Uploaded",
|
||||
value: "WORKFLOW_OBJECT_AUTOMATION_WEBDAV_DOCUMENT_UPLOADED"
|
||||
},
|
||||
{
|
||||
label: "Workflow Object Automation Zapier Completed",
|
||||
value: "WORKFLOW_OBJECT_AUTOMATION_ZAPIER_COMPLETED"
|
||||
},
|
||||
{
|
||||
label: "Workflow Object Automation Zapier Failed",
|
||||
value: "WORKFLOW_OBJECT_AUTOMATION_ZAPIER_FAILED"
|
||||
},
|
||||
{
|
||||
label: "Workflow Object Combination Task Group Created",
|
||||
value: "WORKFLOW_OBJECT_COMBINATION_TASK_GROUP_CREATED"
|
||||
},
|
||||
{
|
||||
label: "Workflow Object Combination Task Group Deleted",
|
||||
value: "WORKFLOW_OBJECT_COMBINATION_TASK_GROUP_DELETED"
|
||||
},
|
||||
{
|
||||
label: "Workflow Object Completed Automations Finished",
|
||||
value: "WORKFLOW_OBJECT_COMPLETED_AUTOMATIONS_FINISHED"
|
||||
},
|
||||
{
|
||||
label: "Workflow Object Completed",
|
||||
value: "WORKFLOW_OBJECT_COMPLETED"
|
||||
},
|
||||
{
|
||||
label: "Workflow Object Created",
|
||||
value: "WORKFLOW_OBJECT_CREATED"
|
||||
},
|
||||
{
|
||||
label: "Workflow Object Document Added",
|
||||
value: "WORKFLOW_OBJECT_DOCUMENT_ADDED"
|
||||
},
|
||||
{
|
||||
label: "Workflow Object Document Lock Added",
|
||||
value: "WORKFLOW_OBJECT_DOCUMENT_LOCK_ADDED"
|
||||
},
|
||||
{
|
||||
label: "Workflow Object Document Lock Deleted",
|
||||
value: "WORKFLOW_OBJECT_DOCUMENT_LOCK_DELETED"
|
||||
},
|
||||
{
|
||||
label: "Workflow Object Document Removed",
|
||||
value: "WORKFLOW_OBJECT_DOCUMENT_REMOVED"
|
||||
},
|
||||
{
|
||||
label: "Workflow Object Email Added",
|
||||
value: "WORKFLOW_OBJECT_EMAIL_ADDED"
|
||||
},
|
||||
{
|
||||
label: "Workflow Object Email Removed",
|
||||
value: "WORKFLOW_OBJECT_EMAIL_REMOVED"
|
||||
},
|
||||
{
|
||||
label: "Workflow Object External User Created",
|
||||
value: "WORKFLOW_OBJECT_EXTERNAL_USER_CREATED"
|
||||
},
|
||||
{
|
||||
label: "Workflow Object External User Deleted",
|
||||
value: "WORKFLOW_OBJECT_EXTERNAL_USER_DELETED"
|
||||
},
|
||||
{
|
||||
label: "Workflow Object Note Added",
|
||||
value: "WORKFLOW_OBJECT_NOTE_ADDED"
|
||||
},
|
||||
{
|
||||
label: "Workflow Object Note Removed",
|
||||
value: "WORKFLOW_OBJECT_NOTE_REMOVED"
|
||||
},
|
||||
{
|
||||
label: "Workflow Object Resource Created",
|
||||
value: "WORKFLOW_OBJECT_RESOURCE_CREATED"
|
||||
},
|
||||
{
|
||||
label: "Workflow Object Snapshot Created",
|
||||
value: "WORKFLOW_OBJECT_SNAPSHOT_CREATED"
|
||||
},
|
||||
{
|
||||
label: "Workflow Object Task Condition Created",
|
||||
value: "WORKFLOW_OBJECT_TASK_CONDITION_CREATED"
|
||||
},
|
||||
{
|
||||
label: "Workflow Object Task Created",
|
||||
value: "WORKFLOW_OBJECT_TASK_CREATED"
|
||||
},
|
||||
{
|
||||
label: "Workflow Object Task Deleted",
|
||||
value: "WORKFLOW_OBJECT_TASK_DELETED"
|
||||
},
|
||||
{
|
||||
label: "Workflow Object Task Snapshot Created",
|
||||
value: "WORKFLOW_OBJECT_TASK_SNAPSHOT_CREATED"
|
||||
},
|
||||
{
|
||||
label: "Workflow Object Task Updated",
|
||||
value: "WORKFLOW_OBJECT_TASK_UPDATED"
|
||||
},
|
||||
{
|
||||
label: "Workflow Object Updated",
|
||||
value: "WORKFLOW_OBJECT_UPDATED"
|
||||
},
|
||||
{
|
||||
label: "Workflow Objects Connection Created",
|
||||
value: "WORKFLOW_OBJECTS_CONNECTION_CREATED"
|
||||
},
|
||||
{
|
||||
label: "Workflow Objects External Connection Created",
|
||||
value: "WORKFLOW_OBJECTS_EXTERNAL_CONNECTION_CREATED"
|
||||
},
|
||||
{
|
||||
label: "Workflow Objects External Connection Group Created",
|
||||
value: "WORKFLOW_OBJECTS_EXTERNAL_CONNECTION_GROUP_CREATED"
|
||||
},
|
||||
{
|
||||
label: "Workflow Unarchived",
|
||||
value: "WORKFLOW_UNARCHIVED"
|
||||
},
|
||||
{
|
||||
label: "Workflow Updated",
|
||||
value: "WORKFLOW_UPDATED"
|
||||
}
|
||||
];
|
||||
|
||||
export default webhookFilters;
|
||||
0
packages/backend/src/apps/flowers-software/index.d.ts
vendored
Normal file
0
packages/backend/src/apps/flowers-software/index.d.ts
vendored
Normal file
18
packages/backend/src/apps/flowers-software/index.ts
Normal file
18
packages/backend/src/apps/flowers-software/index.ts
Normal file
@ -0,0 +1,18 @@
|
||||
import defineApp from '../../helpers/define-app';
|
||||
import addAuthHeader from './common/add-auth-header';
|
||||
import auth from './auth';
|
||||
import triggers from './triggers';
|
||||
|
||||
export default defineApp({
|
||||
name: 'Flowers Software',
|
||||
key: 'flowers-software',
|
||||
iconUrl: '{BASE_URL}/apps/flowers-software/assets/favicon.svg',
|
||||
authDocUrl: 'https://automatisch.io/docs/apps/flowers-software/connection',
|
||||
supportsConnections: true,
|
||||
baseUrl: 'https://flowers-software.com',
|
||||
apiBaseUrl: 'https://webapp.flowers-software.com/api',
|
||||
primaryColor: '02AFC7',
|
||||
beforeRequest: [addAuthHeader],
|
||||
auth,
|
||||
triggers,
|
||||
});
|
||||
@ -0,0 +1,3 @@
|
||||
import newActivity from './new-activity';
|
||||
|
||||
export default [newActivity];
|
||||
@ -0,0 +1,54 @@
|
||||
import isEmpty from 'lodash/isEmpty';
|
||||
import defineTrigger from '../../../../helpers/define-trigger';
|
||||
import webhookFilters from '../../common/webhook-filters';
|
||||
|
||||
export default defineTrigger({
|
||||
name: 'New activity',
|
||||
key: 'newActivity',
|
||||
type: 'webhook',
|
||||
description: 'Triggers when a new activity occurs.',
|
||||
arguments: [
|
||||
{
|
||||
label: 'Activity type',
|
||||
key: 'filters',
|
||||
type: 'dropdown' as const,
|
||||
required: true,
|
||||
description: 'Pick an activity type to receive events for.',
|
||||
variables: false,
|
||||
options: webhookFilters,
|
||||
},
|
||||
],
|
||||
|
||||
async testRun($) {
|
||||
if (!isEmpty($.lastExecutionStep?.dataOut)) {
|
||||
$.pushTriggerItem({
|
||||
raw: $.lastExecutionStep.dataOut,
|
||||
meta: {
|
||||
internalId: '',
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
async registerHook($) {
|
||||
const payload = {
|
||||
name: $.flow.id,
|
||||
type: 'POST',
|
||||
url: $.webhookUrl,
|
||||
filters: [$.step.parameters.filters]
|
||||
};
|
||||
|
||||
const { data } = await $.http.post(
|
||||
`/v2/public/api/webhooks`,
|
||||
payload
|
||||
);
|
||||
|
||||
await $.flow.setRemoteWebhookId(data.id);
|
||||
},
|
||||
|
||||
async unregisterHook($) {
|
||||
await $.http.delete(
|
||||
`/v2/public/api/webhooks/${$.flow.remoteWebhookId}`
|
||||
);
|
||||
},
|
||||
});
|
||||
@ -14,7 +14,7 @@ export default defineAction({
|
||||
variables: false,
|
||||
source: {
|
||||
type: 'query',
|
||||
name: 'getData',
|
||||
name: 'getDynamicData',
|
||||
arguments: [
|
||||
{
|
||||
name: 'key',
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { IField, IGlobalVariable } from '@automatisch/types';
|
||||
import { URLSearchParams } from 'url';
|
||||
|
||||
export default async function createAuthData($: IGlobalVariable) {
|
||||
export default async function generateAuthUrl($: IGlobalVariable) {
|
||||
const scopes = ['read:org', 'repo', 'user'];
|
||||
const oauthRedirectUrlField = $.app.auth.fields.find(
|
||||
(field: IField) => field.key == 'oAuthRedirectUrl'
|
||||
@ -13,9 +13,8 @@ export default async function createAuthData($: IGlobalVariable) {
|
||||
scope: scopes.join(','),
|
||||
});
|
||||
|
||||
const url = `${
|
||||
$.app.baseUrl
|
||||
}/login/oauth/authorize?${searchParams.toString()}`;
|
||||
const url = `${$.app.baseUrl
|
||||
}/login/oauth/authorize?${searchParams.toString()}`;
|
||||
|
||||
await $.auth.set({
|
||||
url,
|
||||
@ -1,4 +1,4 @@
|
||||
import createAuthData from './create-auth-data';
|
||||
import generateAuthUrl from './generate-auth-url';
|
||||
import verifyCredentials from './verify-credentials';
|
||||
import isStillVerified from './is-still-verified';
|
||||
|
||||
@ -42,84 +42,8 @@ export default {
|
||||
clickToCopy: false,
|
||||
},
|
||||
],
|
||||
authenticationSteps: [
|
||||
{
|
||||
type: 'mutation' as const,
|
||||
name: 'createConnection',
|
||||
arguments: [
|
||||
{
|
||||
name: 'key',
|
||||
value: '{key}',
|
||||
},
|
||||
{
|
||||
name: 'formattedData',
|
||||
value: null,
|
||||
properties: [
|
||||
{
|
||||
name: 'consumerKey',
|
||||
value: '{fields.consumerKey}',
|
||||
},
|
||||
{
|
||||
name: 'consumerSecret',
|
||||
value: '{fields.consumerSecret}',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'mutation' as const,
|
||||
name: 'createAuthData',
|
||||
arguments: [
|
||||
{
|
||||
name: 'id',
|
||||
value: '{createConnection.id}',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'openWithPopup' as const,
|
||||
name: 'openAuthPopup',
|
||||
arguments: [
|
||||
{
|
||||
name: 'url',
|
||||
value: '{createAuthData.url}',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'mutation' as const,
|
||||
name: 'updateConnection',
|
||||
arguments: [
|
||||
{
|
||||
name: 'id',
|
||||
value: '{createConnection.id}',
|
||||
},
|
||||
{
|
||||
name: 'formattedData',
|
||||
value: null,
|
||||
properties: [
|
||||
{
|
||||
name: 'oauthVerifier',
|
||||
value: '{openAuthPopup.code}',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'mutation' as const,
|
||||
name: 'verifyConnection',
|
||||
arguments: [
|
||||
{
|
||||
name: 'id',
|
||||
value: '{createConnection.id}',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
||||
createAuthData,
|
||||
generateAuthUrl,
|
||||
verifyCredentials,
|
||||
isStillVerified,
|
||||
};
|
||||
|
||||
@ -2,12 +2,8 @@ import { IGlobalVariable } from '@automatisch/types';
|
||||
import getCurrentUser from '../common/get-current-user';
|
||||
|
||||
const isStillVerified = async ($: IGlobalVariable) => {
|
||||
try {
|
||||
const user = await getCurrentUser($);
|
||||
return !!user.id;
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
const user = await getCurrentUser($);
|
||||
return !!user.id;
|
||||
};
|
||||
|
||||
export default isStillVerified;
|
||||
|
||||
@ -2,39 +2,35 @@ import { IGlobalVariable } from '@automatisch/types';
|
||||
import getCurrentUser from '../common/get-current-user';
|
||||
|
||||
const verifyCredentials = async ($: IGlobalVariable) => {
|
||||
try {
|
||||
const response = await $.http.post(
|
||||
`${$.app.baseUrl}/login/oauth/access_token`,
|
||||
{
|
||||
client_id: $.auth.data.consumerKey,
|
||||
client_secret: $.auth.data.consumerSecret,
|
||||
code: $.auth.data.oauthVerifier,
|
||||
const response = await $.http.post(
|
||||
`${$.app.baseUrl}/login/oauth/access_token`,
|
||||
{
|
||||
client_id: $.auth.data.consumerKey,
|
||||
client_secret: $.auth.data.consumerSecret,
|
||||
code: $.auth.data.code,
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
},
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
const data = response.data;
|
||||
const data = response.data;
|
||||
|
||||
$.auth.data.accessToken = data.access_token;
|
||||
$.auth.data.accessToken = data.access_token;
|
||||
|
||||
const currentUser = await getCurrentUser($);
|
||||
const currentUser = await getCurrentUser($);
|
||||
|
||||
await $.auth.set({
|
||||
consumerKey: $.auth.data.consumerKey,
|
||||
consumerSecret: $.auth.data.consumerSecret,
|
||||
accessToken: data.access_token,
|
||||
scope: data.scope,
|
||||
tokenType: data.token_type,
|
||||
userId: currentUser.id,
|
||||
screenName: currentUser.login,
|
||||
});
|
||||
} catch (error) {
|
||||
throw new Error(error.response.data);
|
||||
}
|
||||
await $.auth.set({
|
||||
consumerKey: $.auth.data.consumerKey,
|
||||
consumerSecret: $.auth.data.consumerSecret,
|
||||
accessToken: data.access_token,
|
||||
scope: data.scope,
|
||||
tokenType: data.token_type,
|
||||
userId: currentUser.id,
|
||||
screenName: currentUser.login,
|
||||
});
|
||||
};
|
||||
|
||||
export default verifyCredentials;
|
||||
|
||||
@ -3,7 +3,7 @@ import addAuthHeader from './common/add-auth-header';
|
||||
import auth from './auth';
|
||||
import triggers from './triggers';
|
||||
import actions from './actions';
|
||||
import data from './data';
|
||||
import dynamicData from './dynamic-data';
|
||||
|
||||
export default defineApp({
|
||||
name: 'Github',
|
||||
@ -18,5 +18,5 @@ export default defineApp({
|
||||
auth,
|
||||
triggers,
|
||||
actions,
|
||||
data,
|
||||
dynamicData,
|
||||
});
|
||||
|
||||
@ -15,7 +15,7 @@ export default defineTrigger({
|
||||
variables: false,
|
||||
source: {
|
||||
type: 'query',
|
||||
name: 'getData',
|
||||
name: 'getDynamicData',
|
||||
arguments: [
|
||||
{
|
||||
name: 'key',
|
||||
@ -65,7 +65,7 @@ export default defineTrigger({
|
||||
dependsOn: ['parameters.repo'],
|
||||
source: {
|
||||
type: 'query',
|
||||
name: 'getData',
|
||||
name: 'getDynamicData',
|
||||
arguments: [
|
||||
{
|
||||
name: 'key',
|
||||
|
||||
@ -15,7 +15,7 @@ export default defineTrigger({
|
||||
variables: false,
|
||||
source: {
|
||||
type: 'query',
|
||||
name: 'getData',
|
||||
name: 'getDynamicData',
|
||||
arguments: [
|
||||
{
|
||||
name: 'key',
|
||||
|
||||
@ -15,7 +15,7 @@ export default defineTrigger({
|
||||
variables: false,
|
||||
source: {
|
||||
type: 'query',
|
||||
name: 'getData',
|
||||
name: 'getDynamicData',
|
||||
arguments: [
|
||||
{
|
||||
name: 'key',
|
||||
|
||||
@ -15,7 +15,7 @@ export default defineTrigger({
|
||||
variables: false,
|
||||
source: {
|
||||
type: 'query',
|
||||
name: 'getData',
|
||||
name: 'getDynamicData',
|
||||
arguments: [
|
||||
{
|
||||
name: 'key',
|
||||
|
||||
41
packages/backend/src/apps/google-forms/assets/favicon.svg
Normal file
41
packages/backend/src/apps/google-forms/assets/favicon.svg
Normal file
@ -0,0 +1,41 @@
|
||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 1904.8 2500" style="enable-background:new 0 0 1904.8 2500;" xml:space="preserve">
|
||||
<style type="text/css">
|
||||
.st0{fill:#673AB7;}
|
||||
.st1{fill:#F1F1F1;}
|
||||
.st2{fill:url(#SVGID_1_);}
|
||||
.st3{fill:#B39DDB;}
|
||||
.st4{fill:#FFFFFF;fill-opacity:0.2;}
|
||||
.st5{fill:#311B92;fill-opacity:0.2;}
|
||||
.st6{fill:#311B92;fill-opacity:0.1;}
|
||||
.st7{fill:url(#SVGID_2_);}
|
||||
</style>
|
||||
<g>
|
||||
<path class="st0" d="M1190.5,0H178.6C83.3,0,0,83.3,0,178.6v2142.9c0,95.2,83.3,178.6,178.6,178.6h1547.6
|
||||
c95.2,0,178.6-83.3,178.6-178.6V714.3l-416.7-297.6L1190.5,0z"/>
|
||||
<path class="st1" d="M714.3,1845.2h714.3v-119H714.3V1845.2z M714.3,1071.4v119h714.3v-119H714.3z M607.1,1131
|
||||
c0,47.6-35.7,95.2-95.2,95.2s-95.2-35.7-95.2-95.2c0-59.5,35.7-95.2,95.2-95.2S607.1,1083.3,607.1,1131z M607.1,1464.3
|
||||
c0,47.6-35.7,95.2-95.2,95.2s-95.2-35.7-95.2-95.2c0-59.5,35.7-95.2,95.2-95.2S607.1,1416.7,607.1,1464.3z M607.1,1785.7
|
||||
c0,47.6-35.7,95.2-95.2,95.2s-95.2-35.7-95.2-95.2c0-59.5,35.7-95.2,95.2-95.2S607.1,1738.1,607.1,1785.7z M714.3,1547.6h714.3
|
||||
v-119.1H714.3L714.3,1547.6L714.3,1547.6z"/>
|
||||
|
||||
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="122.5479" y1="1635.2429" x2="122.5479" y2="1634.3186" gradientTransform="matrix(666.67 0 0 -654.7559 -80127.6016 1071403.75)">
|
||||
<stop offset="0" style="stop-color:#311B92;stop-opacity:0.2"/>
|
||||
<stop offset="1" style="stop-color:#311B92;stop-opacity:2.000000e-02"/>
|
||||
</linearGradient>
|
||||
<path class="st2" d="M1238.1,666.7l666.7,654.8V714.3L1238.1,666.7z"/>
|
||||
<path class="st3" d="M1190.5,0v535.7c0,95.2,83.3,178.6,178.6,178.6h535.7L1190.5,0z"/>
|
||||
<path class="st4" d="M178.6,0C83.3,0,0,83.3,0,178.6v11.9C0,95.2,83.3,11.9,178.6,11.9h1011.9V0H178.6L178.6,0z"/>
|
||||
<path class="st5" d="M1726.2,2488.1H178.6C83.3,2488.1,0,2404.8,0,2309.5v11.9c0,95.2,83.3,178.6,178.6,178.6h1547.6
|
||||
c95.2,0,178.6-83.3,178.6-178.6v-11.9C1904.8,2404.8,1821.4,2488.1,1726.2,2488.1z"/>
|
||||
<path class="st6" d="M1369,714.3c-95.2,0-178.6-83.3-178.6-178.6v11.9c0,95.2,83.3,178.6,178.6,178.6h535.7v-11.9L1369,714.3
|
||||
L1369,714.3z"/>
|
||||
|
||||
<radialGradient id="SVGID_2_" cx="122.6324" cy="1634.4275" r="12.899" gradientTransform="matrix(1904.7655 0 0 -1904.75 -233525.7031 3113242.5)" gradientUnits="userSpaceOnUse">
|
||||
<stop offset="0" style="stop-color:#FFFFFF;stop-opacity:0.1"/>
|
||||
<stop offset="1" style="stop-color:#FFFFFF;stop-opacity:0"/>
|
||||
</radialGradient>
|
||||
<path class="st7" d="M1190.5,0H178.6C83.3,0,0,83.3,0,178.6v2142.9c0,95.2,83.3,178.6,178.6,178.6h1547.6
|
||||
c95.2,0,178.6-83.3,178.6-178.6V714.3L1190.5,0z"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.6 KiB |
@ -0,0 +1,24 @@
|
||||
import { IField, IGlobalVariable } from '@automatisch/types';
|
||||
import { URLSearchParams } from 'url';
|
||||
import authScope from '../common/auth-scope';
|
||||
|
||||
export default async function generateAuthUrl($: IGlobalVariable) {
|
||||
const oauthRedirectUrlField = $.app.auth.fields.find(
|
||||
(field: IField) => field.key == 'oAuthRedirectUrl'
|
||||
);
|
||||
const redirectUri = oauthRedirectUrlField.value as string;
|
||||
const searchParams = new URLSearchParams({
|
||||
client_id: $.auth.data.clientId as string,
|
||||
redirect_uri: redirectUri,
|
||||
prompt: 'select_account',
|
||||
scope: authScope.join(' '),
|
||||
response_type: 'code',
|
||||
access_type: 'offline',
|
||||
});
|
||||
|
||||
const url = `https://accounts.google.com/o/oauth2/v2/auth?${searchParams.toString()}`;
|
||||
|
||||
await $.auth.set({
|
||||
url,
|
||||
});
|
||||
}
|
||||
48
packages/backend/src/apps/google-forms/auth/index.ts
Normal file
48
packages/backend/src/apps/google-forms/auth/index.ts
Normal file
@ -0,0 +1,48 @@
|
||||
import generateAuthUrl from './generate-auth-url';
|
||||
import verifyCredentials from './verify-credentials';
|
||||
import refreshToken from './refresh-token';
|
||||
import isStillVerified from './is-still-verified';
|
||||
|
||||
export default {
|
||||
fields: [
|
||||
{
|
||||
key: 'oAuthRedirectUrl',
|
||||
label: 'OAuth Redirect URL',
|
||||
type: 'string' as const,
|
||||
required: true,
|
||||
readOnly: true,
|
||||
value: '{WEB_APP_URL}/app/google-forms/connections/add',
|
||||
placeholder: null,
|
||||
description:
|
||||
'When asked to input a redirect URL in Google Cloud, enter the URL above.',
|
||||
clickToCopy: true,
|
||||
},
|
||||
{
|
||||
key: 'clientId',
|
||||
label: 'Client ID',
|
||||
type: 'string' as const,
|
||||
required: true,
|
||||
readOnly: false,
|
||||
value: null,
|
||||
placeholder: null,
|
||||
description: null,
|
||||
clickToCopy: false,
|
||||
},
|
||||
{
|
||||
key: 'clientSecret',
|
||||
label: 'Client Secret',
|
||||
type: 'string' as const,
|
||||
required: true,
|
||||
readOnly: false,
|
||||
value: null,
|
||||
placeholder: null,
|
||||
description: null,
|
||||
clickToCopy: false,
|
||||
},
|
||||
],
|
||||
|
||||
generateAuthUrl,
|
||||
verifyCredentials,
|
||||
isStillVerified,
|
||||
refreshToken,
|
||||
};
|
||||
@ -0,0 +1,9 @@
|
||||
import { IGlobalVariable } from '@automatisch/types';
|
||||
import getCurrentUser from '../common/get-current-user';
|
||||
|
||||
const isStillVerified = async ($: IGlobalVariable) => {
|
||||
const currentUser = await getCurrentUser($);
|
||||
return !!currentUser.resourceName;
|
||||
};
|
||||
|
||||
export default isStillVerified;
|
||||
26
packages/backend/src/apps/google-forms/auth/refresh-token.ts
Normal file
26
packages/backend/src/apps/google-forms/auth/refresh-token.ts
Normal file
@ -0,0 +1,26 @@
|
||||
import { URLSearchParams } from 'node:url';
|
||||
import { IGlobalVariable } from '@automatisch/types';
|
||||
import authScope from '../common/auth-scope';
|
||||
|
||||
const refreshToken = async ($: IGlobalVariable) => {
|
||||
const params = new URLSearchParams({
|
||||
client_id: $.auth.data.clientId as string,
|
||||
client_secret: $.auth.data.clientSecret as string,
|
||||
grant_type: 'refresh_token',
|
||||
refresh_token: $.auth.data.refreshToken as string,
|
||||
});
|
||||
|
||||
const { data } = await $.http.post(
|
||||
'https://oauth2.googleapis.com/token',
|
||||
params.toString()
|
||||
);
|
||||
|
||||
await $.auth.set({
|
||||
accessToken: data.access_token,
|
||||
expiresIn: data.expires_in,
|
||||
scope: authScope.join(' '),
|
||||
tokenType: data.token_type,
|
||||
});
|
||||
};
|
||||
|
||||
export default refreshToken;
|
||||
@ -0,0 +1,57 @@
|
||||
import { IField, IGlobalVariable } from '@automatisch/types';
|
||||
import getCurrentUser from '../common/get-current-user';
|
||||
|
||||
type TUser = {
|
||||
displayName: string;
|
||||
metadata: {
|
||||
primary: boolean;
|
||||
};
|
||||
};
|
||||
|
||||
type TEmailAddress = {
|
||||
value: string;
|
||||
metadata: {
|
||||
primary: boolean;
|
||||
};
|
||||
};
|
||||
|
||||
const verifyCredentials = async ($: IGlobalVariable) => {
|
||||
const oauthRedirectUrlField = $.app.auth.fields.find(
|
||||
(field: IField) => field.key == 'oAuthRedirectUrl'
|
||||
);
|
||||
const redirectUri = oauthRedirectUrlField.value as string;
|
||||
const { data } = await $.http.post(`https://oauth2.googleapis.com/token`, {
|
||||
client_id: $.auth.data.clientId,
|
||||
client_secret: $.auth.data.clientSecret,
|
||||
code: $.auth.data.code,
|
||||
grant_type: 'authorization_code',
|
||||
redirect_uri: redirectUri,
|
||||
});
|
||||
|
||||
await $.auth.set({
|
||||
accessToken: data.access_token,
|
||||
tokenType: data.token_type,
|
||||
});
|
||||
|
||||
const currentUser = await getCurrentUser($);
|
||||
|
||||
const { displayName } = currentUser.names.find(
|
||||
(name: TUser) => name.metadata.primary
|
||||
);
|
||||
const { value: email } = currentUser.emailAddresses.find(
|
||||
(emailAddress: TEmailAddress) => emailAddress.metadata.primary
|
||||
);
|
||||
|
||||
await $.auth.set({
|
||||
clientId: $.auth.data.clientId,
|
||||
clientSecret: $.auth.data.clientSecret,
|
||||
scope: $.auth.data.scope,
|
||||
idToken: data.id_token,
|
||||
expiresIn: data.expires_in,
|
||||
refreshToken: data.refresh_token,
|
||||
resourceName: currentUser.resourceName,
|
||||
screenName: `${displayName} - ${email}`,
|
||||
});
|
||||
};
|
||||
|
||||
export default verifyCredentials;
|
||||
@ -0,0 +1,11 @@
|
||||
import { TBeforeRequest } from '@automatisch/types';
|
||||
|
||||
const addAuthHeader: TBeforeRequest = ($, requestConfig) => {
|
||||
if (requestConfig.headers && $.auth.data?.accessToken) {
|
||||
requestConfig.headers.Authorization = `${$.auth.data.tokenType} ${$.auth.data.accessToken}`;
|
||||
}
|
||||
|
||||
return requestConfig;
|
||||
};
|
||||
|
||||
export default addAuthHeader;
|
||||
@ -0,0 +1,9 @@
|
||||
const authScope: string[] = [
|
||||
'https://www.googleapis.com/auth/forms.body.readonly',
|
||||
'https://www.googleapis.com/auth/forms.responses.readonly',
|
||||
'https://www.googleapis.com/auth/drive.readonly',
|
||||
'https://www.googleapis.com/auth/userinfo.email',
|
||||
'profile',
|
||||
];
|
||||
|
||||
export default authScope;
|
||||
@ -0,0 +1,10 @@
|
||||
import { IGlobalVariable } from '@automatisch/types';
|
||||
|
||||
const getCurrentUser = async ($: IGlobalVariable) => {
|
||||
const { data: currentUser } = await $.http.get(
|
||||
'https://people.googleapis.com/v1/people/me?personFields=names,emailAddresses'
|
||||
);
|
||||
return currentUser;
|
||||
};
|
||||
|
||||
export default getCurrentUser;
|
||||
@ -0,0 +1,3 @@
|
||||
import listForms from './list-forms';
|
||||
|
||||
export default [listForms];
|
||||
@ -0,0 +1,34 @@
|
||||
import { IGlobalVariable, IJSONObject } from '@automatisch/types';
|
||||
|
||||
export default {
|
||||
name: 'List forms',
|
||||
key: 'listForms',
|
||||
|
||||
async run($: IGlobalVariable) {
|
||||
const forms: {
|
||||
data: IJSONObject[];
|
||||
} = {
|
||||
data: [],
|
||||
};
|
||||
|
||||
const params = {
|
||||
q: `mimeType='application/vnd.google-apps.form'`,
|
||||
spaces: 'drive',
|
||||
pageToken: undefined as unknown as string,
|
||||
};
|
||||
|
||||
do {
|
||||
const { data } = await $.http.get(`https://www.googleapis.com/drive/v3/files`, { params });
|
||||
params.pageToken = data.nextPageToken;
|
||||
|
||||
for (const file of data.files) {
|
||||
forms.data.push({
|
||||
value: file.id,
|
||||
name: file.name,
|
||||
});
|
||||
}
|
||||
} while (params.pageToken);
|
||||
|
||||
return forms;
|
||||
},
|
||||
};
|
||||
0
packages/backend/src/apps/google-forms/index.d.ts
vendored
Normal file
0
packages/backend/src/apps/google-forms/index.d.ts
vendored
Normal file
20
packages/backend/src/apps/google-forms/index.ts
Normal file
20
packages/backend/src/apps/google-forms/index.ts
Normal file
@ -0,0 +1,20 @@
|
||||
import defineApp from '../../helpers/define-app';
|
||||
import addAuthHeader from './common/add-auth-header';
|
||||
import auth from './auth';
|
||||
import triggers from './triggers';
|
||||
import dynamicData from './dynamic-data';
|
||||
|
||||
export default defineApp({
|
||||
name: 'Google Forms',
|
||||
key: 'google-forms',
|
||||
baseUrl: 'https://docs.google.com/forms',
|
||||
apiBaseUrl: 'https://forms.googleapis.com',
|
||||
iconUrl: '{BASE_URL}/apps/google-forms/assets/favicon.svg',
|
||||
authDocUrl: 'https://automatisch.io/docs/apps/google-forms/connection',
|
||||
primaryColor: '673AB7',
|
||||
supportsConnections: true,
|
||||
beforeRequest: [addAuthHeader],
|
||||
auth,
|
||||
triggers,
|
||||
dynamicData,
|
||||
});
|
||||
3
packages/backend/src/apps/google-forms/triggers/index.ts
Normal file
3
packages/backend/src/apps/google-forms/triggers/index.ts
Normal file
@ -0,0 +1,3 @@
|
||||
import newFormResponses from './new-form-responses';
|
||||
|
||||
export default [newFormResponses];
|
||||
@ -0,0 +1,33 @@
|
||||
import defineTrigger from '../../../../helpers/define-trigger';
|
||||
import newFormResponses from './new-form-responses';
|
||||
|
||||
export default defineTrigger({
|
||||
name: 'New Form Responses',
|
||||
key: 'newFormResponses',
|
||||
pollInterval: 15,
|
||||
description: 'Triggers when a new form response is submitted.',
|
||||
arguments: [
|
||||
{
|
||||
label: 'Form',
|
||||
key: 'formId',
|
||||
type: 'dropdown' as const,
|
||||
required: true,
|
||||
description: 'Pick a form to receive form responses.',
|
||||
variables: false,
|
||||
source: {
|
||||
type: 'query',
|
||||
name: 'getDynamicData',
|
||||
arguments: [
|
||||
{
|
||||
name: 'key',
|
||||
value: 'listForms',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
|
||||
async run($) {
|
||||
await newFormResponses($);
|
||||
},
|
||||
});
|
||||
@ -0,0 +1,28 @@
|
||||
import { IGlobalVariable } from '@automatisch/types';
|
||||
|
||||
const newResponses = async ($: IGlobalVariable) => {
|
||||
const params = {
|
||||
pageToken: undefined as unknown as string,
|
||||
};
|
||||
|
||||
do {
|
||||
const pathname = `/v1/forms/${$.step.parameters.formId}/responses`;
|
||||
const { data } = await $.http.get(pathname, { params });
|
||||
params.pageToken = data.nextPageToken;
|
||||
|
||||
if (data.responses?.length) {
|
||||
for (const formResponse of data.responses) {
|
||||
const dataItem = {
|
||||
raw: formResponse,
|
||||
meta: {
|
||||
internalId: formResponse.responseId,
|
||||
},
|
||||
};
|
||||
|
||||
$.pushTriggerItem(dataItem);
|
||||
}
|
||||
}
|
||||
} while (params.pageToken);
|
||||
};
|
||||
|
||||
export default newResponses;
|
||||
3
packages/backend/src/apps/ntfy/actions/index.ts
Normal file
3
packages/backend/src/apps/ntfy/actions/index.ts
Normal file
@ -0,0 +1,3 @@
|
||||
import sendMessage from './send-message';
|
||||
|
||||
export default [sendMessage];
|
||||
103
packages/backend/src/apps/ntfy/actions/send-message/index.ts
Normal file
103
packages/backend/src/apps/ntfy/actions/send-message/index.ts
Normal file
@ -0,0 +1,103 @@
|
||||
import qs from 'qs';
|
||||
import defineAction from '../../../../helpers/define-action';
|
||||
|
||||
export default defineAction({
|
||||
name: 'Send message',
|
||||
key: 'sendMessage',
|
||||
description: 'Sends a message to a topic you specify.',
|
||||
arguments: [
|
||||
{
|
||||
label: 'Topic',
|
||||
key: 'topic',
|
||||
type: 'string' as const,
|
||||
required: true,
|
||||
description: 'Target topic name.',
|
||||
variables: true,
|
||||
},
|
||||
{
|
||||
label: 'Message body',
|
||||
key: 'message',
|
||||
type: 'string' as const,
|
||||
required: true,
|
||||
description: 'Message body to be sent, set to triggered if empty or not passed.',
|
||||
variables: true,
|
||||
},
|
||||
{
|
||||
label: 'Title',
|
||||
key: 'title',
|
||||
type: 'string' as const,
|
||||
required: false,
|
||||
description: 'Message title.',
|
||||
variables: true,
|
||||
},
|
||||
{
|
||||
label: 'Email',
|
||||
key: 'email',
|
||||
type: 'string' as const,
|
||||
required: false,
|
||||
description: 'E-mail address for e-mail notifications.',
|
||||
variables: true,
|
||||
},
|
||||
{
|
||||
label: 'Click URL',
|
||||
key: 'click',
|
||||
type: 'string' as const,
|
||||
required: false,
|
||||
description: 'Website opened when notification is clicked.',
|
||||
variables: true,
|
||||
},
|
||||
{
|
||||
label: 'Attach file by URL',
|
||||
key: 'attach',
|
||||
type: 'string' as const,
|
||||
required: false,
|
||||
description: 'URL of an attachment.',
|
||||
variables: true,
|
||||
},
|
||||
{
|
||||
label: 'Filename',
|
||||
key: 'filename',
|
||||
type: 'string' as const,
|
||||
required: false,
|
||||
description: 'File name of the attachment.',
|
||||
variables: true,
|
||||
},
|
||||
{
|
||||
label: 'Delay',
|
||||
key: 'delay',
|
||||
type: 'string' as const,
|
||||
required: false,
|
||||
description: 'Timestamp or duration for delayed delivery. For example, 30min or 9am.',
|
||||
variables: true,
|
||||
},
|
||||
],
|
||||
|
||||
async run($) {
|
||||
const {
|
||||
topic,
|
||||
message,
|
||||
title,
|
||||
email,
|
||||
click,
|
||||
attach,
|
||||
filename,
|
||||
delay
|
||||
} = $.step.parameters;
|
||||
const payload = {
|
||||
topic,
|
||||
message,
|
||||
title,
|
||||
email,
|
||||
click,
|
||||
attach,
|
||||
filename,
|
||||
delay
|
||||
};
|
||||
|
||||
const response = await $.http.post('/', payload);
|
||||
|
||||
$.setActionItem({
|
||||
raw: response.data,
|
||||
});
|
||||
},
|
||||
});
|
||||
1
packages/backend/src/apps/ntfy/assets/favicon.svg
Normal file
1
packages/backend/src/apps/ntfy/assets/favicon.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg width="50mm" height="50mm" viewBox="0 0 50 50" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg"><defs><linearGradient id="a"><stop style="stop-color:#348878;stop-opacity:1" offset="0"/><stop style="stop-color:#56bda8;stop-opacity:1" offset="1"/></linearGradient><linearGradient xlink:href="#a" id="b" x1="160.722" y1="128.533" x2="168.412" y2="134.326" gradientUnits="userSpaceOnUse" gradientTransform="translate(-845.726 -630.598) scale(5.59448)"/></defs><g style="display:inline"><path style="color:#000;fill:url(#b);stroke:none;stroke-width:3.72347;-inkscape-stroke:none" d="M94.237 89.912H59.499c-2.388 0-4.342 1.844-4.342 4.098l.033 27.754-.648 3.738 9.297-2.806h30.396c2.388 0 4.342-1.845 4.342-4.099V94.01c0-2.254-1.954-4.098-4.342-4.098z" transform="translate(-51.147 -81.516)"/><path style="color:#000;fill:#fff;stroke:none;stroke-width:.762343;-inkscape-stroke:none" d="M58.849 86.79c-3.62 0-6.72 2.848-6.72 6.47v.002l.035 30.273-.91 6.708 12.362-3.284h30.729c3.62 0 6.72-2.852 6.72-6.473V93.26c0-3.62-3.099-6.469-6.717-6.469h-.003zm0 4.566h35.499c1.272 0 2.151.927 2.151 1.903v27.227c0 .977-.88 1.924-2.154 1.903h-31.4l-6.28 1.898.065-.37-.035-30.658c0-.977.88-1.903 2.154-1.903z" transform="translate(-51.147 -81.516)"/><g style="font-size:8.48274px;font-family:sans-serif;letter-spacing:0;word-spacing:0;fill:#000;stroke:none;stroke-width:.525121"><path style="color:#000;-inkscape-font-specification:'JetBrains Mono, Bold';fill:#fff;stroke:none;-inkscape-stroke:none" d="M62.57 116.77v-1.312l3.28-1.459q.159-.068.306-.102.158-.045.283-.068l.271-.022v-.09q-.136-.012-.271-.046-.125-.023-.283-.057-.147-.045-.306-.113l-3.28-1.459v-1.323l5.068 2.319v1.413z" transform="matrix(2.1689 0 0 2.57844 -124.28 -268.742)"/><path style="color:#000;-inkscape-font-specification:'JetBrains Mono, Bold';fill:#fff;stroke:none;-inkscape-stroke:none" d="M62.309 110.31v1.903l3.437 1.53.022.007-.022.008-3.437 1.53v1.892l.37-.17 5.221-2.39v-1.75zm.525.817 4.541 2.08v1.076l-4.541 2.078v-.732l3.12-1.389.003-.002a1.56 1.56 0 0 1 .258-.086h.006l.008-.002c.094-.027.176-.047.246-.06l.498-.041v-.574l-.24-.02a1.411 1.411 0 0 1-.231-.04l-.008-.001-.008-.002a9.077 9.077 0 0 1-.263-.053 2.781 2.781 0 0 1-.266-.097l-.004-.002-3.119-1.39z" transform="matrix(2.1689 0 0 2.57844 -124.28 -268.742)"/></g><g style="font-size:8.48274px;font-family:sans-serif;letter-spacing:0;word-spacing:0;fill:#000;stroke:none;stroke-width:.525121"><path style="color:#000;-inkscape-font-specification:'JetBrains Mono, Bold';fill:#fff;stroke:none;-inkscape-stroke:none" d="M69.171 117.754h5.43v1.278h-5.43Z" transform="matrix(2.16247 0 0 2.48294 -122.76 -261.211)"/><path style="color:#000;-inkscape-font-specification:'JetBrains Mono, Bold';fill:#fff;stroke:none;-inkscape-stroke:none" d="M68.908 117.492v1.802h5.955v-1.802zm.526.524h4.904v.754h-4.904z" transform="matrix(2.16247 0 0 2.48294 -122.76 -261.211)"/></g></g></svg>
|
||||
|
After Width: | Height: | Size: 2.9 KiB |
41
packages/backend/src/apps/ntfy/auth/index.ts
Normal file
41
packages/backend/src/apps/ntfy/auth/index.ts
Normal file
@ -0,0 +1,41 @@
|
||||
import verifyCredentials from './verify-credentials';
|
||||
import isStillVerified from './is-still-verified';
|
||||
|
||||
export default {
|
||||
fields: [
|
||||
{
|
||||
key: 'serverUrl',
|
||||
label: 'Server URL',
|
||||
type: 'string' as const,
|
||||
required: true,
|
||||
readOnly: false,
|
||||
value: 'https://ntfy.sh',
|
||||
placeholder: null,
|
||||
description: 'ntfy server to use.',
|
||||
clickToCopy: false,
|
||||
},
|
||||
{
|
||||
key: 'username',
|
||||
label: 'Username',
|
||||
type: 'string' as const,
|
||||
required: false,
|
||||
readOnly: false,
|
||||
placeholder: null,
|
||||
clickToCopy: false,
|
||||
description: 'You may need to provide your username if your installation requires authentication.',
|
||||
},
|
||||
{
|
||||
key: 'password',
|
||||
label: 'Password',
|
||||
type: 'string' as const,
|
||||
required: false,
|
||||
readOnly: false,
|
||||
placeholder: null,
|
||||
clickToCopy: false,
|
||||
description: 'You may need to provide your password if your installation requires authentication.',
|
||||
},
|
||||
],
|
||||
|
||||
verifyCredentials,
|
||||
isStillVerified,
|
||||
};
|
||||
9
packages/backend/src/apps/ntfy/auth/is-still-verified.ts
Normal file
9
packages/backend/src/apps/ntfy/auth/is-still-verified.ts
Normal file
@ -0,0 +1,9 @@
|
||||
import { IGlobalVariable } from '@automatisch/types';
|
||||
import verifyCredentials from './verify-credentials';
|
||||
|
||||
const isStillVerified = async ($: IGlobalVariable) => {
|
||||
await verifyCredentials($);
|
||||
return true;
|
||||
};
|
||||
|
||||
export default isStillVerified;
|
||||
16
packages/backend/src/apps/ntfy/auth/verify-credentials.ts
Normal file
16
packages/backend/src/apps/ntfy/auth/verify-credentials.ts
Normal file
@ -0,0 +1,16 @@
|
||||
import { IGlobalVariable } from '@automatisch/types';
|
||||
|
||||
const verifyCredentials = async ($: IGlobalVariable) => {
|
||||
await $.http.post('/', { topic: 'automatisch' });
|
||||
let screenName = $.auth.data.serverUrl;
|
||||
|
||||
if ($.auth.data.username) {
|
||||
screenName = `${$.auth.data.username} @ ${screenName}`
|
||||
}
|
||||
|
||||
await $.auth.set({
|
||||
screenName,
|
||||
});
|
||||
};
|
||||
|
||||
export default verifyCredentials;
|
||||
18
packages/backend/src/apps/ntfy/common/add-auth-header.ts
Normal file
18
packages/backend/src/apps/ntfy/common/add-auth-header.ts
Normal file
@ -0,0 +1,18 @@
|
||||
import { TBeforeRequest } from '@automatisch/types';
|
||||
|
||||
const addAuthHeader: TBeforeRequest = ($, requestConfig) => {
|
||||
if ($.auth.data.apiBaseUrl) {
|
||||
requestConfig.baseURL = $.auth.data.apiBaseUrl as string;
|
||||
}
|
||||
|
||||
if ($.auth.data?.username && $.auth.data?.password) {
|
||||
requestConfig.auth = {
|
||||
username: $.auth.data.username as string,
|
||||
password: $.auth.data.password as string,
|
||||
}
|
||||
}
|
||||
|
||||
return requestConfig;
|
||||
};
|
||||
|
||||
export default addAuthHeader;
|
||||
0
packages/backend/src/apps/ntfy/index.d.ts
vendored
Normal file
0
packages/backend/src/apps/ntfy/index.d.ts
vendored
Normal file
18
packages/backend/src/apps/ntfy/index.ts
Normal file
18
packages/backend/src/apps/ntfy/index.ts
Normal file
@ -0,0 +1,18 @@
|
||||
import defineApp from '../../helpers/define-app';
|
||||
import addAuthHeader from './common/add-auth-header';
|
||||
import auth from './auth';
|
||||
import actions from './actions';
|
||||
|
||||
export default defineApp({
|
||||
name: 'Ntfy',
|
||||
key: 'ntfy',
|
||||
iconUrl: '{BASE_URL}/apps/ntfy/assets/favicon.svg',
|
||||
authDocUrl: 'https://automatisch.io/docs/apps/ntfy/connection',
|
||||
supportsConnections: true,
|
||||
baseUrl: 'https://ntfy.sh',
|
||||
apiBaseUrl: 'https://ntfy.sh',
|
||||
primaryColor: '56bda8',
|
||||
beforeRequest: [addAuthHeader],
|
||||
auth,
|
||||
actions,
|
||||
});
|
||||
@ -0,0 +1,29 @@
|
||||
import defineAction from '../../../../helpers/define-action';
|
||||
|
||||
export default defineAction({
|
||||
name: 'Check moderation',
|
||||
key: 'checkModeration',
|
||||
description: 'Checks for hate, hate/threatening, self-harm, sexual, sexual/minors, violence, or violence/graphic content in the given text.',
|
||||
arguments: [
|
||||
{
|
||||
label: 'Input',
|
||||
key: 'input',
|
||||
type: 'string' as const,
|
||||
required: true,
|
||||
variables: true,
|
||||
description: 'The text to analyze.'
|
||||
},
|
||||
],
|
||||
|
||||
async run($) {
|
||||
const { data } = await $.http.post('/v1/moderations', {
|
||||
input: $.step.parameters.input as string,
|
||||
});
|
||||
|
||||
const result = data?.results[0];
|
||||
|
||||
$.setActionItem({
|
||||
raw: result,
|
||||
});
|
||||
},
|
||||
});
|
||||
4
packages/backend/src/apps/openai/actions/index.ts
Normal file
4
packages/backend/src/apps/openai/actions/index.ts
Normal file
@ -0,0 +1,4 @@
|
||||
import checkModeration from './check-moderation';
|
||||
import sendPrompt from './send-prompt';
|
||||
|
||||
export default [checkModeration, sendPrompt];
|
||||
104
packages/backend/src/apps/openai/actions/send-prompt/index.ts
Normal file
104
packages/backend/src/apps/openai/actions/send-prompt/index.ts
Normal file
@ -0,0 +1,104 @@
|
||||
import defineAction from '../../../../helpers/define-action';
|
||||
|
||||
const castFloatOrUndefined = (value: string | null) => {
|
||||
return value === '' ? undefined : parseFloat(value);
|
||||
}
|
||||
|
||||
export default defineAction({
|
||||
name: 'Send prompt',
|
||||
key: 'sendPrompt',
|
||||
description: 'Creates a completion for the provided prompt and parameters.',
|
||||
arguments: [
|
||||
{
|
||||
label: 'Model',
|
||||
key: 'model',
|
||||
type: 'dropdown' as const,
|
||||
required: true,
|
||||
variables: false,
|
||||
source: {
|
||||
type: 'query',
|
||||
name: 'getDynamicData',
|
||||
arguments: [
|
||||
{
|
||||
name: 'key',
|
||||
value: 'listModels',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
label: 'Prompt',
|
||||
key: 'prompt',
|
||||
type: 'string' as const,
|
||||
required: true,
|
||||
variables: true,
|
||||
description: 'The text to analyze.'
|
||||
},
|
||||
{
|
||||
label: 'Temperature',
|
||||
key: 'temperature',
|
||||
type: 'string' as const,
|
||||
required: false,
|
||||
variables: true,
|
||||
description: 'What sampling temperature to use. Higher values mean the model will take more risk. Try 0.9 for more creative applications, and 0 for ones with a well-defined answer. We generally recommend altering this or Top P but not both.'
|
||||
},
|
||||
{
|
||||
label: 'Maximum tokens',
|
||||
key: 'maxTokens',
|
||||
type: 'string' as const,
|
||||
required: false,
|
||||
variables: true,
|
||||
description: 'The maximum number of tokens to generate in the completion.'
|
||||
},
|
||||
{
|
||||
label: 'Stop Sequence',
|
||||
key: 'stopSequence',
|
||||
type: 'string' as const,
|
||||
required: false,
|
||||
variables: true,
|
||||
description: 'Single stop sequence where the API will stop generating further tokens. The returned text will not contain the stop sequence.'
|
||||
},
|
||||
{
|
||||
label: 'Top P',
|
||||
key: 'topP',
|
||||
type: 'string' as const,
|
||||
required: false,
|
||||
variables: true,
|
||||
description: 'An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with Top P probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.'
|
||||
},
|
||||
{
|
||||
label: 'Frequency Penalty',
|
||||
key: 'frequencyPenalty',
|
||||
type: 'string' as const,
|
||||
required: false,
|
||||
variables: true,
|
||||
description: `Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.`
|
||||
},
|
||||
{
|
||||
label: 'presencePenalty',
|
||||
key: 'presencePenalty',
|
||||
type: 'string' as const,
|
||||
required: false,
|
||||
variables: true,
|
||||
description: `Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.`
|
||||
},
|
||||
],
|
||||
|
||||
async run($) {
|
||||
const payload = {
|
||||
model: $.step.parameters.model as string,
|
||||
prompt: $.step.parameters.prompt as string,
|
||||
temperature: castFloatOrUndefined($.step.parameters.temperature as string),
|
||||
max_tokens: castFloatOrUndefined($.step.parameters.maxTokens as string),
|
||||
stop: ($.step.parameters.stopSequence as string || null),
|
||||
top_p: castFloatOrUndefined($.step.parameters.topP as string),
|
||||
frequency_penalty: castFloatOrUndefined($.step.parameters.frequencyPenalty as string),
|
||||
presence_penalty: castFloatOrUndefined($.step.parameters.presencePenalty as string),
|
||||
};
|
||||
const { data } = await $.http.post('/v1/completions', payload);
|
||||
|
||||
$.setActionItem({
|
||||
raw: data,
|
||||
});
|
||||
},
|
||||
});
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user