Compare commits
546 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
ff72b2ae35 | ||
![]() |
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 | ||
![]() |
c9925ba8fe | ||
![]() |
3b829af43d | ||
![]() |
2abe23f918 | ||
![]() |
475f24f661 | ||
![]() |
e338770e57 | ||
![]() |
6bb2a583de | ||
![]() |
74bbbf55f8 | ||
![]() |
20b87cb000 | ||
![]() |
a3d82c5d70 | ||
![]() |
c778c0c111 | ||
![]() |
bb7ef994f7 | ||
![]() |
278b1ed7c0 | ||
![]() |
08bfb953de | ||
![]() |
276b1ef4cd | ||
![]() |
cbd408ae89 | ||
![]() |
fc6822a298 | ||
![]() |
43b7e506a7 | ||
![]() |
f11a4b8472 | ||
![]() |
927ceb6768 | ||
![]() |
3d9249192c | ||
![]() |
243e50465f | ||
![]() |
d539bc6fc8 | ||
![]() |
6fc52c8b4c | ||
![]() |
df3bf4ce11 | ||
![]() |
c35753c63e | ||
![]() |
8d2cac5018 | ||
![]() |
a8c8efb4bd | ||
![]() |
c94b52aa61 | ||
![]() |
f1d319601e | ||
![]() |
00a0efc945 | ||
![]() |
f175ada782 | ||
![]() |
ede55a70aa | ||
![]() |
7d82ca5d3c | ||
![]() |
6a33636d9d | ||
![]() |
a03c60bd90 | ||
![]() |
4b122bd19e | ||
![]() |
c386b001ba | ||
![]() |
9d5e54c2d9 | ||
![]() |
2ffce75056 | ||
![]() |
ff76e37efc | ||
![]() |
ae3d547c3f | ||
![]() |
a52e365b88 | ||
![]() |
fa7b7d8781 | ||
![]() |
f057501611 | ||
![]() |
e740d4fe25 | ||
![]() |
dbcf8fde7f | ||
![]() |
b4a4f47f78 | ||
![]() |
362c8dc25d | ||
![]() |
18b0a41a40 | ||
![]() |
d43f77a894 | ||
![]() |
aeeb058ebb | ||
![]() |
e57122c4ff | ||
![]() |
802a9bd2e2 | ||
![]() |
b63603afb6 | ||
![]() |
d6c0690324 | ||
![]() |
1cfe84fc3d | ||
![]() |
bcfc9beb99 | ||
![]() |
cb839637ab | ||
![]() |
6dc795fe45 | ||
![]() |
b3f216209a | ||
![]() |
571bf6bfa7 | ||
![]() |
f272e5c4a8 | ||
![]() |
d8a91ac62d | ||
![]() |
92b0c5e409 | ||
![]() |
dfa076ba89 | ||
![]() |
79e609e682 | ||
![]() |
9c40bc5863 | ||
![]() |
7b18937530 | ||
![]() |
c2b020fc94 | ||
![]() |
798769d5ae | ||
![]() |
9546d76dc9 | ||
![]() |
6964f7ebec | ||
![]() |
e58b7166ad | ||
![]() |
d881cfeeb0 | ||
![]() |
854dc6f61a | ||
![]() |
1a3345e521 | ||
![]() |
8632b29719 | ||
![]() |
24a3c3fd1c | ||
![]() |
115a46d2e7 | ||
![]() |
cd5502fdde | ||
![]() |
53bbde4314 | ||
![]() |
9506c22016 | ||
![]() |
f3f9af9fdf | ||
![]() |
2f9e40fc0e | ||
![]() |
c46fbef03c | ||
![]() |
9a973c8257 | ||
![]() |
c2c8973dd5 | ||
![]() |
b178807a39 | ||
![]() |
179fe512af | ||
![]() |
964a38db2c | ||
![]() |
2b38e5a0dd | ||
![]() |
d8e1f6df81 | ||
![]() |
c3a54e0c69 | ||
![]() |
2b6ff7de41 | ||
![]() |
ae58e629ea | ||
![]() |
18ccb25b29 | ||
![]() |
74d7e472af | ||
![]() |
232ba230eb | ||
![]() |
031e175e9f | ||
![]() |
87fdc02224 | ||
![]() |
3308a44c2b | ||
![]() |
796121acfc | ||
![]() |
8e0553147b | ||
![]() |
96007a1f48 | ||
![]() |
5189e5b131 | ||
![]() |
11dc650e0e | ||
![]() |
baebec2270 | ||
![]() |
419d84da97 | ||
![]() |
7d7c96274d | ||
![]() |
4553084503 | ||
![]() |
30bd56b984 | ||
![]() |
4292517a86 | ||
![]() |
f8c7e601a5 | ||
![]() |
fbc867b4fa | ||
![]() |
1644bfeb43 | ||
![]() |
7cc82eb143 | ||
![]() |
5c13c81de9 | ||
![]() |
1b80db1eba | ||
![]() |
30d2740368 | ||
![]() |
8fb58cf662 | ||
![]() |
3b4ad0d9c7 | ||
![]() |
abe4ebe66a | ||
![]() |
ad1514c60b | ||
![]() |
81ff07ec28 | ||
![]() |
7cd45a5ca3 | ||
![]() |
e27a941425 | ||
![]() |
f2c9adf2ef | ||
![]() |
8dfb919aa0 | ||
![]() |
4cfae2d9c6 | ||
![]() |
6b8e44a952 | ||
![]() |
6b40d206f8 | ||
![]() |
524c3c22dc | ||
![]() |
d39cf2f051 | ||
![]() |
b2caea9b9b | ||
![]() |
ea76b5b762 | ||
![]() |
bda7ad9f2f | ||
![]() |
aa8d1d984c | ||
![]() |
4d54a608a6 | ||
![]() |
6466606f49 | ||
![]() |
ca52bee808 | ||
![]() |
8e3ef4873f | ||
![]() |
274d0eb2fd | ||
![]() |
61cf45697c | ||
![]() |
cb8f6f7b75 | ||
![]() |
3978e8cd0d | ||
![]() |
d816446c5e | ||
![]() |
70f1aaab15 | ||
![]() |
cccdb49075 | ||
![]() |
71d6a57cdc | ||
![]() |
05075fc1c4 | ||
![]() |
a1692c3c37 | ||
![]() |
d5cecde0e1 | ||
![]() |
b0dc0adf0e | ||
![]() |
2bb058da36 | ||
![]() |
a56135ca57 | ||
![]() |
bcff9f5a9e | ||
![]() |
59b9c66a91 | ||
![]() |
0f63f6d453 | ||
![]() |
585adb14e6 | ||
![]() |
00be50d2fd | ||
![]() |
7e2dd95134 | ||
![]() |
64807fbc11 | ||
![]() |
204a8ffb7f | ||
![]() |
aef097becb | ||
![]() |
9a743fb4a8 | ||
![]() |
525472d3e0 | ||
![]() |
d2e4f0d143 | ||
![]() |
120a4c2b07 | ||
![]() |
97f88d6c4a | ||
![]() |
1613ab503c | ||
![]() |
45bf274dc0 | ||
![]() |
858737c25c | ||
![]() |
ee31cfd390 | ||
![]() |
5dae0edcf3 | ||
![]() |
e4dd7e454a | ||
![]() |
486e817a40 | ||
![]() |
91ec19c7df | ||
![]() |
f3f4ea5b60 | ||
![]() |
859b3e2db8 | ||
![]() |
3d836b45bf | ||
![]() |
4670e2fe0c | ||
![]() |
3440b89b04 | ||
![]() |
1458003536 | ||
![]() |
eaf3c1ecfd | ||
![]() |
12e73d59d5 | ||
![]() |
51059b0f39 | ||
![]() |
0b8b5aeebd | ||
![]() |
cd795a55d3 | ||
![]() |
922f86f20c | ||
![]() |
b8b2e3e3d2 | ||
![]() |
74aed833bf | ||
![]() |
04a5378e1b | ||
![]() |
dc0f374110 | ||
![]() |
7422f63c62 | ||
![]() |
3004cf1115 | ||
![]() |
a5e114ac68 | ||
![]() |
bc402883b3 | ||
![]() |
72599c6683 | ||
![]() |
1760c6e454 | ||
![]() |
3e05d7b5e9 | ||
![]() |
e9f7dcf030 | ||
![]() |
314787f39c | ||
![]() |
a69cd51dda | ||
![]() |
d1932a107b | ||
![]() |
670ebe5d37 | ||
![]() |
b92e0b9660 | ||
![]() |
664cd1d0cd | ||
![]() |
efc4588a00 | ||
![]() |
92a2d68a81 | ||
![]() |
ee9d095454 | ||
![]() |
b9450e3c55 | ||
![]() |
fe40e16e33 | ||
![]() |
8f5901753e | ||
![]() |
9005256cd3 | ||
![]() |
ace2436e43 | ||
![]() |
d83db08b81 | ||
![]() |
fd0d4dceca | ||
![]() |
6f0a763589 | ||
![]() |
0849801ae9 | ||
![]() |
c0dfc101b2 | ||
![]() |
b5e5ae7321 | ||
![]() |
39792d25d8 | ||
![]() |
20c0451c86 | ||
![]() |
8a883765d4 | ||
![]() |
cad42eed54 | ||
![]() |
a7f68f80d1 | ||
![]() |
c422ca530d | ||
![]() |
237ab48d33 | ||
![]() |
628f872180 | ||
![]() |
56a9aeece7 | ||
![]() |
3c3bb82e97 | ||
![]() |
d9192f6e6b | ||
![]() |
2e31e821b3 | ||
![]() |
6895378d33 | ||
![]() |
f2f99fda31 | ||
![]() |
56b7763488 | ||
![]() |
12bbcd7887 | ||
![]() |
b42c27b02f | ||
![]() |
e34ac3c485 | ||
![]() |
54bbc0d79c | ||
![]() |
3a186ebb1a | ||
![]() |
119650048e | ||
![]() |
ec8e57972a | ||
![]() |
0d04e1534d | ||
![]() |
7b3352ba03 | ||
![]() |
0cfb51dfb1 | ||
![]() |
84558af121 | ||
![]() |
48fd4a0dbe | ||
![]() |
21c16d7272 | ||
![]() |
f604e28ba4 | ||
![]() |
332a4a31f4 | ||
![]() |
8869802d4f | ||
![]() |
b0034de0a5 | ||
![]() |
c76491a8b0 | ||
![]() |
ff2edeea17 | ||
![]() |
284738ae7d | ||
![]() |
b1459cbf3b | ||
![]() |
5838216b72 | ||
![]() |
ce40f7d474 | ||
![]() |
f0d3db6f9a | ||
![]() |
e47c54b336 | ||
![]() |
38bcf6ada0 | ||
![]() |
8d92ba6083 | ||
![]() |
c0aa2e4f6c | ||
![]() |
3705391ecc | ||
![]() |
a2602cd2c8 | ||
![]() |
f5f8632678 | ||
![]() |
a36b805b7c | ||
![]() |
43cd8859bc | ||
![]() |
37548e6c39 | ||
![]() |
47930eca10 | ||
![]() |
1b405728c4 | ||
![]() |
5d7bf38d13 | ||
![]() |
2c2c1e8d89 | ||
![]() |
7f7ec6c115 | ||
![]() |
c9061b24a0 | ||
![]() |
a3dc7d2cde | ||
![]() |
cf90e7cfd6 | ||
![]() |
bbc9ea9571 | ||
![]() |
577abde2e9 | ||
![]() |
8e972fd875 | ||
![]() |
c7b290a380 | ||
![]() |
3d14208175 | ||
![]() |
04ad03cfd9 | ||
![]() |
48e9053124 | ||
![]() |
56c8666f02 | ||
![]() |
1404650566 | ||
![]() |
6a438a34f0 | ||
![]() |
816d63676d | ||
![]() |
8be352765e | ||
![]() |
038b38879f |
@@ -3,6 +3,7 @@ dist
|
|||||||
build
|
build
|
||||||
coverage
|
coverage
|
||||||
packages/docs/*
|
packages/docs/*
|
||||||
|
packages/e2e-tests
|
||||||
|
|
||||||
.eslintrc.js
|
.eslintrc.js
|
||||||
husky.config.js
|
husky.config.js
|
||||||
|
9
.gitignore
vendored
9
.gitignore
vendored
@@ -74,6 +74,15 @@ web_modules/
|
|||||||
.env.test
|
.env.test
|
||||||
.env.production
|
.env.production
|
||||||
|
|
||||||
|
# cypress environment variables file
|
||||||
|
cypress.env.json
|
||||||
|
|
||||||
|
# cypress screenshots
|
||||||
|
packages/e2e-tests/cypress/screenshots
|
||||||
|
|
||||||
|
# cypress videos
|
||||||
|
packages/e2e-tests/cypress/videos/
|
||||||
|
|
||||||
# parcel-bundler cache (https://parceljs.org/)
|
# parcel-bundler cache (https://parceljs.org/)
|
||||||
.cache
|
.cache
|
||||||
.parcel-cache
|
.parcel-cache
|
||||||
|
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@@ -1,3 +1,4 @@
|
|||||||
{
|
{
|
||||||
"editor.formatOnSave": true
|
"editor.formatOnSave": true,
|
||||||
|
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||||
}
|
}
|
||||||
|
15
README.md
15
README.md
@@ -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.
|
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.
|
🤓 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,17 +27,18 @@ The official documentation can be found here: [https://automatisch.io/docs](http
|
|||||||
git clone git@github.com:automatisch/automatisch.git
|
git clone git@github.com:automatisch/automatisch.git
|
||||||
|
|
||||||
# Go to the repository folder
|
# Go to the repository folder
|
||||||
cd automatisch/docker/compose
|
cd automatisch
|
||||||
|
|
||||||
# Start
|
# Start
|
||||||
docker compose up
|
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
|
## Community Links
|
||||||
|
|
||||||
- [Github](https://github.com/automatisch/automatisch)
|
|
||||||
- [Discord](https://discord.gg/dJSah9CVrC)
|
- [Discord](https://discord.gg/dJSah9CVrC)
|
||||||
- [Twitter](https://twitter.com/automatischio)
|
- [Twitter](https://twitter.com/automatischio)
|
||||||
|
|
||||||
@@ -47,10 +48,6 @@ If you have any questions or problems, please visit our GitHub discussions page,
|
|||||||
|
|
||||||
[https://github.com/automatisch/automatisch/discussions](https://github.com/automatisch/automatisch/discussions)
|
[https://github.com/automatisch/automatisch/discussions](https://github.com/automatisch/automatisch/discussions)
|
||||||
|
|
||||||
## Contribution Guide
|
|
||||||
|
|
||||||
You can access to the [contribution guide](https://docs.automatisch.io) page from the documentation website.
|
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
Automatisch is an open-source software with an [AGPL 3.0 license](https://github.com/automatisch/automatisch/blob/main/LICENSE.md).
|
Automatisch is an open-source software with the [AGPL 3.0 license](https://github.com/automatisch/automatisch/blob/main/LICENSE.md).
|
||||||
|
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.3.0
|
||||||
|
|
||||||
|
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.3.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,11 +0,0 @@
|
|||||||
# syntax=docker/dockerfile:1
|
|
||||||
FROM node:16
|
|
||||||
WORKDIR /automatisch
|
|
||||||
|
|
||||||
# npm registry for dev purposes
|
|
||||||
RUN npm config set fetch-retry-maxtimeout 5000
|
|
||||||
RUN npm config set fetch-retry-mintimeout 3000
|
|
||||||
RUN npm set registry http://localhost:5000
|
|
||||||
# npm registry for dev purposes
|
|
||||||
|
|
||||||
RUN yarn global add @automatisch/cli
|
|
@@ -1,21 +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
|
|
||||||
|
|
||||||
# npm registry for dev purposes
|
|
||||||
RUN npm config set fetch-retry-maxtimeout 5000
|
|
||||||
RUN npm config set fetch-retry-mintimeout 3000
|
|
||||||
RUN npm set registry http://localhost:5000
|
|
||||||
# npm registry for dev purposes
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
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 "$@"
|
|
@@ -2,7 +2,7 @@
|
|||||||
"packages": [
|
"packages": [
|
||||||
"packages/*"
|
"packages/*"
|
||||||
],
|
],
|
||||||
"version": "0.1.0",
|
"version": "0.4.0",
|
||||||
"npmClient": "yarn",
|
"npmClient": "yarn",
|
||||||
"useWorkspaces": true,
|
"useWorkspaces": true,
|
||||||
"command": {
|
"command": {
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@automatisch/root",
|
"name": "@automatisch/root",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "lerna run --stream --parallel --scope=@*/{web,backend} dev",
|
"start": "lerna run --stream --parallel --scope=@*/{web,backend} dev",
|
||||||
"start:web": "lerna run --stream --scope=@*/web dev",
|
"start:web": "lerna run --stream --scope=@*/web dev",
|
||||||
|
@@ -1,7 +1,8 @@
|
|||||||
HOST=localhost
|
HOST=localhost
|
||||||
PROTOCOL=http
|
PROTOCOL=http
|
||||||
PORT=3000
|
PORT=3000
|
||||||
WEB_APP_URL=https://localhost:3001
|
WEB_APP_URL=http://localhost:3001
|
||||||
|
WEBHOOK_URL=http://localhost:3000
|
||||||
APP_ENV=development
|
APP_ENV=development
|
||||||
POSTGRES_DATABASE=automatisch_development
|
POSTGRES_DATABASE=automatisch_development
|
||||||
POSTGRES_PORT=5432
|
POSTGRES_PORT=5432
|
||||||
@@ -10,7 +11,12 @@ POSTGRES_USERNAME=automatish_development_user
|
|||||||
POSTGRES_PASSWORD=
|
POSTGRES_PASSWORD=
|
||||||
POSTGRES_ENABLE_SSL=false
|
POSTGRES_ENABLE_SSL=false
|
||||||
ENCRYPTION_KEY=sample-encryption-key
|
ENCRYPTION_KEY=sample-encryption-key
|
||||||
|
WEBHOOK_SECRET_KEY=sample-webhook-key
|
||||||
APP_SECRET_KEY=sample-app-secret-key
|
APP_SECRET_KEY=sample-app-secret-key
|
||||||
REDIS_PORT=6379
|
REDIS_PORT=6379
|
||||||
REDIS_HOST=127.0.0.1
|
REDIS_HOST=127.0.0.1
|
||||||
|
REDIS_USERNAME=redis_username
|
||||||
|
REDIS_PASSWORD=redis_password
|
||||||
|
REDIS_TLS=true
|
||||||
ENABLE_BULLMQ_DASHBOARD=false
|
ENABLE_BULLMQ_DASHBOARD=false
|
||||||
|
SERVE_WEB_APP_SEPARATELY=true
|
||||||
|
@@ -2,11 +2,3 @@
|
|||||||
|
|
||||||
The open source Zapier alternative. Build workflow automation without spending
|
The open source Zapier alternative. Build workflow automation without spending
|
||||||
time and money.
|
time and money.
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
```
|
|
||||||
const backend = require('backend');
|
|
||||||
|
|
||||||
// TODO: DEMONSTRATE API
|
|
||||||
```
|
|
||||||
|
@@ -4,6 +4,6 @@ const client = new Client({
|
|||||||
host: 'localhost',
|
host: 'localhost',
|
||||||
user: 'postgres',
|
user: 'postgres',
|
||||||
port: 5432,
|
port: 5432,
|
||||||
})
|
});
|
||||||
|
|
||||||
export default client;
|
export default client;
|
||||||
|
@@ -4,7 +4,10 @@ import client from './client';
|
|||||||
import User from '../../src/models/user';
|
import User from '../../src/models/user';
|
||||||
import '../../src/config/orm';
|
import '../../src/config/orm';
|
||||||
|
|
||||||
export async function createUser(email = 'user@automatisch.io', password = 'sample') {
|
export async function createUser(
|
||||||
|
email = 'user@automatisch.io',
|
||||||
|
password = 'sample'
|
||||||
|
) {
|
||||||
const UNIQUE_VIOLATION_CODE = '23505';
|
const UNIQUE_VIOLATION_CODE = '23505';
|
||||||
const userParams = {
|
const userParams = {
|
||||||
email,
|
email,
|
||||||
@@ -29,14 +32,17 @@ export async function createUser(email = 'user@automatisch.io', password = 'samp
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const createDatabaseAndUser = async (database = appConfig.postgresDatabase, user = appConfig.postgresUsername) => {
|
export const createDatabaseAndUser = async (
|
||||||
|
database = appConfig.postgresDatabase,
|
||||||
|
user = appConfig.postgresUsername
|
||||||
|
) => {
|
||||||
await client.connect();
|
await client.connect();
|
||||||
await createDatabase(database);
|
await createDatabase(database);
|
||||||
await createDatabaseUser(user);
|
await createDatabaseUser(user);
|
||||||
await grantPrivileges(database, user);
|
await grantPrivileges(database, user);
|
||||||
|
|
||||||
await client.end();
|
await client.end();
|
||||||
}
|
};
|
||||||
|
|
||||||
export const createDatabase = async (database = appConfig.postgresDatabase) => {
|
export const createDatabase = async (database = appConfig.postgresDatabase) => {
|
||||||
const DUPLICATE_DB_CODE = '42P04';
|
const DUPLICATE_DB_CODE = '42P04';
|
||||||
@@ -51,7 +57,7 @@ export const createDatabase = async (database = appConfig.postgresDatabase) => {
|
|||||||
|
|
||||||
logger.info(`Database: ${database} already exists!`);
|
logger.info(`Database: ${database} already exists!`);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
export const createDatabaseUser = async (user = appConfig.postgresUsername) => {
|
export const createDatabaseUser = async (user = appConfig.postgresUsername) => {
|
||||||
const DUPLICATE_OBJECT_CODE = '42710';
|
const DUPLICATE_OBJECT_CODE = '42710';
|
||||||
@@ -68,25 +74,25 @@ export const createDatabaseUser = async (user = appConfig.postgresUsername) => {
|
|||||||
|
|
||||||
logger.info(`Database User: ${user} already exists!`);
|
logger.info(`Database User: ${user} already exists!`);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
export const grantPrivileges = async (
|
export const grantPrivileges = async (
|
||||||
database = appConfig.postgresDatabase, user = appConfig.postgresUsername
|
database = appConfig.postgresDatabase,
|
||||||
|
user = appConfig.postgresUsername
|
||||||
) => {
|
) => {
|
||||||
await client.query(
|
await client.query(
|
||||||
`GRANT ALL PRIVILEGES ON DATABASE ${database} TO ${user};`
|
`GRANT ALL PRIVILEGES ON DATABASE ${database} TO ${user};`
|
||||||
);
|
);
|
||||||
|
|
||||||
logger.info(
|
logger.info(`${user} has granted all privileges on ${database}!`);
|
||||||
`${user} has granted all privileges on ${database}!`
|
};
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export const dropDatabase = async () => {
|
export const dropDatabase = async () => {
|
||||||
if (appConfig.appEnv != 'development' && appConfig.appEnv != 'test') {
|
if (appConfig.appEnv != 'development' && appConfig.appEnv != 'test') {
|
||||||
const errorMessage = 'Drop database command can be used only with development or test environments!'
|
const errorMessage =
|
||||||
|
'Drop database command can be used only with development or test environments!';
|
||||||
|
|
||||||
logger.error(errorMessage)
|
logger.error(errorMessage);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,13 +100,15 @@ export const dropDatabase = async () => {
|
|||||||
await dropDatabaseAndUser();
|
await dropDatabaseAndUser();
|
||||||
|
|
||||||
await client.end();
|
await client.end();
|
||||||
}
|
};
|
||||||
|
|
||||||
export const dropDatabaseAndUser = async(database = appConfig.postgresDatabase, user = appConfig.postgresUsername) => {
|
export const dropDatabaseAndUser = async (
|
||||||
|
database = appConfig.postgresDatabase,
|
||||||
|
user = appConfig.postgresUsername
|
||||||
|
) => {
|
||||||
await client.query(`DROP DATABASE IF EXISTS ${database}`);
|
await client.query(`DROP DATABASE IF EXISTS ${database}`);
|
||||||
logger.info(`Database: ${database} removed!`);
|
logger.info(`Database: ${database} removed!`);
|
||||||
|
|
||||||
await client.query(`DROP USER IF EXISTS ${user}`);
|
await client.query(`DROP USER IF EXISTS ${user}`);
|
||||||
logger.info(`Database User: ${user} removed!`);
|
logger.info(`Database User: ${user} removed!`);
|
||||||
}
|
};
|
||||||
|
|
||||||
|
@@ -10,7 +10,7 @@ const knexConfig = {
|
|||||||
user: appConfig.postgresUsername,
|
user: appConfig.postgresUsername,
|
||||||
password: appConfig.postgresPassword,
|
password: appConfig.postgresPassword,
|
||||||
database: appConfig.postgresDatabase,
|
database: appConfig.postgresDatabase,
|
||||||
ssl: appConfig.postgresEnableSsl
|
ssl: appConfig.postgresEnableSsl,
|
||||||
},
|
},
|
||||||
pool: { min: 0, max: 20 },
|
pool: { min: 0, max: 20 },
|
||||||
migrations: {
|
migrations: {
|
||||||
@@ -20,7 +20,7 @@ const knexConfig = {
|
|||||||
},
|
},
|
||||||
seeds: {
|
seeds: {
|
||||||
directory: __dirname + '/src/db/seeds',
|
directory: __dirname + '/src/db/seeds',
|
||||||
}
|
},
|
||||||
}
|
};
|
||||||
|
|
||||||
export default knexConfig;
|
export default knexConfig;
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
{
|
{
|
||||||
"name": "@automatisch/backend",
|
"name": "@automatisch/backend",
|
||||||
"version": "0.1.0",
|
"version": "0.4.0",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"description": "The open source Zapier alternative. Build workflow automation without spending time and money.",
|
"description": "The open source Zapier alternative. Build workflow automation without spending time and money.",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "ts-node-dev src/server.ts",
|
"dev": "ts-node-dev --exit-child src/server.ts",
|
||||||
"worker": "nodemon --watch 'src/**/*.ts' --exec 'ts-node' src/worker.ts",
|
"worker": "nodemon --watch 'src/**/*.ts' --exec 'ts-node' src/worker.ts",
|
||||||
"build": "tsc && yarn copy-statics",
|
"build": "tsc && yarn copy-statics",
|
||||||
"build:watch": "nodemon --watch 'src/**/*.ts' --watch 'bin/**/*.ts' --exec yarn build --ext ts",
|
"build:watch": "nodemon --watch 'src/**/*.ts' --watch 'bin/**/*.ts' --exec yarn build --ext ts",
|
||||||
@@ -18,49 +18,44 @@
|
|||||||
"db:rollback": "knex migrate:rollback",
|
"db:rollback": "knex migrate:rollback",
|
||||||
"db:migrate": "knex migrate:latest",
|
"db:migrate": "knex migrate:latest",
|
||||||
"copy-statics": "copyfiles src/**/*.{graphql,json,svg} dist",
|
"copy-statics": "copyfiles src/**/*.{graphql,json,svg} dist",
|
||||||
"prepack": "yarn build"
|
"prepack": "yarn build",
|
||||||
|
"prebuild": "rm -rf ./dist"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@automatisch/web": "^0.1.0",
|
"@automatisch/web": "^0.4.0",
|
||||||
"@bull-board/express": "^3.10.1",
|
"@bull-board/express": "^3.10.1",
|
||||||
"@gitbeaker/node": "^35.6.0",
|
|
||||||
"@graphql-tools/graphql-file-loader": "^7.3.4",
|
"@graphql-tools/graphql-file-loader": "^7.3.4",
|
||||||
"@graphql-tools/load": "^7.5.2",
|
"@graphql-tools/load": "^7.5.2",
|
||||||
"@rudderstack/rudder-sdk-node": "^1.1.2",
|
"@rudderstack/rudder-sdk-node": "^1.1.2",
|
||||||
"@slack/bolt": "3.10.0",
|
|
||||||
"@types/luxon": "^2.3.1",
|
"@types/luxon": "^2.3.1",
|
||||||
"ajv-formats": "^2.1.1",
|
"ajv-formats": "^2.1.1",
|
||||||
"axios": "0.24.0",
|
"axios": "0.24.0",
|
||||||
"bcrypt": "^5.0.1",
|
"bcrypt": "^5.0.1",
|
||||||
"bullmq": "^1.76.1",
|
"bullmq": "^3.0.0",
|
||||||
"copyfiles": "^2.4.1",
|
"copyfiles": "^2.4.1",
|
||||||
"cors": "^2.8.5",
|
"cors": "^2.8.5",
|
||||||
"crypto-js": "^4.1.1",
|
"crypto-js": "^4.1.1",
|
||||||
"debug": "~2.6.9",
|
"debug": "~2.6.9",
|
||||||
"discord.js": "13.2.0",
|
|
||||||
"dotenv": "^10.0.0",
|
"dotenv": "^10.0.0",
|
||||||
"express": "~4.16.1",
|
"express": "~4.18.2",
|
||||||
|
"express-basic-auth": "^1.2.1",
|
||||||
"express-graphql": "^0.12.0",
|
"express-graphql": "^0.12.0",
|
||||||
"flickr-sdk": "3.10.0",
|
"fast-xml-parser": "^4.0.11",
|
||||||
"googleapis": "89.0.0",
|
|
||||||
"graphql-middleware": "^6.1.15",
|
"graphql-middleware": "^6.1.15",
|
||||||
"graphql-shield": "^7.5.0",
|
"graphql-shield": "^7.5.0",
|
||||||
"graphql-tools": "^8.2.0",
|
"graphql-tools": "^8.2.0",
|
||||||
"graphql-type-json": "^0.3.2",
|
"graphql-type-json": "^0.3.2",
|
||||||
"http-errors": "~1.6.3",
|
"http-errors": "~1.6.3",
|
||||||
"jsonwebtoken": "^8.5.1",
|
"jsonwebtoken": "^9.0.0",
|
||||||
"knex": "^0.95.11",
|
"knex": "^0.95.11",
|
||||||
"lodash.get": "^4.4.2",
|
"lodash.get": "^4.4.2",
|
||||||
"luxon": "2.3.1",
|
"luxon": "2.5.2",
|
||||||
"morgan": "^1.10.0",
|
"morgan": "^1.10.0",
|
||||||
|
"multer": "1.4.5-lts.1",
|
||||||
"nodemailer": "6.7.0",
|
"nodemailer": "6.7.0",
|
||||||
"oauth-1.0a": "^2.2.6",
|
"oauth-1.0a": "^2.2.6",
|
||||||
"objection": "^3.0.0",
|
"objection": "^3.0.0",
|
||||||
"octokit": "^1.7.1",
|
|
||||||
"pg": "^8.7.1",
|
"pg": "^8.7.1",
|
||||||
"twilio": "3.70.0",
|
|
||||||
"twitch-js": "2.0.0-beta.42",
|
|
||||||
"twitter-api-v2": "1.6.0",
|
|
||||||
"winston": "^3.7.1"
|
"winston": "^3.7.1"
|
||||||
},
|
},
|
||||||
"contributors": [
|
"contributors": [
|
||||||
@@ -99,16 +94,17 @@
|
|||||||
"url": "https://github.com/automatisch/automatisch/issues"
|
"url": "https://github.com/automatisch/automatisch/issues"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@automatisch/types": "^0.1.0",
|
"@automatisch/types": "^0.4.0",
|
||||||
"@types/bcrypt": "^5.0.0",
|
"@types/bcrypt": "^5.0.0",
|
||||||
"@types/bull": "^3.15.8",
|
"@types/bull": "^3.15.8",
|
||||||
"@types/cors": "^2.8.12",
|
"@types/cors": "^2.8.12",
|
||||||
"@types/crypto-js": "^4.0.2",
|
"@types/crypto-js": "^4.0.2",
|
||||||
"@types/express": "^4.17.13",
|
"@types/express": "^4.17.15",
|
||||||
"@types/http-errors": "^1.8.1",
|
"@types/http-errors": "^1.8.1",
|
||||||
"@types/jsonwebtoken": "^8.5.8",
|
"@types/jsonwebtoken": "^8.5.8",
|
||||||
"@types/lodash.get": "^4.4.6",
|
"@types/lodash.get": "^4.4.6",
|
||||||
"@types/morgan": "^1.9.3",
|
"@types/morgan": "^1.9.3",
|
||||||
|
"@types/multer": "1.4.7",
|
||||||
"@types/node": "^16.10.2",
|
"@types/node": "^16.10.2",
|
||||||
"@types/nodemailer": "^6.4.4",
|
"@types/nodemailer": "^6.4.4",
|
||||||
"@types/pg": "^8.6.1",
|
"@types/pg": "^8.6.1",
|
||||||
|
@@ -1,9 +1,7 @@
|
|||||||
import appConfig from './config/app';
|
|
||||||
import createError from 'http-errors';
|
import createError from 'http-errors';
|
||||||
import express, { Request, Response, NextFunction } from 'express';
|
import express from 'express';
|
||||||
import cors from 'cors';
|
import cors from 'cors';
|
||||||
import corsOptions from './config/cors-options';
|
import corsOptions from './config/cors-options';
|
||||||
import graphQLInstance from './helpers/graphql-instance';
|
|
||||||
import morgan from './helpers/morgan';
|
import morgan from './helpers/morgan';
|
||||||
import appAssetsHandler from './helpers/app-assets-handler';
|
import appAssetsHandler from './helpers/app-assets-handler';
|
||||||
import webUIHandler from './helpers/web-ui-handler';
|
import webUIHandler from './helpers/web-ui-handler';
|
||||||
@@ -14,29 +12,38 @@ import {
|
|||||||
serverAdapter,
|
serverAdapter,
|
||||||
} from './helpers/create-bull-board-handler';
|
} from './helpers/create-bull-board-handler';
|
||||||
import injectBullBoardHandler from './helpers/inject-bull-board-handler';
|
import injectBullBoardHandler from './helpers/inject-bull-board-handler';
|
||||||
|
import router from './routes';
|
||||||
|
import { IRequest } from '@automatisch/types';
|
||||||
|
|
||||||
if (appConfig.enableBullMQDashboard) {
|
|
||||||
createBullBoardHandler(serverAdapter);
|
createBullBoardHandler(serverAdapter);
|
||||||
}
|
|
||||||
|
|
||||||
const app = express();
|
const app = express();
|
||||||
|
|
||||||
if (appConfig.enableBullMQDashboard) {
|
|
||||||
injectBullBoardHandler(app, serverAdapter);
|
injectBullBoardHandler(app, serverAdapter);
|
||||||
}
|
|
||||||
|
|
||||||
appAssetsHandler(app);
|
appAssetsHandler(app);
|
||||||
|
|
||||||
app.use(morgan);
|
app.use(morgan);
|
||||||
app.use(express.json());
|
app.use(
|
||||||
app.use(express.urlencoded({ extended: false }));
|
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(cors(corsOptions));
|
||||||
app.use('/graphql', graphQLInstance);
|
app.use('/', router);
|
||||||
|
|
||||||
webUIHandler(app);
|
webUIHandler(app);
|
||||||
|
|
||||||
// catch 404 and forward to error handler
|
// 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));
|
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;
|
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 |
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,
|
||||||
|
});
|
3
packages/backend/src/apps/discord/actions/index.ts
Normal file
3
packages/backend/src/apps/discord/actions/index.ts
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
import sendMessageToChannel from './send-message-to-channel';
|
||||||
|
|
||||||
|
export default [sendMessageToChannel];
|
@@ -0,0 +1,47 @@
|
|||||||
|
import defineAction from '../../../../helpers/define-action';
|
||||||
|
|
||||||
|
export default defineAction({
|
||||||
|
name: 'Send a message to channel',
|
||||||
|
key: 'sendMessageToChannel',
|
||||||
|
description: 'Sends a message to a specific channel you specify.',
|
||||||
|
arguments: [
|
||||||
|
{
|
||||||
|
label: 'Channel',
|
||||||
|
key: 'channel',
|
||||||
|
type: 'dropdown' as const,
|
||||||
|
required: true,
|
||||||
|
description: 'Pick a channel to send the message to.',
|
||||||
|
variables: false,
|
||||||
|
source: {
|
||||||
|
type: 'query',
|
||||||
|
name: 'getDynamicData',
|
||||||
|
arguments: [
|
||||||
|
{
|
||||||
|
name: 'key',
|
||||||
|
value: 'listChannels',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Message text',
|
||||||
|
key: 'message',
|
||||||
|
type: 'string' as const,
|
||||||
|
required: true,
|
||||||
|
description: 'The content of your new message.',
|
||||||
|
variables: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
|
async run($) {
|
||||||
|
const data = {
|
||||||
|
content: $.step.parameters.message as string,
|
||||||
|
};
|
||||||
|
const response = await $.http?.post(
|
||||||
|
`/channels/${$.step.parameters.channel}/messages`,
|
||||||
|
data
|
||||||
|
);
|
||||||
|
|
||||||
|
$.setActionItem({ raw: response.data });
|
||||||
|
},
|
||||||
|
});
|
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 });
|
||||||
|
}
|
61
packages/backend/src/apps/discord/auth/index.ts
Normal file
61
packages/backend/src/apps/discord/auth/index.ts
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
import generateAuthUrl from './generate-auth-url';
|
||||||
|
import verifyCredentials from './verify-credentials';
|
||||||
|
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/discord/connections/add',
|
||||||
|
placeholder: null,
|
||||||
|
description:
|
||||||
|
'When asked to input an OAuth callback or redirect URL in Discord OAuth, enter the URL above.',
|
||||||
|
docUrl: 'https://automatisch.io/docs/discord#oauth-redirect-url',
|
||||||
|
clickToCopy: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'consumerKey',
|
||||||
|
label: 'Consumer Key',
|
||||||
|
type: 'string' as const,
|
||||||
|
required: true,
|
||||||
|
readOnly: false,
|
||||||
|
value: null,
|
||||||
|
placeholder: null,
|
||||||
|
description: null,
|
||||||
|
docUrl: 'https://automatisch.io/docs/discord#consumer-key',
|
||||||
|
clickToCopy: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'consumerSecret',
|
||||||
|
label: 'Consumer Secret',
|
||||||
|
type: 'string' as const,
|
||||||
|
required: true,
|
||||||
|
readOnly: false,
|
||||||
|
value: null,
|
||||||
|
placeholder: null,
|
||||||
|
description: null,
|
||||||
|
docUrl: 'https://automatisch.io/docs/discord#consumer-secret',
|
||||||
|
clickToCopy: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'botToken',
|
||||||
|
label: 'Bot token',
|
||||||
|
type: 'string' as const,
|
||||||
|
required: true,
|
||||||
|
readOnly: false,
|
||||||
|
value: null,
|
||||||
|
placeholder: null,
|
||||||
|
description: null,
|
||||||
|
docUrl: 'https://automatisch.io/docs/discord#bot-token',
|
||||||
|
clickToCopy: false,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
|
generateAuthUrl,
|
||||||
|
verifyCredentials,
|
||||||
|
isStillVerified,
|
||||||
|
};
|
10
packages/backend/src/apps/discord/auth/is-still-verified.ts
Normal file
10
packages/backend/src/apps/discord/auth/is-still-verified.ts
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import { IGlobalVariable } from '@automatisch/types';
|
||||||
|
import getCurrentUser from '../common/get-current-user';
|
||||||
|
|
||||||
|
const isStillVerified = async ($: IGlobalVariable) => {
|
||||||
|
await getCurrentUser($);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default isStillVerified;
|
53
packages/backend/src/apps/discord/auth/verify-credentials.ts
Normal file
53
packages/backend/src/apps/discord/auth/verify-credentials.ts
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
import { IGlobalVariable, IField } from '@automatisch/types';
|
||||||
|
import { URLSearchParams } from 'url';
|
||||||
|
import scopes from '../common/scopes';
|
||||||
|
import getCurrentUser from '../common/get-current-user';
|
||||||
|
|
||||||
|
const verifyCredentials = async ($: IGlobalVariable) => {
|
||||||
|
const oauthRedirectUrlField = $.app.auth.fields.find(
|
||||||
|
(field: IField) => field.key == 'oAuthRedirectUrl'
|
||||||
|
);
|
||||||
|
const callbackUrl = oauthRedirectUrlField.value as string;
|
||||||
|
const params = new URLSearchParams({
|
||||||
|
client_id: $.auth.data.consumerKey as string,
|
||||||
|
redirect_uri: callbackUrl,
|
||||||
|
response_type: 'code',
|
||||||
|
scope: scopes.join(' '),
|
||||||
|
client_secret: $.auth.data.consumerSecret as string,
|
||||||
|
code: $.auth.data.code as string,
|
||||||
|
grant_type: 'authorization_code',
|
||||||
|
});
|
||||||
|
const { data: verifiedCredentials } = await $.http.post(
|
||||||
|
'/oauth2/token',
|
||||||
|
params.toString()
|
||||||
|
);
|
||||||
|
|
||||||
|
const {
|
||||||
|
access_token: accessToken,
|
||||||
|
refresh_token: refreshToken,
|
||||||
|
expires_in: expiresIn,
|
||||||
|
scope: scope,
|
||||||
|
token_type: tokenType,
|
||||||
|
guild: { id: guildId, name: guildName },
|
||||||
|
} = verifiedCredentials;
|
||||||
|
|
||||||
|
await $.auth.set({
|
||||||
|
accessToken,
|
||||||
|
refreshToken,
|
||||||
|
expiresIn,
|
||||||
|
scope,
|
||||||
|
tokenType,
|
||||||
|
});
|
||||||
|
|
||||||
|
const user = await getCurrentUser($);
|
||||||
|
|
||||||
|
await $.auth.set({
|
||||||
|
userId: user.id,
|
||||||
|
screenName: user.username,
|
||||||
|
email: user.email,
|
||||||
|
guildId,
|
||||||
|
guildName,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export default verifyCredentials;
|
@@ -1,99 +0,0 @@
|
|||||||
import type {
|
|
||||||
IAuthentication,
|
|
||||||
IApp,
|
|
||||||
IField,
|
|
||||||
IJSONObject,
|
|
||||||
} from '@automatisch/types';
|
|
||||||
import { URLSearchParams } from 'url';
|
|
||||||
import axios, { AxiosInstance } from 'axios';
|
|
||||||
|
|
||||||
export default class Authentication implements IAuthentication {
|
|
||||||
appData: IApp;
|
|
||||||
connectionData: IJSONObject;
|
|
||||||
client: AxiosInstance = axios.create({
|
|
||||||
baseURL: 'https://discord.com/api/',
|
|
||||||
});
|
|
||||||
|
|
||||||
scope: string[] = ['identify', 'email'];
|
|
||||||
|
|
||||||
constructor(appData: IApp, connectionData: IJSONObject) {
|
|
||||||
this.appData = appData;
|
|
||||||
this.connectionData = connectionData;
|
|
||||||
}
|
|
||||||
|
|
||||||
get oauthRedirectUrl() {
|
|
||||||
return this.appData.fields.find(
|
|
||||||
(field: IField) => field.key == 'oAuthRedirectUrl'
|
|
||||||
).value;
|
|
||||||
}
|
|
||||||
|
|
||||||
async createAuthData() {
|
|
||||||
const searchParams = new URLSearchParams({
|
|
||||||
client_id: this.connectionData.consumerKey as string,
|
|
||||||
redirect_uri: this.oauthRedirectUrl,
|
|
||||||
response_type: 'code',
|
|
||||||
scope: this.scope.join(' '),
|
|
||||||
});
|
|
||||||
|
|
||||||
const url = `https://discord.com/api/oauth2/authorize?${searchParams.toString()}`;
|
|
||||||
|
|
||||||
return { url };
|
|
||||||
}
|
|
||||||
|
|
||||||
async verifyCredentials() {
|
|
||||||
const params = new URLSearchParams({
|
|
||||||
client_id: this.connectionData.consumerKey as string,
|
|
||||||
redirect_uri: this.oauthRedirectUrl,
|
|
||||||
response_type: 'code',
|
|
||||||
scope: this.scope.join(' '),
|
|
||||||
client_secret: this.connectionData.consumerSecret as string,
|
|
||||||
code: this.connectionData.oauthVerifier as string,
|
|
||||||
grant_type: 'authorization_code',
|
|
||||||
});
|
|
||||||
const { data: verifiedCredentials } = await this.client.post(
|
|
||||||
'/oauth2/token',
|
|
||||||
params.toString()
|
|
||||||
);
|
|
||||||
|
|
||||||
const {
|
|
||||||
access_token: accessToken,
|
|
||||||
refresh_token: refreshToken,
|
|
||||||
expires_in: expiresIn,
|
|
||||||
scope: scope,
|
|
||||||
token_type: tokenType,
|
|
||||||
} = verifiedCredentials;
|
|
||||||
|
|
||||||
const { data: user } = await this.client.get('/users/@me', {
|
|
||||||
headers: {
|
|
||||||
Authorization: `${tokenType} ${accessToken}`,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
return {
|
|
||||||
consumerKey: this.connectionData.consumerKey,
|
|
||||||
consumerSecret: this.connectionData.consumerSecret,
|
|
||||||
accessToken,
|
|
||||||
refreshToken,
|
|
||||||
expiresIn,
|
|
||||||
scope,
|
|
||||||
tokenType,
|
|
||||||
userId: user.id,
|
|
||||||
screenName: user.username,
|
|
||||||
email: user.email,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
async isStillVerified() {
|
|
||||||
try {
|
|
||||||
await this.client.get('/users/@me', {
|
|
||||||
headers: {
|
|
||||||
Authorization: `${this.connectionData.tokenType} ${this.connectionData.accessToken}`,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
return true;
|
|
||||||
} catch {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
12
packages/backend/src/apps/discord/common/add-auth-header.ts
Normal file
12
packages/backend/src/apps/discord/common/add-auth-header.ts
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
import { TBeforeRequest } from '@automatisch/types';
|
||||||
|
|
||||||
|
const addAuthHeader: TBeforeRequest = ($, requestConfig) => {
|
||||||
|
const { tokenType, botToken } = $.auth.data;
|
||||||
|
if (tokenType && botToken) {
|
||||||
|
requestConfig.headers.Authorization = `Bot ${botToken}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
return requestConfig;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default addAuthHeader;
|
10
packages/backend/src/apps/discord/common/get-current-user.ts
Normal file
10
packages/backend/src/apps/discord/common/get-current-user.ts
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import { IGlobalVariable, IJSONObject } from '@automatisch/types';
|
||||||
|
|
||||||
|
const getCurrentUser = async ($: IGlobalVariable): Promise<IJSONObject> => {
|
||||||
|
const response = await $.http.get('/users/@me');
|
||||||
|
const currentUser = response.data;
|
||||||
|
|
||||||
|
return currentUser;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default getCurrentUser;
|
3
packages/backend/src/apps/discord/common/scopes.ts
Normal file
3
packages/backend/src/apps/discord/common/scopes.ts
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
const scopes = ['bot', 'identify'];
|
||||||
|
|
||||||
|
export default scopes;
|
3
packages/backend/src/apps/discord/dynamic-data/index.ts
Normal file
3
packages/backend/src/apps/discord/dynamic-data/index.ts
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
import listChannels from './list-channels';
|
||||||
|
|
||||||
|
export default [listChannels];
|
@@ -0,0 +1,34 @@
|
|||||||
|
import { IGlobalVariable, IJSONObject } from '@automatisch/types';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'List channels',
|
||||||
|
key: 'listChannels',
|
||||||
|
|
||||||
|
async run($: IGlobalVariable) {
|
||||||
|
const channels: {
|
||||||
|
data: IJSONObject[];
|
||||||
|
error: IJSONObject | null;
|
||||||
|
} = {
|
||||||
|
data: [],
|
||||||
|
error: null,
|
||||||
|
};
|
||||||
|
|
||||||
|
const response = await $.http.get(
|
||||||
|
`/guilds/${$.auth.data.guildId}/channels`
|
||||||
|
);
|
||||||
|
|
||||||
|
channels.data = response.data
|
||||||
|
.filter((channel: IJSONObject) => {
|
||||||
|
// filter in text channels only
|
||||||
|
return channel.type === 0;
|
||||||
|
})
|
||||||
|
.map((channel: IJSONObject) => {
|
||||||
|
return {
|
||||||
|
value: channel.id,
|
||||||
|
name: channel.name,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
return channels;
|
||||||
|
},
|
||||||
|
};
|
@@ -1,15 +1,22 @@
|
|||||||
import Authentication from './authentication';
|
import defineApp from '../../helpers/define-app';
|
||||||
import {
|
import addAuthHeader from './common/add-auth-header';
|
||||||
IService,
|
import auth from './auth';
|
||||||
IAuthentication,
|
import dynamicData from './dynamic-data';
|
||||||
IApp,
|
import actions from './actions';
|
||||||
IJSONObject,
|
import triggers from './triggers';
|
||||||
} from '@automatisch/types';
|
|
||||||
|
|
||||||
export default class Discord implements IService {
|
export default defineApp({
|
||||||
authenticationClient: IAuthentication;
|
name: 'Discord',
|
||||||
|
key: 'discord',
|
||||||
constructor(appData: IApp, connectionData: IJSONObject) {
|
iconUrl: '{BASE_URL}/apps/discord/assets/favicon.svg',
|
||||||
this.authenticationClient = new Authentication(appData, connectionData);
|
authDocUrl: 'https://automatisch.io/docs/apps/discord/connection',
|
||||||
}
|
supportsConnections: true,
|
||||||
}
|
baseUrl: 'https://discord.com',
|
||||||
|
apiBaseUrl: 'https://discord.com/api',
|
||||||
|
primaryColor: '5865f2',
|
||||||
|
beforeRequest: [addAuthHeader],
|
||||||
|
auth,
|
||||||
|
dynamicData,
|
||||||
|
triggers,
|
||||||
|
actions,
|
||||||
|
});
|
||||||
|
@@ -1,219 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "Discord",
|
|
||||||
"key": "discord",
|
|
||||||
"iconUrl": "{BASE_URL}/apps/discord/assets/favicon.svg",
|
|
||||||
"docUrl": "https://automatisch.io/docs/discord",
|
|
||||||
"primaryColor": "5865f2",
|
|
||||||
"supportsConnections": true,
|
|
||||||
"fields": [
|
|
||||||
{
|
|
||||||
"key": "oAuthRedirectUrl",
|
|
||||||
"label": "OAuth Redirect URL",
|
|
||||||
"type": "string",
|
|
||||||
"required": true,
|
|
||||||
"readOnly": true,
|
|
||||||
"value": "{WEB_APP_URL}/app/discord/connections/add",
|
|
||||||
"placeholder": null,
|
|
||||||
"description": "When asked to input an OAuth callback or redirect URL in Discord OAuth, enter the URL above.",
|
|
||||||
"docUrl": "https://automatisch.io/docs/discord#oauth-redirect-url",
|
|
||||||
"clickToCopy": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"key": "consumerKey",
|
|
||||||
"label": "Consumer Key",
|
|
||||||
"type": "string",
|
|
||||||
"required": true,
|
|
||||||
"readOnly": false,
|
|
||||||
"value": null,
|
|
||||||
"placeholder": null,
|
|
||||||
"description": null,
|
|
||||||
"docUrl": "https://automatisch.io/docs/discord#consumer-key",
|
|
||||||
"clickToCopy": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"key": "consumerSecret",
|
|
||||||
"label": "Consumer Secret",
|
|
||||||
"type": "string",
|
|
||||||
"required": true,
|
|
||||||
"readOnly": false,
|
|
||||||
"value": null,
|
|
||||||
"placeholder": null,
|
|
||||||
"description": null,
|
|
||||||
"docUrl": "https://automatisch.io/docs/discord#consumer-secret",
|
|
||||||
"clickToCopy": false
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"authenticationSteps": [
|
|
||||||
{
|
|
||||||
"step": 1,
|
|
||||||
"type": "mutation",
|
|
||||||
"name": "createConnection",
|
|
||||||
"arguments": [
|
|
||||||
{
|
|
||||||
"name": "key",
|
|
||||||
"value": "{key}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "formattedData",
|
|
||||||
"value": null,
|
|
||||||
"properties": [
|
|
||||||
{
|
|
||||||
"name": "consumerKey",
|
|
||||||
"value": "{fields.consumerKey}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "consumerSecret",
|
|
||||||
"value": "{fields.consumerSecret}"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"step": 2,
|
|
||||||
"type": "mutation",
|
|
||||||
"name": "createAuthData",
|
|
||||||
"arguments": [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"value": "{createConnection.id}"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"step": 3,
|
|
||||||
"type": "openWithPopup",
|
|
||||||
"name": "openAuthPopup",
|
|
||||||
"arguments": [
|
|
||||||
{
|
|
||||||
"name": "url",
|
|
||||||
"value": "{createAuthData.url}"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"step": 4,
|
|
||||||
"type": "mutation",
|
|
||||||
"name": "updateConnection",
|
|
||||||
"arguments": [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"value": "{createConnection.id}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "formattedData",
|
|
||||||
"value": null,
|
|
||||||
"properties": [
|
|
||||||
{
|
|
||||||
"name": "oauthVerifier",
|
|
||||||
"value": "{openAuthPopup.code}"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"step": 5,
|
|
||||||
"type": "mutation",
|
|
||||||
"name": "verifyConnection",
|
|
||||||
"arguments": [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"value": "{createConnection.id}"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"reconnectionSteps": [
|
|
||||||
{
|
|
||||||
"step": 1,
|
|
||||||
"type": "mutation",
|
|
||||||
"name": "resetConnection",
|
|
||||||
"arguments": [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"value": "{connection.id}"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"step": 2,
|
|
||||||
"type": "mutation",
|
|
||||||
"name": "updateConnection",
|
|
||||||
"arguments": [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"value": "{connection.id}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "formattedData",
|
|
||||||
"value": null,
|
|
||||||
"properties": [
|
|
||||||
{
|
|
||||||
"name": "consumerKey",
|
|
||||||
"value": "{fields.consumerKey}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "consumerSecret",
|
|
||||||
"value": "{fields.consumerSecret}"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"step": 3,
|
|
||||||
"type": "mutation",
|
|
||||||
"name": "createAuthData",
|
|
||||||
"arguments": [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"value": "{connection.id}"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"step": 4,
|
|
||||||
"type": "openWithPopup",
|
|
||||||
"name": "openAuthPopup",
|
|
||||||
"arguments": [
|
|
||||||
{
|
|
||||||
"name": "url",
|
|
||||||
"value": "{createAuthData.url}"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"step": 5,
|
|
||||||
"type": "mutation",
|
|
||||||
"name": "updateConnection",
|
|
||||||
"arguments": [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"value": "{connection.id}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "formattedData",
|
|
||||||
"value": null,
|
|
||||||
"properties": [
|
|
||||||
{
|
|
||||||
"name": "oauthVerifier",
|
|
||||||
"value": "{openAuthPopup.code}"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"step": 6,
|
|
||||||
"type": "mutation",
|
|
||||||
"name": "verifyConnection",
|
|
||||||
"arguments": [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"value": "{connection.id}"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
1
packages/backend/src/apps/discord/triggers/index.ts
Normal file
1
packages/backend/src/apps/discord/triggers/index.ts
Normal file
@@ -0,0 +1 @@
|
|||||||
|
export default [];
|
@@ -1,35 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
||||||
<svg width="256px" height="351px" viewBox="0 0 256 351" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" preserveAspectRatio="xMidYMid">
|
|
||||||
<defs>
|
|
||||||
<path d="M1.25273437,280.731641 L2.85834533,277.600858 L102.211177,89.0833546 L58.0613266,5.6082033 C54.3920011,-1.28304578 45.0741245,0.473674398 43.8699203,8.18789086 L1.25273437,280.731641 Z" id="path-1"></path>
|
|
||||||
<filter x="-50%" y="-50%" width="200%" height="200%" filterUnits="objectBoundingBox" id="filter-2">
|
|
||||||
<feGaussianBlur stdDeviation="17.5" in="SourceAlpha" result="shadowBlurInner1"></feGaussianBlur>
|
|
||||||
<feOffset dx="0" dy="0" in="shadowBlurInner1" result="shadowOffsetInner1"></feOffset>
|
|
||||||
<feComposite in="shadowOffsetInner1" in2="SourceAlpha" operator="arithmetic" k2="-1" k3="1" result="shadowInnerInner1"></feComposite>
|
|
||||||
<feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.06 0" type="matrix" in="shadowInnerInner1"></feColorMatrix>
|
|
||||||
</filter>
|
|
||||||
<path d="M134.417103,148.974235 L166.455722,116.161738 L134.417104,55.1546874 C131.374828,49.3635911 123.983911,48.7568362 120.973828,54.5646483 L103.26875,88.6738296 L102.739423,90.4175473 L134.417103,148.974235 Z" id="path-3"></path>
|
|
||||||
<filter x="-50%" y="-50%" width="200%" height="200%" filterUnits="objectBoundingBox" id="filter-4">
|
|
||||||
<feGaussianBlur stdDeviation="3.5" in="SourceAlpha" result="shadowBlurInner1"></feGaussianBlur>
|
|
||||||
<feOffset dx="1" dy="-9" in="shadowBlurInner1" result="shadowOffsetInner1"></feOffset>
|
|
||||||
<feComposite in="shadowOffsetInner1" in2="SourceAlpha" operator="arithmetic" k2="-1" k3="1" result="shadowInnerInner1"></feComposite>
|
|
||||||
<feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.09 0" type="matrix" in="shadowInnerInner1"></feColorMatrix>
|
|
||||||
</filter>
|
|
||||||
</defs>
|
|
||||||
<g>
|
|
||||||
<path d="M0,282.99762 L2.12250746,280.0256 L102.527363,89.5119284 L102.739423,87.4951323 L58.478806,4.35817711 C54.7706269,-2.60604179 44.3313035,-0.845245771 43.1143483,6.95065473 L0,282.99762 Z" fill="#FFC24A"></path>
|
|
||||||
<g>
|
|
||||||
<use fill="#FFA712" fill-rule="evenodd" xlink:href="#path-1"></use>
|
|
||||||
<use fill="black" fill-opacity="1" filter="url(#filter-2)" xlink:href="#path-1"></use>
|
|
||||||
</g>
|
|
||||||
<path d="M135.004975,150.380704 L167.960199,116.629461 L134.995423,53.6993114 C131.866109,47.7425353 123.128817,47.7253411 120.032618,53.6993112 L102.421015,87.2880848 L102.421015,90.1487443 L135.004975,150.380704 Z" fill="#F4BD62"></path>
|
|
||||||
<g>
|
|
||||||
<use fill="#FFA50E" fill-rule="evenodd" xlink:href="#path-3"></use>
|
|
||||||
<use fill="black" fill-opacity="1" filter="url(#filter-4)" xlink:href="#path-3"></use>
|
|
||||||
</g>
|
|
||||||
<polygon fill="#F6820C" points="0 282.99762 0.962097168 282.030396 4.45771144 280.60956 132.935323 152.60956 134.563025 148.178595 102.513123 87.1048584"></polygon>
|
|
||||||
<path d="M139.120971,347.551268 L255.395916,282.703666 L222.191698,78.2093373 C221.153051,71.8112478 213.303658,69.2818149 208.724314,73.8694368 L0.000254726368,282.997875 L115.608454,347.545536 C122.914643,351.624979 131.812872,351.62689 139.120971,347.551268" fill="#FDE068"></path>
|
|
||||||
<path d="M254.354084,282.159837 L221.401937,79.2179369 C220.371175,72.8684188 213.843792,70.2409553 209.299213,74.79375 L1.28945312,282.600785 L115.627825,346.509458 C122.878548,350.557931 131.709226,350.559827 138.961846,346.515146 L254.354084,282.159837 Z" fill="#FCCA3F"></path>
|
|
||||||
<path d="M139.120907,345.64082 C131.812808,349.716442 122.914579,349.714531 115.60839,345.635089 L0.93134768,282.014551 L0.000191044776,282.997875 L115.60839,347.545536 C122.914579,351.624979 131.812808,351.62689 139.120907,347.551268 L255.395853,282.703666 L255.111196,280.951785 L139.120907,345.64082 Z" fill="#EEAB37"></path>
|
|
||||||
</g>
|
|
||||||
</svg>
|
|
Before Width: | Height: | Size: 3.8 KiB |
@@ -1,89 +0,0 @@
|
|||||||
import type {
|
|
||||||
IAuthentication,
|
|
||||||
IApp,
|
|
||||||
IField,
|
|
||||||
IJSONObject,
|
|
||||||
} from '@automatisch/types';
|
|
||||||
import { google as GoogleApi } from 'googleapis';
|
|
||||||
import { OAuth2Client } from 'google-auth-library';
|
|
||||||
|
|
||||||
export default class Authentication implements IAuthentication {
|
|
||||||
appData: IApp;
|
|
||||||
connectionData: IJSONObject;
|
|
||||||
client: OAuth2Client;
|
|
||||||
|
|
||||||
scopes: string[] = [
|
|
||||||
'https://www.googleapis.com/auth/datastore',
|
|
||||||
'https://www.googleapis.com/auth/firebase',
|
|
||||||
'https://www.googleapis.com/auth/user.emails.read',
|
|
||||||
'profile',
|
|
||||||
];
|
|
||||||
|
|
||||||
constructor(appData: IApp, connectionData: IJSONObject) {
|
|
||||||
this.appData = appData;
|
|
||||||
this.connectionData = connectionData;
|
|
||||||
|
|
||||||
this.client = new GoogleApi.auth.OAuth2(
|
|
||||||
connectionData.consumerKey as string,
|
|
||||||
connectionData.consumerSecret as string,
|
|
||||||
this.oauthRedirectUrl
|
|
||||||
);
|
|
||||||
|
|
||||||
GoogleApi.options({ auth: this.client });
|
|
||||||
}
|
|
||||||
|
|
||||||
get oauthRedirectUrl() {
|
|
||||||
return this.appData.fields.find(
|
|
||||||
(field: IField) => field.key == 'oAuthRedirectUrl'
|
|
||||||
).value;
|
|
||||||
}
|
|
||||||
|
|
||||||
async createAuthData() {
|
|
||||||
const url = this.client.generateAuthUrl({
|
|
||||||
access_type: 'offline',
|
|
||||||
scope: this.scopes,
|
|
||||||
});
|
|
||||||
|
|
||||||
return { url };
|
|
||||||
}
|
|
||||||
|
|
||||||
async verifyCredentials() {
|
|
||||||
const { tokens } = await this.client.getToken(
|
|
||||||
this.connectionData.oauthVerifier as string
|
|
||||||
);
|
|
||||||
this.client.setCredentials(tokens);
|
|
||||||
|
|
||||||
const people = GoogleApi.people('v1');
|
|
||||||
|
|
||||||
const { data } = await people.people.get({
|
|
||||||
resourceName: 'people/me',
|
|
||||||
personFields: 'emailAddresses',
|
|
||||||
});
|
|
||||||
|
|
||||||
const { emailAddresses, resourceName: userId } = data;
|
|
||||||
const primaryEmailAddress = emailAddresses.find(
|
|
||||||
(emailAddress) => emailAddress.metadata.primary
|
|
||||||
);
|
|
||||||
|
|
||||||
return {
|
|
||||||
consumerKey: this.connectionData.consumerKey,
|
|
||||||
consumerSecret: this.connectionData.consumerSecret,
|
|
||||||
accessToken: tokens.access_token,
|
|
||||||
refreshToken: tokens.refresh_token,
|
|
||||||
tokenType: tokens.token_type,
|
|
||||||
expiryDate: tokens.expiry_date,
|
|
||||||
scope: tokens.scope,
|
|
||||||
screenName: primaryEmailAddress.value,
|
|
||||||
userId,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
async isStillVerified() {
|
|
||||||
try {
|
|
||||||
await this.client.getTokenInfo(this.connectionData.accessToken as string);
|
|
||||||
return true;
|
|
||||||
} catch {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,15 +0,0 @@
|
|||||||
import Authentication from './authentication';
|
|
||||||
import {
|
|
||||||
IService,
|
|
||||||
IAuthentication,
|
|
||||||
IApp,
|
|
||||||
IJSONObject,
|
|
||||||
} from '@automatisch/types';
|
|
||||||
|
|
||||||
export default class Firebase implements IService {
|
|
||||||
authenticationClient: IAuthentication;
|
|
||||||
|
|
||||||
constructor(appData: IApp, connectionData: IJSONObject) {
|
|
||||||
this.authenticationClient = new Authentication(appData, connectionData);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,219 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "Firebase",
|
|
||||||
"key": "firebase",
|
|
||||||
"iconUrl": "{BASE_URL}/apps/firebase/assets/favicon.svg",
|
|
||||||
"docUrl": "https://automatisch.io/docs/firebase",
|
|
||||||
"primaryColor": "ffca28",
|
|
||||||
"supportsConnections": true,
|
|
||||||
"fields": [
|
|
||||||
{
|
|
||||||
"key": "oAuthRedirectUrl",
|
|
||||||
"label": "OAuth Redirect URL",
|
|
||||||
"type": "string",
|
|
||||||
"required": true,
|
|
||||||
"readOnly": true,
|
|
||||||
"value": "{WEB_APP_URL}/app/firebase/connections/add",
|
|
||||||
"placeholder": null,
|
|
||||||
"description": "When asked to input an OAuth callback or redirect URL in Firebase OAuth, enter the URL above.",
|
|
||||||
"docUrl": "https://automatisch.io/docs/firebase#oauth-redirect-url",
|
|
||||||
"clickToCopy": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"key": "consumerKey",
|
|
||||||
"label": "Consumer Key",
|
|
||||||
"type": "string",
|
|
||||||
"required": true,
|
|
||||||
"readOnly": false,
|
|
||||||
"value": null,
|
|
||||||
"placeholder": null,
|
|
||||||
"description": null,
|
|
||||||
"docUrl": "https://automatisch.io/docs/firebase#consumer-key",
|
|
||||||
"clickToCopy": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"key": "consumerSecret",
|
|
||||||
"label": "Consumer Secret",
|
|
||||||
"type": "string",
|
|
||||||
"required": true,
|
|
||||||
"readOnly": false,
|
|
||||||
"value": null,
|
|
||||||
"placeholder": null,
|
|
||||||
"description": null,
|
|
||||||
"docUrl": "https://automatisch.io/docs/firebase#consumer-secret",
|
|
||||||
"clickToCopy": false
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"authenticationSteps": [
|
|
||||||
{
|
|
||||||
"step": 1,
|
|
||||||
"type": "mutation",
|
|
||||||
"name": "createConnection",
|
|
||||||
"arguments": [
|
|
||||||
{
|
|
||||||
"name": "key",
|
|
||||||
"value": "{key}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "formattedData",
|
|
||||||
"value": null,
|
|
||||||
"properties": [
|
|
||||||
{
|
|
||||||
"name": "consumerKey",
|
|
||||||
"value": "{fields.consumerKey}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "consumerSecret",
|
|
||||||
"value": "{fields.consumerSecret}"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"step": 2,
|
|
||||||
"type": "mutation",
|
|
||||||
"name": "createAuthData",
|
|
||||||
"arguments": [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"value": "{createConnection.id}"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"step": 3,
|
|
||||||
"type": "openWithPopup",
|
|
||||||
"name": "openAuthPopup",
|
|
||||||
"arguments": [
|
|
||||||
{
|
|
||||||
"name": "url",
|
|
||||||
"value": "{createAuthData.url}"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"step": 4,
|
|
||||||
"type": "mutation",
|
|
||||||
"name": "updateConnection",
|
|
||||||
"arguments": [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"value": "{createConnection.id}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "formattedData",
|
|
||||||
"value": null,
|
|
||||||
"properties": [
|
|
||||||
{
|
|
||||||
"name": "oauthVerifier",
|
|
||||||
"value": "{openAuthPopup.code}"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"step": 5,
|
|
||||||
"type": "mutation",
|
|
||||||
"name": "verifyConnection",
|
|
||||||
"arguments": [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"value": "{createConnection.id}"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"reconnectionSteps": [
|
|
||||||
{
|
|
||||||
"step": 1,
|
|
||||||
"type": "mutation",
|
|
||||||
"name": "resetConnection",
|
|
||||||
"arguments": [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"value": "{connection.id}"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"step": 2,
|
|
||||||
"type": "mutation",
|
|
||||||
"name": "updateConnection",
|
|
||||||
"arguments": [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"value": "{connection.id}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "formattedData",
|
|
||||||
"value": null,
|
|
||||||
"properties": [
|
|
||||||
{
|
|
||||||
"name": "consumerKey",
|
|
||||||
"value": "{fields.consumerKey}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "consumerSecret",
|
|
||||||
"value": "{fields.consumerSecret}"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"step": 3,
|
|
||||||
"type": "mutation",
|
|
||||||
"name": "createAuthData",
|
|
||||||
"arguments": [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"value": "{connection.id}"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"step": 4,
|
|
||||||
"type": "openWithPopup",
|
|
||||||
"name": "openAuthPopup",
|
|
||||||
"arguments": [
|
|
||||||
{
|
|
||||||
"name": "url",
|
|
||||||
"value": "{createAuthData.url}"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"step": 5,
|
|
||||||
"type": "mutation",
|
|
||||||
"name": "updateConnection",
|
|
||||||
"arguments": [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"value": "{connection.id}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "formattedData",
|
|
||||||
"value": null,
|
|
||||||
"properties": [
|
|
||||||
{
|
|
||||||
"name": "oauthVerifier",
|
|
||||||
"value": "{openAuthPopup.code}"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"step": 6,
|
|
||||||
"type": "mutation",
|
|
||||||
"name": "verifyConnection",
|
|
||||||
"arguments": [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"value": "{connection.id}"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
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,
|
||||||
|
});
|
||||||
|
}
|
48
packages/backend/src/apps/flickr/auth/index.ts
Normal file
48
packages/backend/src/apps/flickr/auth/index.ts
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
import generateAuthUrl from './generate-auth-url';
|
||||||
|
import verifyCredentials from './verify-credentials';
|
||||||
|
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/flickr/connections/add',
|
||||||
|
placeholder: null,
|
||||||
|
description:
|
||||||
|
'When asked to input an OAuth callback or redirect URL in Flickr OAuth, enter the URL above.',
|
||||||
|
docUrl: 'https://automatisch.io/docs/flickr#oauth-redirect-url',
|
||||||
|
clickToCopy: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'consumerKey',
|
||||||
|
label: 'Consumer Key',
|
||||||
|
type: 'string' as const,
|
||||||
|
required: true,
|
||||||
|
readOnly: false,
|
||||||
|
value: null,
|
||||||
|
placeholder: null,
|
||||||
|
description: null,
|
||||||
|
docUrl: 'https://automatisch.io/docs/flickr#consumer-key',
|
||||||
|
clickToCopy: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'consumerSecret',
|
||||||
|
label: 'Consumer Secret',
|
||||||
|
type: 'string' as const,
|
||||||
|
required: true,
|
||||||
|
readOnly: false,
|
||||||
|
value: null,
|
||||||
|
placeholder: null,
|
||||||
|
description: null,
|
||||||
|
docUrl: 'https://automatisch.io/docs/flickr#consumer-secret',
|
||||||
|
clickToCopy: false,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
generateAuthUrl,
|
||||||
|
verifyCredentials,
|
||||||
|
isStillVerified,
|
||||||
|
};
|
13
packages/backend/src/apps/flickr/auth/is-still-verified.ts
Normal file
13
packages/backend/src/apps/flickr/auth/is-still-verified.ts
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
import { IGlobalVariable } from '@automatisch/types';
|
||||||
|
|
||||||
|
const isStillVerified = async ($: IGlobalVariable) => {
|
||||||
|
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;
|
22
packages/backend/src/apps/flickr/auth/verify-credentials.ts
Normal file
22
packages/backend/src/apps/flickr/auth/verify-credentials.ts
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
import { IGlobalVariable } from '@automatisch/types';
|
||||||
|
import { URLSearchParams } from 'url';
|
||||||
|
|
||||||
|
const verifyCredentials = async ($: IGlobalVariable) => {
|
||||||
|
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));
|
||||||
|
|
||||||
|
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;
|
@@ -1,82 +0,0 @@
|
|||||||
import type {
|
|
||||||
IAuthentication,
|
|
||||||
IApp,
|
|
||||||
IField,
|
|
||||||
IJSONObject,
|
|
||||||
} from '@automatisch/types';
|
|
||||||
import FlickrApi from 'flickr-sdk';
|
|
||||||
|
|
||||||
export default class Authentication implements IAuthentication {
|
|
||||||
appData: IApp;
|
|
||||||
connectionData: IJSONObject;
|
|
||||||
client: typeof FlickrApi;
|
|
||||||
oauthClient: typeof FlickrApi;
|
|
||||||
|
|
||||||
constructor(appData: IApp, connectionData: IJSONObject) {
|
|
||||||
this.oauthClient = new FlickrApi.OAuth(
|
|
||||||
connectionData.consumerKey,
|
|
||||||
connectionData.consumerSecret
|
|
||||||
);
|
|
||||||
|
|
||||||
if (connectionData.accessToken && connectionData.accessSecret) {
|
|
||||||
this.client = new FlickrApi(
|
|
||||||
FlickrApi.OAuth.createPlugin(
|
|
||||||
connectionData.consumerKey,
|
|
||||||
connectionData.consumerSecret,
|
|
||||||
connectionData.accessToken,
|
|
||||||
connectionData.accessSecret
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.connectionData = connectionData;
|
|
||||||
this.appData = appData;
|
|
||||||
}
|
|
||||||
|
|
||||||
async createAuthData() {
|
|
||||||
const appFields = this.appData.fields.find(
|
|
||||||
(field: IField) => field.key == 'oAuthRedirectUrl'
|
|
||||||
);
|
|
||||||
const callbackUrl = appFields.value;
|
|
||||||
|
|
||||||
const oauthData = (await this.oauthClient.request(callbackUrl)).body;
|
|
||||||
const url = await this.oauthClient.authorizeUrl(
|
|
||||||
oauthData.oauth_token,
|
|
||||||
'delete'
|
|
||||||
);
|
|
||||||
|
|
||||||
return {
|
|
||||||
accessToken: oauthData.oauth_token,
|
|
||||||
accessSecret: oauthData.oauth_token_secret,
|
|
||||||
url: url,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
async verifyCredentials() {
|
|
||||||
const verifiedCredentials = (
|
|
||||||
await this.oauthClient.verify(
|
|
||||||
this.connectionData.accessToken,
|
|
||||||
this.connectionData.oauthVerifier,
|
|
||||||
this.connectionData.accessSecret
|
|
||||||
)
|
|
||||||
).body;
|
|
||||||
|
|
||||||
return {
|
|
||||||
consumerKey: this.connectionData.consumerKey,
|
|
||||||
consumerSecret: this.connectionData.consumerSecret,
|
|
||||||
accessToken: verifiedCredentials.oauth_token,
|
|
||||||
accessSecret: verifiedCredentials.oauth_token_secret,
|
|
||||||
userId: verifiedCredentials.user_nsid,
|
|
||||||
screenName: verifiedCredentials.fullname,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
async isStillVerified() {
|
|
||||||
try {
|
|
||||||
await this.client.test.login();
|
|
||||||
return true;
|
|
||||||
} catch {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
41
packages/backend/src/apps/flickr/common/add-auth-header.ts
Normal file
41
packages/backend/src/apps/flickr/common/add-auth-header.ts
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
import { Token } from 'oauth-1.0a';
|
||||||
|
import { IJSONObject, TBeforeRequest } from '@automatisch/types';
|
||||||
|
import oauthClient from './oauth-client';
|
||||||
|
|
||||||
|
type RequestDataType = {
|
||||||
|
url: string;
|
||||||
|
method: string;
|
||||||
|
data?: IJSONObject;
|
||||||
|
};
|
||||||
|
|
||||||
|
const addAuthHeader: TBeforeRequest = ($, requestConfig) => {
|
||||||
|
const { url, method, data, params } = requestConfig;
|
||||||
|
|
||||||
|
const token: Token = {
|
||||||
|
key: $.auth.data?.accessToken as string,
|
||||||
|
secret: $.auth.data?.accessSecret as string,
|
||||||
|
};
|
||||||
|
|
||||||
|
const requestData: RequestDataType = {
|
||||||
|
url: `${requestConfig.baseURL}${url}`,
|
||||||
|
method,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (url === '/oauth/request_token') {
|
||||||
|
requestData.data = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (method === 'get') {
|
||||||
|
requestData.data = params;
|
||||||
|
}
|
||||||
|
|
||||||
|
const authHeader = oauthClient($).toHeader(
|
||||||
|
oauthClient($).authorize(requestData, token)
|
||||||
|
);
|
||||||
|
|
||||||
|
requestConfig.headers.Authorization = authHeader.Authorization;
|
||||||
|
|
||||||
|
return requestConfig;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default addAuthHeader;
|
23
packages/backend/src/apps/flickr/common/oauth-client.ts
Normal file
23
packages/backend/src/apps/flickr/common/oauth-client.ts
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import { IGlobalVariable } from '@automatisch/types';
|
||||||
|
import crypto from 'crypto';
|
||||||
|
import OAuth from 'oauth-1.0a';
|
||||||
|
|
||||||
|
const oauthClient = ($: IGlobalVariable) => {
|
||||||
|
const consumerData = {
|
||||||
|
key: $.auth.data.consumerKey as string,
|
||||||
|
secret: $.auth.data.consumerSecret as string,
|
||||||
|
};
|
||||||
|
|
||||||
|
return new OAuth({
|
||||||
|
consumer: consumerData,
|
||||||
|
signature_method: 'HMAC-SHA1',
|
||||||
|
hash_function(base_string, key) {
|
||||||
|
return crypto
|
||||||
|
.createHmac('sha1', key)
|
||||||
|
.update(base_string)
|
||||||
|
.digest('base64');
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export default oauthClient;
|
@@ -1,10 +0,0 @@
|
|||||||
import { IJSONObject } from '@automatisch/types';
|
|
||||||
import ListAlbums from './data/list-albums';
|
|
||||||
|
|
||||||
export default class Data {
|
|
||||||
listAlbums: ListAlbums;
|
|
||||||
|
|
||||||
constructor(connectionData: IJSONObject) {
|
|
||||||
this.listAlbums = new ListAlbums(connectionData);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,39 +0,0 @@
|
|||||||
import FlickrApi from 'flickr-sdk';
|
|
||||||
import type { IJSONObject } from '@automatisch/types';
|
|
||||||
|
|
||||||
export default class ListAlbums {
|
|
||||||
client?: typeof FlickrApi;
|
|
||||||
|
|
||||||
constructor(connectionData: IJSONObject) {
|
|
||||||
if (
|
|
||||||
connectionData.consumerKey &&
|
|
||||||
connectionData.consumerSecret &&
|
|
||||||
connectionData.accessToken &&
|
|
||||||
connectionData.accessSecret
|
|
||||||
) {
|
|
||||||
this.client = new FlickrApi(
|
|
||||||
FlickrApi.OAuth.createPlugin(
|
|
||||||
connectionData.consumerKey,
|
|
||||||
connectionData.consumerSecret,
|
|
||||||
connectionData.accessToken,
|
|
||||||
connectionData.accessSecret
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async run() {
|
|
||||||
const { photosets } = (await this.client.photosets.getList()).body;
|
|
||||||
const allPhotosets = [...photosets.photoset];
|
|
||||||
|
|
||||||
for (let page = photosets.page + 1; page <= photosets.pages; page++) {
|
|
||||||
const { photosets } = (await this.client.photosets.getList({ page, })).body;
|
|
||||||
allPhotosets.push(...photosets.photoset);
|
|
||||||
}
|
|
||||||
|
|
||||||
return allPhotosets.map((photoset) => ({
|
|
||||||
value: photoset.id,
|
|
||||||
name: photoset.title._content,
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
}
|
|
3
packages/backend/src/apps/flickr/dynamic-data/index.ts
Normal file
3
packages/backend/src/apps/flickr/dynamic-data/index.ts
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
import listAlbums from './list-albums';
|
||||||
|
|
||||||
|
export default [listAlbums];
|
@@ -0,0 +1,56 @@
|
|||||||
|
import { IGlobalVariable, IJSONObject } from '@automatisch/types';
|
||||||
|
|
||||||
|
type TResponse = {
|
||||||
|
data: IJSONObject[];
|
||||||
|
error?: IJSONObject;
|
||||||
|
};
|
||||||
|
|
||||||
|
type TPhotoset = {
|
||||||
|
id: string;
|
||||||
|
title: {
|
||||||
|
_content: string;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'List albums',
|
||||||
|
key: 'listAlbums',
|
||||||
|
|
||||||
|
async run($: IGlobalVariable) {
|
||||||
|
const params = {
|
||||||
|
page: 1,
|
||||||
|
per_page: 500,
|
||||||
|
user_id: $.auth.data.userId,
|
||||||
|
method: 'flickr.photosets.getList',
|
||||||
|
format: 'json',
|
||||||
|
nojsoncallback: 1,
|
||||||
|
};
|
||||||
|
let response = await $.http.get('/rest', { params });
|
||||||
|
|
||||||
|
const aggregatedResponse: TResponse = {
|
||||||
|
data: [...response.data.photosets.photoset],
|
||||||
|
};
|
||||||
|
|
||||||
|
while (response.data.photosets.page < response.data.photosets.pages) {
|
||||||
|
response = await $.http.get('/rest', {
|
||||||
|
params: {
|
||||||
|
...params,
|
||||||
|
page: response.data.photosets.page,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
aggregatedResponse.data.push(...response.data.photosets.photoset);
|
||||||
|
}
|
||||||
|
|
||||||
|
aggregatedResponse.data = aggregatedResponse.data.map(
|
||||||
|
(photoset: TPhotoset) => {
|
||||||
|
return {
|
||||||
|
value: photoset.id,
|
||||||
|
name: photoset.title._content,
|
||||||
|
} as IJSONObject;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
return aggregatedResponse;
|
||||||
|
},
|
||||||
|
};
|
1
packages/backend/src/apps/flickr/index.d.ts
vendored
1
packages/backend/src/apps/flickr/index.d.ts
vendored
@@ -1 +0,0 @@
|
|||||||
declare module 'flickr-sdk';
|
|
||||||
|
@@ -1,25 +1,21 @@
|
|||||||
import {
|
import defineApp from '../../helpers/define-app';
|
||||||
IService,
|
import addAuthHeader from './common/add-auth-header';
|
||||||
IAuthentication,
|
import auth from './auth';
|
||||||
IApp,
|
import triggers from './triggers';
|
||||||
IJSONObject,
|
import dynamicData from './dynamic-data';
|
||||||
} from '@automatisch/types';
|
|
||||||
import Authentication from './authentication';
|
|
||||||
import Triggers from './triggers';
|
|
||||||
import Data from './data';
|
|
||||||
|
|
||||||
export default class Flickr implements IService {
|
export default defineApp({
|
||||||
authenticationClient: IAuthentication;
|
name: 'Flickr',
|
||||||
triggers: Triggers;
|
key: 'flickr',
|
||||||
data: Data;
|
iconUrl: '{BASE_URL}/apps/flickr/assets/favicon.svg',
|
||||||
|
authDocUrl: 'https://automatisch.io/docs/apps/flickr/connection',
|
||||||
constructor(
|
docUrl: 'https://automatisch.io/docs/flickr',
|
||||||
appData: IApp,
|
primaryColor: '000000',
|
||||||
connectionData: IJSONObject,
|
supportsConnections: true,
|
||||||
parameters: IJSONObject
|
baseUrl: 'https://www.flickr.com/',
|
||||||
) {
|
apiBaseUrl: 'https://www.flickr.com/services',
|
||||||
this.authenticationClient = new Authentication(appData, connectionData);
|
beforeRequest: [addAuthHeader],
|
||||||
this.data = new Data(connectionData);
|
auth,
|
||||||
this.triggers = new Triggers(connectionData, parameters);
|
triggers,
|
||||||
}
|
dynamicData,
|
||||||
}
|
});
|
||||||
|
@@ -1,304 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "Flickr",
|
|
||||||
"key": "flickr",
|
|
||||||
"iconUrl": "{BASE_URL}/apps/flickr/assets/favicon.svg",
|
|
||||||
"docUrl": "https://automatisch.io/docs/flickr",
|
|
||||||
"primaryColor": "000000",
|
|
||||||
"supportsConnections": true,
|
|
||||||
"fields": [
|
|
||||||
{
|
|
||||||
"key": "oAuthRedirectUrl",
|
|
||||||
"label": "OAuth Redirect URL",
|
|
||||||
"type": "string",
|
|
||||||
"required": true,
|
|
||||||
"readOnly": true,
|
|
||||||
"value": "{WEB_APP_URL}/app/flickr/connections/add",
|
|
||||||
"placeholder": null,
|
|
||||||
"description": "When asked to input an OAuth callback or redirect URL in Flickr OAuth, enter the URL above.",
|
|
||||||
"docUrl": "https://automatisch.io/docs/flickr#oauth-redirect-url",
|
|
||||||
"clickToCopy": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"key": "consumerKey",
|
|
||||||
"label": "Consumer Key",
|
|
||||||
"type": "string",
|
|
||||||
"required": true,
|
|
||||||
"readOnly": false,
|
|
||||||
"value": null,
|
|
||||||
"placeholder": null,
|
|
||||||
"description": null,
|
|
||||||
"docUrl": "https://automatisch.io/docs/flickr#consumer-key",
|
|
||||||
"clickToCopy": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"key": "consumerSecret",
|
|
||||||
"label": "Consumer Secret",
|
|
||||||
"type": "string",
|
|
||||||
"required": true,
|
|
||||||
"readOnly": false,
|
|
||||||
"value": null,
|
|
||||||
"placeholder": null,
|
|
||||||
"description": null,
|
|
||||||
"docUrl": "https://automatisch.io/docs/flickr#consumer-secret",
|
|
||||||
"clickToCopy": false
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"authenticationSteps": [
|
|
||||||
{
|
|
||||||
"step": 1,
|
|
||||||
"type": "mutation",
|
|
||||||
"name": "createConnection",
|
|
||||||
"arguments": [
|
|
||||||
{
|
|
||||||
"name": "key",
|
|
||||||
"value": "{key}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "formattedData",
|
|
||||||
"value": null,
|
|
||||||
"properties": [
|
|
||||||
{
|
|
||||||
"name": "consumerKey",
|
|
||||||
"value": "{fields.consumerKey}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "consumerSecret",
|
|
||||||
"value": "{fields.consumerSecret}"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"step": 2,
|
|
||||||
"type": "mutation",
|
|
||||||
"name": "createAuthData",
|
|
||||||
"arguments": [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"value": "{createConnection.id}"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"step": 3,
|
|
||||||
"type": "openWithPopup",
|
|
||||||
"name": "openAuthPopup",
|
|
||||||
"arguments": [
|
|
||||||
{
|
|
||||||
"name": "url",
|
|
||||||
"value": "{createAuthData.url}"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"step": 4,
|
|
||||||
"type": "mutation",
|
|
||||||
"name": "updateConnection",
|
|
||||||
"arguments": [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"value": "{createConnection.id}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "formattedData",
|
|
||||||
"value": null,
|
|
||||||
"properties": [
|
|
||||||
{
|
|
||||||
"name": "oauthVerifier",
|
|
||||||
"value": "{openAuthPopup.oauth_verifier}"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"step": 5,
|
|
||||||
"type": "mutation",
|
|
||||||
"name": "verifyConnection",
|
|
||||||
"arguments": [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"value": "{createConnection.id}"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"reconnectionSteps": [
|
|
||||||
{
|
|
||||||
"step": 1,
|
|
||||||
"type": "mutation",
|
|
||||||
"name": "resetConnection",
|
|
||||||
"arguments": [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"value": "{connection.id}"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"step": 2,
|
|
||||||
"type": "mutation",
|
|
||||||
"name": "updateConnection",
|
|
||||||
"arguments": [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"value": "{connection.id}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "formattedData",
|
|
||||||
"value": null,
|
|
||||||
"properties": [
|
|
||||||
{
|
|
||||||
"name": "consumerKey",
|
|
||||||
"value": "{fields.consumerKey}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "consumerSecret",
|
|
||||||
"value": "{fields.consumerSecret}"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"step": 3,
|
|
||||||
"type": "mutation",
|
|
||||||
"name": "createAuthData",
|
|
||||||
"arguments": [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"value": "{connection.id}"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"step": 4,
|
|
||||||
"type": "openWithPopup",
|
|
||||||
"name": "openAuthPopup",
|
|
||||||
"arguments": [
|
|
||||||
{
|
|
||||||
"name": "url",
|
|
||||||
"value": "{createAuthData.url}"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"step": 5,
|
|
||||||
"type": "mutation",
|
|
||||||
"name": "updateConnection",
|
|
||||||
"arguments": [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"value": "{connection.id}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "formattedData",
|
|
||||||
"value": null,
|
|
||||||
"properties": [
|
|
||||||
{
|
|
||||||
"name": "oauthVerifier",
|
|
||||||
"value": "{openAuthPopup.oauth_verifier}"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"step": 6,
|
|
||||||
"type": "mutation",
|
|
||||||
"name": "verifyConnection",
|
|
||||||
"arguments": [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"value": "{connection.id}"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"triggers": [
|
|
||||||
{
|
|
||||||
"name": "New favorite photo",
|
|
||||||
"key": "newFavoritePhoto",
|
|
||||||
"description": "Triggers when you favorite a photo.",
|
|
||||||
"substeps": [
|
|
||||||
{
|
|
||||||
"key": "chooseConnection",
|
|
||||||
"name": "Choose connection"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"key": "testStep",
|
|
||||||
"name": "Test trigger"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "New photo in album",
|
|
||||||
"key": "newPhotoInAlbum",
|
|
||||||
"description": "Triggers when you add a new photo in an album.",
|
|
||||||
"substeps": [
|
|
||||||
{
|
|
||||||
"key": "chooseConnection",
|
|
||||||
"name": "Choose connection"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"key": "chooseTrigger",
|
|
||||||
"name": "Set up a trigger",
|
|
||||||
"arguments": [
|
|
||||||
{
|
|
||||||
"label": "Album",
|
|
||||||
"key": "album",
|
|
||||||
"type": "dropdown",
|
|
||||||
"required": true,
|
|
||||||
"variables": false,
|
|
||||||
"source": {
|
|
||||||
"type": "query",
|
|
||||||
"name": "getData",
|
|
||||||
"arguments": [
|
|
||||||
{
|
|
||||||
"name": "key",
|
|
||||||
"value": "listAlbums"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"key": "testStep",
|
|
||||||
"name": "Test trigger"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "New photo",
|
|
||||||
"key": "newPhoto",
|
|
||||||
"description": "Triggers when you add a new photo.",
|
|
||||||
"substeps": [
|
|
||||||
{
|
|
||||||
"key": "chooseConnection",
|
|
||||||
"name": "Choose connection"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"key": "testStep",
|
|
||||||
"name": "Test trigger"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "New album",
|
|
||||||
"key": "newAlbum",
|
|
||||||
"description": "Triggers when you create a new album.",
|
|
||||||
"substeps": [
|
|
||||||
{
|
|
||||||
"key": "chooseConnection",
|
|
||||||
"name": "Choose connection"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"key": "testStep",
|
|
||||||
"name": "Test trigger"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
@@ -1,19 +0,0 @@
|
|||||||
import { IJSONObject } from '@automatisch/types';
|
|
||||||
import NewFavoritePhoto from './triggers/new-favorite-photo';
|
|
||||||
import NewPhotoInAlbum from './triggers/new-photo-in-album';
|
|
||||||
import NewPhoto from './triggers/new-photo';
|
|
||||||
import NewAlbum from './triggers/new-album';
|
|
||||||
|
|
||||||
export default class Triggers {
|
|
||||||
newFavoritePhoto: NewFavoritePhoto;
|
|
||||||
newPhotoInAlbum: NewPhotoInAlbum;
|
|
||||||
newPhoto: NewPhoto;
|
|
||||||
newAlbum: NewAlbum;
|
|
||||||
|
|
||||||
constructor(connectionData: IJSONObject, parameters: IJSONObject) {
|
|
||||||
this.newFavoritePhoto = new NewFavoritePhoto(connectionData);
|
|
||||||
this.newPhotoInAlbum = new NewPhotoInAlbum(connectionData, parameters);
|
|
||||||
this.newPhoto = new NewPhoto(connectionData);
|
|
||||||
this.newAlbum = new NewAlbum(connectionData);
|
|
||||||
}
|
|
||||||
}
|
|
6
packages/backend/src/apps/flickr/triggers/index.ts
Normal file
6
packages/backend/src/apps/flickr/triggers/index.ts
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
import newAlbums from './new-albums';
|
||||||
|
import newFavoritePhotos from './new-favorite-photos';
|
||||||
|
import newPhotos from './new-photos';
|
||||||
|
import newPhotosInAlbums from './new-photos-in-album';
|
||||||
|
|
||||||
|
export default [newAlbums, newFavoritePhotos, newPhotos, newPhotosInAlbums];
|
@@ -1,103 +0,0 @@
|
|||||||
import { DateTime } from 'luxon';
|
|
||||||
import FlickrApi from 'flickr-sdk';
|
|
||||||
import { IJSONObject } from '@automatisch/types';
|
|
||||||
|
|
||||||
export default class NewAlbum {
|
|
||||||
client?: typeof FlickrApi;
|
|
||||||
connectionData?: IJSONObject;
|
|
||||||
primaryPhotoExtraFields = [
|
|
||||||
'description',
|
|
||||||
'license',
|
|
||||||
'date_upload',
|
|
||||||
'date_taken',
|
|
||||||
'owner_name',
|
|
||||||
'icon_server',
|
|
||||||
'original_format',
|
|
||||||
'last_update',
|
|
||||||
'geo',
|
|
||||||
'tags',
|
|
||||||
'machine_tags',
|
|
||||||
'o_dims',
|
|
||||||
'views',
|
|
||||||
'media',
|
|
||||||
'path_alias',
|
|
||||||
'url_sq',
|
|
||||||
'url_t',
|
|
||||||
'url_s',
|
|
||||||
'url_q',
|
|
||||||
'url_m',
|
|
||||||
'url_n',
|
|
||||||
'url_z',
|
|
||||||
'url_c',
|
|
||||||
'url_l',
|
|
||||||
'url_o',
|
|
||||||
].join(',');
|
|
||||||
|
|
||||||
constructor(connectionData: IJSONObject) {
|
|
||||||
if (
|
|
||||||
connectionData.consumerKey &&
|
|
||||||
connectionData.consumerSecret &&
|
|
||||||
connectionData.accessToken &&
|
|
||||||
connectionData.accessSecret
|
|
||||||
) {
|
|
||||||
this.client = new FlickrApi(
|
|
||||||
FlickrApi.OAuth.createPlugin(
|
|
||||||
connectionData.consumerKey,
|
|
||||||
connectionData.consumerSecret,
|
|
||||||
connectionData.accessToken,
|
|
||||||
connectionData.accessSecret
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
this.connectionData = connectionData;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async getAlbums(options: { perPage?: number, page?: number } = {}) {
|
|
||||||
const { perPage, page } = options;
|
|
||||||
const payload = {
|
|
||||||
page,
|
|
||||||
per_page: perPage,
|
|
||||||
primary_photo_extras: this.primaryPhotoExtraFields,
|
|
||||||
};
|
|
||||||
const { photosets } = (await this.client.photosets.getList(payload)).body;
|
|
||||||
|
|
||||||
return photosets;
|
|
||||||
}
|
|
||||||
|
|
||||||
async run(startTime: Date) {
|
|
||||||
const albums = await this.getAlbums({ page: 1 });
|
|
||||||
const allAlbums = [...albums.photoset];
|
|
||||||
const newAlbums = [];
|
|
||||||
|
|
||||||
let page = 1;
|
|
||||||
for (const album of allAlbums) {
|
|
||||||
const createdAtInSeconds = DateTime.fromSeconds(parseInt(album.date_create, 10));
|
|
||||||
const createdAt = createdAtInSeconds.toMillis();
|
|
||||||
|
|
||||||
if (createdAt <= startTime.getTime()) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
newAlbums.push(album);
|
|
||||||
|
|
||||||
const currentIndex = allAlbums.indexOf(album);
|
|
||||||
const totalAlbums = allAlbums.length;
|
|
||||||
const isLastItem = currentIndex + 1 === totalAlbums;
|
|
||||||
|
|
||||||
if (isLastItem && page < albums.pages) {
|
|
||||||
page = page + 1;
|
|
||||||
const { photoset } = await this.getAlbums({ page, });
|
|
||||||
allAlbums.push(...photoset.photoset);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return newAlbums;
|
|
||||||
}
|
|
||||||
|
|
||||||
async testRun() {
|
|
||||||
const { photoset } = await this.getAlbums({ perPage: 1 });
|
|
||||||
|
|
||||||
return photoset;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -0,0 +1,13 @@
|
|||||||
|
import defineTrigger from '../../../../helpers/define-trigger';
|
||||||
|
import newAlbums from './new-albums';
|
||||||
|
|
||||||
|
export default defineTrigger({
|
||||||
|
name: 'New albums',
|
||||||
|
pollInterval: 15,
|
||||||
|
key: 'newAlbums',
|
||||||
|
description: 'Triggers when you create a new album.',
|
||||||
|
|
||||||
|
async run($) {
|
||||||
|
await newAlbums($);
|
||||||
|
},
|
||||||
|
});
|
@@ -0,0 +1,55 @@
|
|||||||
|
import { IGlobalVariable } from '@automatisch/types';
|
||||||
|
|
||||||
|
const extraFields = [
|
||||||
|
'license',
|
||||||
|
'date_upload',
|
||||||
|
'date_taken',
|
||||||
|
'owner_name',
|
||||||
|
'icon_server',
|
||||||
|
'original_format',
|
||||||
|
'last_update',
|
||||||
|
'geo',
|
||||||
|
'tags',
|
||||||
|
'machine_tags',
|
||||||
|
'o_dims',
|
||||||
|
'views',
|
||||||
|
'media',
|
||||||
|
'path_alias',
|
||||||
|
'url_sq',
|
||||||
|
'url_t',
|
||||||
|
'url_s',
|
||||||
|
'url_m',
|
||||||
|
'url_o',
|
||||||
|
].join(',');
|
||||||
|
|
||||||
|
const newAlbums = async ($: IGlobalVariable) => {
|
||||||
|
let page = 1;
|
||||||
|
let pages = 1;
|
||||||
|
|
||||||
|
do {
|
||||||
|
const params = {
|
||||||
|
page,
|
||||||
|
per_page: 500,
|
||||||
|
user_id: $.auth.data.userId,
|
||||||
|
extras: extraFields,
|
||||||
|
method: 'flickr.photosets.getList',
|
||||||
|
format: 'json',
|
||||||
|
nojsoncallback: 1,
|
||||||
|
};
|
||||||
|
const response = await $.http.get('/rest', { params });
|
||||||
|
const photosets = response.data.photosets;
|
||||||
|
page = photosets.page + 1;
|
||||||
|
pages = photosets.pages;
|
||||||
|
|
||||||
|
for (const photoset of photosets.photoset) {
|
||||||
|
$.pushTriggerItem({
|
||||||
|
raw: photoset,
|
||||||
|
meta: {
|
||||||
|
internalId: photoset.id as string,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} while (page <= pages);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default newAlbums;
|
@@ -1,62 +0,0 @@
|
|||||||
import { DateTime } from 'luxon';
|
|
||||||
import FlickrApi from 'flickr-sdk';
|
|
||||||
import { IJSONObject } from '@automatisch/types';
|
|
||||||
|
|
||||||
export default class NewFavoritePhoto {
|
|
||||||
client?: typeof FlickrApi;
|
|
||||||
|
|
||||||
constructor(connectionData: IJSONObject) {
|
|
||||||
if (
|
|
||||||
connectionData.consumerKey &&
|
|
||||||
connectionData.consumerSecret &&
|
|
||||||
connectionData.accessToken &&
|
|
||||||
connectionData.accessSecret
|
|
||||||
) {
|
|
||||||
this.client = new FlickrApi(
|
|
||||||
FlickrApi.OAuth.createPlugin(
|
|
||||||
connectionData.consumerKey,
|
|
||||||
connectionData.consumerSecret,
|
|
||||||
connectionData.accessToken,
|
|
||||||
connectionData.accessSecret
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async run(startTime: Date) {
|
|
||||||
const { photos } = (await this.client.favorites.getList()).body;
|
|
||||||
const favPhotos = [...photos.photo];
|
|
||||||
const newFavPhotos = [];
|
|
||||||
|
|
||||||
let page = 1;
|
|
||||||
for (const photo of favPhotos) {
|
|
||||||
const markedFavoriteAt = DateTime.fromSeconds(parseInt(photo.date_faved, 10));
|
|
||||||
const markedFavoriteAtInMillis = markedFavoriteAt.toMillis();
|
|
||||||
|
|
||||||
if (markedFavoriteAtInMillis <= startTime.getTime()) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
newFavPhotos.push(photo);
|
|
||||||
|
|
||||||
const currentIndex = favPhotos.indexOf(photo);
|
|
||||||
const totalFavPhotos = favPhotos.length;
|
|
||||||
const isLastItem = currentIndex + 1 === totalFavPhotos;
|
|
||||||
|
|
||||||
if (isLastItem && page < photos.pages) {
|
|
||||||
page = page + 1;
|
|
||||||
const { photos } = (await this.client.favorites.getList({ page, })).body;
|
|
||||||
favPhotos.push(...photos.photo);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return newFavPhotos;
|
|
||||||
}
|
|
||||||
|
|
||||||
async testRun() {
|
|
||||||
const { photos } = (await this.client.favorites.getList({ per_page: 1, })).body;
|
|
||||||
|
|
||||||
return photos.photo;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@@ -0,0 +1,13 @@
|
|||||||
|
import defineTrigger from '../../../../helpers/define-trigger';
|
||||||
|
import newFavoritePhotos from './new-favorite-photos';
|
||||||
|
|
||||||
|
export default defineTrigger({
|
||||||
|
name: 'New favorite photos',
|
||||||
|
pollInterval: 15,
|
||||||
|
key: 'newFavoritePhotos',
|
||||||
|
description: 'Triggers when you favorite a photo.',
|
||||||
|
|
||||||
|
async run($) {
|
||||||
|
await newFavoritePhotos($);
|
||||||
|
},
|
||||||
|
});
|
@@ -0,0 +1,61 @@
|
|||||||
|
import { IGlobalVariable } from '@automatisch/types';
|
||||||
|
|
||||||
|
const extraFields = [
|
||||||
|
'description',
|
||||||
|
'license',
|
||||||
|
'date_upload',
|
||||||
|
'date_taken',
|
||||||
|
'owner_name',
|
||||||
|
'icon_server',
|
||||||
|
'original_format',
|
||||||
|
'last_update',
|
||||||
|
'geo',
|
||||||
|
'tags',
|
||||||
|
'machine_tags',
|
||||||
|
'o_dims',
|
||||||
|
'views',
|
||||||
|
'media',
|
||||||
|
'path_alias',
|
||||||
|
'url_sq',
|
||||||
|
'url_t',
|
||||||
|
'url_s',
|
||||||
|
'url_q',
|
||||||
|
'url_m',
|
||||||
|
'url_n',
|
||||||
|
'url_z',
|
||||||
|
'url_c',
|
||||||
|
'url_l',
|
||||||
|
'url_o',
|
||||||
|
].join(',');
|
||||||
|
|
||||||
|
const newPhotos = async ($: IGlobalVariable) => {
|
||||||
|
let page = 1;
|
||||||
|
let pages = 1;
|
||||||
|
|
||||||
|
do {
|
||||||
|
const params = {
|
||||||
|
page,
|
||||||
|
per_page: 500,
|
||||||
|
user_id: $.auth.data.userId,
|
||||||
|
extras: extraFields,
|
||||||
|
method: 'flickr.favorites.getList',
|
||||||
|
format: 'json',
|
||||||
|
nojsoncallback: 1,
|
||||||
|
};
|
||||||
|
const response = await $.http.get('/rest', { params });
|
||||||
|
const photos = response.data.photos;
|
||||||
|
page = photos.page + 1;
|
||||||
|
pages = photos.pages;
|
||||||
|
|
||||||
|
for (const photo of photos.photo) {
|
||||||
|
$.pushTriggerItem({
|
||||||
|
raw: photo,
|
||||||
|
meta: {
|
||||||
|
internalId: photo.date_faved as string,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} while (page <= pages);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default newPhotos;
|
@@ -1,80 +0,0 @@
|
|||||||
import FlickrApi from 'flickr-sdk';
|
|
||||||
import { IJSONObject } from '@automatisch/types';
|
|
||||||
|
|
||||||
export default class NewPhotoInAlbum {
|
|
||||||
client?: typeof FlickrApi;
|
|
||||||
connectionData?: IJSONObject;
|
|
||||||
albumId?: string;
|
|
||||||
extraFields = [
|
|
||||||
'license',
|
|
||||||
'date_upload',
|
|
||||||
'date_taken',
|
|
||||||
'owner_name',
|
|
||||||
'icon_server',
|
|
||||||
'original_format',
|
|
||||||
'last_update',
|
|
||||||
'geo',
|
|
||||||
'tags',
|
|
||||||
'machine_tags',
|
|
||||||
'o_dims',
|
|
||||||
'views',
|
|
||||||
'media',
|
|
||||||
'path_alias',
|
|
||||||
'url_sq',
|
|
||||||
'url_t',
|
|
||||||
'url_s',
|
|
||||||
'url_m',
|
|
||||||
'url_o'
|
|
||||||
].join(',');
|
|
||||||
|
|
||||||
constructor(connectionData: IJSONObject, parameters: IJSONObject) {
|
|
||||||
if (
|
|
||||||
connectionData.consumerKey &&
|
|
||||||
connectionData.consumerSecret &&
|
|
||||||
connectionData.accessToken &&
|
|
||||||
connectionData.accessSecret
|
|
||||||
) {
|
|
||||||
this.client = new FlickrApi(
|
|
||||||
FlickrApi.OAuth.createPlugin(
|
|
||||||
connectionData.consumerKey,
|
|
||||||
connectionData.consumerSecret,
|
|
||||||
connectionData.accessToken,
|
|
||||||
connectionData.accessSecret
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
this.connectionData = connectionData;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (parameters?.album) {
|
|
||||||
this.albumId = parameters.album as string;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async getAlbumPhotos(options: { perPage?: number, page?: number } = {}) {
|
|
||||||
const { perPage, page } = options;
|
|
||||||
const payload = {
|
|
||||||
page,
|
|
||||||
per_page: perPage,
|
|
||||||
photoset_id: this.albumId,
|
|
||||||
user_id: this.connectionData.userId,
|
|
||||||
extras: this.extraFields,
|
|
||||||
};
|
|
||||||
const { photoset } = (await this.client.photosets.getPhotos(payload)).body;
|
|
||||||
|
|
||||||
return photoset;
|
|
||||||
}
|
|
||||||
|
|
||||||
async run() {
|
|
||||||
// TODO: implement pagination on undated entries
|
|
||||||
const { photo } = await this.getAlbumPhotos({ page: 1 });
|
|
||||||
|
|
||||||
return photo;
|
|
||||||
}
|
|
||||||
|
|
||||||
async testRun() {
|
|
||||||
const { photo } = await this.getAlbumPhotos({ perPage: 1 });
|
|
||||||
|
|
||||||
return photo;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,88 +0,0 @@
|
|||||||
import { DateTime } from 'luxon';
|
|
||||||
import FlickrApi from 'flickr-sdk';
|
|
||||||
import { IJSONObject } from '@automatisch/types';
|
|
||||||
|
|
||||||
export default class NewPhoto {
|
|
||||||
client?: typeof FlickrApi;
|
|
||||||
connectionData?: IJSONObject;
|
|
||||||
extraFields = [
|
|
||||||
'description',
|
|
||||||
'license',
|
|
||||||
'date_upload',
|
|
||||||
'date_taken',
|
|
||||||
'owner_name',
|
|
||||||
'icon_server',
|
|
||||||
'original_format',
|
|
||||||
'last_update',
|
|
||||||
'geo',
|
|
||||||
'tags',
|
|
||||||
'machine_tags',
|
|
||||||
'o_dims',
|
|
||||||
'views',
|
|
||||||
'media',
|
|
||||||
'path_alias',
|
|
||||||
'url_sq',
|
|
||||||
'url_t',
|
|
||||||
'url_s',
|
|
||||||
'url_q',
|
|
||||||
'url_m',
|
|
||||||
'url_n',
|
|
||||||
'url_z',
|
|
||||||
'url_c',
|
|
||||||
'url_l',
|
|
||||||
'url_o',
|
|
||||||
].join(',');
|
|
||||||
|
|
||||||
constructor(connectionData: IJSONObject) {
|
|
||||||
if (
|
|
||||||
connectionData.consumerKey &&
|
|
||||||
connectionData.consumerSecret &&
|
|
||||||
connectionData.accessToken &&
|
|
||||||
connectionData.accessSecret
|
|
||||||
) {
|
|
||||||
this.client = new FlickrApi(
|
|
||||||
FlickrApi.OAuth.createPlugin(
|
|
||||||
connectionData.consumerKey,
|
|
||||||
connectionData.consumerSecret,
|
|
||||||
connectionData.accessToken,
|
|
||||||
connectionData.accessSecret
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
this.connectionData = connectionData;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async getPhotos(options: { perPage?: number, page?: number, minUploadDate?: string } = {}) {
|
|
||||||
const { perPage, page, minUploadDate } = options;
|
|
||||||
const payload = {
|
|
||||||
page,
|
|
||||||
per_page: perPage,
|
|
||||||
user_id: this.connectionData.userId,
|
|
||||||
extras: this.extraFields,
|
|
||||||
min_upload_date: minUploadDate,
|
|
||||||
};
|
|
||||||
const { photos } = (await this.client.photos.search(payload)).body;
|
|
||||||
|
|
||||||
return photos;
|
|
||||||
}
|
|
||||||
|
|
||||||
async run(startTime: Date) {
|
|
||||||
const minUploadDate = DateTime.fromJSDate(startTime).toSeconds().toString();
|
|
||||||
const photos = await this.getPhotos({ page: 1, minUploadDate });
|
|
||||||
const allPhotos = [...photos.photo];
|
|
||||||
|
|
||||||
for (let page = photos.page + 1; page <= photos.pages; page++) {
|
|
||||||
const photos = (await this.getPhotos({ page, minUploadDate }));
|
|
||||||
allPhotos.push(...photos.photo);
|
|
||||||
}
|
|
||||||
|
|
||||||
return allPhotos;
|
|
||||||
}
|
|
||||||
|
|
||||||
async testRun(startTime: Date) {
|
|
||||||
const { photo } = await this.getPhotos({ perPage: 1 });
|
|
||||||
|
|
||||||
return photo;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -0,0 +1,32 @@
|
|||||||
|
import defineTrigger from '../../../../helpers/define-trigger';
|
||||||
|
import newPhotosInAlbum from './new-photos-in-album';
|
||||||
|
|
||||||
|
export default defineTrigger({
|
||||||
|
name: 'New photos in album',
|
||||||
|
pollInterval: 15,
|
||||||
|
key: 'newPhotosInAlbum',
|
||||||
|
description: 'Triggers when you add a new photo in an album.',
|
||||||
|
arguments: [
|
||||||
|
{
|
||||||
|
label: 'Album',
|
||||||
|
key: 'album',
|
||||||
|
type: 'dropdown' as const,
|
||||||
|
required: true,
|
||||||
|
variables: false,
|
||||||
|
source: {
|
||||||
|
type: 'query',
|
||||||
|
name: 'getDynamicData',
|
||||||
|
arguments: [
|
||||||
|
{
|
||||||
|
name: 'key',
|
||||||
|
value: 'listAlbums',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
|
async run($) {
|
||||||
|
await newPhotosInAlbum($);
|
||||||
|
},
|
||||||
|
});
|
@@ -0,0 +1,56 @@
|
|||||||
|
import { IGlobalVariable } from '@automatisch/types';
|
||||||
|
|
||||||
|
const extraFields = [
|
||||||
|
'license',
|
||||||
|
'date_upload',
|
||||||
|
'date_taken',
|
||||||
|
'owner_name',
|
||||||
|
'icon_server',
|
||||||
|
'original_format',
|
||||||
|
'last_update',
|
||||||
|
'geo',
|
||||||
|
'tags',
|
||||||
|
'machine_tags',
|
||||||
|
'o_dims',
|
||||||
|
'views',
|
||||||
|
'media',
|
||||||
|
'path_alias',
|
||||||
|
'url_sq',
|
||||||
|
'url_t',
|
||||||
|
'url_s',
|
||||||
|
'url_m',
|
||||||
|
'url_o',
|
||||||
|
].join(',');
|
||||||
|
|
||||||
|
const newPhotosInAlbum = async ($: IGlobalVariable) => {
|
||||||
|
let page = 1;
|
||||||
|
let pages = 1;
|
||||||
|
|
||||||
|
do {
|
||||||
|
const params = {
|
||||||
|
page,
|
||||||
|
per_page: 11,
|
||||||
|
user_id: $.auth.data.userId,
|
||||||
|
extras: extraFields,
|
||||||
|
photoset_id: $.step.parameters.album as string,
|
||||||
|
method: 'flickr.photosets.getPhotos',
|
||||||
|
format: 'json',
|
||||||
|
nojsoncallback: 1,
|
||||||
|
};
|
||||||
|
const response = await $.http.get('/rest', { params });
|
||||||
|
const photoset = response.data.photoset;
|
||||||
|
page = photoset.page + 1;
|
||||||
|
pages = photoset.pages;
|
||||||
|
|
||||||
|
for (const photo of photoset.photo) {
|
||||||
|
$.pushTriggerItem({
|
||||||
|
raw: photo,
|
||||||
|
meta: {
|
||||||
|
internalId: photo.id as string,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} while (page <= pages);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default newPhotosInAlbum;
|
@@ -0,0 +1,13 @@
|
|||||||
|
import defineTrigger from '../../../../helpers/define-trigger';
|
||||||
|
import newPhotos from './new-photos';
|
||||||
|
|
||||||
|
export default defineTrigger({
|
||||||
|
name: 'New photos',
|
||||||
|
pollInterval: 15,
|
||||||
|
key: 'newPhotos',
|
||||||
|
description: 'Triggers when you add a new photo.',
|
||||||
|
|
||||||
|
async run($) {
|
||||||
|
await newPhotos($);
|
||||||
|
},
|
||||||
|
});
|
@@ -0,0 +1,61 @@
|
|||||||
|
import { IGlobalVariable } from '@automatisch/types';
|
||||||
|
|
||||||
|
const extraFields = [
|
||||||
|
'description',
|
||||||
|
'license',
|
||||||
|
'date_upload',
|
||||||
|
'date_taken',
|
||||||
|
'owner_name',
|
||||||
|
'icon_server',
|
||||||
|
'original_format',
|
||||||
|
'last_update',
|
||||||
|
'geo',
|
||||||
|
'tags',
|
||||||
|
'machine_tags',
|
||||||
|
'o_dims',
|
||||||
|
'views',
|
||||||
|
'media',
|
||||||
|
'path_alias',
|
||||||
|
'url_sq',
|
||||||
|
'url_t',
|
||||||
|
'url_s',
|
||||||
|
'url_q',
|
||||||
|
'url_m',
|
||||||
|
'url_n',
|
||||||
|
'url_z',
|
||||||
|
'url_c',
|
||||||
|
'url_l',
|
||||||
|
'url_o',
|
||||||
|
].join(',');
|
||||||
|
|
||||||
|
const newPhotos = async ($: IGlobalVariable) => {
|
||||||
|
let page = 1;
|
||||||
|
let pages = 1;
|
||||||
|
|
||||||
|
do {
|
||||||
|
const params = {
|
||||||
|
page,
|
||||||
|
per_page: 500,
|
||||||
|
user_id: $.auth.data.userId,
|
||||||
|
extras: extraFields,
|
||||||
|
method: 'flickr.photos.search',
|
||||||
|
format: 'json',
|
||||||
|
nojsoncallback: 1,
|
||||||
|
};
|
||||||
|
const response = await $.http.get('/rest', { params });
|
||||||
|
const photos = response.data.photos;
|
||||||
|
page = photos.page + 1;
|
||||||
|
pages = photos.pages;
|
||||||
|
|
||||||
|
for (const photo of photos.photo) {
|
||||||
|
$.pushTriggerItem({
|
||||||
|
raw: photo,
|
||||||
|
meta: {
|
||||||
|
internalId: photo.id as string,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} while (page <= pages);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default newPhotos;
|
@@ -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;
|
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}`
|
||||||
|
);
|
||||||
|
},
|
||||||
|
});
|
@@ -0,0 +1,58 @@
|
|||||||
|
import defineAction from '../../../../helpers/define-action';
|
||||||
|
import getRepoOwnerAndRepo from '../../common/get-repo-owner-and-repo';
|
||||||
|
|
||||||
|
export default defineAction({
|
||||||
|
name: 'Create issue',
|
||||||
|
key: 'createIssue',
|
||||||
|
description: 'Creates a new issue.',
|
||||||
|
arguments: [
|
||||||
|
{
|
||||||
|
label: 'Repo',
|
||||||
|
key: 'repo',
|
||||||
|
type: 'dropdown' as const,
|
||||||
|
required: false,
|
||||||
|
variables: false,
|
||||||
|
source: {
|
||||||
|
type: 'query',
|
||||||
|
name: 'getDynamicData',
|
||||||
|
arguments: [
|
||||||
|
{
|
||||||
|
name: 'key',
|
||||||
|
value: 'listRepos',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Title',
|
||||||
|
key: 'title',
|
||||||
|
type: 'string' as const,
|
||||||
|
required: true,
|
||||||
|
variables: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Body',
|
||||||
|
key: 'body',
|
||||||
|
type: 'string' as const,
|
||||||
|
required: true,
|
||||||
|
variables: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
|
async run($) {
|
||||||
|
const repoParameter = $.step.parameters.repo as string;
|
||||||
|
const title = $.step.parameters.title as string;
|
||||||
|
const body = $.step.parameters.body as string;
|
||||||
|
|
||||||
|
if (!repoParameter) throw new Error('A repo must be set!');
|
||||||
|
if (!title) throw new Error('A title must be set!');
|
||||||
|
|
||||||
|
const { repoOwner, repo } = getRepoOwnerAndRepo(repoParameter);
|
||||||
|
const response = await $.http.post(`/repos/${repoOwner}/${repo}/issues`, {
|
||||||
|
title,
|
||||||
|
body,
|
||||||
|
});
|
||||||
|
|
||||||
|
$.setActionItem({ raw: response.data });
|
||||||
|
},
|
||||||
|
});
|
3
packages/backend/src/apps/github/actions/index.ts
Normal file
3
packages/backend/src/apps/github/actions/index.ts
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
import createIssue from './create-issue';
|
||||||
|
|
||||||
|
export default [createIssue];
|
22
packages/backend/src/apps/github/auth/generate-auth-url.ts
Normal file
22
packages/backend/src/apps/github/auth/generate-auth-url.ts
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
import { IField, IGlobalVariable } from '@automatisch/types';
|
||||||
|
import { URLSearchParams } from 'url';
|
||||||
|
|
||||||
|
export default async function generateAuthUrl($: IGlobalVariable) {
|
||||||
|
const scopes = ['read:org', 'repo', 'user'];
|
||||||
|
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.consumerKey as string,
|
||||||
|
redirect_uri: redirectUri,
|
||||||
|
scope: scopes.join(','),
|
||||||
|
});
|
||||||
|
|
||||||
|
const url = `${$.app.baseUrl
|
||||||
|
}/login/oauth/authorize?${searchParams.toString()}`;
|
||||||
|
|
||||||
|
await $.auth.set({
|
||||||
|
url,
|
||||||
|
});
|
||||||
|
}
|
49
packages/backend/src/apps/github/auth/index.ts
Normal file
49
packages/backend/src/apps/github/auth/index.ts
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
import generateAuthUrl from './generate-auth-url';
|
||||||
|
import verifyCredentials from './verify-credentials';
|
||||||
|
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/github/connections/add',
|
||||||
|
placeholder: null,
|
||||||
|
description:
|
||||||
|
'When asked to input an OAuth callback or redirect URL in Github OAuth, enter the URL above.',
|
||||||
|
docUrl: 'https://automatisch.io/docs/github#oauth-redirect-url',
|
||||||
|
clickToCopy: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'consumerKey',
|
||||||
|
label: 'Client ID',
|
||||||
|
type: 'string' as const,
|
||||||
|
required: true,
|
||||||
|
readOnly: false,
|
||||||
|
value: null,
|
||||||
|
placeholder: null,
|
||||||
|
description: null,
|
||||||
|
docUrl: 'https://automatisch.io/docs/github#client-id',
|
||||||
|
clickToCopy: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'consumerSecret',
|
||||||
|
label: 'Client Secret',
|
||||||
|
type: 'string' as const,
|
||||||
|
required: true,
|
||||||
|
readOnly: false,
|
||||||
|
value: null,
|
||||||
|
placeholder: null,
|
||||||
|
description: null,
|
||||||
|
docUrl: 'https://automatisch.io/docs/github#client-secret',
|
||||||
|
clickToCopy: false,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
|
generateAuthUrl,
|
||||||
|
verifyCredentials,
|
||||||
|
isStillVerified,
|
||||||
|
};
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user