Compare commits
701 Commits
@automatis
...
v0.1.2
Author | SHA1 | Date | |
---|---|---|---|
![]() |
dcd2986a12 | ||
![]() |
c9061b24a0 | ||
![]() |
a3dc7d2cde | ||
![]() |
cf90e7cfd6 | ||
![]() |
bbc9ea9571 | ||
![]() |
577abde2e9 | ||
![]() |
8e972fd875 | ||
![]() |
c7b290a380 | ||
![]() |
3d14208175 | ||
![]() |
04ad03cfd9 | ||
![]() |
48e9053124 | ||
![]() |
bd5aae3469 | ||
![]() |
2d3e307189 | ||
![]() |
c79c82cac7 | ||
![]() |
a80cd106bf | ||
![]() |
e1d953c855 | ||
![]() |
096837bf22 | ||
![]() |
ac4be28a03 | ||
![]() |
42ffd907ae | ||
![]() |
11ef2ac4bc | ||
![]() |
2862953136 | ||
![]() |
c958abdfcf | ||
![]() |
050f392dd1 | ||
![]() |
80b25694b5 | ||
![]() |
e462d1f7ea | ||
![]() |
e7b47f5c98 | ||
![]() |
89d7359060 | ||
![]() |
8a09408cf5 | ||
![]() |
45c0995d9d | ||
![]() |
0f3d1f0173 | ||
![]() |
a83983fe06 | ||
![]() |
b3937af636 | ||
![]() |
5037e67857 | ||
![]() |
ae76f7100c | ||
![]() |
0825eb36e4 | ||
![]() |
a58a59788d | ||
![]() |
77624acc01 | ||
![]() |
63ffd1f720 | ||
![]() |
8308265a62 | ||
![]() |
dc0e03245f | ||
![]() |
67cb57e7ac | ||
![]() |
4d5be952ce | ||
![]() |
0abab06124 | ||
![]() |
048689d28f | ||
![]() |
0be4b74d0e | ||
![]() |
26ed5cc794 | ||
![]() |
d236494c0b | ||
![]() |
52e4e09e85 | ||
![]() |
3b8a12810c | ||
![]() |
e5bd4228b2 | ||
![]() |
8e60f3dfd7 | ||
![]() |
18f315d26c | ||
![]() |
fca140e3c9 | ||
![]() |
330902ccb3 | ||
![]() |
932994622e | ||
![]() |
37a60e3105 | ||
![]() |
bce11819ff | ||
![]() |
d97fab28e3 | ||
![]() |
620629ff8b | ||
![]() |
e149d47135 | ||
![]() |
45cce9956b | ||
![]() |
dd003845af | ||
![]() |
93b31c10ae | ||
![]() |
c9056516a1 | ||
![]() |
953a031ba6 | ||
![]() |
e2f04441c5 | ||
![]() |
8826125845 | ||
![]() |
d0bcf997fb | ||
![]() |
9429031a61 | ||
![]() |
556cdc17bd | ||
![]() |
db052baea3 | ||
![]() |
e858fc2df8 | ||
![]() |
d5d239937a | ||
![]() |
68fb34491c | ||
![]() |
6ab7265a04 | ||
![]() |
c13248fb44 | ||
![]() |
2bc5da885e | ||
![]() |
1bd7f7a1c5 | ||
![]() |
5e8884c3f4 | ||
![]() |
ed0d22dcd7 | ||
![]() |
7e960024dd | ||
![]() |
90f4c873bb | ||
![]() |
1e34ab1ec6 | ||
![]() |
4cf25a8781 | ||
![]() |
53264e0637 | ||
![]() |
7cb3c00709 | ||
![]() |
ef1619fafb | ||
![]() |
10b9d69ac8 | ||
![]() |
2223cd7491 | ||
![]() |
927a0983ee | ||
![]() |
bb752e2bce | ||
![]() |
121b99a526 | ||
![]() |
7d325f06f6 | ||
![]() |
a2d83f5f21 | ||
![]() |
85473f6dcf | ||
![]() |
bfb685047e | ||
![]() |
416649c8cd | ||
![]() |
aef77dde59 | ||
![]() |
e1354c15fc | ||
![]() |
b41fca7e6c | ||
![]() |
dc89da2420 | ||
![]() |
1a1e7e57fb | ||
![]() |
cc0c73f226 | ||
![]() |
3c46f747b5 | ||
![]() |
0f8e4613da | ||
![]() |
801052adcd | ||
![]() |
70af9981e7 | ||
![]() |
715c900d88 | ||
![]() |
8162ab4299 | ||
![]() |
a2eae0da6d | ||
![]() |
832876d711 | ||
![]() |
4d7ee3dcca | ||
![]() |
6a8c642b72 | ||
![]() |
fe200fb790 | ||
![]() |
601582002a | ||
![]() |
81349bfdb3 | ||
![]() |
ab71dd2974 | ||
![]() |
40dfbae70c | ||
![]() |
31613225af | ||
![]() |
09b3f96189 | ||
![]() |
cfef769604 | ||
![]() |
364e69600c | ||
![]() |
b57f0735c9 | ||
![]() |
58565fddae | ||
![]() |
4183884537 | ||
![]() |
8c12d2dc85 | ||
![]() |
b8970fc3f8 | ||
![]() |
dc8a32b0b4 | ||
![]() |
02deed3e3a | ||
![]() |
e50f641533 | ||
![]() |
bd754da1ed | ||
![]() |
23c568c87c | ||
![]() |
cc9b047300 | ||
![]() |
eb3ac23c01 | ||
![]() |
5358d6ce5d | ||
![]() |
c0eaab3254 | ||
![]() |
2a39435413 | ||
![]() |
01ea316c1f | ||
![]() |
b253040d0a | ||
![]() |
57748a3541 | ||
![]() |
486eb088cf | ||
![]() |
c07a741970 | ||
![]() |
d1c7d5ef70 | ||
![]() |
4b15dad5ea | ||
![]() |
577e3fc669 | ||
![]() |
b5c7c6d88b | ||
![]() |
d812bb431f | ||
![]() |
3593727d29 | ||
![]() |
75b536959e | ||
![]() |
29a9338ad7 | ||
![]() |
3755a3ce4c | ||
![]() |
ec0d0203ae | ||
![]() |
72e3a69bd9 | ||
![]() |
2c61fb0c8b | ||
![]() |
56352560a5 | ||
![]() |
2ac7c17514 | ||
![]() |
a5b3a68588 | ||
![]() |
10dcccf99f | ||
![]() |
d0922d85b3 | ||
![]() |
fc330e25cf | ||
![]() |
dc79d623be | ||
![]() |
91f5f1d628 | ||
![]() |
e0f055a375 | ||
![]() |
7f3098362a | ||
![]() |
26eee1bb63 | ||
![]() |
0246d48584 | ||
![]() |
92053ea25a | ||
![]() |
d12984f324 | ||
![]() |
0eb28ec1a5 | ||
![]() |
20f8cca07d | ||
![]() |
9613e142c9 | ||
![]() |
1cc752b5c7 | ||
![]() |
163629b990 | ||
![]() |
770e115be9 | ||
![]() |
0eb5f3d3e6 | ||
![]() |
6e9a9992c0 | ||
![]() |
827fef8a05 | ||
![]() |
b53fcdebe3 | ||
![]() |
6537a1c649 | ||
![]() |
abaad7cb82 | ||
![]() |
ba140f05d3 | ||
![]() |
81a444e056 | ||
![]() |
db2c3556de | ||
![]() |
9bd1447bcf | ||
![]() |
fda957b1f6 | ||
![]() |
29abf702bd | ||
![]() |
5ddb5ab6fa | ||
![]() |
e997aa6c81 | ||
![]() |
6271cedc25 | ||
![]() |
743b6d6587 | ||
![]() |
ee4303a676 | ||
![]() |
c361b9af8d | ||
![]() |
f66656fd4e | ||
![]() |
be141e55a9 | ||
![]() |
5ed3b9230e | ||
![]() |
44e3de8534 | ||
![]() |
cd6c5216ff | ||
![]() |
17010f9283 | ||
![]() |
5fb988ae2d | ||
![]() |
c4a3f19bba | ||
![]() |
347c9c9455 | ||
![]() |
731443ab7d | ||
![]() |
898ab41167 | ||
![]() |
cf4f5bd084 | ||
![]() |
c7e55fe3e0 | ||
![]() |
b737cf68ba | ||
![]() |
c95622affe | ||
![]() |
c1b637b284 | ||
![]() |
bb37299c5b | ||
![]() |
2e9d5fb2fc | ||
![]() |
2aeabd4be3 | ||
![]() |
a4a9d60d68 | ||
![]() |
dac9276b9e | ||
![]() |
38700256b0 | ||
![]() |
a5f391d2dc | ||
![]() |
77d7260698 | ||
![]() |
782b2bafaa | ||
![]() |
a35bee0bc9 | ||
![]() |
c7d5584cd9 | ||
![]() |
bb68b2dea1 | ||
![]() |
3b587de138 | ||
![]() |
c827ce4270 | ||
![]() |
c6c3cbb1d3 | ||
![]() |
ad97fae883 | ||
![]() |
a5b6e66e22 | ||
![]() |
5d7daa8886 | ||
![]() |
47ba42f9f8 | ||
![]() |
04f8a71244 | ||
![]() |
3148118784 | ||
![]() |
b7c4a63d2b | ||
![]() |
a4abd7e1cd | ||
![]() |
0b01a6386d | ||
![]() |
fa75f11eaf | ||
![]() |
a1b360a172 | ||
![]() |
e0a76ea918 | ||
![]() |
7990c68d65 | ||
![]() |
8c5d95796f | ||
![]() |
b901a396bf | ||
![]() |
fa92375e33 | ||
![]() |
04b3d93d5d | ||
![]() |
1f8bc9cfbd | ||
![]() |
71939f9163 | ||
![]() |
0ea8f3a01a | ||
![]() |
ffa49149c9 | ||
![]() |
40a35691fe | ||
![]() |
908a3126f1 | ||
![]() |
726707afe8 | ||
![]() |
3c926adeca | ||
![]() |
fc681d9ebc | ||
![]() |
364f53142c | ||
![]() |
2764aa2c06 | ||
![]() |
ca141b1076 | ||
![]() |
2e980664ac | ||
![]() |
03cfa8b904 | ||
![]() |
c5bb07a768 | ||
![]() |
3a1e8b4bbd | ||
![]() |
0e749936a6 | ||
![]() |
744b31aad6 | ||
![]() |
82bdf9d3b1 | ||
![]() |
8c59bd664e | ||
![]() |
15aaada3fe | ||
![]() |
0fdbe4d39b | ||
![]() |
280c7832ae | ||
![]() |
1f9dd6a3bc | ||
![]() |
e7f12f4a06 | ||
![]() |
5a24b9ec8a | ||
![]() |
1d8a72e03b | ||
![]() |
ef987eae36 | ||
![]() |
dc4899c240 | ||
![]() |
88a780f008 | ||
![]() |
6fc13f3707 | ||
![]() |
6f1b9b8fe7 | ||
![]() |
533d73d718 | ||
![]() |
63241d2438 | ||
![]() |
5a177b330a | ||
![]() |
ae8f701e5c | ||
![]() |
744c927b69 | ||
![]() |
6ca1b99947 | ||
![]() |
cdb018dcd2 | ||
![]() |
03efe3f0b3 | ||
![]() |
913a2773c1 | ||
![]() |
10c64167d7 | ||
![]() |
a624a8d8b5 | ||
![]() |
ff09a836b4 | ||
![]() |
e7c734c55e | ||
![]() |
5271af8b94 | ||
![]() |
df55d9fdd9 | ||
![]() |
c7ff9dc162 | ||
![]() |
f7ab2b667c | ||
![]() |
b89086d3b8 | ||
![]() |
448a1a49b4 | ||
![]() |
98d7969a1e | ||
![]() |
d513e03138 | ||
![]() |
a5367c3770 | ||
![]() |
58d5847eed | ||
![]() |
02b22740b2 | ||
![]() |
70d59c6c64 | ||
![]() |
095948e737 | ||
![]() |
e6cec355cc | ||
![]() |
351f152664 | ||
![]() |
04450b8793 | ||
![]() |
76612e81b2 | ||
![]() |
cb26948db6 | ||
![]() |
18cdd226bb | ||
![]() |
2199970e50 | ||
![]() |
8389c9fdad | ||
![]() |
0d06ec9a22 | ||
![]() |
ce56f166cc | ||
![]() |
a07938d517 | ||
![]() |
7d81a4bdd2 | ||
![]() |
c4bffe7f9d | ||
![]() |
0c2caccc7c | ||
![]() |
d3c9f7a491 | ||
![]() |
f09fa0fe7c | ||
![]() |
8f1fbf086f | ||
![]() |
272c666d23 | ||
![]() |
a1db89700b | ||
![]() |
311f0a747d | ||
![]() |
69298857a9 | ||
![]() |
c98680fa59 | ||
![]() |
5f357afcd6 | ||
![]() |
997775e54b | ||
![]() |
2cf79e27de | ||
![]() |
95d03e00da | ||
![]() |
c85aadf006 | ||
![]() |
e9ffb7ef82 | ||
![]() |
4237972c86 | ||
![]() |
b69009f8b6 | ||
![]() |
6fa6ee7a1b | ||
![]() |
7cf1bfffbc | ||
![]() |
903b0f52b9 | ||
![]() |
16e299a12d | ||
![]() |
e950d73742 | ||
![]() |
b44cccb972 | ||
![]() |
5d4ef1bbe8 | ||
![]() |
12a6912d97 | ||
![]() |
2740f8e23d | ||
![]() |
d0814477eb | ||
![]() |
cdb256390c | ||
![]() |
9895cc1488 | ||
![]() |
fad2495941 | ||
![]() |
f9fa7c4094 | ||
![]() |
a5538a07f1 | ||
![]() |
d1b46df78a | ||
![]() |
57186bf85d | ||
![]() |
cc1892a5cf | ||
![]() |
c59bb85793 | ||
![]() |
a88d208cd6 | ||
![]() |
91e209e961 | ||
![]() |
7c543ff8ed | ||
![]() |
9f56fd7c3b | ||
![]() |
3a63fc376d | ||
![]() |
445ed9239d | ||
![]() |
9d5060f902 | ||
![]() |
54152a3564 | ||
![]() |
ed6493509b | ||
![]() |
bc94e0f849 | ||
![]() |
98f107f480 | ||
![]() |
8386c9f2e4 | ||
![]() |
d065d119c4 | ||
![]() |
8117089f34 | ||
![]() |
d864831bc5 | ||
![]() |
c4c3779646 | ||
![]() |
6cda49b747 | ||
![]() |
069ee526a8 | ||
![]() |
99440d48cc | ||
![]() |
832ea9e31f | ||
![]() |
40e2bb44da | ||
![]() |
b7959b5a8c | ||
![]() |
3caa857afe | ||
![]() |
031a35cc8f | ||
![]() |
21836bc5f1 | ||
![]() |
00b8f83da5 | ||
![]() |
466ffcc6bc | ||
![]() |
c5465513ba | ||
![]() |
4ff6d887ab | ||
![]() |
5c1e0f5b17 | ||
![]() |
380894069e | ||
![]() |
39d82f17d7 | ||
![]() |
e651fd141b | ||
![]() |
2e2d371875 | ||
![]() |
14ab827b34 | ||
![]() |
7664c9af0a | ||
![]() |
224a5b7ba0 | ||
![]() |
fa607ef403 | ||
![]() |
11fb25ca3f | ||
![]() |
f9c68babae | ||
![]() |
e396963e61 | ||
![]() |
5b9adf0442 | ||
![]() |
d7f770df0e | ||
![]() |
024bb731d4 | ||
![]() |
57478dcc17 | ||
![]() |
c79622aefd | ||
![]() |
bdfdb1f228 | ||
![]() |
65e6fbd54b | ||
![]() |
af348714f8 | ||
![]() |
a623116204 | ||
![]() |
3551d12e7d | ||
![]() |
6bee6bafa8 | ||
![]() |
96ede071cf | ||
![]() |
4f7bef83ea | ||
![]() |
b65fa88f16 | ||
![]() |
6e4d61f9b1 | ||
![]() |
9234885ce4 | ||
![]() |
10723b1c00 | ||
![]() |
bf56b54aad | ||
![]() |
1e00c7d14e | ||
![]() |
651cceec14 | ||
![]() |
d4ad8645c9 | ||
![]() |
31403b7020 | ||
![]() |
79fb62d409 | ||
![]() |
c227dc86bb | ||
![]() |
75eda7f2af | ||
![]() |
45f810b5b8 | ||
![]() |
4173e3bd2a | ||
![]() |
d373d04cdf | ||
![]() |
db021c06c7 | ||
![]() |
bb6c464770 | ||
![]() |
b8fb84ef42 | ||
![]() |
140734b32c | ||
![]() |
68e5e6d011 | ||
![]() |
3340bdff4c | ||
![]() |
782dba1f5e | ||
![]() |
22e1fe5c44 | ||
![]() |
3715291df7 | ||
![]() |
f11f523b30 | ||
![]() |
c9bf7c9e21 | ||
![]() |
932145e3a1 | ||
![]() |
5e1fc510ff | ||
![]() |
fb7e679230 | ||
![]() |
8512528fcf | ||
![]() |
f8c7b85682 | ||
![]() |
2218ffd790 | ||
![]() |
ab82134b88 | ||
![]() |
3f7a888429 | ||
![]() |
fec55d698a | ||
![]() |
af027b7e20 | ||
![]() |
a57e357354 | ||
![]() |
bf8adb286a | ||
![]() |
44623cc384 | ||
![]() |
906a8d0644 | ||
![]() |
343b360303 | ||
![]() |
d4bef44b93 | ||
![]() |
5d1c4b81e7 | ||
![]() |
030d886cf7 | ||
![]() |
f5f7a998ca | ||
![]() |
bb36748764 | ||
![]() |
212523aec6 | ||
![]() |
64011b5c4b | ||
![]() |
63198a6569 | ||
![]() |
775ac7a8b1 | ||
![]() |
ecc9239bfe | ||
![]() |
9926e5589e | ||
![]() |
96cca96bff | ||
![]() |
c935f3f691 | ||
![]() |
f883dd1287 | ||
![]() |
20e725b590 | ||
![]() |
b288dc8c35 | ||
![]() |
e73f33f3db | ||
![]() |
6a8ec97c31 | ||
![]() |
719a948134 | ||
![]() |
39b50fc0d3 | ||
![]() |
02af7948e5 | ||
![]() |
0c183eeadd | ||
![]() |
3391578655 | ||
![]() |
bbb6f0b0ff | ||
![]() |
b2369fa8cd | ||
![]() |
a506d1985f | ||
![]() |
cdc6168ff4 | ||
![]() |
d06f21c927 | ||
![]() |
c864a1062d | ||
![]() |
003213d223 | ||
![]() |
70bb79ab6c | ||
![]() |
61c1f3a300 | ||
![]() |
1f0463b04a | ||
![]() |
4d8c15d10a | ||
![]() |
b234240f11 | ||
![]() |
c732780672 | ||
![]() |
059c039a8b | ||
![]() |
654e868a23 | ||
![]() |
d139eb8c06 | ||
![]() |
98864ceadd | ||
![]() |
ba2b5afe2b | ||
![]() |
4a8c3988c2 | ||
![]() |
b6494ea1c4 | ||
![]() |
82e1f345d4 | ||
![]() |
3457ad29d7 | ||
![]() |
e996e5d0c6 | ||
![]() |
020ef45f0a | ||
![]() |
50ef6be69c | ||
![]() |
873421f1e9 | ||
![]() |
5aae9a60f4 | ||
![]() |
85c3442196 | ||
![]() |
e155bb528f | ||
![]() |
572ad71241 | ||
![]() |
d19ccac925 | ||
![]() |
a1a9692b31 | ||
![]() |
dfc95cafe0 | ||
![]() |
50015ae073 | ||
![]() |
4b69d7f983 | ||
![]() |
cf08501371 | ||
![]() |
9ce92a19c1 | ||
![]() |
1d31ce66f5 | ||
![]() |
684e3b3ec7 | ||
![]() |
675de79d94 | ||
![]() |
6a3d1ced93 | ||
![]() |
b864100890 | ||
![]() |
8364695f8a | ||
![]() |
89fbfd9dfc | ||
![]() |
91a1c8b793 | ||
![]() |
6c0ba197c6 | ||
![]() |
7740529a2a | ||
![]() |
90aac874bf | ||
![]() |
0b6eecd41d | ||
![]() |
3e5b9478c7 | ||
![]() |
b822e25359 | ||
![]() |
3429784309 | ||
![]() |
700d0bfd32 | ||
![]() |
131d33916a | ||
![]() |
c6e2b94128 | ||
![]() |
86d5cceec7 | ||
![]() |
e7c537f217 | ||
![]() |
2416ce13a7 | ||
![]() |
5b392f3f87 | ||
![]() |
da9ab8016b | ||
![]() |
3925de13a7 | ||
![]() |
bb3183959e | ||
![]() |
60b0b02de2 | ||
![]() |
4d6f645d6b | ||
![]() |
1448dc1ea7 | ||
![]() |
e129dc2d3b | ||
![]() |
ec2bfb6538 | ||
![]() |
110210f865 | ||
![]() |
aa363e7899 | ||
![]() |
fda6507e72 | ||
![]() |
3c2188ebf2 | ||
![]() |
95a63affe7 | ||
![]() |
4985fb422e | ||
![]() |
c09a535653 | ||
![]() |
f6d7971b4f | ||
![]() |
a831bf1673 | ||
![]() |
6ad92b60e3 | ||
![]() |
02cfb979bc | ||
![]() |
430f0d07e8 | ||
![]() |
d25d327ef7 | ||
![]() |
b6c7ce96c9 | ||
![]() |
c07b377de1 | ||
![]() |
247b25cfc4 | ||
![]() |
a232408f22 | ||
![]() |
06bfba371d | ||
![]() |
3f2f1212c9 | ||
![]() |
a58411ee99 | ||
![]() |
11bdbf1727 | ||
![]() |
e3184aedb8 | ||
![]() |
e0f380026e | ||
![]() |
8b05489e40 | ||
![]() |
ede68b2af2 | ||
![]() |
d06ce4958e | ||
![]() |
19a8323058 | ||
![]() |
1b60efa9b8 | ||
![]() |
0729ca82d5 | ||
![]() |
8cd745fd77 | ||
![]() |
4dab34fe66 | ||
![]() |
fbbfefb5e4 | ||
![]() |
81c18ee37c | ||
![]() |
3e8bae2ec3 | ||
![]() |
e05436034c | ||
![]() |
f6050f91c3 | ||
![]() |
b600179221 | ||
![]() |
78375934d7 | ||
![]() |
fc85716d07 | ||
![]() |
fdfad28c2e | ||
![]() |
6da8557219 | ||
![]() |
3785c705ff | ||
![]() |
39eafca5ec | ||
![]() |
5c60738f25 | ||
![]() |
ec53d0ae66 | ||
![]() |
2e1523b40f | ||
![]() |
c94b8af821 | ||
![]() |
c855a5f555 | ||
![]() |
cab2d281f3 | ||
![]() |
95d38b740e | ||
![]() |
d8c216d8c8 | ||
![]() |
79b12ac9e6 | ||
![]() |
3e4768c106 | ||
![]() |
f949eca3c4 | ||
![]() |
69bea588e4 | ||
![]() |
9ea5242d94 | ||
![]() |
63d478f9a9 | ||
![]() |
232c224ccf | ||
![]() |
3260bf8215 | ||
![]() |
81d04e417d | ||
![]() |
23621d1b06 | ||
![]() |
9358f6c5b0 | ||
![]() |
58ba78e52b | ||
![]() |
f0e25ed9f3 | ||
![]() |
d53ef4ffc6 | ||
![]() |
a5811d44ac | ||
![]() |
cf1fa9039b | ||
![]() |
3f8a711119 | ||
![]() |
9232ad3378 | ||
![]() |
77ab83b43b | ||
![]() |
f8e823545a | ||
![]() |
8a7d54bb25 | ||
![]() |
b42cb759a5 | ||
![]() |
46321f19f4 | ||
![]() |
6b1dee053f | ||
![]() |
c48c905805 | ||
![]() |
a3dd76df21 | ||
![]() |
c8e3a458ff | ||
![]() |
1a64b745d2 | ||
![]() |
7ed0ec45c3 | ||
![]() |
219d24495d | ||
![]() |
72476ceb8b | ||
![]() |
2f7cde95da | ||
![]() |
65a41ff492 | ||
![]() |
561f539123 | ||
![]() |
cbfba465db | ||
![]() |
901699fe64 | ||
![]() |
ce7130b271 | ||
![]() |
9e3c61e3df | ||
![]() |
8e91f1f7ed | ||
![]() |
81d5e6d17c | ||
![]() |
17907a288c | ||
![]() |
2eeeeb0028 | ||
![]() |
c7d757a337 | ||
![]() |
3e6220c39e | ||
![]() |
44fbaeee82 | ||
![]() |
de82dbfe29 | ||
![]() |
1654abb197 | ||
![]() |
ec4dd8a037 | ||
![]() |
258caa81f0 | ||
![]() |
bc0fe5323e | ||
![]() |
a7582a4503 | ||
![]() |
2293c939e7 | ||
![]() |
672cc4c60c | ||
![]() |
5a2de1de9e | ||
![]() |
650416ce6b | ||
![]() |
f39b2c8011 | ||
![]() |
258b523042 | ||
![]() |
d13470d587 | ||
![]() |
177b5eba48 | ||
![]() |
93df78b5b3 | ||
![]() |
8de65e52ab | ||
![]() |
48ba4565e4 | ||
![]() |
a1363f7fdd | ||
![]() |
084a831e7a | ||
![]() |
8fa0178e08 | ||
![]() |
3a44cf5f86 | ||
![]() |
9cc10f6346 | ||
![]() |
46f68037ec | ||
![]() |
bfd63204a2 | ||
![]() |
e045fb1710 | ||
![]() |
01ad1f2335 | ||
![]() |
800f6b1653 | ||
![]() |
9c529b6c6d | ||
![]() |
1fbc58e7e1 | ||
![]() |
5be9ff8383 | ||
![]() |
bdd0843d94 | ||
![]() |
7f17420ae0 | ||
![]() |
a2a9bd9020 | ||
![]() |
c62c44b17e | ||
![]() |
f50c09ed37 | ||
![]() |
981ea6d163 | ||
![]() |
e569b188a9 | ||
![]() |
ebaf0244a5 | ||
![]() |
61e1488e11 | ||
![]() |
1d65a7c0dd | ||
![]() |
2a01407495 | ||
![]() |
7a8889220f | ||
![]() |
c078a97e12 | ||
![]() |
f36a5cb6d8 | ||
![]() |
4dbbf37844 | ||
![]() |
c9079db77a | ||
![]() |
e0ab059744 | ||
![]() |
0e684570f8 | ||
![]() |
a39ae93ca4 | ||
![]() |
a0c34e9353 | ||
![]() |
36ed8d7838 | ||
![]() |
3aa90bf29f | ||
![]() |
2e524eabd3 | ||
![]() |
ae3d24e233 | ||
![]() |
d03e34e9cc | ||
![]() |
3f56da5efb | ||
![]() |
f032dea77e | ||
![]() |
908f156a45 | ||
![]() |
c41d938f9e | ||
![]() |
4039e520d6 | ||
![]() |
c0f022a1b0 | ||
![]() |
fc9bcc5c14 | ||
![]() |
1343352819 | ||
![]() |
7d98333a8a | ||
![]() |
7a675e6c79 | ||
![]() |
a62d5369d4 | ||
![]() |
a4ddc8b50c | ||
![]() |
fbc2b1e00a | ||
![]() |
701fc48d6f | ||
![]() |
a5bf0649ae | ||
![]() |
677f0ef908 | ||
![]() |
b51bb41bdc | ||
![]() |
fb3de58ccf |
13
.eslintignore
Normal file
@@ -0,0 +1,13 @@
|
||||
node_modules
|
||||
dist
|
||||
build
|
||||
coverage
|
||||
packages/docs/*
|
||||
|
||||
.eslintrc.js
|
||||
husky.config.js
|
||||
jest.config.js
|
||||
jest.config.base.js
|
||||
lint-staged.config.js
|
||||
|
||||
webpack.config.js
|
10
.eslintrc.js
Normal file
@@ -0,0 +1,10 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
parser: '@typescript-eslint/parser',
|
||||
plugins: ['@typescript-eslint'],
|
||||
extends: [
|
||||
'eslint:recommended',
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
'prettier',
|
||||
],
|
||||
};
|
74
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
name: Automatisch CI
|
||||
on: [push]
|
||||
jobs:
|
||||
linter:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
|
||||
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
|
||||
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '16'
|
||||
cache: 'yarn'
|
||||
cache-dependency-path: yarn.lock
|
||||
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
|
||||
- run: echo "🖥️ The workflow is now ready to test your code on the runner."
|
||||
- run: yarn --frozen-lockfile
|
||||
- run: yarn lint
|
||||
- run: echo "🍏 This job's status is ${{ job.status }}."
|
||||
build-backend:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
|
||||
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
|
||||
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '16'
|
||||
cache: 'yarn'
|
||||
cache-dependency-path: yarn.lock
|
||||
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
|
||||
- run: echo "🖥️ The workflow is now ready to test your code on the runner."
|
||||
- run: yarn --frozen-lockfile && yarn lerna bootstrap
|
||||
- run: cd packages/backend && yarn build
|
||||
- run: echo "🍏 This job's status is ${{ job.status }}."
|
||||
build-web:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
|
||||
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
|
||||
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '16'
|
||||
cache: 'yarn'
|
||||
cache-dependency-path: yarn.lock
|
||||
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
|
||||
- run: echo "🖥️ The workflow is now ready to test your code on the runner."
|
||||
- run: yarn --frozen-lockfile && yarn lerna bootstrap
|
||||
- run: cd packages/web && yarn build
|
||||
env:
|
||||
CI: false
|
||||
- run: echo "🍏 This job's status is ${{ job.status }}."
|
||||
build-cli:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
|
||||
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
|
||||
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '16'
|
||||
cache: 'yarn'
|
||||
cache-dependency-path: yarn.lock
|
||||
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
|
||||
- run: echo "🖥️ The workflow is now ready to test your code on the runner."
|
||||
- run: yarn --frozen-lockfile && yarn lerna bootstrap
|
||||
- run: cd packages/backend && yarn build
|
||||
- run: cd packages/cli && yarn build
|
||||
- run: echo "🍏 This job's status is ${{ job.status }}."
|
118
.gitignore
vendored
Normal file
@@ -0,0 +1,118 @@
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
lerna-debug.log*
|
||||
.pnpm-debug.log*
|
||||
|
||||
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
*.pid.lock
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
*.lcov
|
||||
|
||||
# nyc test coverage
|
||||
.nyc_output
|
||||
|
||||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# Bower dependency directory (https://bower.io/)
|
||||
bower_components
|
||||
|
||||
# node-waf configuration
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directories
|
||||
node_modules/
|
||||
jspm_packages/
|
||||
|
||||
# Snowpack dependency directory (https://snowpack.dev/)
|
||||
web_modules/
|
||||
|
||||
# TypeScript cache
|
||||
*.tsbuildinfo
|
||||
|
||||
# Optional npm cache directory
|
||||
.npm
|
||||
|
||||
# Optional eslint cache
|
||||
.eslintcache
|
||||
|
||||
# Microbundle cache
|
||||
.rpt2_cache/
|
||||
.rts2_cache_cjs/
|
||||
.rts2_cache_es/
|
||||
.rts2_cache_umd/
|
||||
|
||||
# Optional REPL history
|
||||
.node_repl_history
|
||||
|
||||
# Output of 'npm pack'
|
||||
*.tgz
|
||||
|
||||
# Yarn Integrity file
|
||||
.yarn-integrity
|
||||
|
||||
# dotenv environment variables file
|
||||
.env
|
||||
.env.test
|
||||
.env.production
|
||||
|
||||
# parcel-bundler cache (https://parceljs.org/)
|
||||
.cache
|
||||
.parcel-cache
|
||||
|
||||
# Next.js build output
|
||||
.next
|
||||
out
|
||||
|
||||
# Nuxt.js build / generate output
|
||||
.nuxt
|
||||
dist
|
||||
|
||||
# Gatsby files
|
||||
.cache/
|
||||
# Comment in the public line in if your project uses Gatsby and not Next.js
|
||||
# https://nextjs.org/blog/next-9-1#public-directory-support
|
||||
# public
|
||||
|
||||
# vuepress build output
|
||||
.vuepress/dist
|
||||
|
||||
# Serverless directories
|
||||
.serverless/
|
||||
|
||||
# FuseBox cache
|
||||
.fusebox/
|
||||
|
||||
# DynamoDB Local files
|
||||
.dynamodb/
|
||||
|
||||
# TernJS port file
|
||||
.tern-port
|
||||
|
||||
# Stores VSCode versions used for testing VSCode extensions
|
||||
.vscode-test
|
||||
|
||||
# yarn v2
|
||||
.yarn/cache
|
||||
.yarn/unplugged
|
||||
.yarn/build-state.yml
|
||||
.yarn/install-state.gz
|
||||
.pnp.*
|
3
.prettierrc.js
Normal file
@@ -0,0 +1,3 @@
|
||||
module.exports = {
|
||||
singleQuote: true,
|
||||
};
|
12
.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Launch server-side",
|
||||
"type": "node-terminal",
|
||||
"request": "launch",
|
||||
"cwd": "${workspaceFolder}/packages/backend",
|
||||
"command": "yarn dev"
|
||||
}
|
||||
]
|
||||
}
|
3
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"editor.formatOnSave": true
|
||||
}
|
76
CODE_OF_CONDUCT.md
Normal file
@@ -0,0 +1,76 @@
|
||||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.
|
||||
|
||||
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to a positive environment for our community include:
|
||||
|
||||
Demonstrating empathy and kindness toward other people
|
||||
Being respectful of differing opinions, viewpoints, and experiences
|
||||
Giving and gracefully accepting constructive feedback
|
||||
Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
|
||||
Focusing on what is best not just for us as individuals, but for the overall community
|
||||
Examples of unacceptable behavior include:
|
||||
|
||||
The use of sexualized language or imagery, and sexual attention or advances of any kind
|
||||
Trolling, insulting or derogatory comments, and personal or political attacks
|
||||
Public or private harassment
|
||||
Publishing others’ private information, such as a physical or email address, without their explicit permission
|
||||
Other conduct which could reasonably be considered inappropriate in a professional setting
|
||||
|
||||
## Enforcement Responsibilities
|
||||
|
||||
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
|
||||
|
||||
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at ali@automatisch.io. All complaints will be reviewed and investigated promptly and fairly.
|
||||
|
||||
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
|
||||
|
||||
## Enforcement Guidelines
|
||||
|
||||
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
|
||||
|
||||
### 1. Correction
|
||||
|
||||
Community Impact: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
|
||||
|
||||
Consequence: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
|
||||
|
||||
### 2. Warning
|
||||
|
||||
Community Impact: A violation through a single incident or series of actions.
|
||||
|
||||
Consequence: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
|
||||
|
||||
### 3. Temporary Ban
|
||||
|
||||
Community Impact: A serious violation of community standards, including sustained inappropriate behavior.
|
||||
|
||||
Consequence: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
|
||||
|
||||
### 4. Permanent Ban
|
||||
|
||||
Community Impact: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
|
||||
|
||||
Consequence: A permanent ban from any sort of public interaction within the community.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the Contributor Covenant, version 2.1, available at https://www.contributor-covenant.org/version/2/1/code_of_conduct.html.
|
||||
|
||||
Community Impact Guidelines were inspired by Mozilla’s code of conduct enforcement ladder.
|
||||
|
||||
For answers to common questions about this code of conduct, see the FAQ at https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
|
661
LICENSE.md
Normal file
@@ -0,0 +1,661 @@
|
||||
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3, 19 November 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU Affero General Public License is a free, copyleft license for
|
||||
software and other kinds of works, specifically designed to ensure
|
||||
cooperation with the community in the case of network server software.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
our General Public Licenses are intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
Developers that use our General Public Licenses protect your rights
|
||||
with two steps: (1) assert copyright on the software, and (2) offer
|
||||
you this License which gives you legal permission to copy, distribute
|
||||
and/or modify the software.
|
||||
|
||||
A secondary benefit of defending all users' freedom is that
|
||||
improvements made in alternate versions of the program, if they
|
||||
receive widespread use, become available for other developers to
|
||||
incorporate. Many developers of free software are heartened and
|
||||
encouraged by the resulting cooperation. However, in the case of
|
||||
software used on network servers, this result may fail to come about.
|
||||
The GNU General Public License permits making a modified version and
|
||||
letting the public access it on a server without ever releasing its
|
||||
source code to the public.
|
||||
|
||||
The GNU Affero General Public License is designed specifically to
|
||||
ensure that, in such cases, the modified source code becomes available
|
||||
to the community. It requires the operator of a network server to
|
||||
provide the source code of the modified version running there to the
|
||||
users of that server. Therefore, public use of a modified version, on
|
||||
a publicly accessible server, gives the public access to the source
|
||||
code of the modified version.
|
||||
|
||||
An older license, called the Affero General Public License and
|
||||
published by Affero, was designed to accomplish similar goals. This is
|
||||
a different license, not a version of the Affero GPL, but Affero has
|
||||
released a new version of the Affero GPL which permits relicensing under
|
||||
this license.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, if you modify the
|
||||
Program, your modified version must prominently offer all users
|
||||
interacting with it remotely through a computer network (if your version
|
||||
supports such interaction) an opportunity to receive the Corresponding
|
||||
Source of your version by providing access to the Corresponding Source
|
||||
from a network server at no charge, through some standard or customary
|
||||
means of facilitating copying of software. This Corresponding Source
|
||||
shall include the Corresponding Source for any work covered by version 3
|
||||
of the GNU General Public License that is incorporated pursuant to the
|
||||
following paragraph.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the work with which it is combined will remain governed by version
|
||||
3 of the GNU General Public License.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU Affero General Public License from time to time. Such new versions
|
||||
will be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU Affero General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU Affero General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU Affero General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If your software can interact with users remotely through a computer
|
||||
network, you should also make sure that it provides a way for users to
|
||||
get its source. For example, if your program is a web application, its
|
||||
interface could display a "Source" link that leads users to an archive
|
||||
of the code. There are many ways you could offer source, and different
|
||||
solutions will be better for different programs; see section 13 for the
|
||||
specific requirements.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU AGPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
56
README.md
Normal file
@@ -0,0 +1,56 @@
|
||||
# Automatisch - Open Source Zapier Alternative
|
||||
|
||||

|
||||
|
||||
🧐 Automatisch is a business automation tool that lets you connect different services like Twitter, Slack, and more to automate your business processes.
|
||||
|
||||
💸 Automating your workflows doesn't have to be a difficult or expensive process. You also don't need any programming knowledge to use Automatisch.
|
||||
|
||||
## Advantages
|
||||
|
||||
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.
|
||||
|
||||
🤓 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.
|
||||
|
||||
💙 No vendor lock-in. If you ever decide that Automatisch is no longer helpful for your business, you can switch to any other provider, which will be easier than switching from the one cloud provider to another since you have all data and flexibility.
|
||||
|
||||
## Documentation
|
||||
|
||||
The official documentation can be found here: [https://automatisch.io/docs](https://automatisch.io/docs)
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
# Clone the repository
|
||||
git clone git@github.com:automatisch/automatisch.git
|
||||
|
||||
# Go to the repository folder
|
||||
cd automatisch/docker/compose
|
||||
|
||||
# Start
|
||||
docker compose up
|
||||
```
|
||||
|
||||
You can use `user@automatisch.io` email address and `sample` password to login to Automatisch. You can also change your email and password later on from the settings page.
|
||||
|
||||
## Community Links
|
||||
|
||||
- [Github](https://github.com/automatisch/automatisch)
|
||||
- [Discord](https://discord.gg/dJSah9CVrC)
|
||||
- [Twitter](https://twitter.com/automatischio)
|
||||
|
||||
## Support
|
||||
|
||||
If you have any questions or problems, please visit our GitHub discussions page, and we'll try to help you as soon as possible.
|
||||
|
||||
[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
|
||||
|
||||
Automatisch is an open-source software with an [AGPL 3.0 license](https://github.com/automatisch/automatisch/blob/main/LICENSE.md).
|
47
docker/compose/docker-compose.yml
Normal file
@@ -0,0 +1,47 @@
|
||||
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:
|
5
docker/images/plain/Dockerfile
Normal file
@@ -0,0 +1,5 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
FROM node:16
|
||||
WORKDIR /automatisch
|
||||
|
||||
RUN yarn global add @automatisch/cli
|
15
docker/images/wait-for-postgres/Dockerfile
Normal file
@@ -0,0 +1,15 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
FROM node:16
|
||||
WORKDIR /automatisch
|
||||
|
||||
RUN apt-get update && apt-get install -y postgresql-client
|
||||
COPY ./wait-for-postgres.sh /automatisch/wait-for-postgres.sh
|
||||
|
||||
RUN mkdir -p /automatisch/storage
|
||||
RUN touch /automatisch/storage/.env
|
||||
RUN echo "ENCRYPTION_KEY=$(openssl rand -base64 36)" >> /automatisch/storage/.env
|
||||
RUN echo "APP_SECRET_KEY=$(openssl rand -base64 36)" >> /automatisch/storage/.env
|
||||
RUN yarn global add @automatisch/cli
|
||||
|
||||
EXPOSE 3000
|
||||
CMD sh /automatisch/wait-for-postgres.sh automatisch start --env-file=/automatisch/storage/.env
|
11
docker/images/wait-for-postgres/wait-for-postgres.sh
Normal file
@@ -0,0 +1,11 @@
|
||||
#!/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,13 +2,12 @@
|
||||
"packages": [
|
||||
"packages/*"
|
||||
],
|
||||
"private": true,
|
||||
"version": "independent",
|
||||
"version": "0.1.2",
|
||||
"npmClient": "yarn",
|
||||
"useWorkspaces": true,
|
||||
"command": {
|
||||
"publish": {
|
||||
"registry": "http://localhost:5000"
|
||||
"add": {
|
||||
"exact": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
36
package.json
@@ -1,13 +1,37 @@
|
||||
{
|
||||
"name": "@automatisch/root",
|
||||
"license": "AGPL-3.0",
|
||||
"private": true,
|
||||
"workspaces": [
|
||||
"packages/*"
|
||||
],
|
||||
"scripts": {
|
||||
"start": "lerna run --stream --parallel --scope=@*/{web,backend} dev",
|
||||
"start:web": "lerna run --stream --scope=@*/web dev",
|
||||
"start:backend": "lerna run --stream --scope=@*/backend dev",
|
||||
"lint": "lerna run --no-bail --stream --parallel --scope=@*/{web,backend,cli} lint",
|
||||
"build:watch": "lerna run --no-bail --stream --parallel --scope=@*/{web,backend,cli} build:watch",
|
||||
"build:docs": "cd ./packages/docs && yarn install && yarn build"
|
||||
},
|
||||
"workspaces": {
|
||||
"packages": [
|
||||
"packages/*"
|
||||
],
|
||||
"nohoist": [
|
||||
"**/babel-loader",
|
||||
"**/webpack",
|
||||
"**/@automatisch/web",
|
||||
"**/@automatisch/types",
|
||||
"**/ajv"
|
||||
]
|
||||
},
|
||||
"devDependencies": {
|
||||
"lerna": "^4.0.0"
|
||||
"@typescript-eslint/eslint-plugin": "^5.9.1",
|
||||
"@typescript-eslint/parser": "^5.9.1",
|
||||
"eslint": "^8.13.0",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"eslint-plugin-prettier": "^4.0.0",
|
||||
"lerna": "^4.0.0",
|
||||
"prettier": "^2.5.1"
|
||||
},
|
||||
"publishConfig": {
|
||||
"registry": "http://localhost:5000"
|
||||
"access": "public"
|
||||
}
|
||||
}
|
||||
}
|
16
packages/backend/.env-example
Normal file
@@ -0,0 +1,16 @@
|
||||
HOST=localhost
|
||||
PROTOCOL=http
|
||||
PORT=3000
|
||||
WEB_APP_URL=https://localhost:3001
|
||||
APP_ENV=development
|
||||
POSTGRES_DATABASE=automatisch_development
|
||||
POSTGRES_PORT=5432
|
||||
POSTGRES_HOST=localhost
|
||||
POSTGRES_USERNAME=automatish_development_user
|
||||
POSTGRES_PASSWORD=
|
||||
POSTGRES_ENABLE_SSL=false
|
||||
ENCRYPTION_KEY=sample-encryption-key
|
||||
APP_SECRET_KEY=sample-app-secret-key
|
||||
REDIS_PORT=6379
|
||||
REDIS_HOST=127.0.0.1
|
||||
ENABLE_BULLMQ_DASHBOARD=false
|
12
packages/backend/README.md
Normal file
@@ -0,0 +1,12 @@
|
||||
# `backend`
|
||||
|
||||
The open source Zapier alternative. Build workflow automation without spending
|
||||
time and money.
|
||||
|
||||
## Usage
|
||||
|
||||
```
|
||||
const backend = require('backend');
|
||||
|
||||
// TODO: DEMONSTRATE API
|
||||
```
|
9
packages/backend/bin/database/client.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { Client } from 'pg';
|
||||
|
||||
const client = new Client({
|
||||
host: 'localhost',
|
||||
user: 'postgres',
|
||||
port: 5432,
|
||||
})
|
||||
|
||||
export default client;
|
3
packages/backend/bin/database/create.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
import { createDatabaseAndUser } from './utils';
|
||||
|
||||
createDatabaseAndUser();
|
3
packages/backend/bin/database/drop.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
import { dropDatabase } from './utils';
|
||||
|
||||
dropDatabase();
|
3
packages/backend/bin/database/seed-user.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
import { createUser } from './utils';
|
||||
|
||||
createUser();
|
106
packages/backend/bin/database/utils.ts
Normal file
@@ -0,0 +1,106 @@
|
||||
import appConfig from '../../src/config/app';
|
||||
import logger from '../../src/helpers/logger';
|
||||
import client from './client';
|
||||
import User from '../../src/models/user';
|
||||
import '../../src/config/orm';
|
||||
|
||||
export async function createUser(email = 'user@automatisch.io', password = 'sample') {
|
||||
const UNIQUE_VIOLATION_CODE = '23505';
|
||||
const userParams = {
|
||||
email,
|
||||
password,
|
||||
};
|
||||
|
||||
try {
|
||||
const userCount = await User.query().resultSize();
|
||||
|
||||
if (userCount === 0) {
|
||||
const user = await User.query().insertAndFetch(userParams);
|
||||
logger.info(`User has been saved: ${user.email}`);
|
||||
} else {
|
||||
logger.info('No need to seed a user.');
|
||||
}
|
||||
} catch (err) {
|
||||
if ((err as any).nativeError.code !== UNIQUE_VIOLATION_CODE) {
|
||||
throw err;
|
||||
}
|
||||
|
||||
logger.info(`User already exists: ${email}`);
|
||||
}
|
||||
}
|
||||
|
||||
export const createDatabaseAndUser = async (database = appConfig.postgresDatabase, user = appConfig.postgresUsername) => {
|
||||
await client.connect();
|
||||
await createDatabase(database);
|
||||
await createDatabaseUser(user);
|
||||
await grantPrivileges(database, user);
|
||||
|
||||
await client.end();
|
||||
}
|
||||
|
||||
export const createDatabase = async (database = appConfig.postgresDatabase) => {
|
||||
const DUPLICATE_DB_CODE = '42P04';
|
||||
|
||||
try {
|
||||
await client.query(`CREATE DATABASE ${database}`);
|
||||
logger.info(`Database: ${database} created!`);
|
||||
} catch (err) {
|
||||
if ((err as any).code !== DUPLICATE_DB_CODE) {
|
||||
throw err;
|
||||
}
|
||||
|
||||
logger.info(`Database: ${database} already exists!`);
|
||||
}
|
||||
}
|
||||
|
||||
export const createDatabaseUser = async (user = appConfig.postgresUsername) => {
|
||||
const DUPLICATE_OBJECT_CODE = '42710';
|
||||
|
||||
try {
|
||||
const result = await client.query(`CREATE USER ${user}`);
|
||||
logger.info(`Database User: ${user} created!`);
|
||||
|
||||
return result;
|
||||
} catch (err) {
|
||||
if ((err as any).code !== DUPLICATE_OBJECT_CODE) {
|
||||
throw err;
|
||||
}
|
||||
|
||||
logger.info(`Database User: ${user} already exists!`);
|
||||
}
|
||||
}
|
||||
|
||||
export const grantPrivileges = async (
|
||||
database = appConfig.postgresDatabase, user = appConfig.postgresUsername
|
||||
) => {
|
||||
await client.query(
|
||||
`GRANT ALL PRIVILEGES ON DATABASE ${database} TO ${user};`
|
||||
);
|
||||
|
||||
logger.info(
|
||||
`${user} has granted all privileges on ${database}!`
|
||||
);
|
||||
}
|
||||
|
||||
export const dropDatabase = async () => {
|
||||
if (appConfig.appEnv != 'development' && appConfig.appEnv != 'test') {
|
||||
const errorMessage = 'Drop database command can be used only with development or test environments!'
|
||||
|
||||
logger.error(errorMessage)
|
||||
return;
|
||||
}
|
||||
|
||||
await client.connect();
|
||||
await dropDatabaseAndUser();
|
||||
|
||||
await client.end();
|
||||
}
|
||||
|
||||
export const dropDatabaseAndUser = async(database = appConfig.postgresDatabase, user = appConfig.postgresUsername) => {
|
||||
await client.query(`DROP DATABASE IF EXISTS ${database}`);
|
||||
logger.info(`Database: ${database} removed!`);
|
||||
|
||||
await client.query(`DROP USER IF EXISTS ${user}`);
|
||||
logger.info(`Database User: ${user} removed!`);
|
||||
}
|
||||
|
1
packages/backend/database-utils.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export * from './dist/bin/database/utils';
|
2
packages/backend/database-utils.js
Normal file
@@ -0,0 +1,2 @@
|
||||
/* eslint-disable */
|
||||
module.exports = require('./dist/bin/database/utils');
|
1
packages/backend/database.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export * from './dist/src/config/database';
|
2
packages/backend/database.js
Normal file
@@ -0,0 +1,2 @@
|
||||
/* eslint-disable */
|
||||
module.exports = require('./dist/src/config/database');
|
26
packages/backend/knexfile.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import appConfig from './src/config/app';
|
||||
|
||||
const fileExtension = appConfig.isDev ? 'ts' : 'js';
|
||||
|
||||
const knexConfig = {
|
||||
client: 'pg',
|
||||
connection: {
|
||||
host: appConfig.postgresHost,
|
||||
port: appConfig.postgresPort,
|
||||
user: appConfig.postgresUsername,
|
||||
password: appConfig.postgresPassword,
|
||||
database: appConfig.postgresDatabase,
|
||||
ssl: appConfig.postgresEnableSsl
|
||||
},
|
||||
pool: { min: 0, max: 20 },
|
||||
migrations: {
|
||||
directory: __dirname + '/src/db/migrations',
|
||||
extension: fileExtension,
|
||||
loadExtensions: [`.${fileExtension}`],
|
||||
},
|
||||
seeds: {
|
||||
directory: __dirname + '/src/db/seeds',
|
||||
}
|
||||
}
|
||||
|
||||
export default knexConfig;
|
1
packages/backend/logger.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export * from './dist/src/helpers/logger';
|
2
packages/backend/logger.js
Normal file
@@ -0,0 +1,2 @@
|
||||
/* eslint-disable */
|
||||
module.exports = require('./dist/src/helpers/logger');
|
137
packages/backend/package.json
Normal file
@@ -0,0 +1,137 @@
|
||||
{
|
||||
"name": "@automatisch/backend",
|
||||
"version": "0.1.2",
|
||||
"license": "AGPL-3.0",
|
||||
"description": "The open source Zapier alternative. Build workflow automation without spending time and money.",
|
||||
"scripts": {
|
||||
"dev": "ts-node-dev src/server.ts",
|
||||
"worker": "nodemon --watch 'src/**/*.ts' --exec 'ts-node' src/worker.ts",
|
||||
"build": "tsc && yarn copy-statics",
|
||||
"build:watch": "nodemon --watch 'src/**/*.ts' --watch 'bin/**/*.ts' --exec yarn build --ext ts",
|
||||
"start": "node dist/src/server.js",
|
||||
"test": "ava",
|
||||
"lint": "eslint . --ignore-path ../../.eslintignore",
|
||||
"db:create": "ts-node ./bin/database/create.ts",
|
||||
"db:seed:user": "ts-node ./bin/database/seed-user.ts",
|
||||
"db:drop": "ts-node ./bin/database/drop.ts",
|
||||
"db:migration:create": "knex migrate:make",
|
||||
"db:rollback": "knex migrate:rollback",
|
||||
"db:migrate": "knex migrate:latest",
|
||||
"copy-statics": "copyfiles src/**/*.{graphql,json,svg} dist",
|
||||
"prepack": "yarn build",
|
||||
"prebuild": "rm -rf ./dist"
|
||||
},
|
||||
"dependencies": {
|
||||
"@automatisch/web": "^0.1.2",
|
||||
"@bull-board/express": "^3.10.1",
|
||||
"@gitbeaker/node": "^35.6.0",
|
||||
"@graphql-tools/graphql-file-loader": "^7.3.4",
|
||||
"@graphql-tools/load": "^7.5.2",
|
||||
"@rudderstack/rudder-sdk-node": "^1.1.2",
|
||||
"@slack/bolt": "3.10.0",
|
||||
"@types/luxon": "^2.3.1",
|
||||
"ajv-formats": "^2.1.1",
|
||||
"axios": "0.24.0",
|
||||
"bcrypt": "^5.0.1",
|
||||
"bullmq": "^1.76.1",
|
||||
"copyfiles": "^2.4.1",
|
||||
"cors": "^2.8.5",
|
||||
"crypto-js": "^4.1.1",
|
||||
"debug": "~2.6.9",
|
||||
"discord.js": "13.2.0",
|
||||
"dotenv": "^10.0.0",
|
||||
"express": "~4.16.1",
|
||||
"express-graphql": "^0.12.0",
|
||||
"flickr-sdk": "3.10.0",
|
||||
"googleapis": "89.0.0",
|
||||
"graphql-middleware": "^6.1.15",
|
||||
"graphql-shield": "^7.5.0",
|
||||
"graphql-tools": "^8.2.0",
|
||||
"graphql-type-json": "^0.3.2",
|
||||
"http-errors": "~1.6.3",
|
||||
"jsonwebtoken": "^8.5.1",
|
||||
"knex": "^0.95.11",
|
||||
"lodash.get": "^4.4.2",
|
||||
"luxon": "2.3.1",
|
||||
"morgan": "^1.10.0",
|
||||
"nodemailer": "6.7.0",
|
||||
"oauth-1.0a": "^2.2.6",
|
||||
"objection": "^3.0.0",
|
||||
"octokit": "^1.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"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "automatisch contributors",
|
||||
"url": "https://github.com/automatisch/automatisch/graphs/contributors"
|
||||
}
|
||||
],
|
||||
"homepage": "https://github.com/automatisch/automatisch#readme",
|
||||
"main": "dist/src/app",
|
||||
"directories": {
|
||||
"bin": "bin",
|
||||
"src": "src",
|
||||
"test": "__tests__"
|
||||
},
|
||||
"files": [
|
||||
"dist",
|
||||
"bin",
|
||||
"src",
|
||||
"server.js",
|
||||
"server.d.ts",
|
||||
"worker.js",
|
||||
"worker.d.ts",
|
||||
"logger.js",
|
||||
"logger.d.ts",
|
||||
"database.js",
|
||||
"database.d.ts",
|
||||
"database-utils.js",
|
||||
"database-utils.d.ts"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/automatisch/automatisch.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/automatisch/automatisch/issues"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@automatisch/types": "^0.1.2",
|
||||
"@types/bcrypt": "^5.0.0",
|
||||
"@types/bull": "^3.15.8",
|
||||
"@types/cors": "^2.8.12",
|
||||
"@types/crypto-js": "^4.0.2",
|
||||
"@types/express": "^4.17.13",
|
||||
"@types/http-errors": "^1.8.1",
|
||||
"@types/jsonwebtoken": "^8.5.8",
|
||||
"@types/lodash.get": "^4.4.6",
|
||||
"@types/morgan": "^1.9.3",
|
||||
"@types/node": "^16.10.2",
|
||||
"@types/nodemailer": "^6.4.4",
|
||||
"@types/pg": "^8.6.1",
|
||||
"@types/pino": "^7.0.5",
|
||||
"ava": "^3.15.0",
|
||||
"nodemon": "^2.0.13",
|
||||
"sinon": "^11.1.2",
|
||||
"ts-node": "^10.2.1",
|
||||
"ts-node-dev": "^1.1.8"
|
||||
},
|
||||
"ava": {
|
||||
"files": [
|
||||
"test/**/*"
|
||||
],
|
||||
"extensions": [
|
||||
"ts"
|
||||
],
|
||||
"require": [
|
||||
"ts-node/register"
|
||||
]
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
}
|
||||
}
|
1
packages/backend/server.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export * from './dist/src/server';
|
2
packages/backend/server.js
Normal file
@@ -0,0 +1,2 @@
|
||||
/* eslint-disable */
|
||||
module.exports = require('./dist/src/server.js');
|
45
packages/backend/src/app.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
import appConfig from './config/app';
|
||||
import createError from 'http-errors';
|
||||
import express, { Request, Response, NextFunction } from 'express';
|
||||
import cors from 'cors';
|
||||
import corsOptions from './config/cors-options';
|
||||
import graphQLInstance from './helpers/graphql-instance';
|
||||
import morgan from './helpers/morgan';
|
||||
import appAssetsHandler from './helpers/app-assets-handler';
|
||||
import webUIHandler from './helpers/web-ui-handler';
|
||||
import errorHandler from './helpers/error-handler';
|
||||
import './config/orm';
|
||||
import {
|
||||
createBullBoardHandler,
|
||||
serverAdapter,
|
||||
} from './helpers/create-bull-board-handler';
|
||||
import injectBullBoardHandler from './helpers/inject-bull-board-handler';
|
||||
|
||||
if (appConfig.enableBullMQDashboard) {
|
||||
createBullBoardHandler(serverAdapter);
|
||||
}
|
||||
|
||||
const app = express();
|
||||
|
||||
if (appConfig.enableBullMQDashboard) {
|
||||
injectBullBoardHandler(app, serverAdapter);
|
||||
}
|
||||
|
||||
appAssetsHandler(app);
|
||||
|
||||
app.use(morgan);
|
||||
app.use(express.json());
|
||||
app.use(express.urlencoded({ extended: false }));
|
||||
app.use(cors(corsOptions));
|
||||
app.use('/graphql', graphQLInstance);
|
||||
|
||||
webUIHandler(app);
|
||||
|
||||
// catch 404 and forward to error handler
|
||||
app.use(function (req: Request, res: Response, next: NextFunction) {
|
||||
next(createError(404));
|
||||
});
|
||||
|
||||
app.use(errorHandler);
|
||||
|
||||
export default app;
|
4
packages/backend/src/apps/discord/assets/favicon.svg
Normal file
@@ -0,0 +1,4 @@
|
||||
<svg fill="#5865f2" aria-label="Discord" role="img" version="1.1" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect width="512" height="512" rx="15%" fill="#fff"/>
|
||||
<path d="m386 137c-24-11-49.5-19-76.3-23.7c-.5 0-1 0-1.2.6c-3.3 5.9-7 13.5-9.5 19.5c-29-4.3-57.5-4.3-85.7 0c-2.6-6.2-6.3-13.7-10-19.5c-.3-.4-.7-.7-1.2-.6c-23 4.6-52.4 13-76 23.7c-.2 0-.4.2-.5.4c-49 73-62 143-55 213c0 .3.2.7.5 1c32 23.6 63 38 93.6 47.3c.5 0 1 0 1.3-.4c7.2-9.8 13.6-20.2 19.2-31.2c.3-.6 0-1.4-.7-1.6c-10-4-20-8.6-29.3-14c-.7-.4-.8-1.5 0-2c2-1.5 4-3 5.8-4.5c.3-.3.8-.3 1.2-.2c61.4 28 128 28 188 0c.4-.2.9-.1 1.2.1c1.9 1.6 3.8 3.1 5.8 4.6c.7.5.6 1.6 0 2c-9.3 5.5-19 10-29.3 14c-.7.3-1 1-.6 1.7c5.6 11 12.1 21.3 19 31c.3.4.8.6 1.3.4c30.6-9.5 61.7-23.8 93.8-47.3c.3-.2.5-.5.5-1c7.8-80.9-13.1-151-55.4-213c0-.2-.3-.4-.5-.4Zm-192 171c-19 0-34-17-34-38c0-21 15-38 34-38c19 0 34 17 34 38c0 21-15 38-34 38zm125 0c-19 0-34-17-34-38c0-21 15-38 34-38c19 0 34 17 34 38c0 21-15 38-34 38z" fill="#5865f2"/>
|
||||
</svg>
|
After Width: | Height: | Size: 993 B |
99
packages/backend/src/apps/discord/authentication.ts
Normal file
@@ -0,0 +1,99 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
0
packages/backend/src/apps/discord/index.d.ts
vendored
Normal file
15
packages/backend/src/apps/discord/index.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import Authentication from './authentication';
|
||||
import {
|
||||
IService,
|
||||
IAuthentication,
|
||||
IApp,
|
||||
IJSONObject,
|
||||
} from '@automatisch/types';
|
||||
|
||||
export default class Discord implements IService {
|
||||
authenticationClient: IAuthentication;
|
||||
|
||||
constructor(appData: IApp, connectionData: IJSONObject) {
|
||||
this.authenticationClient = new Authentication(appData, connectionData);
|
||||
}
|
||||
}
|
219
packages/backend/src/apps/discord/info.json
Normal file
@@ -0,0 +1,219 @@
|
||||
{
|
||||
"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}"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
35
packages/backend/src/apps/firebase/assets/favicon.svg
Normal file
@@ -0,0 +1,35 @@
|
||||
<?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>
|
After Width: | Height: | Size: 3.8 KiB |
89
packages/backend/src/apps/firebase/authentication.ts
Normal file
@@ -0,0 +1,89 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
0
packages/backend/src/apps/firebase/index.d.ts
vendored
Normal file
15
packages/backend/src/apps/firebase/index.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
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);
|
||||
}
|
||||
}
|
219
packages/backend/src/apps/firebase/info.json
Normal file
@@ -0,0 +1,219 @@
|
||||
{
|
||||
"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}"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
5
packages/backend/src/apps/flickr/assets/favicon.svg
Normal file
@@ -0,0 +1,5 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" aria-label="Flickr" role="img" viewBox="0 0 512 512">
|
||||
<rect width="512" height="512" rx="15%" fill="#fff"/>
|
||||
<circle cx="157" cy="256" fill="#0063dc" r="79"/>
|
||||
<circle cx="355" cy="256" fill="#ff0084" r="79"/>
|
||||
</svg>
|
After Width: | Height: | Size: 261 B |
82
packages/backend/src/apps/flickr/authentication.ts
Normal file
@@ -0,0 +1,82 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
10
packages/backend/src/apps/flickr/data.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
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);
|
||||
}
|
||||
}
|
39
packages/backend/src/apps/flickr/data/list-albums.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
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,
|
||||
}));
|
||||
}
|
||||
}
|
1
packages/backend/src/apps/flickr/index.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
declare module 'flickr-sdk';
|
25
packages/backend/src/apps/flickr/index.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import {
|
||||
IService,
|
||||
IAuthentication,
|
||||
IApp,
|
||||
IJSONObject,
|
||||
} from '@automatisch/types';
|
||||
import Authentication from './authentication';
|
||||
import Triggers from './triggers';
|
||||
import Data from './data';
|
||||
|
||||
export default class Flickr implements IService {
|
||||
authenticationClient: IAuthentication;
|
||||
triggers: Triggers;
|
||||
data: Data;
|
||||
|
||||
constructor(
|
||||
appData: IApp,
|
||||
connectionData: IJSONObject,
|
||||
parameters: IJSONObject
|
||||
) {
|
||||
this.authenticationClient = new Authentication(appData, connectionData);
|
||||
this.data = new Data(connectionData);
|
||||
this.triggers = new Triggers(connectionData, parameters);
|
||||
}
|
||||
}
|
304
packages/backend/src/apps/flickr/info.json
Normal file
@@ -0,0 +1,304 @@
|
||||
{
|
||||
"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"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
19
packages/backend/src/apps/flickr/triggers.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
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);
|
||||
}
|
||||
}
|
103
packages/backend/src/apps/flickr/triggers/new-album.ts
Normal file
@@ -0,0 +1,103 @@
|
||||
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,62 @@
|
||||
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,80 @@
|
||||
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;
|
||||
}
|
||||
}
|
88
packages/backend/src/apps/flickr/triggers/new-photo.ts
Normal file
@@ -0,0 +1,88 @@
|
||||
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;
|
||||
}
|
||||
}
|
6
packages/backend/src/apps/github/assets/favicon.svg
Normal file
@@ -0,0 +1,6 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg"
|
||||
aria-label="GitHub" role="img"
|
||||
viewBox="0 0 512 512"><rect
|
||||
width="512" height="512"
|
||||
rx="15%"
|
||||
fill="#1B1817"/><path fill="#fff" d="M335 499c14 0 12 17 12 17H165s-2-17 12-17c13 0 16-6 16-12l-1-50c-71 16-86-28-86-28-12-30-28-37-28-37-24-16 1-16 1-16 26 2 40 26 40 26 22 39 59 28 74 22 2-17 9-28 16-35-57-6-116-28-116-126 0-28 10-51 26-69-3-6-11-32 3-67 0 0 21-7 70 26 42-12 86-12 128 0 49-33 70-26 70-26 14 35 6 61 3 67 16 18 26 41 26 69 0 98-60 120-117 126 10 8 18 24 18 48l-1 70c0 6 3 12 16 12z"/></svg>
|
After Width: | Height: | Size: 542 B |
95
packages/backend/src/apps/github/authentication.ts
Normal file
@@ -0,0 +1,95 @@
|
||||
import type {
|
||||
IAuthentication,
|
||||
IApp,
|
||||
IField,
|
||||
IJSONObject,
|
||||
} from '@automatisch/types';
|
||||
import createHttpClient, { IHttpClient } from '../../helpers/http-client';
|
||||
import { URLSearchParams } from 'url';
|
||||
|
||||
export default class Authentication implements IAuthentication {
|
||||
appData: IApp;
|
||||
connectionData: IJSONObject;
|
||||
scopes: string[] = ['read:org', 'repo', 'user'];
|
||||
client: IHttpClient;
|
||||
|
||||
constructor(appData: IApp, connectionData: IJSONObject) {
|
||||
this.connectionData = connectionData;
|
||||
this.appData = appData;
|
||||
this.client = createHttpClient({ baseURL: 'https://github.com' });
|
||||
}
|
||||
|
||||
get oauthRedirectUrl(): string {
|
||||
return this.appData.fields.find(
|
||||
(field: IField) => field.key == 'oAuthRedirectUrl'
|
||||
).value;
|
||||
}
|
||||
|
||||
async createAuthData(): Promise<{ url: string }> {
|
||||
const searchParams = new URLSearchParams({
|
||||
client_id: this.connectionData.consumerKey as string,
|
||||
redirect_uri: this.oauthRedirectUrl,
|
||||
scope: this.scopes.join(','),
|
||||
});
|
||||
|
||||
const url = `https://github.com/login/oauth/authorize?${searchParams.toString()}`;
|
||||
|
||||
return {
|
||||
url,
|
||||
};
|
||||
}
|
||||
|
||||
async verifyCredentials() {
|
||||
const response = await this.client.post('/login/oauth/access_token', {
|
||||
client_id: this.connectionData.consumerKey,
|
||||
client_secret: this.connectionData.consumerSecret,
|
||||
code: this.connectionData.oauthVerifier,
|
||||
});
|
||||
|
||||
const data = Object.fromEntries(new URLSearchParams(response.data));
|
||||
|
||||
this.connectionData.accessToken = data.access_token;
|
||||
|
||||
const tokenInfo = await this.getTokenInfo();
|
||||
|
||||
return {
|
||||
consumerKey: this.connectionData.consumerKey,
|
||||
consumerSecret: this.connectionData.consumerSecret,
|
||||
accessToken: data.access_token,
|
||||
scope: data.scope,
|
||||
tokenType: data.token_type,
|
||||
userId: tokenInfo.data.user.id,
|
||||
screenName: tokenInfo.data.user.login,
|
||||
};
|
||||
}
|
||||
|
||||
async getTokenInfo() {
|
||||
const basicAuthToken = Buffer.from(
|
||||
this.connectionData.consumerKey + ':' + this.connectionData.consumerSecret
|
||||
).toString('base64');
|
||||
|
||||
const headers = {
|
||||
Authorization: `Basic ${basicAuthToken}`,
|
||||
};
|
||||
|
||||
const body = {
|
||||
access_token: this.connectionData.accessToken,
|
||||
};
|
||||
|
||||
return await this.client.post(
|
||||
`https://api.github.com/applications/${this.connectionData.consumerKey}/token`,
|
||||
body,
|
||||
{ headers }
|
||||
);
|
||||
}
|
||||
|
||||
async isStillVerified() {
|
||||
try {
|
||||
await this.getTokenInfo();
|
||||
|
||||
return true;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
16
packages/backend/src/apps/github/data.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { IJSONObject } from '@automatisch/types';
|
||||
import ListRepos from './data/list-repos';
|
||||
import ListBranches from './data/list-branches';
|
||||
import ListLabels from './data/list-labels';
|
||||
|
||||
export default class Data {
|
||||
listRepos: ListRepos;
|
||||
listBranches: ListBranches;
|
||||
listLabels: ListLabels;
|
||||
|
||||
constructor(connectionData: IJSONObject, parameters: IJSONObject) {
|
||||
this.listRepos = new ListRepos(connectionData);
|
||||
this.listBranches = new ListBranches(connectionData, parameters);
|
||||
this.listLabels = new ListLabels(connectionData, parameters);
|
||||
}
|
||||
}
|
36
packages/backend/src/apps/github/data/list-branches.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
import { Octokit } from 'octokit';
|
||||
import type { IJSONObject } from '@automatisch/types';
|
||||
|
||||
import { assignOwnerAndRepo } from '../utils';
|
||||
|
||||
export default class ListBranches {
|
||||
client?: Octokit;
|
||||
repoOwner?: string;
|
||||
repo?: string;
|
||||
|
||||
constructor(connectionData: IJSONObject, parameters?: IJSONObject) {
|
||||
if (connectionData.accessToken) {
|
||||
this.client = new Octokit({
|
||||
auth: connectionData.accessToken as string,
|
||||
});
|
||||
}
|
||||
|
||||
assignOwnerAndRepo(this, parameters?.repo as string);
|
||||
}
|
||||
|
||||
get options() {
|
||||
return {
|
||||
owner: this.repoOwner,
|
||||
repo: this.repo,
|
||||
};
|
||||
}
|
||||
|
||||
async run() {
|
||||
const branches = await this.client.paginate(this.client.rest.repos.listBranches, this.options);
|
||||
|
||||
return branches.map((branch) => ({
|
||||
value: branch.name,
|
||||
name: branch.name,
|
||||
}));
|
||||
}
|
||||
}
|
36
packages/backend/src/apps/github/data/list-labels.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
import { Octokit } from 'octokit';
|
||||
import type { IJSONObject } from '@automatisch/types';
|
||||
|
||||
import { assignOwnerAndRepo } from '../utils';
|
||||
|
||||
export default class ListLabels {
|
||||
client?: Octokit;
|
||||
repoOwner?: string;
|
||||
repo?: string;
|
||||
|
||||
constructor(connectionData: IJSONObject, parameters?: IJSONObject) {
|
||||
if (connectionData.accessToken) {
|
||||
this.client = new Octokit({
|
||||
auth: connectionData.accessToken as string,
|
||||
});
|
||||
}
|
||||
|
||||
assignOwnerAndRepo(this, parameters?.repo as string);
|
||||
}
|
||||
|
||||
get options() {
|
||||
return {
|
||||
owner: this.repoOwner,
|
||||
repo: this.repo,
|
||||
};
|
||||
}
|
||||
|
||||
async run() {
|
||||
const labels = await this.client.paginate(this.client.rest.issues.listLabelsForRepo, this.options);
|
||||
|
||||
return labels.map((label) => ({
|
||||
value: label.name,
|
||||
name: label.name,
|
||||
}));
|
||||
}
|
||||
}
|
23
packages/backend/src/apps/github/data/list-repos.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { Octokit } from 'octokit';
|
||||
import type { IJSONObject } from '@automatisch/types';
|
||||
|
||||
export default class ListRepos {
|
||||
client?: Octokit;
|
||||
|
||||
constructor(connectionData: IJSONObject) {
|
||||
if (connectionData.accessToken) {
|
||||
this.client = new Octokit({
|
||||
auth: connectionData.accessToken as string,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async run() {
|
||||
const repos = await this.client.paginate(this.client.rest.repos.listForAuthenticatedUser);
|
||||
|
||||
return repos.map((repo) => ({
|
||||
value: repo.full_name,
|
||||
name: repo.full_name,
|
||||
}));
|
||||
}
|
||||
}
|
0
packages/backend/src/apps/github/index.d.ts
vendored
Normal file
25
packages/backend/src/apps/github/index.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import {
|
||||
IService,
|
||||
IAuthentication,
|
||||
IApp,
|
||||
IJSONObject,
|
||||
} from '@automatisch/types';
|
||||
import Authentication from './authentication';
|
||||
import Triggers from './triggers';
|
||||
import Data from './data';
|
||||
|
||||
export default class Github implements IService {
|
||||
authenticationClient: IAuthentication;
|
||||
triggers: Triggers;
|
||||
data: Data;
|
||||
|
||||
constructor(
|
||||
appData: IApp,
|
||||
connectionData: IJSONObject,
|
||||
parameters: IJSONObject
|
||||
) {
|
||||
this.authenticationClient = new Authentication(appData, connectionData);
|
||||
this.data = new Data(connectionData, parameters);
|
||||
this.triggers = new Triggers(connectionData, parameters);
|
||||
}
|
||||
}
|
747
packages/backend/src/apps/github/info.json
Normal file
@@ -0,0 +1,747 @@
|
||||
{
|
||||
"name": "Github",
|
||||
"key": "github",
|
||||
"iconUrl": "{BASE_URL}/apps/github/assets/favicon.svg",
|
||||
"docUrl": "https://automatisch.io/docs/github",
|
||||
"primaryColor": "000000",
|
||||
"supportsConnections": true,
|
||||
"fields": [
|
||||
{
|
||||
"key": "oAuthRedirectUrl",
|
||||
"label": "OAuth Redirect URL",
|
||||
"type": "string",
|
||||
"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",
|
||||
"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",
|
||||
"required": true,
|
||||
"readOnly": false,
|
||||
"value": null,
|
||||
"placeholder": null,
|
||||
"description": null,
|
||||
"docUrl": "https://automatisch.io/docs/github#client-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}"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"triggers": [
|
||||
{
|
||||
"name": "New repository",
|
||||
"key": "newRepository",
|
||||
"description": "Triggers when a new repository is created",
|
||||
"substeps": [
|
||||
{
|
||||
"key": "chooseConnection",
|
||||
"name": "Choose connection"
|
||||
},
|
||||
{
|
||||
"key": "testStep",
|
||||
"name": "Test trigger"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "New organization",
|
||||
"key": "newOrganization",
|
||||
"description": "Triggers when a new organization is created",
|
||||
"substeps": [
|
||||
{
|
||||
"key": "chooseConnection",
|
||||
"name": "Choose connection"
|
||||
},
|
||||
{
|
||||
"key": "testStep",
|
||||
"name": "Test trigger"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "New branch",
|
||||
"key": "newBranch",
|
||||
"description": "Triggers when a new branch is created",
|
||||
"substeps": [
|
||||
{
|
||||
"key": "chooseConnection",
|
||||
"name": "Choose connection"
|
||||
},
|
||||
{
|
||||
"key": "chooseTrigger",
|
||||
"name": "Set up a trigger",
|
||||
"arguments": [
|
||||
{
|
||||
"label": "Repo",
|
||||
"key": "repo",
|
||||
"type": "dropdown",
|
||||
"required": true,
|
||||
"variables": false,
|
||||
"source": {
|
||||
"type": "query",
|
||||
"name": "getData",
|
||||
"arguments": [
|
||||
{
|
||||
"name": "key",
|
||||
"value": "listRepos"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "testStep",
|
||||
"name": "Test trigger"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "New notification",
|
||||
"key": "newNotification",
|
||||
"description": "Triggers when a new notification is created",
|
||||
"substeps": [
|
||||
{
|
||||
"key": "chooseConnection",
|
||||
"name": "Choose connection"
|
||||
},
|
||||
{
|
||||
"key": "chooseTrigger",
|
||||
"name": "Set up a trigger",
|
||||
"arguments": [
|
||||
{
|
||||
"label": "Repo",
|
||||
"key": "repo",
|
||||
"type": "dropdown",
|
||||
"required": false,
|
||||
"variables": false,
|
||||
"description": "If blank, we will retrieve all notifications.",
|
||||
"source": {
|
||||
"type": "query",
|
||||
"name": "getData",
|
||||
"arguments": [
|
||||
{
|
||||
"name": "key",
|
||||
"value": "listRepos"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "testStep",
|
||||
"name": "Test trigger"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "New pull request",
|
||||
"key": "newPullRequest",
|
||||
"description": "Triggers when a new pull request is created",
|
||||
"substeps": [
|
||||
{
|
||||
"key": "chooseConnection",
|
||||
"name": "Choose connection"
|
||||
},
|
||||
{
|
||||
"key": "chooseTrigger",
|
||||
"name": "Set up a trigger",
|
||||
"arguments": [
|
||||
{
|
||||
"label": "Repo",
|
||||
"key": "repo",
|
||||
"type": "dropdown",
|
||||
"required": true,
|
||||
"variables": false,
|
||||
"source": {
|
||||
"type": "query",
|
||||
"name": "getData",
|
||||
"arguments": [
|
||||
{
|
||||
"name": "key",
|
||||
"value": "listRepos"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "testStep",
|
||||
"name": "Test trigger"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "New watcher",
|
||||
"key": "newWatcher",
|
||||
"description": "Triggers when a new watcher is added to a repo",
|
||||
"substeps": [
|
||||
{
|
||||
"key": "chooseConnection",
|
||||
"name": "Choose connection"
|
||||
},
|
||||
{
|
||||
"key": "chooseTrigger",
|
||||
"name": "Set up a trigger",
|
||||
"arguments": [
|
||||
{
|
||||
"label": "Repo",
|
||||
"key": "repo",
|
||||
"type": "dropdown",
|
||||
"required": true,
|
||||
"variables": false,
|
||||
"source": {
|
||||
"type": "query",
|
||||
"name": "getData",
|
||||
"arguments": [
|
||||
{
|
||||
"name": "key",
|
||||
"value": "listRepos"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "testStep",
|
||||
"name": "Test trigger"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "New milestone",
|
||||
"key": "newMilestone",
|
||||
"description": "Triggers when a new milestone is created",
|
||||
"substeps": [
|
||||
{
|
||||
"key": "chooseConnection",
|
||||
"name": "Choose connection"
|
||||
},
|
||||
{
|
||||
"key": "chooseTrigger",
|
||||
"name": "Set up a trigger",
|
||||
"arguments": [
|
||||
{
|
||||
"label": "Repo",
|
||||
"key": "repo",
|
||||
"type": "dropdown",
|
||||
"required": true,
|
||||
"variables": false,
|
||||
"source": {
|
||||
"type": "query",
|
||||
"name": "getData",
|
||||
"arguments": [
|
||||
{
|
||||
"name": "key",
|
||||
"value": "listRepos"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "testStep",
|
||||
"name": "Test trigger"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "New commit comment",
|
||||
"key": "newCommitComment",
|
||||
"description": "Triggers when a new commit comment is created",
|
||||
"substeps": [
|
||||
{
|
||||
"key": "chooseConnection",
|
||||
"name": "Choose connection"
|
||||
},
|
||||
{
|
||||
"key": "chooseTrigger",
|
||||
"name": "Set up a trigger",
|
||||
"arguments": [
|
||||
{
|
||||
"label": "Repo",
|
||||
"key": "repo",
|
||||
"type": "dropdown",
|
||||
"required": true,
|
||||
"variables": false,
|
||||
"source": {
|
||||
"type": "query",
|
||||
"name": "getData",
|
||||
"arguments": [
|
||||
{
|
||||
"name": "key",
|
||||
"value": "listRepos"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "testStep",
|
||||
"name": "Test trigger"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "New label",
|
||||
"key": "newLabel",
|
||||
"description": "Triggers when a new label is created",
|
||||
"substeps": [
|
||||
{
|
||||
"key": "chooseConnection",
|
||||
"name": "Choose connection"
|
||||
},
|
||||
{
|
||||
"key": "chooseTrigger",
|
||||
"name": "Set up a trigger",
|
||||
"arguments": [
|
||||
{
|
||||
"label": "Repo",
|
||||
"key": "repo",
|
||||
"type": "dropdown",
|
||||
"required": true,
|
||||
"variables": false,
|
||||
"source": {
|
||||
"type": "query",
|
||||
"name": "getData",
|
||||
"arguments": [
|
||||
{
|
||||
"name": "key",
|
||||
"value": "listRepos"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "testStep",
|
||||
"name": "Test trigger"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "New collaborator",
|
||||
"key": "newCollaborator",
|
||||
"description": "Triggers when a new collaborator is added to a repo",
|
||||
"substeps": [
|
||||
{
|
||||
"key": "chooseConnection",
|
||||
"name": "Choose connection"
|
||||
},
|
||||
{
|
||||
"key": "chooseTrigger",
|
||||
"name": "Set up a trigger",
|
||||
"arguments": [
|
||||
{
|
||||
"label": "Repo",
|
||||
"key": "repo",
|
||||
"type": "dropdown",
|
||||
"required": true,
|
||||
"variables": false,
|
||||
"source": {
|
||||
"type": "query",
|
||||
"name": "getData",
|
||||
"arguments": [
|
||||
{
|
||||
"name": "key",
|
||||
"value": "listRepos"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "testStep",
|
||||
"name": "Test trigger"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "New release",
|
||||
"key": "newRelease",
|
||||
"description": "Triggers when a new release is created",
|
||||
"substeps": [
|
||||
{
|
||||
"key": "chooseConnection",
|
||||
"name": "Choose connection"
|
||||
},
|
||||
{
|
||||
"key": "chooseTrigger",
|
||||
"name": "Set up a trigger",
|
||||
"arguments": [
|
||||
{
|
||||
"label": "Repo",
|
||||
"key": "repo",
|
||||
"type": "dropdown",
|
||||
"required": true,
|
||||
"variables": false,
|
||||
"source": {
|
||||
"type": "query",
|
||||
"name": "getData",
|
||||
"arguments": [
|
||||
{
|
||||
"name": "key",
|
||||
"value": "listRepos"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "testStep",
|
||||
"name": "Test trigger"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "New commit",
|
||||
"key": "newCommit",
|
||||
"description": "Triggers when a new commit is created",
|
||||
"substeps": [
|
||||
{
|
||||
"key": "chooseConnection",
|
||||
"name": "Choose connection"
|
||||
},
|
||||
{
|
||||
"key": "chooseTrigger",
|
||||
"name": "Set up a trigger",
|
||||
"arguments": [
|
||||
{
|
||||
"label": "Repo",
|
||||
"key": "repo",
|
||||
"type": "dropdown",
|
||||
"required": true,
|
||||
"variables": false,
|
||||
"source": {
|
||||
"type": "query",
|
||||
"name": "getData",
|
||||
"arguments": [
|
||||
{
|
||||
"name": "key",
|
||||
"value": "listRepos"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "Head",
|
||||
"key": "head",
|
||||
"type": "dropdown",
|
||||
"description": "Branch to pull commits from. If unspecified, will use the repository's default branch (usually main or develop).",
|
||||
"required": false,
|
||||
"variables": false,
|
||||
"dependsOn": ["parameters.repo"],
|
||||
"source": {
|
||||
"type": "query",
|
||||
"name": "getData",
|
||||
"arguments": [
|
||||
{
|
||||
"name": "key",
|
||||
"value": "listBranches"
|
||||
},
|
||||
{
|
||||
"name": "parameters.repo",
|
||||
"value": "{parameters.repo}"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "testStep",
|
||||
"name": "Test trigger"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "New issue",
|
||||
"key": "newIssue",
|
||||
"description": "Triggers when a new issue is created",
|
||||
"substeps": [
|
||||
{
|
||||
"key": "chooseConnection",
|
||||
"name": "Choose connection"
|
||||
},
|
||||
{
|
||||
"key": "chooseTrigger",
|
||||
"name": "Set up a trigger",
|
||||
"arguments": [
|
||||
{
|
||||
"label": "Repo",
|
||||
"key": "repo",
|
||||
"type": "dropdown",
|
||||
"required": false,
|
||||
"variables": false,
|
||||
"source": {
|
||||
"type": "query",
|
||||
"name": "getData",
|
||||
"arguments": [
|
||||
{
|
||||
"name": "key",
|
||||
"value": "listRepos"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "Which types of issues should this trigger on?",
|
||||
"key": "issueType",
|
||||
"type": "dropdown",
|
||||
"description": "Defaults to any issue you can see.",
|
||||
"required": true,
|
||||
"variables": false,
|
||||
"value": "all",
|
||||
"options": [
|
||||
{
|
||||
"label": "Any issue you can see",
|
||||
"value": "all"
|
||||
},
|
||||
{
|
||||
"label": "Only issues assigned to you",
|
||||
"value": "assigned"
|
||||
},
|
||||
{
|
||||
"label": "Only issues created by you",
|
||||
"value": "created"
|
||||
},
|
||||
{
|
||||
"label": "Only issues you're mentioned in",
|
||||
"value": "mentioned"
|
||||
},
|
||||
{
|
||||
"label": "Only issues you're subscribed to",
|
||||
"value": "subscribed"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "Label",
|
||||
"key": "label",
|
||||
"type": "dropdown",
|
||||
"description": "Only trigger on issues when this label is added.",
|
||||
"required": false,
|
||||
"variables": false,
|
||||
"dependsOn": ["parameters.repo"],
|
||||
"source": {
|
||||
"type": "query",
|
||||
"name": "getData",
|
||||
"arguments": [
|
||||
{
|
||||
"name": "key",
|
||||
"value": "listLabels"
|
||||
},
|
||||
{
|
||||
"name": "parameters.repo",
|
||||
"value": "{parameters.repo}"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "testStep",
|
||||
"name": "Test trigger"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
46
packages/backend/src/apps/github/triggers.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
import { IJSONObject } from '@automatisch/types';
|
||||
import NewRepository from './triggers/new-repository';
|
||||
import NewOrganization from './triggers/new-organization';
|
||||
import NewBranch from './triggers/new-branch';
|
||||
import NewNotification from './triggers/new-notification';
|
||||
import NewPullRequest from './triggers/new-pull-request';
|
||||
import NewWatcher from './triggers/new-watcher';
|
||||
import NewMilestone from './triggers/new-milestone';
|
||||
import NewCommit from './triggers/new-commit';
|
||||
import NewCommitComment from './triggers/new-commit-comment';
|
||||
import NewLabel from './triggers/new-label';
|
||||
import NewCollaborator from './triggers/new-collaborator';
|
||||
import NewRelease from './triggers/new-release';
|
||||
import NewIssue from './triggers/new-issue';
|
||||
|
||||
export default class Triggers {
|
||||
newRepository: NewRepository;
|
||||
newOrganization: NewOrganization;
|
||||
newBranch: NewBranch;
|
||||
newNotification: NewNotification;
|
||||
newPullRequest: NewPullRequest;
|
||||
newWatcher: NewWatcher;
|
||||
newMilestone: NewMilestone;
|
||||
newCommit: NewCommit;
|
||||
newCommitComment: NewCommitComment;
|
||||
newLabel: NewLabel;
|
||||
newCollaborator: NewCollaborator;
|
||||
newRelease: NewRelease;
|
||||
newIssue: NewIssue;
|
||||
|
||||
constructor(connectionData: IJSONObject, parameters: IJSONObject) {
|
||||
this.newRepository = new NewRepository(connectionData);
|
||||
this.newOrganization = new NewOrganization(connectionData);
|
||||
this.newBranch = new NewBranch(connectionData, parameters);
|
||||
this.newNotification = new NewNotification(connectionData, parameters);
|
||||
this.newPullRequest = new NewPullRequest(connectionData, parameters);
|
||||
this.newWatcher = new NewWatcher(connectionData, parameters);
|
||||
this.newMilestone = new NewMilestone(connectionData, parameters);
|
||||
this.newCommit = new NewCommit(connectionData, parameters);
|
||||
this.newCommitComment = new NewCommitComment(connectionData, parameters);
|
||||
this.newLabel = new NewLabel(connectionData, parameters);
|
||||
this.newCollaborator = new NewCollaborator(connectionData, parameters);
|
||||
this.newRelease = new NewRelease(connectionData, parameters);
|
||||
this.newIssue = new NewIssue(connectionData, parameters);
|
||||
}
|
||||
}
|
42
packages/backend/src/apps/github/triggers/new-branch.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
import { Octokit } from 'octokit';
|
||||
import { IJSONObject } from '@automatisch/types';
|
||||
|
||||
import { assignOwnerAndRepo } from '../utils';
|
||||
|
||||
export default class NewBranch {
|
||||
client?: Octokit;
|
||||
repoOwner?: string;
|
||||
repo?: string;
|
||||
|
||||
constructor(connectionData: IJSONObject, parameters: IJSONObject) {
|
||||
if (connectionData.accessToken) {
|
||||
this.client = new Octokit({
|
||||
auth: connectionData.accessToken as string,
|
||||
});
|
||||
}
|
||||
|
||||
assignOwnerAndRepo(this, parameters?.repo as string);
|
||||
}
|
||||
|
||||
get options() {
|
||||
return {
|
||||
owner: this.repoOwner,
|
||||
repo: this.repo,
|
||||
};
|
||||
}
|
||||
|
||||
async run() {
|
||||
// TODO: implement pagination on undated entires
|
||||
return await this.client.paginate(this.client.rest.repos.listBranches, this.options);
|
||||
}
|
||||
|
||||
async testRun() {
|
||||
const options = {
|
||||
...this.options,
|
||||
per_page: 1,
|
||||
};
|
||||
const { data: branches } = await this.client.rest.repos.listBranches(options);
|
||||
|
||||
return branches;
|
||||
}
|
||||
}
|
@@ -0,0 +1,44 @@
|
||||
import { Octokit } from 'octokit';
|
||||
import { IJSONObject } from '@automatisch/types';
|
||||
|
||||
import { assignOwnerAndRepo } from '../utils';
|
||||
|
||||
export default class NewCollaborator {
|
||||
client?: Octokit;
|
||||
repoOwner?: string;
|
||||
repo?: string;
|
||||
|
||||
constructor(connectionData: IJSONObject, parameters: IJSONObject) {
|
||||
if (connectionData.accessToken) {
|
||||
this.client = new Octokit({
|
||||
auth: connectionData.accessToken as string,
|
||||
});
|
||||
}
|
||||
|
||||
assignOwnerAndRepo(this, parameters?.repo as string);
|
||||
}
|
||||
|
||||
get options() {
|
||||
return {
|
||||
owner: this.repoOwner,
|
||||
repo: this.repo,
|
||||
};
|
||||
}
|
||||
|
||||
async run() {
|
||||
// TODO: implement pagination on undated entries
|
||||
return await this.client.paginate(
|
||||
this.client.rest.repos.listCollaborators,
|
||||
this.options
|
||||
);
|
||||
}
|
||||
|
||||
async testRun() {
|
||||
const options = {
|
||||
...this.options,
|
||||
per_page: 1,
|
||||
};
|
||||
|
||||
return (await this.client.rest.repos.listCollaborators(options)).data;
|
||||
}
|
||||
}
|
@@ -0,0 +1,59 @@
|
||||
import { Octokit } from 'octokit';
|
||||
import { DateTime } from 'luxon';
|
||||
import { IJSONObject } from '@automatisch/types';
|
||||
|
||||
import { assignOwnerAndRepo } from '../utils';
|
||||
|
||||
export default class NewCommitComment {
|
||||
client?: Octokit;
|
||||
repoOwner?: string;
|
||||
repo?: string;
|
||||
|
||||
constructor(connectionData: IJSONObject, parameters: IJSONObject) {
|
||||
if (connectionData.accessToken) {
|
||||
this.client = new Octokit({
|
||||
auth: connectionData.accessToken as string,
|
||||
});
|
||||
}
|
||||
|
||||
assignOwnerAndRepo(this, parameters?.repo as string);
|
||||
}
|
||||
|
||||
get options() {
|
||||
return {
|
||||
owner: this.repoOwner,
|
||||
repo: this.repo,
|
||||
};
|
||||
}
|
||||
|
||||
async run(startTime: Date) {
|
||||
const iterator = await this.client.paginate.iterator(this.client.rest.repos.listCommitCommentsForRepo, this.options);
|
||||
const newCommitComments = [];
|
||||
|
||||
const startTimeDateObject = DateTime.fromJSDate(startTime);
|
||||
|
||||
commitCommentIterator:
|
||||
for await (const { data: commitComments } of iterator) {
|
||||
for (const commitComment of commitComments) {
|
||||
const createdAtDateObject = DateTime.fromISO(commitComment.created_at);
|
||||
|
||||
if (createdAtDateObject < startTimeDateObject) {
|
||||
break commitCommentIterator;
|
||||
}
|
||||
|
||||
newCommitComments.push(commitComment);
|
||||
}
|
||||
}
|
||||
|
||||
return newCommitComments;
|
||||
}
|
||||
|
||||
async testRun() {
|
||||
const options = {
|
||||
...this.options,
|
||||
per_page: 1,
|
||||
};
|
||||
|
||||
return (await this.client.rest.repos.listCommitCommentsForRepo(options)).data;
|
||||
}
|
||||
}
|
59
packages/backend/src/apps/github/triggers/new-commit.ts
Normal file
@@ -0,0 +1,59 @@
|
||||
import { Octokit } from 'octokit';
|
||||
import { DateTime } from 'luxon';
|
||||
import { IJSONObject } from '@automatisch/types';
|
||||
|
||||
import { assignOwnerAndRepo } from '../utils';
|
||||
|
||||
export default class NewCommit {
|
||||
client?: Octokit;
|
||||
repoOwner?: string;
|
||||
repo?: string;
|
||||
head?: string;
|
||||
|
||||
constructor(connectionData: IJSONObject, parameters: IJSONObject) {
|
||||
if (connectionData.accessToken) {
|
||||
this.client = new Octokit({
|
||||
auth: connectionData.accessToken as string,
|
||||
});
|
||||
}
|
||||
|
||||
if (parameters?.head) {
|
||||
this.head = parameters.head as string;
|
||||
}
|
||||
|
||||
assignOwnerAndRepo(this, parameters?.repo as string);
|
||||
}
|
||||
|
||||
get options() {
|
||||
const options = {
|
||||
owner: this.repoOwner,
|
||||
repo: this.repo,
|
||||
};
|
||||
|
||||
if (this.head) {
|
||||
return {
|
||||
...options,
|
||||
sha: this.head,
|
||||
};
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
async run(startTime: Date) {
|
||||
const options = {
|
||||
...this.options,
|
||||
since: DateTime.fromJSDate(startTime).toISO(),
|
||||
};
|
||||
return await this.client.paginate(this.client.rest.repos.listCommits, options);
|
||||
}
|
||||
|
||||
async testRun() {
|
||||
const options = {
|
||||
...this.options,
|
||||
per_page: 1,
|
||||
};
|
||||
|
||||
return (await this.client.rest.repos.listCommits(options)).data;
|
||||
}
|
||||
}
|
88
packages/backend/src/apps/github/triggers/new-issue.ts
Normal file
@@ -0,0 +1,88 @@
|
||||
import { Octokit } from 'octokit';
|
||||
import { DateTime } from 'luxon';
|
||||
import { IJSONObject } from '@automatisch/types';
|
||||
|
||||
import { assignOwnerAndRepo } from '../utils';
|
||||
|
||||
export default class NewIssue {
|
||||
client?: Octokit;
|
||||
connectionData?: IJSONObject;
|
||||
repoOwner?: string;
|
||||
repo?: string;
|
||||
hasRepo?: boolean;
|
||||
label?: string;
|
||||
issueType?: string;
|
||||
|
||||
constructor(connectionData: IJSONObject, parameters: IJSONObject) {
|
||||
if (connectionData.accessToken) {
|
||||
this.client = new Octokit({
|
||||
auth: connectionData.accessToken as string,
|
||||
});
|
||||
}
|
||||
|
||||
assignOwnerAndRepo(this, parameters?.repo as string);
|
||||
}
|
||||
|
||||
get options() {
|
||||
return {
|
||||
labels: this.label,
|
||||
}
|
||||
}
|
||||
|
||||
async listRepoIssues(options = {}, paginate = false) {
|
||||
const listRepoIssues = this.client.rest.issues.listForRepo;
|
||||
|
||||
const extendedOptions = {
|
||||
...this.options,
|
||||
repo: this.repo,
|
||||
owner: this.repoOwner,
|
||||
filter: this.issueType,
|
||||
...options,
|
||||
};
|
||||
|
||||
if (paginate) {
|
||||
return await this.client.paginate(listRepoIssues, extendedOptions);
|
||||
}
|
||||
|
||||
return (await listRepoIssues(extendedOptions)).data;
|
||||
}
|
||||
|
||||
async listIssues(options = {}, paginate = false) {
|
||||
const listIssues = this.client.rest.issues.listForAuthenticatedUser;
|
||||
|
||||
const extendedOptions = {
|
||||
...this.options,
|
||||
...options,
|
||||
};
|
||||
|
||||
if (paginate) {
|
||||
return await this.client.paginate(listIssues, extendedOptions);
|
||||
}
|
||||
|
||||
return (await listIssues(extendedOptions)).data;
|
||||
}
|
||||
|
||||
async run(startTime: Date) {
|
||||
const options = {
|
||||
since: DateTime.fromJSDate(startTime).toISO(),
|
||||
};
|
||||
|
||||
if (this.hasRepo) {
|
||||
return await this.listRepoIssues(options, true);
|
||||
}
|
||||
|
||||
return await this.listIssues(options, true);
|
||||
}
|
||||
|
||||
async testRun() {
|
||||
const options = {
|
||||
per_page: 1,
|
||||
};
|
||||
|
||||
if (this.hasRepo) {
|
||||
return await this.listRepoIssues(options, false);
|
||||
}
|
||||
|
||||
return await this.listIssues(options, false);
|
||||
}
|
||||
}
|
44
packages/backend/src/apps/github/triggers/new-label.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
import { Octokit } from 'octokit';
|
||||
import { IJSONObject } from '@automatisch/types';
|
||||
|
||||
import { assignOwnerAndRepo } from '../utils';
|
||||
|
||||
export default class NewLabel {
|
||||
client?: Octokit;
|
||||
repoOwner?: string;
|
||||
repo?: string;
|
||||
|
||||
constructor(connectionData: IJSONObject, parameters: IJSONObject) {
|
||||
if (connectionData.accessToken) {
|
||||
this.client = new Octokit({
|
||||
auth: connectionData.accessToken as string,
|
||||
});
|
||||
}
|
||||
|
||||
assignOwnerAndRepo(this, parameters?.repo as string);
|
||||
}
|
||||
|
||||
get options() {
|
||||
return {
|
||||
owner: this.repoOwner,
|
||||
repo: this.repo,
|
||||
};
|
||||
}
|
||||
|
||||
async run() {
|
||||
// TODO: implement pagination on undated entires
|
||||
return await this.client.paginate(
|
||||
this.client.rest.issues.listLabelsForRepo,
|
||||
this.options
|
||||
);
|
||||
}
|
||||
|
||||
async testRun() {
|
||||
const options = {
|
||||
...this.options,
|
||||
per_page: 1,
|
||||
};
|
||||
|
||||
return (await this.client.rest.issues.listLabelsForRepo(options)).data;
|
||||
}
|
||||
}
|
60
packages/backend/src/apps/github/triggers/new-milestone.ts
Normal file
@@ -0,0 +1,60 @@
|
||||
import { Octokit } from 'octokit';
|
||||
import { DateTime } from 'luxon';
|
||||
import { IJSONObject } from '@automatisch/types';
|
||||
|
||||
import { assignOwnerAndRepo } from '../utils';
|
||||
|
||||
export default class NewMilestone {
|
||||
client?: Octokit;
|
||||
repoOwner?: string;
|
||||
repo?: string;
|
||||
|
||||
constructor(connectionData: IJSONObject, parameters: IJSONObject) {
|
||||
if (connectionData.accessToken) {
|
||||
this.client = new Octokit({
|
||||
auth: connectionData.accessToken as string,
|
||||
});
|
||||
}
|
||||
|
||||
assignOwnerAndRepo(this, parameters?.repo as string);
|
||||
}
|
||||
|
||||
get options() {
|
||||
return {
|
||||
owner: this.repoOwner,
|
||||
repo: this.repo,
|
||||
state: 'open' as const,
|
||||
};
|
||||
}
|
||||
|
||||
async run(startTime: Date) {
|
||||
const iterator = await this.client.paginate.iterator(this.client.rest.issues.listMilestones, this.options);
|
||||
const newMilestones = [];
|
||||
|
||||
const startTimeDateObject = DateTime.fromJSDate(startTime);
|
||||
|
||||
milestoneIterator:
|
||||
for await (const { data: milestones } of iterator) {
|
||||
for (const milestone of milestones) {
|
||||
const createdAtDateObject = DateTime.fromISO(milestone.created_at);
|
||||
|
||||
if (createdAtDateObject < startTimeDateObject) {
|
||||
break milestoneIterator;
|
||||
}
|
||||
|
||||
newMilestones.push(milestone);
|
||||
}
|
||||
}
|
||||
|
||||
return newMilestones;
|
||||
}
|
||||
|
||||
async testRun() {
|
||||
const options = {
|
||||
...this.options,
|
||||
per_page: 1,
|
||||
};
|
||||
|
||||
return (await this.client.rest.issues.listMilestones(options)).data;
|
||||
}
|
||||
}
|
@@ -0,0 +1,83 @@
|
||||
import { Octokit } from 'octokit';
|
||||
import { DateTime } from 'luxon';
|
||||
import { IJSONObject } from '@automatisch/types';
|
||||
|
||||
import { assignOwnerAndRepo } from '../utils';
|
||||
|
||||
export default class NewNotification {
|
||||
client?: Octokit;
|
||||
connectionData?: IJSONObject;
|
||||
repoOwner?: string;
|
||||
repo?: string;
|
||||
hasRepo?: boolean;
|
||||
baseOptions = {
|
||||
all: true,
|
||||
participating: false,
|
||||
};
|
||||
|
||||
constructor(connectionData: IJSONObject, parameters: IJSONObject) {
|
||||
if (connectionData.accessToken) {
|
||||
this.client = new Octokit({
|
||||
auth: connectionData.accessToken as string,
|
||||
});
|
||||
}
|
||||
|
||||
assignOwnerAndRepo(this, parameters?.repo as string);
|
||||
}
|
||||
|
||||
async listRepoNotifications(options = {}, paginate = false) {
|
||||
const listRepoNotifications = this.client.rest.activity.listRepoNotificationsForAuthenticatedUser;
|
||||
|
||||
const extendedOptions = {
|
||||
...this.baseOptions,
|
||||
repo: this.repo,
|
||||
owner: this.repoOwner,
|
||||
...options,
|
||||
};
|
||||
|
||||
if (paginate) {
|
||||
return await this.client.paginate(listRepoNotifications, extendedOptions);
|
||||
}
|
||||
|
||||
return (await listRepoNotifications(extendedOptions)).data;
|
||||
}
|
||||
|
||||
async listNotifications(options = {}, paginate = false) {
|
||||
const listNotifications = this.client.rest.activity.listNotificationsForAuthenticatedUser;
|
||||
|
||||
const extendedOptions = {
|
||||
...this.baseOptions,
|
||||
...options,
|
||||
};
|
||||
|
||||
if (paginate) {
|
||||
return await this.client.paginate(listNotifications, extendedOptions);
|
||||
}
|
||||
|
||||
return (await listNotifications(extendedOptions)).data;
|
||||
}
|
||||
|
||||
async run(startTime: Date) {
|
||||
const options = {
|
||||
since: DateTime.fromJSDate(startTime).toISO(),
|
||||
};
|
||||
|
||||
if (this.hasRepo) {
|
||||
return await this.listRepoNotifications(options, true);
|
||||
}
|
||||
|
||||
return await this.listNotifications(options, true);
|
||||
}
|
||||
|
||||
async testRun() {
|
||||
const options = {
|
||||
per_page: 1,
|
||||
};
|
||||
|
||||
if (this.hasRepo) {
|
||||
return await this.listRepoNotifications(options, false);
|
||||
}
|
||||
|
||||
return await this.listNotifications(options, false);
|
||||
}
|
||||
}
|
@@ -0,0 +1,32 @@
|
||||
import { Octokit } from 'octokit';
|
||||
import { IJSONObject } from '@automatisch/types';
|
||||
|
||||
export default class NewOrganization {
|
||||
client?: Octokit;
|
||||
baseOptions = {
|
||||
per_page: 100,
|
||||
};
|
||||
|
||||
constructor(connectionData: IJSONObject) {
|
||||
if (
|
||||
connectionData.consumerKey &&
|
||||
connectionData.consumerSecret &&
|
||||
connectionData.accessToken
|
||||
) {
|
||||
this.client = new Octokit({
|
||||
auth: connectionData.accessToken as string,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async run() {
|
||||
// TODO: implement pagination on undated entires
|
||||
return await this.client.paginate(this.client.rest.orgs.listForAuthenticatedUser);
|
||||
}
|
||||
|
||||
async testRun() {
|
||||
const { data: orgs } = await this.client.rest.orgs.listForAuthenticatedUser({ per_page: 1 });
|
||||
|
||||
return orgs;
|
||||
}
|
||||
}
|
@@ -0,0 +1,63 @@
|
||||
import { Octokit } from 'octokit';
|
||||
import { DateTime } from 'luxon';
|
||||
import { IJSONObject } from '@automatisch/types';
|
||||
|
||||
import { assignOwnerAndRepo } from '../utils';
|
||||
|
||||
export default class NewPullRequest {
|
||||
client?: Octokit;
|
||||
repoOwner?: string;
|
||||
repo?: string;
|
||||
|
||||
constructor(connectionData: IJSONObject, parameters: IJSONObject) {
|
||||
if (connectionData.accessToken) {
|
||||
this.client = new Octokit({
|
||||
auth: connectionData.accessToken as string,
|
||||
});
|
||||
}
|
||||
|
||||
assignOwnerAndRepo(this, parameters?.repo as string);
|
||||
}
|
||||
|
||||
get options() {
|
||||
return {
|
||||
owner: this.repoOwner,
|
||||
repo: this.repo,
|
||||
sort: 'created' as const,
|
||||
direction: 'desc' as const,
|
||||
};
|
||||
}
|
||||
|
||||
async run(startTime: Date) {
|
||||
const iterator = await this.client.paginate.iterator(
|
||||
this.client.rest.pulls.list,
|
||||
this.options
|
||||
);
|
||||
const newPullRequests = [];
|
||||
|
||||
const startTimeDateObject = DateTime.fromJSDate(startTime);
|
||||
|
||||
pullRequestIterator: for await (const { data: pullRequests } of iterator) {
|
||||
for (const pullRequest of pullRequests) {
|
||||
const createdAtDateObject = DateTime.fromISO(pullRequest.created_at);
|
||||
|
||||
if (createdAtDateObject < startTimeDateObject) {
|
||||
break pullRequestIterator;
|
||||
}
|
||||
|
||||
newPullRequests.push(pullRequest);
|
||||
}
|
||||
}
|
||||
|
||||
return newPullRequests;
|
||||
}
|
||||
|
||||
async testRun() {
|
||||
const options = {
|
||||
...this.options,
|
||||
per_page: 1,
|
||||
};
|
||||
|
||||
return (await this.client.rest.pulls.list(options)).data;
|
||||
}
|
||||
}
|
59
packages/backend/src/apps/github/triggers/new-release.ts
Normal file
@@ -0,0 +1,59 @@
|
||||
import { Octokit } from 'octokit';
|
||||
import { DateTime } from 'luxon';
|
||||
import { IJSONObject } from '@automatisch/types';
|
||||
|
||||
import { assignOwnerAndRepo } from '../utils';
|
||||
|
||||
export default class NewRelease {
|
||||
client?: Octokit;
|
||||
repoOwner?: string;
|
||||
repo?: string;
|
||||
|
||||
constructor(connectionData: IJSONObject, parameters: IJSONObject) {
|
||||
if (connectionData.accessToken) {
|
||||
this.client = new Octokit({
|
||||
auth: connectionData.accessToken as string,
|
||||
});
|
||||
}
|
||||
|
||||
assignOwnerAndRepo(this, parameters?.repo as string);
|
||||
}
|
||||
|
||||
get options() {
|
||||
return {
|
||||
owner: this.repoOwner,
|
||||
repo: this.repo,
|
||||
};
|
||||
}
|
||||
|
||||
async run(startTime: Date) {
|
||||
const iterator = await this.client.paginate.iterator(this.client.rest.repos.listReleases, this.options);
|
||||
const newReleases = [];
|
||||
|
||||
const startTimeDateObject = DateTime.fromJSDate(startTime);
|
||||
|
||||
releaseIterator:
|
||||
for await (const { data: releases } of iterator) {
|
||||
for (const release of releases) {
|
||||
const createdAtDateObject = DateTime.fromISO(release.created_at);
|
||||
|
||||
if (createdAtDateObject < startTimeDateObject) {
|
||||
break releaseIterator;
|
||||
}
|
||||
|
||||
newReleases.push(release);
|
||||
}
|
||||
}
|
||||
|
||||
return newReleases;
|
||||
}
|
||||
|
||||
async testRun() {
|
||||
const options = {
|
||||
...this.options,
|
||||
per_page: 1,
|
||||
};
|
||||
|
||||
return (await this.client.rest.repos.listReleases(options)).data;
|
||||
}
|
||||
}
|
32
packages/backend/src/apps/github/triggers/new-repository.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import { Octokit } from 'octokit';
|
||||
import { DateTime } from 'luxon';
|
||||
import { IJSONObject } from '@automatisch/types';
|
||||
|
||||
export default class NewRepository {
|
||||
client?: Octokit;
|
||||
connectionData?: IJSONObject;
|
||||
|
||||
constructor(connectionData: IJSONObject) {
|
||||
if (connectionData.accessToken) {
|
||||
this.client = new Octokit({
|
||||
auth: connectionData.accessToken as string,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async run(startTime: Date) {
|
||||
const options = {
|
||||
since: DateTime.fromJSDate(startTime).toISO(),
|
||||
};
|
||||
return await this.client.paginate(this.client.rest.repos.listForAuthenticatedUser, options);
|
||||
}
|
||||
|
||||
async testRun() {
|
||||
const options = {
|
||||
per_page: 1,
|
||||
};
|
||||
const { data: repos } = await this.client.rest.repos.listForAuthenticatedUser(options);
|
||||
|
||||
return repos;
|
||||
}
|
||||
}
|
45
packages/backend/src/apps/github/triggers/new-watcher.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
import { Octokit } from 'octokit';
|
||||
import { IJSONObject } from '@automatisch/types';
|
||||
|
||||
import { assignOwnerAndRepo } from '../utils';
|
||||
|
||||
export default class NewWatcher {
|
||||
client?: Octokit;
|
||||
repoOwner?: string;
|
||||
repo?: string;
|
||||
|
||||
constructor(connectionData: IJSONObject, parameters: IJSONObject) {
|
||||
if (connectionData.accessToken) {
|
||||
this.client = new Octokit({
|
||||
auth: connectionData.accessToken as string,
|
||||
});
|
||||
}
|
||||
|
||||
assignOwnerAndRepo(this, parameters?.repo as string);
|
||||
}
|
||||
|
||||
get options() {
|
||||
return {
|
||||
owner: this.repoOwner,
|
||||
repo: this.repo,
|
||||
};
|
||||
}
|
||||
|
||||
async run() {
|
||||
// TODO: implement pagination on undated entries
|
||||
return await this.client.paginate(
|
||||
this.client.rest.activity.listWatchersForRepo,
|
||||
this.options
|
||||
);
|
||||
}
|
||||
|
||||
async testRun() {
|
||||
return await this.run();
|
||||
const options = {
|
||||
...this.options,
|
||||
per_page: 1,
|
||||
};
|
||||
|
||||
return (await this.client.rest.activity.listWatchersForRepo(options)).data;
|
||||
}
|
||||
}
|
10
packages/backend/src/apps/github/utils.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
export function assignOwnerAndRepo<T extends { repoOwner?: string; repo?: string; hasRepo?: boolean; }>(object: T, repoFullName: string): T {
|
||||
if (object && repoFullName) {
|
||||
const [repoOwner, repo] = repoFullName.split('/');
|
||||
object.repoOwner = repoOwner;
|
||||
object.repo = repo;
|
||||
object.hasRepo = true;
|
||||
}
|
||||
|
||||
return object;
|
||||
}
|
12
packages/backend/src/apps/gitlab/assets/favicon.svg
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<svg width="256px" height="236px" viewBox="0 0 256 236" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" preserveAspectRatio="xMidYMid">
|
||||
<g>
|
||||
<path d="M128.07485,236.074667 L128.07485,236.074667 L175.17885,91.1043048 L80.9708495,91.1043048 L128.07485,236.074667 L128.07485,236.074667 Z" fill="#E24329"></path>
|
||||
<path d="M128.07485,236.074423 L80.9708495,91.104061 L14.9557638,91.104061 L128.07485,236.074423 L128.07485,236.074423 Z" fill="#FC6D26"></path>
|
||||
<path d="M14.9558857,91.1044267 L14.9558857,91.1044267 L0.641828571,135.159589 C-0.663771429,139.17757 0.766171429,143.57955 4.18438095,146.06275 L128.074971,236.074789 L14.9558857,91.1044267 L14.9558857,91.1044267 Z" fill="#FCA326"></path>
|
||||
<path d="M14.9558857,91.1045486 L80.9709714,91.1045486 L52.6000762,3.79026286 C51.1408762,-0.703146667 44.7847619,-0.701927619 43.3255619,3.79026286 L14.9558857,91.1045486 L14.9558857,91.1045486 Z" fill="#E24329"></path>
|
||||
<path d="M128.07485,236.074423 L175.17885,91.104061 L241.193935,91.104061 L128.07485,236.074423 L128.07485,236.074423 Z" fill="#FC6D26"></path>
|
||||
<path d="M241.193935,91.1044267 L241.193935,91.1044267 L255.507992,135.159589 C256.813592,139.17757 255.38365,143.57955 251.96544,146.06275 L128.07485,236.074789 L241.193935,91.1044267 L241.193935,91.1044267 Z" fill="#FCA326"></path>
|
||||
<path d="M241.193935,91.1045486 L175.17885,91.1045486 L203.549745,3.79026286 C205.008945,-0.703146667 211.365059,-0.701927619 212.824259,3.79026286 L241.193935,91.1045486 L241.193935,91.1045486 Z" fill="#E24329"></path>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 1.6 KiB |
101
packages/backend/src/apps/gitlab/authentication.ts
Normal file
@@ -0,0 +1,101 @@
|
||||
import { URLSearchParams } from 'url';
|
||||
import axios from 'axios';
|
||||
import crypto from 'crypto';
|
||||
import { Gitlab } from '@gitbeaker/node';
|
||||
import type {
|
||||
IAuthentication,
|
||||
IApp,
|
||||
IField,
|
||||
IJSONObject,
|
||||
} from '@automatisch/types';
|
||||
|
||||
export default class Authentication implements IAuthentication {
|
||||
appData: IApp;
|
||||
connectionData: IJSONObject;
|
||||
client: any;
|
||||
scopes = [
|
||||
'api',
|
||||
'profile',
|
||||
'email',
|
||||
];
|
||||
|
||||
constructor(appData: IApp, connectionData: IJSONObject) {
|
||||
this.connectionData = connectionData;
|
||||
this.appData = appData;
|
||||
|
||||
if (connectionData?.accessToken) {
|
||||
this.client = new Gitlab({
|
||||
host: this.host,
|
||||
oauthToken: connectionData?.accessToken as string,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
get host() {
|
||||
return `https://${this.connectionData.host}`;
|
||||
}
|
||||
|
||||
get oauthRedirectUrl() {
|
||||
return this.appData.fields.find(
|
||||
(field: IField) => field.key == 'oAuthRedirectUrl'
|
||||
).value;
|
||||
}
|
||||
|
||||
async createAuthData() {
|
||||
const state = crypto.randomUUID();
|
||||
|
||||
const searchParams = new URLSearchParams({
|
||||
client_id: this.connectionData.applicationId as string,
|
||||
redirect_uri: this.oauthRedirectUrl,
|
||||
response_type: 'code',
|
||||
scope: this.scopes.join(' '),
|
||||
state,
|
||||
});
|
||||
|
||||
const url = `${this.host}/oauth/authorize?${searchParams.toString()}`;
|
||||
|
||||
return { url };
|
||||
}
|
||||
|
||||
async verifyCredentials() {
|
||||
const params = new URLSearchParams({
|
||||
client_id: this.connectionData.applicationId as string,
|
||||
grant_type: 'authorization_code',
|
||||
redirect_uri: this.oauthRedirectUrl,
|
||||
code: this.connectionData.oauthVerifier as string,
|
||||
client_secret: this.connectionData.secret as string,
|
||||
});
|
||||
const { data } = await axios.post(`${this.host}/oauth/token`, params.toString());
|
||||
const accessToken = data.access_token;
|
||||
|
||||
const client = new Gitlab({
|
||||
host: this.host,
|
||||
oauthToken: accessToken,
|
||||
});
|
||||
|
||||
const user = await client.Users.current();
|
||||
|
||||
return {
|
||||
host: this.connectionData.host as string,
|
||||
applicationId: this.connectionData.applicationId as string,
|
||||
secret: this.connectionData.secret,
|
||||
accessToken: data.access_token,
|
||||
refreshToken: data.refresh_token,
|
||||
expiresIn: data.expires_in,
|
||||
tokenType: data.token_type,
|
||||
userId: user.id,
|
||||
screenName: user.name,
|
||||
username: user.username,
|
||||
};
|
||||
}
|
||||
|
||||
async isStillVerified() {
|
||||
try {
|
||||
await this.client.Users.current();
|
||||
|
||||
return true;
|
||||
} catch (err) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
0
packages/backend/src/apps/gitlab/index.d.ts
vendored
Normal file
15
packages/backend/src/apps/gitlab/index.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import Authentication from './authentication';
|
||||
import {
|
||||
IService,
|
||||
IAuthentication,
|
||||
IApp,
|
||||
IJSONObject,
|
||||
} from '@automatisch/types';
|
||||
|
||||
export default class Gitlab implements IService {
|
||||
authenticationClient: IAuthentication;
|
||||
|
||||
constructor(appData: IApp, connectionData: IJSONObject) {
|
||||
this.authenticationClient = new Authentication(appData, connectionData);
|
||||
}
|
||||
}
|
239
packages/backend/src/apps/gitlab/info.json
Normal file
@@ -0,0 +1,239 @@
|
||||
{
|
||||
"name": "GitLab",
|
||||
"key": "gitlab",
|
||||
"iconUrl": "{BASE_URL}/apps/gitlab/assets/favicon.svg",
|
||||
"docUrl": "https://automatisch.io/docs/gitlab",
|
||||
"primaryColor": "2DAAE1",
|
||||
"supportsConnections": true,
|
||||
"fields": [
|
||||
{
|
||||
"key": "oAuthRedirectUrl",
|
||||
"label": "OAuth Redirect URL",
|
||||
"type": "string",
|
||||
"required": true,
|
||||
"readOnly": true,
|
||||
"value": "{WEB_APP_URL}/app/gitlab/connections/add",
|
||||
"placeholder": null,
|
||||
"description": "When asked to input an OAuth callback or redirect URL in GitLab OAuth, enter the URL above.",
|
||||
"docUrl": "https://automatisch.io/docs/gitlab#oauth-redirect-url",
|
||||
"clickToCopy": true
|
||||
},
|
||||
{
|
||||
"key": "host",
|
||||
"label": "GitLab Host",
|
||||
"type": "string",
|
||||
"required": true,
|
||||
"readOnly": false,
|
||||
"value": "gitlab.com",
|
||||
"placeholder": null,
|
||||
"description": "Only required if you host your own instance of GitLab. If you access GitLab by going to https://www.example.com, enter www.example.com here.",
|
||||
"docUrl": "https://automatisch.io/docs/gitlab#host",
|
||||
"clickToCopy": false
|
||||
},
|
||||
{
|
||||
"key": "applicationId",
|
||||
"label": "Application ID",
|
||||
"type": "string",
|
||||
"required": true,
|
||||
"readOnly": false,
|
||||
"value": null,
|
||||
"placeholder": null,
|
||||
"description": null,
|
||||
"docUrl": "https://automatisch.io/docs/gitlab#application-id",
|
||||
"clickToCopy": false
|
||||
},
|
||||
{
|
||||
"key": "secret",
|
||||
"label": "Secret",
|
||||
"type": "string",
|
||||
"required": true,
|
||||
"readOnly": false,
|
||||
"value": null,
|
||||
"placeholder": null,
|
||||
"description": null,
|
||||
"docUrl": "https://automatisch.io/docs/gitlab#secret",
|
||||
"clickToCopy": false
|
||||
}
|
||||
],
|
||||
"authenticationSteps": [
|
||||
{
|
||||
"step": 1,
|
||||
"type": "mutation",
|
||||
"name": "createConnection",
|
||||
"arguments": [
|
||||
{
|
||||
"name": "key",
|
||||
"value": "{key}"
|
||||
},
|
||||
{
|
||||
"name": "formattedData",
|
||||
"value": null,
|
||||
"properties": [
|
||||
{
|
||||
"name": "host",
|
||||
"value": "{fields.host}"
|
||||
},
|
||||
{
|
||||
"name": "applicationId",
|
||||
"value": "{fields.applicationId}"
|
||||
},
|
||||
{
|
||||
"name": "secret",
|
||||
"value": "{fields.secret}"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"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": "host",
|
||||
"value": "{fields.host}"
|
||||
},
|
||||
{
|
||||
"name": "applicationId",
|
||||
"value": "{fields.applicationId}"
|
||||
},
|
||||
{
|
||||
"name": "secret",
|
||||
"value": "{fields.secret}"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"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}"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
10
packages/backend/src/apps/postgresql/assets/favicon.svg
Normal file
After Width: | Height: | Size: 13 KiB |
39
packages/backend/src/apps/postgresql/authentication.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import type { IAuthentication, IApp, IJSONObject } from '@automatisch/types';
|
||||
import { Client } from 'pg';
|
||||
|
||||
export default class Authentication implements IAuthentication {
|
||||
appData: IApp;
|
||||
connectionData: IJSONObject;
|
||||
client: Client;
|
||||
|
||||
constructor(appData: IApp, connectionData: IJSONObject) {
|
||||
this.client = new Client({
|
||||
host: connectionData.host as string,
|
||||
port: connectionData.port as number,
|
||||
database: connectionData.database as string,
|
||||
user: connectionData.username as string,
|
||||
password: connectionData.password as string,
|
||||
ssl: connectionData.ssl as boolean,
|
||||
});
|
||||
|
||||
this.connectionData = connectionData;
|
||||
this.appData = appData;
|
||||
}
|
||||
|
||||
async verifyCredentials() {
|
||||
await this.client.connect();
|
||||
|
||||
return {
|
||||
screenName: this.connectionData.database,
|
||||
};
|
||||
}
|
||||
|
||||
async isStillVerified() {
|
||||
try {
|
||||
await this.client.connect();
|
||||
return true;
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
0
packages/backend/src/apps/postgresql/index.d.ts
vendored
Normal file
15
packages/backend/src/apps/postgresql/index.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import Authentication from './authentication';
|
||||
import {
|
||||
IService,
|
||||
IAuthentication,
|
||||
IApp,
|
||||
IJSONObject,
|
||||
} from '@automatisch/types';
|
||||
|
||||
export default class PostgreSQL implements IService {
|
||||
authenticationClient: IAuthentication;
|
||||
|
||||
constructor(appData: IApp, connectionData: IJSONObject) {
|
||||
this.authenticationClient = new Authentication(appData, connectionData);
|
||||
}
|
||||
}
|
201
packages/backend/src/apps/postgresql/info.json
Normal file
@@ -0,0 +1,201 @@
|
||||
{
|
||||
"name": "PostgreSQL",
|
||||
"key": "postgresql",
|
||||
"iconUrl": "{BASE_URL}/apps/postgresql/assets/favicon.svg",
|
||||
"docUrl": "https://automatisch.io/docs/postgresql",
|
||||
"primaryColor": "2DAAE1",
|
||||
"supportsConnections": true,
|
||||
"fields": [
|
||||
{
|
||||
"key": "host",
|
||||
"label": "Host",
|
||||
"type": "string",
|
||||
"required": true,
|
||||
"readOnly": false,
|
||||
"value": null,
|
||||
"placeholder": null,
|
||||
"description": "The host information Automatisch will connect to.",
|
||||
"docUrl": "https://automatisch.io/docs/postgresql#host",
|
||||
"clickToCopy": false
|
||||
},
|
||||
{
|
||||
"key": "port",
|
||||
"label": "Port",
|
||||
"type": "integer",
|
||||
"required": true,
|
||||
"readOnly": false,
|
||||
"value": 5432,
|
||||
"placeholder": null,
|
||||
"description": null,
|
||||
"docUrl": "https://automatisch.io/docs/postgresql#port",
|
||||
"clickToCopy": false
|
||||
},
|
||||
{
|
||||
"key": "database",
|
||||
"label": "Database",
|
||||
"type": "string",
|
||||
"required": true,
|
||||
"readOnly": false,
|
||||
"value": null,
|
||||
"placeholder": null,
|
||||
"description": "The name of the database.",
|
||||
"docUrl": "https://automatisch.io/docs/postgresql#password",
|
||||
"clickToCopy": false
|
||||
},
|
||||
{
|
||||
"key": "username",
|
||||
"label": "Username",
|
||||
"type": "string",
|
||||
"required": true,
|
||||
"readOnly": false,
|
||||
"value": null,
|
||||
"placeholder": null,
|
||||
"description": null,
|
||||
"docUrl": "https://automatisch.io/docs/postgresql#username",
|
||||
"clickToCopy": false
|
||||
},
|
||||
{
|
||||
"key": "password",
|
||||
"label": "Password",
|
||||
"type": "string",
|
||||
"required": false,
|
||||
"readOnly": false,
|
||||
"value": null,
|
||||
"placeholder": null,
|
||||
"description": null,
|
||||
"docUrl": "https://automatisch.io/docs/postgresql#password",
|
||||
"clickToCopy": false
|
||||
},
|
||||
{
|
||||
"key": "ssl",
|
||||
"label": "Use SSL?",
|
||||
"type": "boolean",
|
||||
"required": true,
|
||||
"readOnly": false,
|
||||
"value": false,
|
||||
"placeholder": null,
|
||||
"description": null,
|
||||
"docUrl": "https://automatisch.io/docs/postgresql#ssl",
|
||||
"clickToCopy": false
|
||||
}
|
||||
],
|
||||
"authenticationSteps": [
|
||||
{
|
||||
"step": 1,
|
||||
"type": "mutation",
|
||||
"name": "createConnection",
|
||||
"arguments": [
|
||||
{
|
||||
"name": "key",
|
||||
"value": "{key}"
|
||||
},
|
||||
{
|
||||
"name": "formattedData",
|
||||
"value": null,
|
||||
"properties": [
|
||||
{
|
||||
"name": "host",
|
||||
"value": "{fields.host}"
|
||||
},
|
||||
{
|
||||
"name": "port",
|
||||
"value": "{fields.port}"
|
||||
},
|
||||
{
|
||||
"name": "database",
|
||||
"value": "{fields.database}"
|
||||
},
|
||||
{
|
||||
"name": "username",
|
||||
"value": "{fields.username}"
|
||||
},
|
||||
{
|
||||
"name": "password",
|
||||
"value": "{fields.password}"
|
||||
},
|
||||
{
|
||||
"name": "ssl",
|
||||
"value": "{fields.ssl}"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"step": 2,
|
||||
"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": "host",
|
||||
"value": "{fields.host}"
|
||||
},
|
||||
{
|
||||
"name": "port",
|
||||
"value": "{fields.port}"
|
||||
},
|
||||
{
|
||||
"name": "database",
|
||||
"value": "{fields.database}"
|
||||
},
|
||||
{
|
||||
"name": "username",
|
||||
"value": "{fields.username}"
|
||||
},
|
||||
{
|
||||
"name": "password",
|
||||
"value": "{fields.password}"
|
||||
},
|
||||
{
|
||||
"name": "ssl",
|
||||
"value": "{fields.ssl}"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"step": 3,
|
||||
"type": "mutation",
|
||||
"name": "verifyConnection",
|
||||
"arguments": [
|
||||
{
|
||||
"name": "id",
|
||||
"value": "{connection.id}"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
1
packages/backend/src/apps/scheduler/assets/favicon.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 24 24"><path fill="#1976d2" d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"></path><path fill="#1976d2" d="M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"></path></svg>
|
After Width: | Height: | Size: 345 B |
10
packages/backend/src/apps/scheduler/common/cron-times.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
const cronTimes = {
|
||||
everyHour: '0 * * * *',
|
||||
everyHourExcludingWeekends: '0 * * * 1-5',
|
||||
everyDayAt: (hour: number) => `0 ${hour} * * *`,
|
||||
everyDayExcludingWeekendsAt: (hour: number) => `0 ${hour} * * 1-5`,
|
||||
everyWeekOnAndAt: (weekday: number, hour: number) => `0 ${hour} * * ${weekday}`,
|
||||
everyMonthOnAndAt: (day: number, hour: number) => `0 ${hour} ${day} * *`,
|
||||
};
|
||||
|
||||
export default cronTimes;
|
@@ -0,0 +1,14 @@
|
||||
import { DateTime } from 'luxon';
|
||||
|
||||
export default function getDateTimeObjectRepresentation(dateTime: DateTime) {
|
||||
const defaults = dateTime.toObject();
|
||||
|
||||
return {
|
||||
...defaults,
|
||||
ISO_date_time: dateTime.toISO(),
|
||||
pretty_date: dateTime.toLocaleString(DateTime.DATE_MED),
|
||||
pretty_time: dateTime.toLocaleString(DateTime.TIME_WITH_SECONDS),
|
||||
pretty_day_of_week: dateTime.toFormat('cccc'),
|
||||
day_of_week: dateTime.weekday,
|
||||
};
|
||||
}
|
@@ -0,0 +1,10 @@
|
||||
import { DateTime } from 'luxon';
|
||||
import cronParser from 'cron-parser';
|
||||
|
||||
export default function getNextCronDateTime(cronString: string) {
|
||||
const cronDate = cronParser.parseExpression(cronString);
|
||||
const matchingNextCronDateTime = cronDate.next();
|
||||
const matchingNextDateTime = DateTime.fromJSDate(matchingNextCronDateTime.toDate());
|
||||
|
||||
return matchingNextDateTime;
|
||||
};
|
0
packages/backend/src/apps/scheduler/index.d.ts
vendored
Normal file
10
packages/backend/src/apps/scheduler/index.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
export default {
|
||||
name: "Scheduler",
|
||||
key: "scheduler",
|
||||
iconUrl: "{BASE_URL}/apps/scheduler/assets/favicon.svg",
|
||||
docUrl: "https://automatisch.io/docs/scheduler",
|
||||
authDocUrl: "https://automatisch.io/docs/connections/scheduler",
|
||||
primaryColor: "0059F7",
|
||||
supportsConnections: false,
|
||||
requiresAuthentication: false,
|
||||
};
|
170
packages/backend/src/apps/scheduler/triggers/every-day/index.ts
Normal file
@@ -0,0 +1,170 @@
|
||||
import { DateTime } from 'luxon';
|
||||
import { IGlobalVariable, IJSONValue } from '@automatisch/types';
|
||||
import cronTimes from '../../common/cron-times';
|
||||
import getNextCronDateTime from '../../common/get-next-cron-date-time';
|
||||
import getDateTimeObjectRepresentation from '../../common/get-date-time-object';
|
||||
|
||||
export default {
|
||||
name: 'Every day',
|
||||
key: 'everyDay',
|
||||
description: 'Triggers every day.',
|
||||
substeps: [
|
||||
{
|
||||
key: 'chooseTrigger',
|
||||
name: 'Set up a trigger',
|
||||
arguments: [
|
||||
{
|
||||
label: 'Trigger on weekends?',
|
||||
key: 'triggersOnWeekend',
|
||||
type: 'dropdown',
|
||||
description: 'Should this flow trigger on Saturday and Sunday?',
|
||||
required: true,
|
||||
value: true,
|
||||
variables: false,
|
||||
options: [
|
||||
{
|
||||
label: 'Yes',
|
||||
value: true
|
||||
},
|
||||
{
|
||||
label: 'No',
|
||||
value: false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: 'Time of day',
|
||||
key: 'hour',
|
||||
type: 'dropdown',
|
||||
required: true,
|
||||
value: null,
|
||||
variables: false,
|
||||
options: [
|
||||
{
|
||||
label: '00:00',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
label: '01:00',
|
||||
value: 1
|
||||
},
|
||||
{
|
||||
label: '02:00',
|
||||
value: 2
|
||||
},
|
||||
{
|
||||
label: '03:00',
|
||||
value: 3
|
||||
},
|
||||
{
|
||||
label: '04:00',
|
||||
value: 4
|
||||
},
|
||||
{
|
||||
label: '05:00',
|
||||
value: 5
|
||||
},
|
||||
{
|
||||
label: '06:00',
|
||||
value: 6
|
||||
},
|
||||
{
|
||||
label: '07:00',
|
||||
value: 7
|
||||
},
|
||||
{
|
||||
label: '08:00',
|
||||
value: 8
|
||||
},
|
||||
{
|
||||
label: '09:00',
|
||||
value: 9
|
||||
},
|
||||
{
|
||||
label: '10:00',
|
||||
value: 10
|
||||
},
|
||||
{
|
||||
label: '11:00',
|
||||
value: 11
|
||||
},
|
||||
{
|
||||
label: '12:00',
|
||||
value: 12
|
||||
},
|
||||
{
|
||||
label: '13:00',
|
||||
value: 13
|
||||
},
|
||||
{
|
||||
label: '14:00',
|
||||
value: 14
|
||||
},
|
||||
{
|
||||
label: '15:00',
|
||||
value: 15
|
||||
},
|
||||
{
|
||||
label: '16:00',
|
||||
value: 16
|
||||
},
|
||||
{
|
||||
label: '17:00',
|
||||
value: 17
|
||||
},
|
||||
{
|
||||
label: '18:00',
|
||||
value: 18
|
||||
},
|
||||
{
|
||||
label: '19:00',
|
||||
value: 19
|
||||
},
|
||||
{
|
||||
label: '20:00',
|
||||
value: 20
|
||||
},
|
||||
{
|
||||
label: '21:00',
|
||||
value: 21
|
||||
},
|
||||
{
|
||||
label: '22:00',
|
||||
value: 22
|
||||
},
|
||||
{
|
||||
label: '23:00',
|
||||
value: 23
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
key: 'testStep',
|
||||
name: 'Test trigger'
|
||||
}
|
||||
],
|
||||
|
||||
getInterval(parameters: IGlobalVariable["db"]["step"]["parameters"]) {
|
||||
if (parameters.triggersOnWeekend as boolean) {
|
||||
return cronTimes.everyDayAt(parameters.hour as number);
|
||||
}
|
||||
|
||||
return cronTimes.everyDayExcludingWeekendsAt(parameters.hour as number);
|
||||
},
|
||||
|
||||
async run($: IGlobalVariable, startDateTime: Date) {
|
||||
const dateTime = DateTime.fromJSDate(startDateTime);
|
||||
const dateTimeObjectRepresentation = getDateTimeObjectRepresentation(dateTime) as IJSONValue;
|
||||
|
||||
return { data: [dateTimeObjectRepresentation] };
|
||||
},
|
||||
|
||||
async testRun($: IGlobalVariable) {
|
||||
const nextCronDateTime = getNextCronDateTime(this.getInterval($.db.step.parameters));
|
||||
const dateTimeObjectRepresentation = getDateTimeObjectRepresentation(nextCronDateTime) as IJSONValue;
|
||||
|
||||
return { data: [dateTimeObjectRepresentation] };
|
||||
},
|
||||
};
|
@@ -0,0 +1,64 @@
|
||||
import { DateTime } from 'luxon';
|
||||
import { IGlobalVariable, IJSONValue } from '@automatisch/types';
|
||||
import cronTimes from '../../common/cron-times';
|
||||
import getNextCronDateTime from '../../common/get-next-cron-date-time';
|
||||
import getDateTimeObjectRepresentation from '../../common/get-date-time-object';
|
||||
|
||||
export default {
|
||||
name: 'Every hour',
|
||||
key: 'everyHour',
|
||||
description: 'Triggers every hour.',
|
||||
substeps: [
|
||||
{
|
||||
key: 'chooseTrigger',
|
||||
name: 'Set up a trigger',
|
||||
arguments: [
|
||||
{
|
||||
label: 'Trigger on weekends?',
|
||||
key: 'triggersOnWeekend',
|
||||
type: 'dropdown',
|
||||
description: 'Should this flow trigger on Saturday and Sunday?',
|
||||
required: true,
|
||||
value: true,
|
||||
variables: false,
|
||||
options: [
|
||||
{
|
||||
label: 'Yes',
|
||||
value: true
|
||||
},
|
||||
{
|
||||
label: 'No',
|
||||
value: false
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
key: 'testStep',
|
||||
name: 'Test trigger'
|
||||
}
|
||||
],
|
||||
|
||||
getInterval(parameters: IGlobalVariable["db"]["step"]["parameters"]) {
|
||||
if (parameters.triggersOnWeekend) {
|
||||
return cronTimes.everyHour
|
||||
}
|
||||
|
||||
return cronTimes.everyHourExcludingWeekends;
|
||||
},
|
||||
|
||||
async run($: IGlobalVariable, startDateTime: Date) {
|
||||
const dateTime = DateTime.fromJSDate(startDateTime);
|
||||
const dateTimeObjectRepresentation = getDateTimeObjectRepresentation(dateTime) as IJSONValue;
|
||||
|
||||
return { data: [dateTimeObjectRepresentation] };
|
||||
},
|
||||
|
||||
async testRun($: IGlobalVariable) {
|
||||
const nextCronDateTime = getNextCronDateTime(this.getInterval($.db.step.parameters));
|
||||
const dateTimeObjectRepresentation = getDateTimeObjectRepresentation(nextCronDateTime) as IJSONValue;
|
||||
|
||||
return { data: [dateTimeObjectRepresentation] };
|
||||
},
|
||||
};
|
@@ -0,0 +1,283 @@
|
||||
import { DateTime } from 'luxon';
|
||||
import { IGlobalVariable, IJSONValue } from '@automatisch/types';
|
||||
import cronTimes from '../../common/cron-times';
|
||||
import getNextCronDateTime from '../../common/get-next-cron-date-time';
|
||||
import getDateTimeObjectRepresentation from '../../common/get-date-time-object';
|
||||
|
||||
export default {
|
||||
name: 'Every month',
|
||||
key: 'everyMonth',
|
||||
description: 'Triggers every month.',
|
||||
substeps: [
|
||||
{
|
||||
key: 'chooseTrigger',
|
||||
name: 'Set up a trigger',
|
||||
arguments: [
|
||||
{
|
||||
label: 'Day of the month',
|
||||
key: 'day',
|
||||
type: 'dropdown',
|
||||
required: true,
|
||||
value: null,
|
||||
variables: false,
|
||||
options: [
|
||||
{
|
||||
label: 1,
|
||||
value: 1
|
||||
},
|
||||
{
|
||||
label: 2,
|
||||
value: 2
|
||||
},
|
||||
{
|
||||
label: 3,
|
||||
value: 3
|
||||
},
|
||||
{
|
||||
label: 4,
|
||||
value: 4
|
||||
},
|
||||
{
|
||||
label: 5,
|
||||
value: 5
|
||||
},
|
||||
{
|
||||
label: 6,
|
||||
value: 6
|
||||
},
|
||||
{
|
||||
label: 7,
|
||||
value: 7
|
||||
},
|
||||
{
|
||||
label: 8,
|
||||
value: 8
|
||||
},
|
||||
{
|
||||
label: 9,
|
||||
value: 9
|
||||
},
|
||||
{
|
||||
label: 10,
|
||||
value: 10
|
||||
},
|
||||
{
|
||||
label: 11,
|
||||
value: 11
|
||||
},
|
||||
{
|
||||
label: 12,
|
||||
value: 12
|
||||
},
|
||||
{
|
||||
label: 13,
|
||||
value: 13
|
||||
},
|
||||
{
|
||||
label: 14,
|
||||
value: 14
|
||||
},
|
||||
{
|
||||
label: 15,
|
||||
value: 15
|
||||
},
|
||||
{
|
||||
label: 16,
|
||||
value: 16
|
||||
},
|
||||
{
|
||||
label: 17,
|
||||
value: 17
|
||||
},
|
||||
{
|
||||
label: 18,
|
||||
value: 18
|
||||
},
|
||||
{
|
||||
label: 19,
|
||||
value: 19
|
||||
},
|
||||
{
|
||||
label: 20,
|
||||
value: 20
|
||||
},
|
||||
{
|
||||
label: 21,
|
||||
value: 21
|
||||
},
|
||||
{
|
||||
label: 22,
|
||||
value: 22
|
||||
},
|
||||
{
|
||||
label: 23,
|
||||
value: 23
|
||||
},
|
||||
{
|
||||
label: 24,
|
||||
value: 24
|
||||
},
|
||||
{
|
||||
label: 25,
|
||||
value: 25
|
||||
},
|
||||
{
|
||||
label: 26,
|
||||
value: 26
|
||||
},
|
||||
{
|
||||
label: 27,
|
||||
value: 27
|
||||
},
|
||||
{
|
||||
label: 28,
|
||||
value: 28
|
||||
},
|
||||
{
|
||||
label: 29,
|
||||
value: 29
|
||||
},
|
||||
{
|
||||
label: 30,
|
||||
value: 30
|
||||
},
|
||||
{
|
||||
label: 31,
|
||||
value: 31
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: 'Time of day',
|
||||
key: 'hour',
|
||||
type: 'dropdown',
|
||||
required: true,
|
||||
value: null,
|
||||
variables: false,
|
||||
options: [
|
||||
{
|
||||
label: '00:00',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
label: '01:00',
|
||||
value: 1
|
||||
},
|
||||
{
|
||||
label: '02:00',
|
||||
value: 2
|
||||
},
|
||||
{
|
||||
label: '03:00',
|
||||
value: 3
|
||||
},
|
||||
{
|
||||
label: '04:00',
|
||||
value: 4
|
||||
},
|
||||
{
|
||||
label: '05:00',
|
||||
value: 5
|
||||
},
|
||||
{
|
||||
label: '06:00',
|
||||
value: 6
|
||||
},
|
||||
{
|
||||
label: '07:00',
|
||||
value: 7
|
||||
},
|
||||
{
|
||||
label: '08:00',
|
||||
value: 8
|
||||
},
|
||||
{
|
||||
label: '09:00',
|
||||
value: 9
|
||||
},
|
||||
{
|
||||
label: '10:00',
|
||||
value: 10
|
||||
},
|
||||
{
|
||||
label: '11:00',
|
||||
value: 11
|
||||
},
|
||||
{
|
||||
label: '12:00',
|
||||
value: 12
|
||||
},
|
||||
{
|
||||
label: '13:00',
|
||||
value: 13
|
||||
},
|
||||
{
|
||||
label: '14:00',
|
||||
value: 14
|
||||
},
|
||||
{
|
||||
label: '15:00',
|
||||
value: 15
|
||||
},
|
||||
{
|
||||
label: '16:00',
|
||||
value: 16
|
||||
},
|
||||
{
|
||||
label: '17:00',
|
||||
value: 17
|
||||
},
|
||||
{
|
||||
label: '18:00',
|
||||
value: 18
|
||||
},
|
||||
{
|
||||
label: '19:00',
|
||||
value: 19
|
||||
},
|
||||
{
|
||||
label: '20:00',
|
||||
value: 20
|
||||
},
|
||||
{
|
||||
label: '21:00',
|
||||
value: 21
|
||||
},
|
||||
{
|
||||
label: '22:00',
|
||||
value: 22
|
||||
},
|
||||
{
|
||||
label: '23:00',
|
||||
value: 23
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
key: 'testStep',
|
||||
name: 'Test trigger'
|
||||
}
|
||||
],
|
||||
|
||||
getInterval(parameters: IGlobalVariable["db"]["step"]["parameters"]) {
|
||||
const interval = cronTimes.everyMonthOnAndAt(parameters.day as number, parameters.hour as number);
|
||||
|
||||
return interval;
|
||||
},
|
||||
|
||||
async run($: IGlobalVariable, startDateTime: Date) {
|
||||
const dateTime = DateTime.fromJSDate(startDateTime);
|
||||
const dateTimeObjectRepresentation = getDateTimeObjectRepresentation(dateTime) as IJSONValue;
|
||||
|
||||
return { data: [dateTimeObjectRepresentation] };
|
||||
},
|
||||
|
||||
async testRun($: IGlobalVariable) {
|
||||
const nextCronDateTime = getNextCronDateTime(this.getInterval($.db.step.parameters));
|
||||
const dateTimeObjectRepresentation = getDateTimeObjectRepresentation(nextCronDateTime) as IJSONValue;
|
||||
|
||||
return { data: [dateTimeObjectRepresentation] };
|
||||
},
|
||||
};
|
187
packages/backend/src/apps/scheduler/triggers/every-week/index.ts
Normal file
@@ -0,0 +1,187 @@
|
||||
import { DateTime } from 'luxon';
|
||||
import { IGlobalVariable, IJSONValue } from '@automatisch/types';
|
||||
import cronTimes from '../../common/cron-times';
|
||||
import getNextCronDateTime from '../../common/get-next-cron-date-time';
|
||||
import getDateTimeObjectRepresentation from '../../common/get-date-time-object';
|
||||
|
||||
export default {
|
||||
name: 'Every week',
|
||||
key: 'everyWeek',
|
||||
description: 'Triggers every week.',
|
||||
substeps: [
|
||||
{
|
||||
key: 'chooseTrigger',
|
||||
name: 'Set up a trigger',
|
||||
arguments: [
|
||||
{
|
||||
label: 'Day of the week',
|
||||
key: 'weekday',
|
||||
type: 'dropdown',
|
||||
required: true,
|
||||
value: null,
|
||||
variables: false,
|
||||
options: [
|
||||
{
|
||||
label: 'Monday',
|
||||
value: 1
|
||||
},
|
||||
{
|
||||
label: 'Tuesday',
|
||||
value: 2
|
||||
},
|
||||
{
|
||||
label: 'Wednesday',
|
||||
value: 3
|
||||
},
|
||||
{
|
||||
label: 'Thursday',
|
||||
value: 4
|
||||
},
|
||||
{
|
||||
label: 'Friday',
|
||||
value: 5
|
||||
},
|
||||
{
|
||||
label: 'Saturday',
|
||||
value: 6
|
||||
},
|
||||
{
|
||||
label: 'Sunday',
|
||||
value: 0
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: 'Time of day',
|
||||
key: 'hour',
|
||||
type: 'dropdown',
|
||||
required: true,
|
||||
value: null,
|
||||
variables: false,
|
||||
options: [
|
||||
{
|
||||
label: '00:00',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
label: '01:00',
|
||||
value: 1
|
||||
},
|
||||
{
|
||||
label: '02:00',
|
||||
value: 2
|
||||
},
|
||||
{
|
||||
label: '03:00',
|
||||
value: 3
|
||||
},
|
||||
{
|
||||
label: '04:00',
|
||||
value: 4
|
||||
},
|
||||
{
|
||||
label: '05:00',
|
||||
value: 5
|
||||
},
|
||||
{
|
||||
label: '06:00',
|
||||
value: 6
|
||||
},
|
||||
{
|
||||
label: '07:00',
|
||||
value: 7
|
||||
},
|
||||
{
|
||||
label: '08:00',
|
||||
value: 8
|
||||
},
|
||||
{
|
||||
label: '09:00',
|
||||
value: 9
|
||||
},
|
||||
{
|
||||
label: '10:00',
|
||||
value: 10
|
||||
},
|
||||
{
|
||||
label: '11:00',
|
||||
value: 11
|
||||
},
|
||||
{
|
||||
label: '12:00',
|
||||
value: 12
|
||||
},
|
||||
{
|
||||
label: '13:00',
|
||||
value: 13
|
||||
},
|
||||
{
|
||||
label: '14:00',
|
||||
value: 14
|
||||
},
|
||||
{
|
||||
label: '15:00',
|
||||
value: 15
|
||||
},
|
||||
{
|
||||
label: '16:00',
|
||||
value: 16
|
||||
},
|
||||
{
|
||||
label: '17:00',
|
||||
value: 17
|
||||
},
|
||||
{
|
||||
label: '18:00',
|
||||
value: 18
|
||||
},
|
||||
{
|
||||
label: '19:00',
|
||||
value: 19
|
||||
},
|
||||
{
|
||||
label: '20:00',
|
||||
value: 20
|
||||
},
|
||||
{
|
||||
label: '21:00',
|
||||
value: 21
|
||||
},
|
||||
{
|
||||
label: '22:00',
|
||||
value: 22
|
||||
},
|
||||
{
|
||||
label: '23:00',
|
||||
value: 23
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
key: 'testStep',
|
||||
name: 'Test trigger'
|
||||
}
|
||||
],
|
||||
|
||||
getInterval(parameters: IGlobalVariable["db"]["step"]["parameters"]) {
|
||||
const interval = cronTimes.everyWeekOnAndAt(parameters.weekday as number, parameters.hour as number);
|
||||
|
||||
return interval;
|
||||
},
|
||||
|
||||
async run($: IGlobalVariable, startDateTime: Date) {
|
||||
const dateTime = DateTime.fromJSDate(startDateTime);
|
||||
const dateTimeObjectRepresentation = getDateTimeObjectRepresentation(dateTime) as IJSONValue;
|
||||
|
||||
return { data: [dateTimeObjectRepresentation] };
|
||||
},
|
||||
|
||||
async testRun($: IGlobalVariable) {
|
||||
const nextCronDateTime = getNextCronDateTime(this.getInterval($.db.step.parameters));
|
||||
const dateTimeObjectRepresentation = getDateTimeObjectRepresentation(nextCronDateTime) as IJSONValue;
|
||||
|
||||
return { data: [dateTimeObjectRepresentation] };
|
||||
},
|
||||
};
|