Compare commits

...

348 Commits

Author SHA1 Message Date
Ali BARIN
69ae448d64 feat: new find project merge requests action in GitLab 2022-05-07 20:47:37 +02:00
Ömer Faruk Aydın
54152a3564 Merge pull request #323 from automatisch/new-every-week-trigger
feat: add every week trigger in schedule integration
2022-05-07 19:03:27 +02:00
Ömer Faruk Aydın
ed6493509b Merge pull request #322 from automatisch/new-every-day-trigger
feat: add every day trigger in schedule integration
2022-05-07 19:02:09 +02:00
Ömer Faruk Aydın
bc94e0f849 Merge pull request #324 from automatisch/new-every-month-trigger
feat: add every month trigger in schedule integration
2022-05-07 19:01:18 +02:00
Ömer Faruk Aydın
98f107f480 Merge pull request #321 from automatisch/schedule-app
feat: add schedule integration
2022-05-07 18:47:38 +02:00
Ali BARIN
8386c9f2e4 feat: add every month trigger in schedule integration 2022-05-07 17:11:26 +02:00
Ali BARIN
d065d119c4 feat: add every week trigger in schedule integration 2022-05-07 15:18:32 +02:00
Ali BARIN
8117089f34 feat: add every day trigger in schedule integration 2022-05-07 14:04:25 +02:00
Ali BARIN
d864831bc5 feat: add schedule integration 2022-05-07 11:17:45 +02:00
Ömer Faruk Aydın
c4c3779646 Merge pull request #320 from automatisch/feature/telemetry-separate-web-app-info
feat: Send whether serving web separately or not to telemetry
2022-05-05 16:00:14 +02:00
Faruk AYDIN
6cda49b747 feat: Send whether serving web separately or not to telemetry 2022-05-05 15:47:26 +02:00
Ömer Faruk Aydın
069ee526a8 Merge pull request #318 from automatisch/feature/telemetry-diagnostic-info
feat: Implement telemetry for diagnostic info
2022-05-05 10:51:17 +02:00
Ömer Faruk Aydın
99440d48cc Merge pull request #317 from automatisch/feature/telemetry-connection
feat: Implement telemetry for connection creation and updates
2022-05-05 10:50:59 +02:00
Ömer Faruk Aydın
832ea9e31f Merge pull request #316 from automatisch/feature/telemetry-execution-step
feat: Implement telemetry for execution step creation
2022-05-05 10:50:51 +02:00
Ömer Faruk Aydın
40e2bb44da Merge pull request #315 from automatisch/feature/telemetry-execution
feat: Implement telemetry for the creation of executions
2022-05-05 10:50:43 +02:00
Ömer Faruk Aydın
b7959b5a8c Merge pull request #314 from automatisch/feature/telemetry-flow
feat: Implement telemetry for created and updated flows
2022-05-05 10:50:34 +02:00
Ömer Faruk Aydın
3caa857afe Merge pull request #313 from automatisch/feature/telemetry-step
feat: Implement telemetry for step creation and updates
2022-05-05 10:50:13 +02:00
Faruk AYDIN
031a35cc8f feat: Implement telemetry for diagnostic info 2022-05-05 02:12:05 +02:00
Faruk AYDIN
21836bc5f1 feat: Implement telemetry for connection creation and updates 2022-05-05 01:34:26 +02:00
Faruk AYDIN
00b8f83da5 feat: Implement telemetry for execution step creation 2022-05-05 01:29:47 +02:00
Faruk AYDIN
466ffcc6bc feat: Implement telemetry for the creation of executions 2022-05-05 01:26:31 +02:00
Faruk AYDIN
c5465513ba feat: Implement telemetry for created and updated flows 2022-05-05 01:21:09 +02:00
Faruk AYDIN
4ff6d887ab feat: Implement telemetry for step creation and updates 2022-05-05 01:18:37 +02:00
Ömer Faruk Aydın
5c1e0f5b17 Merge pull request #312 from automatisch/gitlab-auth
feat: add gitlab authentication
2022-05-05 01:03:50 +02:00
Ömer Faruk Aydın
380894069e Merge pull request #311 from automatisch/github-new-commit-trigger
feat: add new commit trigger in GitHub
2022-05-05 01:01:40 +02:00
Ali BARIN
39d82f17d7 feat: add gitlab authentication 2022-05-04 00:49:14 +02:00
Ali BARIN
e651fd141b feat: add new commit trigger in GitHub 2022-05-03 21:12:29 +02:00
Ömer Faruk Aydın
2e2d371875 Merge pull request #310 from automatisch/feature/instance-id
feat: Generate organization and instance id for telemetry
2022-05-03 17:18:04 +02:00
Faruk AYDIN
14ab827b34 feat: Generate organization and instance id for telemetry 2022-05-03 17:09:32 +02:00
Ömer Faruk Aydın
7664c9af0a Merge pull request #309 from automatisch/feature/telemetry-poc
feat: Implement initial version of telemetry client
2022-05-01 19:07:58 +02:00
Faruk AYDIN
224a5b7ba0 feat: Implement initial version of telemetry client 2022-05-01 19:01:21 +02:00
Ömer Faruk Aydın
fa607ef403 Merge pull request #308 from automatisch/dependabot/npm_and_yarn/cross-fetch-3.1.5
chore(deps): bump cross-fetch from 3.1.4 to 3.1.5
2022-05-01 02:17:26 +02:00
dependabot[bot]
11fb25ca3f chore(deps): bump cross-fetch from 3.1.4 to 3.1.5
Bumps [cross-fetch](https://github.com/lquixada/cross-fetch) from 3.1.4 to 3.1.5.
- [Release notes](https://github.com/lquixada/cross-fetch/releases)
- [Commits](https://github.com/lquixada/cross-fetch/compare/v3.1.4...v3.1.5)

---
updated-dependencies:
- dependency-name: cross-fetch
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-28 23:59:10 +00:00
Ömer Faruk Aydın
f9c68babae Merge pull request #307 from automatisch/github-new-release-trigger
feat: add new release trigger in GitHub
2022-04-24 02:38:30 +03:00
Ömer Faruk Aydın
e396963e61 Merge pull request #306 from automatisch/github-new-collaborator-trigger
feat: add new collaborator trigger in GitHub
2022-04-24 02:36:53 +03:00
Ali BARIN
5b9adf0442 feat: add new release trigger in GitHub 2022-04-24 01:35:58 +02:00
Ömer Faruk Aydın
d7f770df0e Merge pull request #305 from automatisch/github-new-label-trigger
feat: add new label trigger in GitHub
2022-04-24 02:30:52 +03:00
Ali BARIN
024bb731d4 feat: add new collaborator trigger in GitHub 2022-04-24 01:29:23 +02:00
Ali BARIN
57478dcc17 feat: add new label trigger in GitHub 2022-04-24 01:26:38 +02:00
Ali BARIN
c79622aefd feat: add new commit comment trigger in GitHub 2022-04-24 02:17:41 +03:00
Ali BARIN
bdfdb1f228 feat: add new milestone trigger in GitHub 2022-04-23 02:34:05 +02:00
Ali BARIN
65e6fbd54b feat: add new watcher trigger in GitHub (#302)
* feat: add new watcher trigger in GitHub
2022-04-23 02:21:51 +03:00
Ali BARIN
af348714f8 feat: add new pull request trigger in GitHub (#301)
* feat: add new pull request trigger in GitHub
2022-04-23 02:14:54 +03:00
Ali BARIN
a623116204 feat: add new notification trigger in GitHub 2022-04-23 02:11:05 +03:00
Ali BARIN
3551d12e7d feat: add new branch trigger in GitHub 2022-04-23 02:04:15 +03:00
Ali BARIN
6bee6bafa8 feat: add new organization trigger in GitHub 2022-04-20 12:47:25 +03:00
Ali BARIN
96ede071cf feat: add new repository trigger in GitHub 2022-04-20 12:38:11 +03:00
Ali BARIN
4f7bef83ea chore: add build CI step 2022-04-18 17:41:27 +03:00
Ali BARIN
b65fa88f16 feat(web): replace JSONViewer with react-json-tree 2022-04-18 13:38:51 +03:00
Ali BARIN
6e4d61f9b1 fix: correct favorite photo trigger name in flickr 2022-04-18 12:09:48 +03:00
Ali BARIN
9234885ce4 chore: introduce empty type definitions for apps 2022-04-17 01:40:20 +03:00
Ali BARIN
10723b1c00 feat: add new album trigger in flickr 2022-04-16 02:43:04 +03:00
Ali BARIN
bf56b54aad feat: add new photo trigger in flickr 2022-04-16 02:38:50 +03:00
Ali BARIN
1e00c7d14e feat: add new photo in album flickr trigger 2022-04-16 02:24:50 +03:00
Ali BARIN
651cceec14 feat: add new favorite photo trigger in flickr 2022-04-16 02:12:35 +03:00
Ali BARIN
d4ad8645c9 chore(docs): make baseUrl configurable
Use BASE_URL environment variable to configure baseUrl in docusaurus config. Otherwise, `/` is used by default.
2022-04-12 00:30:26 +03:00
Ali BARIN
31403b7020 fix(backend): correct app favicon path 2022-04-09 13:36:34 +03:00
Ali BARIN
79fb62d409 chore: add build:watch script in root 2022-04-09 13:15:31 +03:00
Ali BARIN
c227dc86bb feat(cli): create DB in start command if not exists (#285) 2022-04-08 11:36:35 +02:00
Ali BARIN
75eda7f2af feat(cli): run migrations and app in start command (#284)
* feat: perform pending migrations in start command

* feat: log error when DB connection is refused

* feat: log error when Redis connection is refused

* refactor: fix type errors

* fix: correct server and copy graphql schema

* fix: differentiate migrations by env

* chore: remove dev executable

* chore: fix typo in default postgresUsername

* fix: copy json files into dist folder

* chore(cli): add dev script

* chore: pull non-dev logs to info level

* feat(cli): run app in start command

* fix(backend): remove default count in Connection

* fix(cli): remove .eslintrc usage in lint script

* refactor: remove disableMigrationsListValidation

* refactor: make Step optional in ExecutionStep

* refactor: make Flow optional in Step
2022-04-08 11:27:46 +02:00
Ali BARIN
45f810b5b8 feat: remove explore page 2022-04-02 13:10:46 +03:00
dependabot[bot]
4173e3bd2a chore(deps): bump minimist from 1.2.5 to 1.2.6
Bumps [minimist](https://github.com/substack/minimist) from 1.2.5 to 1.2.6.
- [Release notes](https://github.com/substack/minimist/releases)
- [Commits](https://github.com/substack/minimist/compare/1.2.5...1.2.6)

---
updated-dependencies:
- dependency-name: minimist
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-01 23:32:15 +03:00
Ali BARIN
d373d04cdf feat: introduce notifications page 2022-04-01 23:32:03 +03:00
dependabot[bot]
db021c06c7 chore(deps): bump minimist from 1.2.5 to 1.2.6 in /packages/cli
Bumps [minimist](https://github.com/substack/minimist) from 1.2.5 to 1.2.6.
- [Release notes](https://github.com/substack/minimist/releases)
- [Commits](https://github.com/substack/minimist/compare/1.2.5...1.2.6)

---
updated-dependencies:
- dependency-name: minimist
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-01 23:05:20 +03:00
Ali BARIN
bb6c464770 feat: make email and password updatable 2022-04-01 00:38:54 +03:00
Ali BARIN
b8fb84ef42 feat: add getCurrentUser query 2022-04-01 00:38:54 +03:00
Ali BARIN
140734b32c feat: add primitive profile settings 2022-04-01 00:38:54 +03:00
Faruk AYDIN
68e5e6d011 fix: Adjust user email address with correct domain 2022-03-24 22:36:27 +03:00
Faruk AYDIN
3340bdff4c feat: Fetch data while considering previously persisted records 2022-03-24 20:13:36 +03:00
Ali BARIN
782dba1f5e feat: add account dropdown menu with logout link 2022-03-24 15:53:04 +03:00
Faruk AYDIN
22e1fe5c44 feat: Implement auto-run interval for triggers of completed flows 2022-03-23 18:17:41 +03:00
dependabot[bot]
3715291df7 chore(deps): bump node-forge from 1.2.1 to 1.3.0
Bumps [node-forge](https://github.com/digitalbazaar/forge) from 1.2.1 to 1.3.0.
- [Release notes](https://github.com/digitalbazaar/forge/releases)
- [Changelog](https://github.com/digitalbazaar/forge/blob/main/CHANGELOG.md)
- [Commits](https://github.com/digitalbazaar/forge/compare/v1.2.1...v1.3.0)

---
updated-dependencies:
- dependency-name: node-forge
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-23 17:32:42 +03:00
Ali BARIN
f11f523b30 feat: add single execution page 2022-03-23 09:33:55 +01:00
Ali BARIN
c9bf7c9e21 feat: make flows enablable 2022-03-22 20:25:54 +03:00
Ali BARIN
932145e3a1 feat: add dropdown field with dynamic data in flow 2022-03-20 11:46:49 +03:00
Faruk AYDIN
5e1fc510ff feat: Create send slack message action 2022-03-17 22:27:59 +03:00
Faruk AYDIN
fb7e679230 fix: Use computed parameters for dataIn field of execution steps 2022-03-16 01:56:44 +03:00
Faruk AYDIN
8512528fcf feat: Implement getData query and send a message action for slack 2022-03-16 01:48:58 +03:00
Faruk AYDIN
f8c7b85682 feat: Implement slack authentication 2022-03-15 10:52:54 +03:00
Ali BARIN
2218ffd790 feat: add executions page 2022-03-13 12:52:31 +03:00
Faruk AYDIN
ab82134b88 feat: Implement search tweet trigger step for twitter 2022-03-12 17:16:54 +03:00
Faruk AYDIN
3f7a888429 fix: Make processor to work with multiple trigger objects 2022-03-12 17:16:40 +03:00
Ali BARIN
fec55d698a fix: remove input from getStepWithTestExecutions queries 2022-03-12 13:18:19 +03:00
Ali BARIN
af027b7e20 feat: show flows when going back on flow editor 2022-03-12 13:05:27 +03:00
Faruk AYDIN
a57e357354 chore: Add interval value to myTweet trigger 2022-03-11 21:45:00 +03:00
Faruk AYDIN
bf8adb286a feat: Implement getExecutionSteps query 2022-03-11 21:34:33 +03:00
Faruk AYDIN
44623cc384 feat: Implement pagination logic and use with getExecutions query 2022-03-11 21:24:14 +03:00
Ali BARIN
906a8d0644 fix: stop flickering due to late initiated token 2022-03-09 21:02:00 +01:00
Faruk AYDIN
343b360303 feat: Implement initial version of getExecutions query 2022-03-09 21:23:31 +03:00
Ali BARIN
d4bef44b93 fix: remove input out of textConnection query 2022-03-09 09:30:55 +01:00
Ali BARIN
5d1c4b81e7 feat: introduce authentication context 2022-03-09 01:09:14 +03:00
Ali BARIN
030d886cf7 refactor: introduce input in gql mutations 2022-03-09 00:53:20 +03:00
Ali BARIN
f5f7a998ca feat: introduce login page 2022-03-08 12:17:35 +01:00
Faruk AYDIN
bb36748764 refactor: Use input params for all mutations 2022-03-08 11:32:38 +03:00
Faruk AYDIN
212523aec6 feat: Implement updateUser mutation 2022-03-07 21:08:45 +03:00
Faruk AYDIN
64011b5c4b feat: Implement updateFlowStatus mutation 2022-03-07 20:39:47 +03:00
Faruk AYDIN
63198a6569 fix: Do not try to update ID of the flow 2022-03-07 18:26:41 +03:00
Faruk AYDIN
775ac7a8b1 fix: Backend eslint warnings 2022-03-07 18:26:31 +03:00
Faruk AYDIN
ecc9239bfe chore: Set token expiration time to 14 days 2022-03-06 18:56:14 +03:00
Faruk AYDIN
9926e5589e refactor: Use graphql schema directly with graphql-tools library 2022-03-06 18:33:33 +03:00
Faruk AYDIN
96cca96bff fix: Allow external errors for graphql shield 2022-03-06 02:07:08 +03:00
Faruk AYDIN
c935f3f691 feat: Implement authentication with JWT 2022-03-06 00:35:30 +03:00
Ali BARIN
f883dd1287 fix: incorporate UUID in variable regex 2022-03-05 12:57:03 +03:00
Faruk AYDIN
20e725b590 feat: Implement process worker with bullmq 2022-03-05 12:56:34 +03:00
Ali BARIN
b288dc8c35 refactor: use step.executionSteps[].dataOut 2022-03-05 01:37:25 +03:00
Faruk AYDIN
e73f33f3db fix: Adjust info.json files to work with formattedData field 2022-03-05 01:27:00 +03:00
Ali BARIN
6a8ec97c31 refactor: add formattedData in IConnection references 2022-03-05 01:27:00 +03:00
Faruk AYDIN
719a948134 fix: Introduce formattedData for connections to separate types 2022-03-05 01:27:00 +03:00
Faruk AYDIN
39b50fc0d3 fix: JSON related interfaces 2022-03-04 14:35:33 +03:00
Ali BARIN
02af7948e5 refactor: convert IDs to uuid 2022-03-04 02:11:03 +03:00
Faruk AYDIN
0c183eeadd refactor: Use relations to expose dataOut field of execution steps 2022-03-03 19:07:25 +01:00
Ali BARIN
3391578655 chore: introduce @automatisch/types 2022-03-03 13:33:33 +03:00
Faruk AYDIN
bbb6f0b0ff chore: Find apps folder path by using require resolve 2022-03-02 21:34:31 +03:00
Faruk AYDIN
b2369fa8cd chore: Add authentication interface and adjust authentication classes 2022-03-01 18:30:15 +01:00
Ali BARIN
a506d1985f feat: compute step parameters with prior steps 2022-02-28 23:08:18 +01:00
Faruk AYDIN
cdc6168ff4 chore: Adjust authentication classes to have similar structure 2022-02-28 18:31:39 +03:00
Ali BARIN
d06f21c927 feat: add PowerInput component 2022-02-28 01:26:57 +03:00
Faruk AYDIN
c864a1062d refactor: Pass app data within the constructor of an app 2022-02-27 16:49:07 +01:00
Faruk AYDIN
003213d223 fix: Adjust null flag for step model fields 2022-02-27 16:46:04 +03:00
Faruk AYDIN
70bb79ab6c chore: Update objectionjs version to 3 2022-02-26 20:29:44 +03:00
dependabot[bot]
61c1f3a300 chore(deps): bump shelljs from 0.8.4 to 0.8.5 in /packages/cli
Bumps [shelljs](https://github.com/shelljs/shelljs) from 0.8.4 to 0.8.5.
- [Release notes](https://github.com/shelljs/shelljs/releases)
- [Changelog](https://github.com/shelljs/shelljs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/shelljs/shelljs/compare/v0.8.4...v0.8.5)

---
updated-dependencies:
- dependency-name: shelljs
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-26 19:50:09 +03:00
dependabot[bot]
1f0463b04a chore(deps): bump glob-parent from 3.1.0 to 5.1.2 in /packages/cli
Bumps [glob-parent](https://github.com/gulpjs/glob-parent) from 3.1.0 to 5.1.2.
- [Release notes](https://github.com/gulpjs/glob-parent/releases)
- [Changelog](https://github.com/gulpjs/glob-parent/blob/main/CHANGELOG.md)
- [Commits](https://github.com/gulpjs/glob-parent/compare/v3.1.0...v5.1.2)

---
updated-dependencies:
- dependency-name: glob-parent
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-26 12:53:18 +03:00
dependabot[bot]
4d8c15d10a chore(deps): bump node-fetch from 2.6.6 to 2.6.7 in /packages/cli
Bumps [node-fetch](https://github.com/node-fetch/node-fetch) from 2.6.6 to 2.6.7.
- [Release notes](https://github.com/node-fetch/node-fetch/releases)
- [Commits](https://github.com/node-fetch/node-fetch/compare/v2.6.6...v2.6.7)

---
updated-dependencies:
- dependency-name: node-fetch
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-26 12:53:08 +03:00
dependabot[bot]
b234240f11 chore(deps): bump url-parse from 1.5.7 to 1.5.10
Bumps [url-parse](https://github.com/unshiftio/url-parse) from 1.5.7 to 1.5.10.
- [Release notes](https://github.com/unshiftio/url-parse/releases)
- [Commits](https://github.com/unshiftio/url-parse/compare/1.5.7...1.5.10)

---
updated-dependencies:
- dependency-name: url-parse
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-26 12:49:00 +03:00
Faruk AYDIN
c732780672 feat: Implement draft version of CLI package 2022-02-26 12:48:48 +03:00
dependabot[bot]
059c039a8b chore(deps): bump prismjs from 1.26.0 to 1.27.0
Bumps [prismjs](https://github.com/PrismJS/prism) from 1.26.0 to 1.27.0.
- [Release notes](https://github.com/PrismJS/prism/releases)
- [Changelog](https://github.com/PrismJS/prism/blob/master/CHANGELOG.md)
- [Commits](https://github.com/PrismJS/prism/compare/v1.26.0...v1.27.0)

---
updated-dependencies:
- dependency-name: prismjs
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-26 12:44:56 +03:00
Faruk AYDIN
654e868a23 feat: Serve react app through express server 2022-02-24 22:48:04 +03:00
Faruk AYDIN
d139eb8c06 feat: Implement getStepWithTestExecutions query 2022-02-22 00:14:56 +01:00
Faruk AYDIN
98864ceadd chore: Adjust untilStep logic for processor 2022-02-20 20:36:36 +03:00
Faruk AYDIN
ba2b5afe2b feat: Implement initial version of processor 2022-02-20 18:02:09 +03:00
dependabot[bot]
4a8c3988c2 chore(deps): bump url-parse from 1.5.4 to 1.5.7
Bumps [url-parse](https://github.com/unshiftio/url-parse) from 1.5.4 to 1.5.7.
- [Release notes](https://github.com/unshiftio/url-parse/releases)
- [Commits](https://github.com/unshiftio/url-parse/compare/1.5.4...1.5.7)

---
updated-dependencies:
- dependency-name: url-parse
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-19 13:12:02 +01:00
Faruk AYDIN
b6494ea1c4 feat: Create execution step model 2022-02-19 13:21:38 +03:00
Faruk AYDIN
82e1f345d4 feat: Create execution model 2022-02-19 13:18:09 +03:00
Faruk AYDIN
3457ad29d7 feat: Use active field with flows 2022-02-18 12:48:49 +03:00
dependabot[bot]
e996e5d0c6 chore(deps): bump follow-redirects from 1.14.7 to 1.14.8
Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.14.7 to 1.14.8.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.14.7...v1.14.8)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-15 09:05:37 +01:00
Ali BARIN
020ef45f0a feat: add TestSubstep along with step status 2022-02-14 19:25:54 +03:00
Ali BARIN
50ef6be69c refactor: separate substeps in FlowStep 2022-02-07 16:30:33 +03:00
Ali BARIN
873421f1e9 feat: add connection in updateStep response 2022-02-07 16:30:33 +03:00
Ali BARIN
5aae9a60f4 feat: introduce FlowSubstepTitle in FlowStep 2022-02-07 16:30:33 +03:00
Ali BARIN
85c3442196 refactor: use styleOverrides callback in theme 2022-02-07 16:30:33 +03:00
Faruk AYDIN
e155bb528f feat: Add status to step model and adjust executeFlow accordingly 2022-02-05 19:17:53 +03:00
Faruk AYDIN
572ad71241 docs: Fix key concepts sub-headings 2022-02-05 17:18:51 +03:00
Faruk AYDIN
d19ccac925 docs: Add initial version of key concepts page 2022-02-05 17:14:47 +03:00
Faruk AYDIN
a1a9692b31 docs: Add initial version of installation guide 2022-02-05 12:49:15 +01:00
Ali BARIN
dfc95cafe0 fix(ChooseAccountSubstep): show app connections 2022-02-05 00:31:36 +03:00
Ali BARIN
50015ae073 feat(FlowStep): introduce expand more/less icons 2022-02-05 00:31:36 +03:00
Faruk AYDIN
4b69d7f983 feat: Add executeFlow graphQL mutation 2022-02-03 23:14:31 +01:00
Faruk AYDIN
cf08501371 docs: Adjust introduction page info section 2022-02-03 23:00:11 +03:00
Faruk AYDIN
9ce92a19c1 docs: Adjust edit page url 2022-02-03 20:53:18 +03:00
Faruk AYDIN
1d31ce66f5 docs: Create initial version of introduction page 2022-02-03 19:58:01 +03:00
Faruk AYDIN
684e3b3ec7 chore: Adjust primary color of docs and footer links 2022-02-03 11:53:53 +03:00
Faruk AYDIN
675de79d94 docs: Add initial version of the documentation pages 2022-02-02 13:27:56 +03:00
Ali BARIN
6a3d1ced93 feat: introduce choose account substep in flow editor 2022-02-02 10:40:35 +03:00
Faruk AYDIN
b864100890 feat: Introduce github actions for the linter 2022-02-01 19:42:04 +03:00
Ali BARIN
8364695f8a feat: show only triggerable apps in trigger steps 2022-02-01 10:09:50 +03:00
Ali BARIN
89fbfd9dfc feat: make flow name updatable 2022-02-01 10:08:58 +03:00
Ali BARIN
91a1c8b793 feat: make substeps updatable 2022-02-01 00:26:17 +03:00
Faruk AYDIN
6c0ba197c6 feat: Implement onlyWithTriggers flag for getApps graphQL query 2022-02-01 00:15:45 +03:00
Ali BARIN
7740529a2a feat: add primitive substeps in flow editor 2022-01-31 23:16:14 +03:00
Ali BARIN
90aac874bf feat: add delete step functionality 2022-01-30 18:27:57 +03:00
Faruk AYDIN
0b6eecd41d feat: Adjust positions and return all steps after deletion of the step 2022-01-30 13:11:19 +01:00
Ali BARIN
3e5b9478c7 feat: add default flow name 2022-01-30 14:13:21 +03:00
Faruk AYDIN
b822e25359 feat: Implement deleteFlow mutation 2022-01-30 12:57:44 +03:00
Faruk AYDIN
3429784309 chore: Introduce has many steps through flows for user model 2022-01-30 12:34:36 +03:00
Ali BARIN
700d0bfd32 feat: create flow with trigger app 2022-01-30 11:15:30 +03:00
Ali BARIN
131d33916a chore: stop casting IDs as number 2022-01-29 18:50:55 +03:00
Faruk AYDIN
c6e2b94128 chore: Use string IDs instead of integer ones 2022-01-29 18:50:55 +03:00
Faruk AYDIN
86d5cceec7 refactor: Use related query from objectionjs for mutations 2022-01-29 12:27:07 +03:00
Ali BARIN
e7c537f217 feat: introduce action event step in flow step 2022-01-29 11:36:29 +03:00
Faruk AYDIN
2416ce13a7 refactor: Refactor queries by using related query from objectionjs 2022-01-28 19:25:41 +01:00
Faruk AYDIN
5b392f3f87 feat: Add deleteStep mutation 2022-01-28 18:56:49 +01:00
Ali BARIN
da9ab8016b fix: make connectionId optional step model 2022-01-28 19:17:20 +03:00
Ali BARIN
3925de13a7 fix: do not update step on initial render 2022-01-28 19:17:20 +03:00
Faruk AYDIN
bb3183959e chore: Order steps by position ascending 2022-01-28 16:33:53 +01:00
dependabot[bot]
60b0b02de2 chore(deps): bump dns-packet from 1.3.1 to 1.3.4 in /packages/web
Bumps [dns-packet](https://github.com/mafintosh/dns-packet) from 1.3.1 to 1.3.4.
- [Release notes](https://github.com/mafintosh/dns-packet/releases)
- [Changelog](https://github.com/mafintosh/dns-packet/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mafintosh/dns-packet/compare/v1.3.1...v1.3.4)

---
updated-dependencies:
- dependency-name: dns-packet
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-28 18:32:44 +03:00
dependabot[bot]
4d6f645d6b chore(deps): bump ansi-regex from 5.0.0 to 5.0.1 in /packages/web
Bumps [ansi-regex](https://github.com/chalk/ansi-regex) from 5.0.0 to 5.0.1.
- [Release notes](https://github.com/chalk/ansi-regex/releases)
- [Commits](https://github.com/chalk/ansi-regex/compare/v5.0.0...v5.0.1)

---
updated-dependencies:
- dependency-name: ansi-regex
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-28 18:31:13 +03:00
dependabot[bot]
1448dc1ea7 chore(deps): bump browserslist from 4.16.3 to 4.19.1 in /packages/web
Bumps [browserslist](https://github.com/browserslist/browserslist) from 4.16.3 to 4.19.1.
- [Release notes](https://github.com/browserslist/browserslist/releases)
- [Changelog](https://github.com/browserslist/browserslist/blob/main/CHANGELOG.md)
- [Commits](https://github.com/browserslist/browserslist/compare/4.16.3...4.19.1)

---
updated-dependencies:
- dependency-name: browserslist
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-28 18:31:02 +03:00
dependabot[bot]
e129dc2d3b chore(deps): bump glob-parent from 5.1.1 to 5.1.2 in /packages/web
Bumps [glob-parent](https://github.com/gulpjs/glob-parent) from 5.1.1 to 5.1.2.
- [Release notes](https://github.com/gulpjs/glob-parent/releases)
- [Changelog](https://github.com/gulpjs/glob-parent/blob/main/CHANGELOG.md)
- [Commits](https://github.com/gulpjs/glob-parent/compare/v5.1.1...v5.1.2)

---
updated-dependencies:
- dependency-name: glob-parent
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-28 18:30:33 +03:00
dependabot[bot]
ec2bfb6538 chore(deps): bump node-forge from 0.10.0 to 1.2.1 in /packages/web
Bumps [node-forge](https://github.com/digitalbazaar/forge) from 0.10.0 to 1.2.1.
- [Release notes](https://github.com/digitalbazaar/forge/releases)
- [Changelog](https://github.com/digitalbazaar/forge/blob/main/CHANGELOG.md)
- [Commits](https://github.com/digitalbazaar/forge/compare/0.10.0...v1.2.1)

---
updated-dependencies:
- dependency-name: node-forge
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-28 15:49:20 +01:00
dependabot[bot]
110210f865 chore(deps): bump postcss from 7.0.21 to 7.0.39
Bumps [postcss](https://github.com/postcss/postcss) from 7.0.21 to 7.0.39.
- [Release notes](https://github.com/postcss/postcss/releases)
- [Changelog](https://github.com/postcss/postcss/blob/7.0.39/CHANGELOG.md)
- [Commits](https://github.com/postcss/postcss/compare/7.0.21...7.0.39)

---
updated-dependencies:
- dependency-name: postcss
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-28 15:43:20 +01:00
dependabot[bot]
aa363e7899 chore(deps): bump nanoid from 3.1.20 to 3.2.0 in /packages/web
Bumps [nanoid](https://github.com/ai/nanoid) from 3.1.20 to 3.2.0.
- [Release notes](https://github.com/ai/nanoid/releases)
- [Changelog](https://github.com/ai/nanoid/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ai/nanoid/compare/3.1.20...3.2.0)

---
updated-dependencies:
- dependency-name: nanoid
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-28 15:42:46 +01:00
dependabot[bot]
fda6507e72 chore(deps): bump follow-redirects in /packages/web
Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.13.2 to 1.14.7.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.13.2...v1.14.7)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-28 15:41:52 +01:00
Faruk AYDIN
3c2188ebf2 feat: Create step with previous step id and assign position 2022-01-28 17:12:33 +03:00
Ali BARIN
95a63affe7 feat: make step in editor configurable 2022-01-28 15:53:37 +03:00
Faruk AYDIN
4985fb422e feat: Introduce position to step model 2022-01-27 17:46:44 +03:00
Ali BARIN
c09a535653 chore: suit eslint rules 2022-01-20 17:09:12 +01:00
Ali BARIN
f6d7971b4f chore: add eslint separately per package 2022-01-20 17:07:14 +01:00
Faruk AYDIN
a831bf1673 feat: Setup eslint and prettier 2022-01-20 17:07:14 +01:00
Faruk AYDIN
6ad92b60e3 chore: Add nohoist flag to babel-loader and webpack 2022-01-14 17:29:40 +03:00
Faruk AYDIN
02cfb979bc chore: Add active column to flows 2022-01-08 17:48:57 +03:00
Ali BARIN
430f0d07e8 feat: introduce basic flows page 2022-01-08 15:09:26 +01:00
Faruk AYDIN
d25d327ef7 feat: Implement update step graphQL mutation 2022-01-06 22:30:48 +01:00
Faruk AYDIN
b6c7ce96c9 feat: Add draft triggers and actions to twitter app 2022-01-06 21:46:58 +03:00
Faruk AYDIN
c07b377de1 feat: Create empty trigger step when the flow is created 2022-01-06 00:08:54 +03:00
Ali BARIN
247b25cfc4 feat: introduce steps in flow editor 2022-01-02 14:44:21 +03:00
Faruk AYDIN
a232408f22 chore: Expose type field of the steps arguments 2022-01-02 14:33:05 +03:00
Ali BARIN
06bfba371d refactor: cast variable types while computing 2022-01-02 14:33:05 +03:00
Faruk AYDIN
3f2f1212c9 chore: Use integer for IDs of resources 2022-01-02 14:33:05 +03:00
Faruk AYDIN
a58411ee99 chore: Expose connection with step type instead of only connectionId 2021-12-24 21:01:07 +03:00
Ali BARIN
11bdbf1727 feat: introduce dummy flow editor 2021-12-24 17:41:31 +01:00
Faruk AYDIN
e3184aedb8 feat: Implement get flow graphQL query 2021-12-24 15:28:45 +01:00
Ali BARIN
e0f380026e feat: add login mutation 2021-12-21 10:05:16 +01:00
Ali BARIN
8b05489e40 fix: correct params type in update-flow mutation 2021-12-21 10:05:02 +01:00
Ali BARIN
ede68b2af2 feat: add updateFlow mutation 2021-12-21 10:05:02 +01:00
Ali BARIN
d06ce4958e feat: add /editor/create to create a flow 2021-12-21 09:32:17 +01:00
dependabot[bot]
19a8323058 chore(deps): bump ws from 6.2.1 to 6.2.2 in /packages/web
Bumps [ws](https://github.com/websockets/ws) from 6.2.1 to 6.2.2.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](https://github.com/websockets/ws/compare/6.2.1...6.2.2)

---
updated-dependencies:
- dependency-name: ws
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-12-17 21:50:39 +01:00
dependabot[bot]
1b60efa9b8 chore(deps): bump color-string from 1.5.4 to 1.9.0 in /packages/web
Bumps [color-string](https://github.com/Qix-/color-string) from 1.5.4 to 1.9.0.
- [Release notes](https://github.com/Qix-/color-string/releases)
- [Changelog](https://github.com/Qix-/color-string/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Qix-/color-string/compare/1.5.4...1.9.0)

---
updated-dependencies:
- dependency-name: color-string
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-12-17 20:24:15 +01:00
dependabot[bot]
0729ca82d5 chore(deps): bump url-parse from 1.5.1 to 1.5.3 in /packages/web
Bumps [url-parse](https://github.com/unshiftio/url-parse) from 1.5.1 to 1.5.3.
- [Release notes](https://github.com/unshiftio/url-parse/releases)
- [Commits](https://github.com/unshiftio/url-parse/compare/1.5.1...1.5.3)

---
updated-dependencies:
- dependency-name: url-parse
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-12-17 20:24:03 +01:00
dependabot[bot]
8cd745fd77 chore(deps): bump tmpl from 1.0.4 to 1.0.5 in /packages/web
Bumps [tmpl](https://github.com/daaku/nodejs-tmpl) from 1.0.4 to 1.0.5.
- [Release notes](https://github.com/daaku/nodejs-tmpl/releases)
- [Commits](https://github.com/daaku/nodejs-tmpl/commits/v1.0.5)

---
updated-dependencies:
- dependency-name: tmpl
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-12-17 20:23:50 +01:00
dependabot[bot]
4dab34fe66 chore(deps): bump path-parse from 1.0.6 to 1.0.7 in /packages/web
Bumps [path-parse](https://github.com/jbgutierrez/path-parse) from 1.0.6 to 1.0.7.
- [Release notes](https://github.com/jbgutierrez/path-parse/releases)
- [Commits](https://github.com/jbgutierrez/path-parse/commits/v1.0.7)

---
updated-dependencies:
- dependency-name: path-parse
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-12-17 20:23:40 +01:00
dependabot[bot]
fbbfefb5e4 chore(deps): bump tar from 6.1.0 to 6.1.11 in /packages/web
Bumps [tar](https://github.com/npm/node-tar) from 6.1.0 to 6.1.11.
- [Release notes](https://github.com/npm/node-tar/releases)
- [Changelog](https://github.com/npm/node-tar/blob/main/CHANGELOG.md)
- [Commits](https://github.com/npm/node-tar/compare/v6.1.0...v6.1.11)

---
updated-dependencies:
- dependency-name: tar
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-12-17 19:25:28 +01:00
Ali BARIN
81c18ee37c feat: tweak add new app connection dialog 2021-12-17 12:20:38 +01:00
Ali BARIN
3e8bae2ec3 feat: rework connection test feedback 2021-12-17 12:20:38 +01:00
Ali BARIN
e05436034c feat: add loading state to app connection creation 2021-12-17 12:20:38 +01:00
Ali BARIN
f6050f91c3 feat: enlarge small size OutlinedInput 2021-12-17 12:20:38 +01:00
Ali BARIN
b600179221 chore: install @mui/lab 2021-12-17 12:20:38 +01:00
Ali BARIN
78375934d7 feat: style app connections 2021-12-15 22:27:27 +01:00
Ali BARIN
fc85716d07 feat: style add new app connection 2021-12-15 10:21:03 +01:00
Ali BARIN
fdfad28c2e fix: use correct icon in ConditionalIconButton 2021-12-15 10:12:28 +01:00
Ali BARIN
6da8557219 feat: design my apps along with app layout 2021-12-14 01:16:56 +01:00
Faruk AYDIN
3785c705ff feat: Add build:docs script 2021-12-12 17:58:13 +01:00
Ali BARIN
39eafca5ec chore: upgrade to react-router@6 2021-12-12 17:14:05 +01:00
Ali BARIN
5c60738f25 chore: make packages explicit in yarn workspaces 2021-12-12 17:14:05 +01:00
Ali BARIN
ec53d0ae66 feat: introduce dynamic flow data 2021-12-10 23:46:00 +01:00
Ali BARIN
2e1523b40f refactor: rename db:create:user as db:seed:user 2021-12-10 23:46:00 +01:00
Ali BARIN
c94b8af821 feat: introduce app flows with dummy data 2021-12-10 23:46:00 +01:00
Ali BARIN
c855a5f555 feat: update theme 2021-12-10 10:39:01 +01:00
Faruk AYDIN
cab2d281f3 feat: Add docs package which uses docusaurus internally 2021-12-09 17:52:21 +01:00
Faruk AYDIN
95d38b740e feat: Implement getFlows graphQL query 2021-12-09 17:48:57 +01:00
Faruk AYDIN
d8c216d8c8 chore: Force users to set ENCRYPTION_KEY env variable 2021-11-29 14:01:41 +01:00
Faruk AYDIN
79b12ac9e6 chore: Do not override query method for findOne query errors 2021-11-28 22:57:20 +01:00
Faruk AYDIN
3e4768c106 chore: Do not try to encrypt or decrypt if data field is empty 2021-11-28 22:57:20 +01:00
Ömer Faruk Aydın
f949eca3c4 feat: Encrypt data column of connections (#105) 2021-11-28 22:08:35 +01:00
Ali BARIN
69bea588e4 refactor: start using AvailableAppsEnumType 2021-11-28 20:56:42 +01:00
Faruk AYDIN
9ea5242d94 chore: Use available apps enum type in queries and mutations 2021-11-28 20:56:42 +01:00
Faruk AYDIN
63d478f9a9 chore: Implement not found error for queries without a result 2021-11-25 00:39:52 +01:00
Ali BARIN
232c224ccf feat: update theme 2021-11-25 00:39:36 +01:00
Ali BARIN
3260bf8215 fix: introduce AvailableAppsEnumType in createConnection 2021-11-24 21:32:09 +01:00
Faruk AYDIN
81d04e417d chore: Add available app enum type to validate app keys 2021-11-24 21:32:09 +01:00
Faruk AYDIN
23621d1b06 fix: Add ssl flag to the postgresql authentication 2021-11-24 15:07:51 +01:00
Faruk AYDIN
9358f6c5b0 chore: Set database pool size 2021-11-24 11:06:39 +01:00
Faruk AYDIN
58ba78e52b fix: Pass empty parameter object for twitter actions 2021-11-24 00:27:22 +01:00
Faruk AYDIN
f0e25ed9f3 fix: Use computed raw data instead of raw app data for convertion 2021-11-24 00:17:51 +01:00
Faruk AYDIN
d53ef4ffc6 chore: Use web app url as dynamic for info.json files 2021-11-24 00:07:34 +01:00
Faruk AYDIN
a5811d44ac chore: Add env variable to toggle postgresql ssl flag 2021-11-23 14:56:39 +01:00
Faruk AYDIN
cf1fa9039b fix: Take parameters for twitter actions 2021-11-23 12:31:57 +01:00
Faruk AYDIN
3f8a711119 chore: Add ssl true to the database options 2021-11-23 11:39:34 +01:00
Faruk AYDIN
9232ad3378 fix: Adjust web app url 2021-11-23 11:24:10 +01:00
Faruk AYDIN
77ab83b43b chore: Use web app url instead of cors protocol, port and host 2021-11-23 11:18:08 +01:00
Faruk AYDIN
f8e823545a chore: Adjust create step mutation to work with flows 2021-11-22 23:54:31 +01:00
Faruk AYDIN
8a7d54bb25 feat: Create flow model and graphQL mutation 2021-11-22 23:05:53 +01:00
Faruk AYDIN
b42cb759a5 feat: Introduce my tweet trigger with execute step mutation 2021-11-20 17:07:31 +01:00
Faruk AYDIN
46321f19f4 chore: Extract authentication logic of the apps to their own classes 2021-11-19 11:53:23 +01:00
Faruk AYDIN
6b1dee053f chore: Disable eager loading apps 2021-11-17 20:38:22 +01:00
Faruk AYDIN
c48c905805 feat: Implement draft version of Step model 2021-11-07 00:42:50 +01:00
Faruk AYDIN
a3dd76df21 feat: Expose triggers of twitter integration with app query 2021-11-06 23:08:16 +01:00
Ali BARIN
c8e3a458ff chore: Adjust license links and remove contributor license agreement 2021-11-06 18:48:12 +01:00
Faruk AYDIN
1a64b745d2 feat: Implement typeform connection 2021-10-28 17:53:03 +02:00
Faruk AYDIN
7ed0ec45c3 feat: Implement PostgreSQL connection 2021-10-28 15:35:33 +02:00
Ali BARIN
219d24495d feat: introduce twilio auth 2021-10-27 20:04:08 +02:00
Ali BARIN
72476ceb8b feat: introduce github authentication 2021-10-26 23:41:25 +02:00
Ali BARIN
2f7cde95da refactor: rename fields with arguments and properties 2021-10-26 23:55:02 +02:00
Faruk AYDIN
65a41ff492 chore: Use arguments or properties instead of fields 2021-10-26 23:35:01 +02:00
Faruk AYDIN
561f539123 chore: Eager load integration apps 2021-10-26 22:25:59 +02:00
Faruk AYDIN
cbfba465db chore: Rename createAuthLink as createAuthData 2021-10-26 21:52:04 +02:00
Ali BARIN
901699fe64 feat: introduce discord authentication 2021-10-26 18:11:09 +02:00
Faruk AYDIN
ce7130b271 feat: Implement SMTP app connection 2021-10-25 16:49:03 +02:00
Ali BARIN
9e3c61e3df feat: introduce twitch auth 2021-10-24 21:25:04 +02:00
Faruk AYDIN
8e91f1f7ed chore: Make createAuthLink mutation more generic 2021-10-24 20:06:16 +02:00
Ali BARIN
81d5e6d17c chore: install always exact version for deps 2021-10-24 17:47:18 +02:00
Ali BARIN
17907a288c feat: introduce firebase authentication 2021-10-24 01:02:34 +02:00
Faruk AYDIN
2eeeeb0028 chore: Introduce GraphQLJSONObject type for credentials 2021-10-24 16:51:29 +02:00
Ali BARIN
c7d757a337 feat: introduce snackbars for GQL errors 2021-10-23 18:53:48 +02:00
Faruk AYDIN
3e6220c39e chore: Refactor exposing graphQL errors 2021-10-23 15:29:03 +02:00
Faruk AYDIN
44fbaeee82 feat: Introduce reset and verify connection mutations 2021-10-22 15:55:25 +02:00
Ali BARIN
de82dbfe29 feat: introduce notistack for snackbars 2021-10-21 22:51:55 +02:00
Ali BARIN
1654abb197 feat: introduce reconnection support for Flickr 2021-10-20 21:51:13 +02:00
Ali BARIN
ec4dd8a037 feat: introduce reconnect feature for connections 2021-10-20 21:01:48 +02:00
Faruk AYDIN
258caa81f0 feat: Introduce reconnection steps for twitter app 2021-10-20 18:15:23 +02:00
Faruk AYDIN
bc0fe5323e chore: Start with uppercase letter for grahpQL type names 2021-10-20 14:06:12 +02:00
Faruk AYDIN
a7582a4503 chore: Introduce app info converter and use JSON for info files 2021-10-20 13:56:41 +02:00
Ali BARIN
2293c939e7 feat: add app connections w/ testing and deleting functions 2021-10-18 23:58:40 +02:00
Faruk AYDIN
672cc4c60c feat: Serve static assets of apps 2021-10-19 16:29:37 +02:00
Faruk AYDIN
5a2de1de9e chore: Return connectionType for testConnection query 2021-10-19 13:22:03 +02:00
Faruk AYDIN
650416ce6b feat: Create testConnection graphQL query 2021-10-18 18:05:04 +02:00
Faruk AYDIN
f39b2c8011 feat: Implement deleteConnection mutation 2021-10-18 17:29:53 +02:00
Faruk AYDIN
258b523042 feat: Implement getAppConnections graphQL query 2021-10-18 17:05:36 +02:00
Ali BARIN
d13470d587 fix: add missing type and dependency for flickr-sdk 2021-10-17 20:38:20 +02:00
Ali BARIN
177b5eba48 feat: add Flickr as a connection 2021-10-17 19:29:57 +02:00
Ali BARIN
93df78b5b3 feat: Replace all apps with connected apps on /apps 2021-10-17 16:40:09 +02:00
Faruk AYDIN
8de65e52ab chore: Use key instead of name as parameter for getApp query 2021-10-17 16:04:20 +02:00
Ali BARIN
48ba4565e4 refactor: Update credential wording with connection 2021-10-17 16:08:05 +02:00
Ali BARIN
a1363f7fdd feat: Introduce adding a new app connection 2021-10-17 15:50:42 +02:00
Faruk AYDIN
084a831e7a feat: Implement getConnectedApps graphQL query 2021-10-17 15:10:38 +02:00
Faruk AYDIN
8fa0178e08 chore: Rename credentials as connections 2021-10-17 13:26:58 +02:00
Ali BARIN
3a44cf5f86 refactor: iterate array, not generator in auth steps 2021-10-15 18:34:48 +02:00
Ali BARIN
9cc10f6346 feat: Introduce auth step to verify connection 2021-10-15 18:15:46 +02:00
Faruk AYDIN
46f68037ec feat: Implement update credentials endpoint 2021-10-15 16:26:34 +02:00
Ali BARIN
bfd63204a2 refactor: Introduce generator for auth steps 2021-10-15 00:31:30 +02:00
Ali BARIN
e045fb1710 feat: Introduce openWithPopup auth step 2021-10-14 23:53:48 +02:00
Faruk AYDIN
01ad1f2335 feat: Add third step to twitter authentication steps 2021-10-14 18:47:16 +02:00
Faruk AYDIN
800f6b1653 chore: Fix yarn start command 2021-10-14 18:41:02 +02:00
Ali BARIN
9c529b6c6d feat: Introduce generic auth steps 2021-10-14 18:34:30 +02:00
Faruk AYDIN
1fbc58e7e1 chore: Remove displayName field from credentials 2021-10-14 16:56:51 +02:00
Faruk AYDIN
5be9ff8383 chore: Use currentUser from authentication 2021-10-14 16:38:03 +02:00
Faruk AYDIN
bdd0843d94 feat: Implement createAuthLink mutation 2021-10-14 15:17:58 +02:00
Faruk AYDIN
7f17420ae0 chore: Expose authentication steps to the client 2021-10-13 16:19:13 +02:00
Faruk AYDIN
a2a9bd9020 chore: Add static current user temporarily 2021-10-13 12:12:29 +02:00
Faruk AYDIN
c62c44b17e chore: Add slug and placeholder fields to apps 2021-10-13 11:45:13 +02:00
Ali BARIN
f50c09ed37 feat: Introduce InputCreator 2021-10-11 23:22:12 +02:00
Faruk AYDIN
981ea6d163 feat: Create credentials model and graphQL mutation 2021-10-12 17:51:43 +02:00
Faruk AYDIN
e569b188a9 chore: Expose data fields by using camelCase convention 2021-10-11 21:46:41 +02:00
Faruk AYDIN
ebaf0244a5 chore: Implement sample user creation script 2021-10-11 16:48:52 +02:00
Faruk AYDIN
61e1488e11 chore: Refactor graphQL queries structure 2021-10-11 21:01:34 +02:00
Ali BARIN
1d65a7c0dd feat: Extend apps with further data 2021-10-10 21:51:16 +02:00
Faruk AYDIN
2a01407495 feat: Add primaryColor values into app info files 2021-10-10 20:27:53 +02:00
Faruk AYDIN
7a8889220f chore: Use value key instead of placeholder for apps 2021-10-09 21:39:59 +02:00
Ali BARIN
c078a97e12 feat: Extend App pages with tabs and data 2021-10-09 21:56:16 +02:00
Faruk AYDIN
f36a5cb6d8 feat: Implement getApp graphQL query 2021-10-09 13:31:44 +02:00
Faruk AYDIN
4dbbf37844 chore: Build graphQL query type dynamically 2021-10-09 12:39:18 +02:00
Ali BARIN
c9079db77a feat: Extend Apps page with search and data 2021-10-09 00:16:24 +02:00
Faruk AYDIN
e0ab059744 chore: Use only getApps query with optional name argument 2021-10-08 23:31:40 +02:00
Faruk AYDIN
0e684570f8 feat: Implement getAll and getAllByName graphQL queries 2021-10-08 21:24:27 +02:00
Faruk AYDIN
a39ae93ca4 chore: Setup ava and sinon test libraries 2021-10-08 19:02:36 +02:00
Faruk AYDIN
a0c34e9353 chore: Move migration folder into src folder 2021-10-08 18:59:47 +02:00
Ali BARIN
36ed8d7838 feat: Add dummy pages 2021-10-07 01:10:19 +02:00
Ali BARIN
3aa90bf29f feat: update links in drawer 2021-10-07 00:04:31 +02:00
Faruk AYDIN
2e524eabd3 feat: Introduce base model to implement created_at & updated_at logic 2021-10-06 23:40:14 +02:00
Faruk AYDIN
ae3d24e233 chore: Extract knex model integration to separate file 2021-10-06 23:39:02 +02:00
Faruk AYDIN
d03e34e9cc feat: Create user model 2021-10-06 23:37:45 +02:00
Ali BARIN
3f56da5efb feat: Add Layout with AppBar and Drawer 2021-10-05 20:35:13 +02:00
Faruk AYDIN
f032dea77e chore: Setup objectionjs as ORM 2021-10-05 18:39:28 +02:00
Faruk AYDIN
908f156a45 chore: Add database create & drop commands 2021-10-05 18:37:57 +02:00
Faruk AYDIN
c41d938f9e chore: Extract error handler and graphql instance to seperate files 2021-10-05 18:34:40 +02:00
Faruk AYDIN
4039e520d6 chore: Handle 404 not found errors 2021-10-04 22:16:06 +02:00
Faruk AYDIN
c0f022a1b0 chore: Adjust cors options 2021-10-04 21:40:17 +02:00
Ali BARIN
fc9bcc5c14 chore: add app config with GQL URL and PORT 3001 2021-10-04 20:25:18 +02:00
Ali BARIN
1343352819 chore: Add react-router 2021-10-04 19:54:40 +02:00
Faruk AYDIN
7d98333a8a chore: Integrate graphql to the express app 2021-10-04 19:42:23 +02:00
Faruk AYDIN
7a675e6c79 chore: Implement logger with winston library 2021-10-04 18:01:14 +02:00
Ali BARIN
a62d5369d4 chore: add support for react-intl, mui, apolloql 2021-10-03 23:46:37 +02:00
Faruk AYDIN
a4ddc8b50c chore: Setup dotenv for the express application 2021-10-03 20:28:22 +02:00
Faruk AYDIN
fbc2b1e00a chore: Setup typescript for the express app 2021-10-03 18:55:01 +02:00
Faruk AYDIN
701fc48d6f chore: Setup express app 2021-10-03 18:03:50 +02:00
Ali BARIN
a5bf0649ae chore: Add web package 2021-10-03 15:11:55 +02:00
Ali BARIN
677f0ef908 chore: Add LICENSES 2021-11-06 01:10:35 +01:00
Faruk AYDIN
b51bb41bdc chore: Use src folder instead of lib 2021-10-02 13:52:55 +02:00
Faruk AYDIN
fb3de58ccf chore: Add backend package 2021-10-02 13:36:57 +02:00
425 changed files with 55297 additions and 31 deletions

13
.eslintignore Normal file
View 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
View 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
View 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
View 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
View File

@@ -0,0 +1,3 @@
module.exports = {
singleQuote: true,
};

12
.vscode/launch.json vendored Normal file
View 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
View File

@@ -0,0 +1,3 @@
{
"editor.formatOnSave": true
}

661
LICENSE.md Normal file
View 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/>.

View File

@@ -9,6 +9,9 @@
"command": {
"publish": {
"registry": "http://localhost:5000"
},
"add": {
"exact": true
}
}
}

View File

@@ -1,11 +1,34 @@
{
"name": "@automatisch/root",
"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"

View File

@@ -0,0 +1,15 @@
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

View File

@@ -0,0 +1,11 @@
# `backend`
> TODO: description
## Usage
```
const backend = require('backend');
// TODO: DEMONSTRATE API
```

View File

@@ -0,0 +1,9 @@
import { Client } from 'pg';
const client = new Client({
host: 'localhost',
user: 'postgres',
port: 5432,
})
export default client;

View File

@@ -0,0 +1,3 @@
import { createDatabaseAndUser } from './utils';
createDatabaseAndUser();

View File

@@ -0,0 +1,3 @@
import { dropDatabase } from './utils';
dropDatabase();

View File

@@ -0,0 +1,3 @@
import { createUser } from './utils';
createUser();

View File

@@ -0,0 +1,100 @@
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 user = await User.query().insertAndFetch(userParams);
logger.info(`User has been saved: ${user.email}`);
} 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!`);
}

2
packages/backend/database.d.ts vendored Normal file
View File

@@ -0,0 +1,2 @@
export * as utils from './dist/bin/database/utils';
export * as database from './dist/src/config/database';

View File

@@ -0,0 +1,3 @@
/* eslint-disable */
module.exports.utils = require('./dist/bin/database/utils');
module.exports.database = require('./dist/src/config/database');

View 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
View File

@@ -0,0 +1 @@
export * from './dist/src/helpers/logger';

View File

@@ -0,0 +1,2 @@
/* eslint-disable */
module.exports = require('./dist/src/helpers/logger');

View File

@@ -0,0 +1,125 @@
{
"name": "@automatisch/backend",
"version": "0.1.0",
"description": "> TODO: description",
"scripts": {
"dev": "nodemon --watch 'src/**/*.ts' --watch 'bin/**/*.ts' --exec 'ts-node' src/server.ts --ext ts,json",
"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"
},
"dependencies": {
"@automatisch/web": "0.1.0",
"@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",
"@octokit/oauth-methods": "^1.2.6",
"@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",
"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": [
"bin",
"src",
"server.js",
"server.d.ts",
"logger.js",
"logger.d.ts",
"database.js",
"database.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.0",
"@types/bcrypt": "^5.0.0",
"@types/bull": "^3.15.8",
"@types/cors": "^2.8.12",
"@types/crypto-js": "^4.0.2",
"@types/express": "^4.17.13",
"@types/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"
},
"ava": {
"files": [
"test/**/*"
],
"extensions": [
"ts"
],
"require": [
"ts-node/register"
]
}
}

1
packages/backend/server.d.ts vendored Normal file
View File

@@ -0,0 +1 @@
export * from './dist/src/server';

View File

@@ -0,0 +1,2 @@
/* eslint-disable */
module.exports = require('./dist/src/server.js');

View 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.appEnv === 'development') {
createBullBoardHandler(serverAdapter);
}
const app = express();
if (appConfig.appEnv === 'development') {
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;

View 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

View 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;
}
}
}

View File

View 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);
}
}

View File

@@ -0,0 +1,218 @@
{
"name": "Discord",
"key": "discord",
"iconUrl": "{BASE_URL}/apps/discord/assets/favicon.svg",
"docUrl": "https://automatisch.io/docs/discord",
"primaryColor": "5865f2",
"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}"
}
]
}
]
}

View 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

View 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;
}
}
}

View File

View 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);
}
}

View File

@@ -0,0 +1,218 @@
{
"name": "Firebase",
"key": "firebase",
"iconUrl": "{BASE_URL}/apps/firebase/assets/favicon.svg",
"docUrl": "https://automatisch.io/docs/firebase",
"primaryColor": "ffca28",
"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}"
}
]
}
]
}

View 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

View 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;
}
}
}

View 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);
}
}

View 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,
}));
}
}

View File

@@ -0,0 +1 @@
declare module 'flickr-sdk';

View 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);
}
}

View File

@@ -0,0 +1,303 @@
{
"name": "Flickr",
"key": "flickr",
"iconUrl": "{BASE_URL}/apps/flickr/assets/favicon.svg",
"docUrl": "https://automatisch.io/docs/flickr",
"primaryColor": "000000",
"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": "chooseAccount",
"name": "Choose account"
},
{
"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": "chooseAccount",
"name": "Choose account"
},
{
"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": "chooseAccount",
"name": "Choose account"
},
{
"key": "testStep",
"name": "Test trigger"
}
]
},
{
"name": "New album",
"key": "newAlbum",
"description": "Triggers when you create a new album.",
"substeps": [
{
"key": "chooseAccount",
"name": "Choose account"
},
{
"key": "testStep",
"name": "Test trigger"
}
]
}
]
}

View 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);
}
}

View 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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View 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;
}
}

View 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

View File

@@ -0,0 +1,98 @@
import type {
IAuthentication,
IApp,
IField,
IJSONObject,
} from '@automatisch/types';
import {
getWebFlowAuthorizationUrl,
exchangeWebFlowCode,
checkToken,
} from '@octokit/oauth-methods';
export default class Authentication implements IAuthentication {
appData: IApp;
connectionData: IJSONObject;
scopes: string[] = [
'read:org',
'repo',
'user',
];
client: {
getWebFlowAuthorizationUrl: typeof getWebFlowAuthorizationUrl;
exchangeWebFlowCode: typeof exchangeWebFlowCode;
checkToken: typeof checkToken;
};
constructor(appData: IApp, connectionData: IJSONObject) {
this.connectionData = connectionData;
this.appData = appData;
this.client = {
getWebFlowAuthorizationUrl,
exchangeWebFlowCode,
checkToken,
};
}
get oauthRedirectUrl(): string {
return this.appData.fields.find(
(field: IField) => field.key == 'oAuthRedirectUrl'
).value;
}
async createAuthData(): Promise<{ url: string }> {
const { url } = await this.client.getWebFlowAuthorizationUrl({
clientType: 'oauth-app',
clientId: this.connectionData.consumerKey as string,
redirectUrl: this.oauthRedirectUrl,
scopes: this.scopes,
});
return {
url: url,
};
}
async verifyCredentials() {
const { data } = await this.client.exchangeWebFlowCode({
clientType: 'oauth-app',
clientId: this.connectionData.consumerKey as string,
clientSecret: this.connectionData.consumerSecret as string,
code: this.connectionData.oauthVerifier as string,
});
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() {
return this.client.checkToken({
clientType: 'oauth-app',
clientId: this.connectionData.consumerKey as string,
clientSecret: this.connectionData.consumerSecret as string,
token: this.connectionData.accessToken as string,
});
}
async isStillVerified() {
try {
await this.getTokenInfo();
return true;
} catch {
return false;
}
}
}

View File

@@ -0,0 +1,13 @@
import { IJSONObject } from '@automatisch/types';
import ListRepos from './data/list-repos';
import ListBranches from './data/list-branches';
export default class Data {
listRepos: ListRepos;
listBranches: ListBranches;
constructor(connectionData: IJSONObject, parameters: IJSONObject) {
this.listRepos = new ListRepos(connectionData);
this.listBranches = new ListBranches(connectionData, parameters);
}
}

View 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,
}));
}
}

View 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,
}));
}
}

View File

View 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);
}
}

View File

@@ -0,0 +1,654 @@
{
"name": "Github",
"key": "github",
"iconUrl": "{BASE_URL}/apps/github/assets/favicon.svg",
"docUrl": "https://automatisch.io/docs/github",
"primaryColor": "000000",
"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": "Consumer Key",
"type": "string",
"required": true,
"readOnly": false,
"value": null,
"placeholder": null,
"description": null,
"docUrl": "https://automatisch.io/docs/github#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/github#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}"
}
]
}
],
"triggers": [
{
"name": "New repository",
"key": "newRepository",
"description": "Triggers when a new repository is created",
"substeps": [
{
"key": "chooseAccount",
"name": "Choose account"
},
{
"key": "testStep",
"name": "Test trigger"
}
]
},
{
"name": "New organization",
"key": "newOrganization",
"description": "Triggers when a new organization is created",
"substeps": [
{
"key": "chooseAccount",
"name": "Choose account"
},
{
"key": "testStep",
"name": "Test trigger"
}
]
},
{
"name": "New branch",
"key": "newBranch",
"description": "Triggers when a new branch is created",
"substeps": [
{
"key": "chooseAccount",
"name": "Choose account"
},
{
"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": "chooseAccount",
"name": "Choose account"
},
{
"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": "chooseAccount",
"name": "Choose account"
},
{
"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": "chooseAccount",
"name": "Choose account"
},
{
"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": "chooseAccount",
"name": "Choose account"
},
{
"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": "chooseAccount",
"name": "Choose account"
},
{
"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": "chooseAccount",
"name": "Choose account"
},
{
"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": "chooseAccount",
"name": "Choose account"
},
{
"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": "chooseAccount",
"name": "Choose account"
},
{
"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": "chooseAccount",
"name": "Choose account"
},
{
"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"
}
]
}
]
}

View File

@@ -0,0 +1,43 @@
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';
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;
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);
}
}

View 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;
}
}

View File

@@ -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;
}
}

View 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 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;
}
}

View 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;
}
}

View 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;
}
}

View 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;
}
}

View File

@@ -0,0 +1,86 @@
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;
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);
}
get hasRepo() {
return this.repoOwner && this.repo;
}
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);
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View 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;
}
}

View 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;
}
}

View 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;
}
}

View File

@@ -0,0 +1,9 @@
export function assignOwnerAndRepo<T extends { repoOwner?: string; repo?: string; }>(object: T, repoFullName: string): T {
if (object && repoFullName) {
const [repoOwner, repo] = repoFullName.split('/');
object.repoOwner = repoOwner;
object.repo = repo;
}
return object;
}

View File

@@ -0,0 +1,13 @@
import { IJSONObject } from '@automatisch/types';
import FindProjectMergeRequests from './actions/find-project-merge-requests';
export default class Actions {
findProjectMergeRequests: FindProjectMergeRequests;
constructor(connectionData: IJSONObject, parameters: IJSONObject) {
this.findProjectMergeRequests = new FindProjectMergeRequests(
connectionData,
parameters
);
}
}

View File

@@ -0,0 +1,35 @@
import { Gitlab } from '@gitbeaker/node';
import { IJSONObject } from '@automatisch/types';
export default class FindProjectMergeRequests {
client: any;
projectId: number;
state: string;
constructor(connectionData: IJSONObject, parameters: IJSONObject) {
if (connectionData?.accessToken) {
this.client = new Gitlab({
host: `https://${connectionData.host}`,
oauthToken: connectionData?.accessToken as string,
});
}
if (parameters.project) {
this.projectId = parameters.project as number;
}
if (parameters.state) {
this.state = parameters.state as string;
}
}
async run() {
const mergeRequests = await this.client.MergeRequests.all({
state: this.state,
projectId: this.projectId,
maxPages: 1,
});
return { data: mergeRequests };
}
}

View 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

View 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;
}
}
}

View File

@@ -0,0 +1,10 @@
import { IJSONObject } from '@automatisch/types';
import ListProjects from './data/list-projects';
export default class Data {
listProjects: ListProjects;
constructor(connectionData: IJSONObject, parameters?: IJSONObject) {
this.listProjects = new ListProjects(connectionData, parameters);
}
}

View File

@@ -0,0 +1,26 @@
import { Gitlab } from '@gitbeaker/node';
import type { IJSONObject } from '@automatisch/types';
export default class ListProjects {
client?: any;
constructor(connectionData: IJSONObject, parameters?: IJSONObject) {
if (connectionData?.accessToken) {
this.client = new Gitlab({
host: `https://${connectionData.host}`,
oauthToken: connectionData?.accessToken as string,
});
}
}
async run() {
const projects = await this.client.Projects.all({
membership: true,
});
return projects.map((project: any) => ({
value: project.id,
name: project.name_with_namespace,
}));
}
}

View File

View File

@@ -0,0 +1,25 @@
import {
IService,
IAuthentication,
IApp,
IJSONObject,
} from '@automatisch/types';
import Authentication from './authentication';
import Actions from './actions';
import Data from './data';
export default class Gitlab implements IService {
authenticationClient: IAuthentication;
actions: Actions;
data: Data;
constructor(
appData: IApp,
connectionData: IJSONObject,
parameters: IJSONObject
) {
this.authenticationClient = new Authentication(appData, connectionData);
this.actions = new Actions(connectionData, parameters);
this.data = new Data(connectionData, parameters);
}
}

View File

@@ -0,0 +1,309 @@
{
"name": "GitLab",
"key": "gitlab",
"iconUrl": "{BASE_URL}/apps/gitlab/assets/favicon.svg",
"docUrl": "https://automatisch.io/docs/gitlab",
"primaryColor": "2DAAE1",
"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}"
}
]
}
],
"actions": [
{
"name": "Find project merge requests",
"key": "findProjectMergeRequests",
"description": "Find merge requests for a project.",
"substeps": [
{
"key": "chooseAccount",
"name": "Choose account"
},
{
"key": "setupAction",
"name": "Set up action",
"arguments": [
{
"label": "Project",
"key": "project",
"type": "dropdown",
"required": true,
"description": "Search for merge requests in this project.",
"variables": false,
"source": {
"type": "query",
"name": "getData",
"arguments": [
{
"name": "key",
"value": "listProjects"
}
]
}
},
{
"label": "State",
"key": "state",
"type": "dropdown",
"required": true,
"description": "Filter merge requests by their state.",
"variables": false,
"options": [
{
"label": "All",
"value": "all"
},
{
"label": "Opened",
"value": "opened"
},
{
"label": "Closed",
"value": "closed"
},
{
"label": "Locked",
"value": "locked"
},
{
"label": "Merged",
"value": "merged"
}
]
}
]
},
{
"key": "testStep",
"name": "Test action"
}
]
}
]
}

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 13 KiB

View 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;
}
}
}

View File

View 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);
}
}

View File

@@ -0,0 +1,200 @@
{
"name": "PostgreSQL",
"key": "postgresql",
"iconUrl": "{BASE_URL}/apps/postgresql/assets/favicon.svg",
"docUrl": "https://automatisch.io/docs/postgresql",
"primaryColor": "2DAAE1",
"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}"
}
]
}
]
}

View 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

View File

View File

@@ -0,0 +1,18 @@
import Triggers from './triggers';
import {
IService,
IApp,
IJSONObject,
} from '@automatisch/types';
export default class Schedule implements IService {
triggers: Triggers;
constructor(
appData: IApp,
connectionData: IJSONObject,
parameters: IJSONObject
) {
this.triggers = new Triggers(connectionData, parameters);
}
}

View File

@@ -0,0 +1,606 @@
{
"name": "Schedule",
"key": "schedule",
"iconUrl": "{BASE_URL}/apps/schedule/assets/favicon.svg",
"docUrl": "https://automatisch.io/docs/schedule",
"primaryColor": "0059F7",
"requiresAuthentication": false,
"triggers": [
{
"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"
}
]
},
{
"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"
}
]
},
{
"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"
}
]
},
{
"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"
}
]
}
]
}

View File

@@ -0,0 +1,19 @@
import { IJSONObject } from '@automatisch/types';
import EveryHour from './triggers/every-hour';
import EveryDay from './triggers/every-day';
import EveryWeek from './triggers/every-week';
import EveryMonth from './triggers/every-month';
export default class Triggers {
everyHour: EveryHour;
everyDay: EveryDay;
everyWeek: EveryWeek;
everyMonth: EveryMonth;
constructor(connectionData: IJSONObject, parameters: IJSONObject) {
this.everyHour = new EveryHour(parameters);
this.everyDay = new EveryDay(parameters);
this.everyWeek = new EveryWeek(parameters);
this.everyMonth = new EveryMonth(parameters);
}
}

View File

@@ -0,0 +1,40 @@
import { DateTime } from 'luxon';
import type { IJSONObject, IJSONValue, ITrigger } from '@automatisch/types';
import { cronTimes, getNextCronDateTime, getDateTimeObjectRepresentation } from '../utils';
export default class EveryDay implements ITrigger {
triggersOnWeekend?: boolean;
hour?: number;
constructor(parameters: IJSONObject) {
if (parameters.triggersOnWeekend) {
this.triggersOnWeekend = parameters.triggersOnWeekend as boolean;
}
if (parameters.hour) {
this.hour = parameters.hour as number;
}
}
get interval() {
if (this.triggersOnWeekend) {
return cronTimes.everyDayAt(this.hour);
}
return cronTimes.everyDayExcludingWeekendsAt(this.hour);
}
async run(startDateTime: Date) {
const dateTime = DateTime.fromJSDate(startDateTime);
const dateTimeObjectRepresentation = getDateTimeObjectRepresentation(dateTime) as IJSONValue;
return [dateTimeObjectRepresentation] as IJSONValue;
}
async testRun() {
const nextCronDateTime = getNextCronDateTime(this.interval);
const dateTimeObjectRepresentation = getDateTimeObjectRepresentation(nextCronDateTime) as IJSONValue;
return [dateTimeObjectRepresentation] as IJSONValue;
}
}

View File

@@ -0,0 +1,35 @@
import { DateTime } from 'luxon';
import type { IJSONObject, IJSONValue, ITrigger } from '@automatisch/types';
import { cronTimes, getNextCronDateTime, getDateTimeObjectRepresentation } from '../utils';
export default class EveryHour implements ITrigger {
triggersOnWeekend?: boolean | string;
constructor(parameters: IJSONObject) {
if (parameters.triggersOnWeekend) {
this.triggersOnWeekend = parameters.triggersOnWeekend as string;
}
}
get interval() {
if (this.triggersOnWeekend) {
return cronTimes.everyHour;
}
return cronTimes.everyHourExcludingWeekends;
}
async run(startDateTime: Date) {
const dateTime = DateTime.fromJSDate(startDateTime);
const dateTimeObjectRepresentation = getDateTimeObjectRepresentation(dateTime) as IJSONValue;
return [dateTimeObjectRepresentation] as IJSONValue;
}
async testRun() {
const nextCronDateTime = getNextCronDateTime(this.interval);
const dateTimeObjectRepresentation = getDateTimeObjectRepresentation(nextCronDateTime) as IJSONValue;
return [dateTimeObjectRepresentation] as IJSONValue;
}
}

View File

@@ -0,0 +1,36 @@
import { DateTime } from 'luxon';
import type { IJSONObject, IJSONValue, ITrigger } from '@automatisch/types';
import { cronTimes, getNextCronDateTime, getDateTimeObjectRepresentation } from '../utils';
export default class EveryMonth implements ITrigger {
day?: number;
hour?: number;
constructor(parameters: IJSONObject) {
if (parameters.day) {
this.day = parameters.day as number;
}
if (parameters.hour) {
this.hour = parameters.hour as number;
}
}
get interval() {
return cronTimes.everyMonthOnAndAt(this.day, this.hour);
}
async run(startDateTime: Date) {
const dateTime = DateTime.fromJSDate(startDateTime);
const dateTimeObjectRepresentation = getDateTimeObjectRepresentation(dateTime) as IJSONValue;
return [dateTimeObjectRepresentation] as IJSONValue;
}
async testRun() {
const nextCronDateTime = getNextCronDateTime(this.interval);
const dateTimeObjectRepresentation = getDateTimeObjectRepresentation(nextCronDateTime) as IJSONValue;
return [dateTimeObjectRepresentation] as IJSONValue;
}
}

View File

@@ -0,0 +1,36 @@
import { DateTime } from 'luxon';
import type { IJSONObject, IJSONValue, ITrigger } from '@automatisch/types';
import { cronTimes, getNextCronDateTime, getDateTimeObjectRepresentation } from '../utils';
export default class EveryWeek implements ITrigger {
weekday?: number;
hour?: number;
constructor(parameters: IJSONObject) {
if (parameters.weekday) {
this.weekday = parameters.weekday as number;
}
if (parameters.hour) {
this.hour = parameters.hour as number;
}
}
get interval() {
return cronTimes.everyWeekOnAndAt(this.weekday, this.hour);
}
async run(startDateTime: Date) {
const dateTime = DateTime.fromJSDate(startDateTime);
const dateTimeObjectRepresentation = getDateTimeObjectRepresentation(dateTime) as IJSONValue;
return [dateTimeObjectRepresentation] as IJSONValue;
}
async testRun() {
const nextCronDateTime = getNextCronDateTime(this.interval);
const dateTimeObjectRepresentation = getDateTimeObjectRepresentation(nextCronDateTime) as IJSONValue;
return [dateTimeObjectRepresentation] as IJSONValue;
}
}

View File

@@ -0,0 +1,32 @@
import { DateTime } from 'luxon';
import cronParser from 'cron-parser';
export 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 function getNextCronDateTime(cronString: string) {
const cronDate = cronParser.parseExpression(cronString);
const matchingNextCronDateTime = cronDate.next();
const matchingNextDateTime = DateTime.fromJSDate(matchingNextCronDateTime.toDate());
return matchingNextDateTime;
};
export 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,
};
}

View File

@@ -0,0 +1,13 @@
import SendMessageToChannel from './actions/send-message-to-channel';
import { IJSONObject } from '@automatisch/types';
export default class Actions {
sendMessageToChannel: SendMessageToChannel;
constructor(connectionData: IJSONObject, parameters: IJSONObject) {
this.sendMessageToChannel = new SendMessageToChannel(
connectionData,
parameters
);
}
}

View File

@@ -0,0 +1,21 @@
import { WebClient } from '@slack/web-api';
import { IJSONObject } from '@automatisch/types';
export default class SendMessageToChannel {
client: WebClient;
parameters: IJSONObject;
constructor(connectionData: IJSONObject, parameters: IJSONObject) {
this.client = new WebClient(connectionData.accessToken as string);
this.parameters = parameters;
}
async run() {
const result = await this.client.chat.postMessage({
channel: this.parameters.channel as string,
text: this.parameters.message as string,
});
return result;
}
}

View File

@@ -0,0 +1,7 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
aria-label="Slack" role="img"
viewBox="0 0 512 512"><rect
width="512" height="512"
rx="15%"
fill="#fff"/><g fill="#e01e5a"><path id="a" d="M149 305a39 39 0 01-78 0c0-22 17 -39 39 -39h39zM168 305a39 39 0 0178 0v97a39 39 0 01-78 0z"/></g><use xlink:href="#a" fill="#36c5f0" transform="rotate(90,256,256)"/><use xlink:href="#a" fill="#2eb67d" transform="rotate(180,256,256)"/><use xlink:href="#a" fill="#ecb22e" transform="rotate(270,256,256)"/></svg>

After

Width:  |  Height:  |  Size: 533 B

View File

@@ -0,0 +1,39 @@
import type { IAuthentication, IApp, IJSONObject } from '@automatisch/types';
import { WebClient } from '@slack/web-api';
export default class Authentication implements IAuthentication {
appData: IApp;
connectionData: IJSONObject;
client: WebClient;
constructor(appData: IApp, connectionData: IJSONObject) {
this.client = new WebClient();
this.connectionData = connectionData;
this.appData = appData;
}
async verifyCredentials() {
const { bot_id: botId, user: screenName } = await this.client.auth.test({
token: this.connectionData.accessToken as string,
});
return {
botId,
screenName,
token: this.connectionData.accessToken,
};
}
async isStillVerified() {
try {
await this.client.auth.test({
token: this.connectionData.accessToken as string,
});
return true;
} catch (error) {
return false;
}
}
}

View File

@@ -0,0 +1,10 @@
import ListChannels from './data/list-channels';
import { IJSONObject } from '@automatisch/types';
export default class Data {
listChannels: ListChannels;
constructor(connectionData: IJSONObject) {
this.listChannels = new ListChannels(connectionData);
}
}

View File

@@ -0,0 +1,21 @@
import type { IJSONObject } from '@automatisch/types';
import { WebClient } from '@slack/web-api';
export default class ListChannels {
client: WebClient;
constructor(connectionData: IJSONObject) {
this.client = new WebClient(connectionData.accessToken as string);
}
async run() {
const { channels } = await this.client.conversations.list();
return channels.map((channel) => {
return {
value: channel.id,
name: channel.name,
};
});
}
}

Some files were not shown because too many files have changed in this diff Show More