Compare commits
287 Commits
stringify-
...
AUT-1324
Author | SHA1 | Date | |
---|---|---|---|
![]() |
d31309a92d | ||
![]() |
0234b4ad81 | ||
![]() |
59ee9c21f3 | ||
![]() |
00317fed24 | ||
![]() |
42f6311ca8 | ||
![]() |
0f77a1ec03 | ||
![]() |
8268cd4d09 | ||
![]() |
c868070337 | ||
![]() |
623ec66a79 | ||
![]() |
b51bae14ec | ||
![]() |
9250456e7b | ||
![]() |
163d6a7a28 | ||
![]() |
4ce9976dbc | ||
![]() |
f6490990de | ||
![]() |
f24ff606ac | ||
![]() |
3ff53744b5 | ||
![]() |
0b33c10ed8 | ||
![]() |
3fa87701ed | ||
![]() |
e5e0c6fa2a | ||
![]() |
0b38a0b6af | ||
![]() |
44b228777a | ||
![]() |
dd4f658d14 | ||
![]() |
9c66f47bca | ||
![]() |
138a34d6a4 | ||
![]() |
8f2af2e863 | ||
![]() |
c732fe16b3 | ||
![]() |
9be75e56e7 | ||
![]() |
e7d1f26034 | ||
![]() |
c554fff048 | ||
![]() |
0268521aaa | ||
![]() |
89b1cb9353 | ||
![]() |
8a17c5eaab | ||
![]() |
f4a1ad6c8c | ||
![]() |
93d76d8d79 | ||
![]() |
0b956a71b9 | ||
![]() |
26be72f76d | ||
![]() |
737391c721 | ||
![]() |
9c1d21fd1b | ||
![]() |
ef4a4c8611 | ||
![]() |
13c0a8ceaa | ||
![]() |
c2976080f6 | ||
![]() |
0a1b6931af | ||
![]() |
5009319f91 | ||
![]() |
4db8683bd6 | ||
![]() |
d35cf8d31e | ||
![]() |
5fef16131a | ||
![]() |
8b2235ee26 | ||
![]() |
2d8faf849e | ||
![]() |
c9de9fa185 | ||
![]() |
0618877d58 | ||
![]() |
f6b4e7eef8 | ||
![]() |
7abe44da19 | ||
![]() |
9006a0c25f | ||
![]() |
f8389ff8ab | ||
![]() |
894afe8f92 | ||
![]() |
115394ac8c | ||
![]() |
de42eda65f | ||
![]() |
0b7591edce | ||
![]() |
a043a044ca | ||
![]() |
b1f2727beb | ||
![]() |
d6e78a48a0 | ||
![]() |
589fe0f5f3 | ||
![]() |
244eeeb816 | ||
![]() |
4d5fc50f1a | ||
![]() |
dc0273148c | ||
![]() |
5e6f4bfb88 | ||
![]() |
bc0e18d074 | ||
![]() |
24d09fda4c | ||
![]() |
5e20ac07d1 | ||
![]() |
37c78e6bbd | ||
![]() |
7dcfb1081b | ||
![]() |
01407cf040 | ||
![]() |
eb814c2fb0 | ||
![]() |
d3caadf4af | ||
![]() |
5769c82fca | ||
![]() |
3754783ce2 | ||
![]() |
55ebe2cc0b | ||
![]() |
23c1a42163 | ||
![]() |
c879ffa768 | ||
![]() |
32f7bbfbab | ||
![]() |
84d5b3b158 | ||
![]() |
c8dae9ea9a | ||
![]() |
cbfb5dd8a6 | ||
![]() |
09b2b7350c | ||
![]() |
e146793d32 | ||
![]() |
0bad2ead10 | ||
![]() |
25176884e7 | ||
![]() |
266d4cddb0 | ||
![]() |
6e529a4205 | ||
![]() |
d2cce278bd | ||
![]() |
b774a62f8c | ||
![]() |
66c12e1a92 | ||
![]() |
184d748890 | ||
![]() |
8cc732c8d1 | ||
![]() |
c688d67e4b | ||
![]() |
3408be2840 | ||
![]() |
e126066132 | ||
![]() |
cfec447d8a | ||
![]() |
805d1fdd52 | ||
![]() |
9299948072 | ||
![]() |
b02960a5ec | ||
![]() |
8134b6db6a | ||
![]() |
cd16a3cc15 | ||
![]() |
074e7828f3 | ||
![]() |
5f7d1f9219 | ||
![]() |
b29c6105a1 | ||
![]() |
1297f5d43c | ||
![]() |
f94a5385d7 | ||
![]() |
8ef2000e45 | ||
![]() |
30d496076b | ||
![]() |
5de06d4482 | ||
![]() |
97fa983305 | ||
![]() |
dccc3c5bc1 | ||
![]() |
ed12465975 | ||
![]() |
b78be222d7 | ||
![]() |
342990e1bf | ||
![]() |
2e5dfdbb0d | ||
![]() |
1790ef0ee6 | ||
![]() |
712a5756e2 | ||
![]() |
bf6ff6b0f7 | ||
![]() |
c6003b6695 | ||
![]() |
8352540fcb | ||
![]() |
22299868fa | ||
![]() |
0d126a8e2b | ||
![]() |
776d027dfa | ||
![]() |
fa9b6d1006 | ||
![]() |
89aa7ffc73 | ||
![]() |
fd971449ca | ||
![]() |
f7cd57e549 | ||
![]() |
34aadbfb09 | ||
![]() |
167195a01c | ||
![]() |
b0abf94191 | ||
![]() |
1009c71e72 | ||
![]() |
29b1695159 | ||
![]() |
44f782221f | ||
![]() |
bab25c51d9 | ||
![]() |
89277e1665 | ||
![]() |
1e9c5a1682 | ||
![]() |
0c75486c7a | ||
![]() |
8c39739880 | ||
![]() |
ace1f84094 | ||
![]() |
2cfd6739ca | ||
![]() |
e0d6f0d653 | ||
![]() |
a4d3b387d0 | ||
![]() |
7394aca02d | ||
![]() |
e812725182 | ||
![]() |
bb76bfcd8b | ||
![]() |
6ff6d0a7dc | ||
![]() |
ddc9867058 | ||
![]() |
ba0d46c6cd | ||
![]() |
369f04fdbc | ||
![]() |
09dd8abe23 | ||
![]() |
8c692758ae | ||
![]() |
32d39b88bd | ||
![]() |
8bd66da511 | ||
![]() |
f86799e494 | ||
![]() |
8d10f26f56 | ||
![]() |
297543f9dd | ||
![]() |
0c53ee8460 | ||
![]() |
862842e3e1 | ||
![]() |
a4fad360df | ||
![]() |
3ba4c8b3bf | ||
![]() |
2992236be4 | ||
![]() |
82161f028e | ||
![]() |
1bcaec144b | ||
![]() |
852d4bba0a | ||
![]() |
af56fa2830 | ||
![]() |
813646e392 | ||
![]() |
1ce31eefc6 | ||
![]() |
fdf53844e1 | ||
![]() |
be57a82302 | ||
![]() |
fb82e863e0 | ||
![]() |
101483409f | ||
![]() |
6fe863eec1 | ||
![]() |
fbb6526aac | ||
![]() |
5556aea913 | ||
![]() |
95dc5fb849 | ||
![]() |
062199d0e3 | ||
![]() |
53ce327516 | ||
![]() |
61a1ce57c2 | ||
![]() |
687295f772 | ||
![]() |
e5366534ed | ||
![]() |
66fe84e126 | ||
![]() |
0b6c28422c | ||
![]() |
ea667bb6a9 | ||
![]() |
c9ba219de1 | ||
![]() |
9df1b29d70 | ||
![]() |
3e34359fa9 | ||
![]() |
1818930d2f | ||
![]() |
c03e674001 | ||
![]() |
10a25b82e0 | ||
![]() |
3b2489d738 | ||
![]() |
5c4ca3c84f | ||
![]() |
06c4b7ed2e | ||
![]() |
5591f6ccc9 | ||
![]() |
63dfb6947e | ||
![]() |
b089069b8e | ||
![]() |
e76a99fd68 | ||
![]() |
a4ea6c1fad | ||
![]() |
64ebdce1b2 | ||
![]() |
2709491d59 | ||
![]() |
81beedede6 | ||
![]() |
33a2386d74 | ||
![]() |
0df5e5283e | ||
![]() |
560407b972 | ||
![]() |
f8c25ae508 | ||
![]() |
c524277665 | ||
![]() |
a70fb009c7 | ||
![]() |
11e67f2ea3 | ||
![]() |
e7118ffe15 | ||
![]() |
79e9455244 | ||
![]() |
6ca8e8958a | ||
![]() |
d3dc207166 | ||
![]() |
51e200533b | ||
![]() |
b8a25b87d8 | ||
![]() |
f4fe0a0d4f | ||
![]() |
1d4f829d29 | ||
![]() |
4afa79fca4 | ||
![]() |
ec22184087 | ||
![]() |
413f3db5b4 | ||
![]() |
8ddfcce787 | ||
![]() |
562341adfe | ||
![]() |
9519ec53ef | ||
![]() |
35bada360d | ||
![]() |
1f39765efe | ||
![]() |
cce5b3b533 | ||
![]() |
e77a03b855 | ||
![]() |
7a54ff212e | ||
![]() |
01340f4597 | ||
![]() |
af6fa80d20 | ||
![]() |
e7474dcb9e | ||
![]() |
0eb906d5df | ||
![]() |
c7babf227c | ||
![]() |
d5c81c14f5 | ||
![]() |
59278378e5 | ||
![]() |
990e69143d | ||
![]() |
c413ae06dc | ||
![]() |
456f8a30cc | ||
![]() |
19c4561feb | ||
![]() |
1392fed023 | ||
![]() |
ca81e14d63 | ||
![]() |
8e7a8a02ec | ||
![]() |
e45dfa94ed | ||
![]() |
a153787ae6 | ||
![]() |
cf37c43bc7 | ||
![]() |
d0aa2bca69 | ||
![]() |
7b3811e6ee | ||
![]() |
4054f551d4 | ||
![]() |
4eeda10f3f | ||
![]() |
4231784ed2 | ||
![]() |
61ff6986d3 | ||
![]() |
09bc0bba1e | ||
![]() |
b2bda8479e | ||
![]() |
09b255f99e | ||
![]() |
0800642a2a | ||
![]() |
48b2b006c0 | ||
![]() |
af4c1f08ec | ||
![]() |
87b26b6342 | ||
![]() |
706fb8d82f | ||
![]() |
f7ca59bd5f | ||
![]() |
6540d0ea53 | ||
![]() |
5995038e21 | ||
![]() |
337ba6ea87 | ||
![]() |
04c6183752 | ||
![]() |
0b63922f46 | ||
![]() |
81c39d7d93 | ||
![]() |
164d31dfbc | ||
![]() |
1a833aad52 | ||
![]() |
77246c1fde | ||
![]() |
56c08a3587 | ||
![]() |
ce6214dc0f | ||
![]() |
22002d50ac | ||
![]() |
ab4e94695d | ||
![]() |
47a01cec7e | ||
![]() |
0cf9bc1a32 | ||
![]() |
6552ebcd3c | ||
![]() |
5af1d94fc0 | ||
![]() |
a4ec7b3047 | ||
![]() |
66f5003d91 | ||
![]() |
0c754e4b4b | ||
![]() |
e008087c4a | ||
![]() |
53f63996bd | ||
![]() |
4fedf77991 | ||
![]() |
34331d8763 | ||
![]() |
2c21b7762c | ||
![]() |
7f9c2b687f | ||
![]() |
b452ed648c |
4
.github/workflows/playwright.yml
vendored
4
.github/workflows/playwright.yml
vendored
@@ -12,6 +12,9 @@ on:
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
BULLMQ_DASHBOARD_USERNAME: root
|
||||
BULLMQ_DASHBOARD_PASSWORD: sample
|
||||
ENABLE_BULLMQ_DASHBOARD: true
|
||||
ENCRYPTION_KEY: sample_encryption_key
|
||||
WEBHOOK_SECRET_KEY: sample_webhook_secret_key
|
||||
APP_SECRET_KEY: sample_app_secret_key
|
||||
@@ -22,6 +25,7 @@ env:
|
||||
POSTGRES_PASSWORD: automatisch_password
|
||||
REDIS_HOST: localhost
|
||||
APP_ENV: production
|
||||
PORT: 3000
|
||||
LICENSE_KEY: dummy_license_key
|
||||
|
||||
jobs:
|
||||
|
@@ -10,7 +10,7 @@ import process from 'process';
|
||||
async function fetchAdminRole() {
|
||||
const role = await Role.query()
|
||||
.where({
|
||||
key: 'admin',
|
||||
name: 'Admin',
|
||||
})
|
||||
.limit(1)
|
||||
.first();
|
||||
|
@@ -11,6 +11,7 @@
|
||||
"start:worker": "node src/worker.js",
|
||||
"pretest": "APP_ENV=test node ./test/setup/prepare-test-env.js",
|
||||
"test": "APP_ENV=test vitest run",
|
||||
"test:watch": "APP_ENV=test vitest watch",
|
||||
"lint": "eslint .",
|
||||
"db:create": "node ./bin/database/create.js",
|
||||
"db:seed:user": "node ./bin/database/seed-user.js",
|
||||
@@ -22,8 +23,6 @@
|
||||
"dependencies": {
|
||||
"@bull-board/express": "^3.10.1",
|
||||
"@casl/ability": "^6.5.0",
|
||||
"@graphql-tools/graphql-file-loader": "^7.3.4",
|
||||
"@graphql-tools/load": "^7.5.2",
|
||||
"@node-saml/passport-saml": "^4.0.4",
|
||||
"@rudderstack/rudder-sdk-node": "^1.1.2",
|
||||
"@sentry/node": "^7.42.0",
|
||||
@@ -38,13 +37,9 @@
|
||||
"debug": "~2.6.9",
|
||||
"dotenv": "^10.0.0",
|
||||
"express": "~4.18.2",
|
||||
"express-async-handler": "^1.2.0",
|
||||
"express-async-errors": "^3.1.1",
|
||||
"express-basic-auth": "^1.2.1",
|
||||
"express-graphql": "^0.12.0",
|
||||
"fast-xml-parser": "^4.0.11",
|
||||
"graphql-middleware": "^6.1.15",
|
||||
"graphql-shield": "^7.5.0",
|
||||
"graphql-tools": "^8.2.0",
|
||||
"handlebars": "^4.7.7",
|
||||
"http-errors": "~1.6.3",
|
||||
"http-proxy-agent": "^7.0.0",
|
||||
@@ -106,7 +101,9 @@
|
||||
"access": "public"
|
||||
},
|
||||
"nodemonConfig": {
|
||||
"watch": [ "src/" ],
|
||||
"watch": [
|
||||
"src/"
|
||||
],
|
||||
"ext": "js"
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,6 @@
|
||||
import createError from 'http-errors';
|
||||
import express from 'express';
|
||||
import 'express-async-errors';
|
||||
import cors from 'cors';
|
||||
|
||||
import appConfig from './config/app.js';
|
||||
|
@@ -12,7 +12,7 @@ export default defineApp({
|
||||
apiBaseUrl: 'https://api.airtable.com',
|
||||
iconUrl: '{BASE_URL}/apps/airtable/assets/favicon.svg',
|
||||
authDocUrl: '{DOCS_URL}/apps/airtable/connection',
|
||||
primaryColor: 'FFBF00',
|
||||
primaryColor: '#FFBF00',
|
||||
supportsConnections: true,
|
||||
beforeRequest: [addAuthHeader],
|
||||
auth,
|
||||
|
@@ -12,7 +12,7 @@ export default defineApp({
|
||||
apiBaseUrl: 'https://cloud.appwrite.io',
|
||||
iconUrl: '{BASE_URL}/apps/appwrite/assets/favicon.svg',
|
||||
authDocUrl: '{DOCS_URL}/apps/appwrite/connection',
|
||||
primaryColor: 'FD366E',
|
||||
primaryColor: '#FD366E',
|
||||
supportsConnections: true,
|
||||
beforeRequest: [setBaseUrl, addAuthHeader],
|
||||
auth,
|
||||
|
@@ -12,7 +12,7 @@ export default defineApp({
|
||||
apiBaseUrl: '',
|
||||
iconUrl: '{BASE_URL}/apps/azure-openai/assets/favicon.svg',
|
||||
authDocUrl: '{DOCS_URL}/apps/azure-openai/connection',
|
||||
primaryColor: '000000',
|
||||
primaryColor: '#000000',
|
||||
supportsConnections: true,
|
||||
beforeRequest: [setBaseUrl, addAuthHeader],
|
||||
auth,
|
||||
|
@@ -11,7 +11,7 @@ export default defineApp({
|
||||
supportsConnections: true,
|
||||
baseUrl: 'https://carbone.io',
|
||||
apiBaseUrl: 'https://api.carbone.io',
|
||||
primaryColor: '6f42c1',
|
||||
primaryColor: '#6f42c1',
|
||||
beforeRequest: [addAuthHeader],
|
||||
auth,
|
||||
actions,
|
||||
|
@@ -12,8 +12,8 @@ export default defineApp({
|
||||
baseUrl: 'https://clickup.com',
|
||||
apiBaseUrl: 'https://api.clickup.com/api',
|
||||
iconUrl: '{BASE_URL}/apps/clickup/assets/favicon.svg',
|
||||
authDocUrl: 'https://automatisch.io/docs/apps/clickup/connection',
|
||||
primaryColor: 'FD71AF',
|
||||
authDocUrl: '{DOCS_URL}/apps/clickup/connection',
|
||||
primaryColor: '#FD71AF',
|
||||
supportsConnections: true,
|
||||
beforeRequest: [addAuthHeader],
|
||||
auth,
|
||||
|
@@ -33,6 +33,7 @@ export default defineAction({
|
||||
type: 'string',
|
||||
required: true,
|
||||
variables: true,
|
||||
valueType: 'parse',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@@ -8,7 +8,7 @@ export default defineApp({
|
||||
apiBaseUrl: '',
|
||||
iconUrl: '{BASE_URL}/apps/code/assets/favicon.svg',
|
||||
authDocUrl: '{DOCS_URL}/apps/code/connection',
|
||||
primaryColor: '000000',
|
||||
primaryColor: '#000000',
|
||||
supportsConnections: false,
|
||||
actions,
|
||||
});
|
||||
|
@@ -9,6 +9,6 @@ export default defineApp({
|
||||
supportsConnections: false,
|
||||
baseUrl: '',
|
||||
apiBaseUrl: '',
|
||||
primaryColor: '001F52',
|
||||
primaryColor: '#001F52',
|
||||
actions,
|
||||
});
|
||||
|
@@ -9,6 +9,6 @@ export default defineApp({
|
||||
supportsConnections: false,
|
||||
baseUrl: '',
|
||||
apiBaseUrl: '',
|
||||
primaryColor: '001F52',
|
||||
primaryColor: '#001F52',
|
||||
actions,
|
||||
});
|
||||
|
@@ -11,7 +11,7 @@ export default defineApp({
|
||||
supportsConnections: true,
|
||||
baseUrl: 'https://deepl.com',
|
||||
apiBaseUrl: 'https://api.deepl.com',
|
||||
primaryColor: '0d2d45',
|
||||
primaryColor: '#0d2d45',
|
||||
beforeRequest: [addAuthHeader],
|
||||
auth,
|
||||
actions,
|
||||
|
@@ -9,6 +9,6 @@ export default defineApp({
|
||||
supportsConnections: false,
|
||||
baseUrl: '',
|
||||
apiBaseUrl: '',
|
||||
primaryColor: '001F52',
|
||||
primaryColor: '#001F52',
|
||||
actions,
|
||||
});
|
||||
|
@@ -14,7 +14,7 @@ export default defineApp({
|
||||
supportsConnections: true,
|
||||
baseUrl: 'https://discord.com',
|
||||
apiBaseUrl: 'https://discord.com/api',
|
||||
primaryColor: '5865f2',
|
||||
primaryColor: '#5865f2',
|
||||
beforeRequest: [addAuthHeader],
|
||||
auth,
|
||||
dynamicData,
|
||||
|
@@ -11,7 +11,7 @@ export default defineApp({
|
||||
apiBaseUrl: 'https://disqus.com/api',
|
||||
iconUrl: '{BASE_URL}/apps/disqus/assets/favicon.svg',
|
||||
authDocUrl: '{DOCS_URL}/apps/disqus/connection',
|
||||
primaryColor: '2E9FFF',
|
||||
primaryColor: '#2E9FFF',
|
||||
supportsConnections: true,
|
||||
beforeRequest: [addAuthHeader],
|
||||
auth,
|
||||
|
@@ -11,7 +11,7 @@ export default defineApp({
|
||||
supportsConnections: true,
|
||||
baseUrl: 'https://dropbox.com',
|
||||
apiBaseUrl: 'https://api.dropboxapi.com',
|
||||
primaryColor: '0061ff',
|
||||
primaryColor: '#0061ff',
|
||||
beforeRequest: [addAuthHeader],
|
||||
auth,
|
||||
actions,
|
||||
|
@@ -9,6 +9,6 @@ export default defineApp({
|
||||
supportsConnections: false,
|
||||
baseUrl: '',
|
||||
apiBaseUrl: '',
|
||||
primaryColor: '001F52',
|
||||
primaryColor: '#001F52',
|
||||
actions,
|
||||
});
|
||||
|
@@ -10,7 +10,7 @@ export default defineApp({
|
||||
iconUrl: '{BASE_URL}/apps/flickr/assets/favicon.svg',
|
||||
authDocUrl: '{DOCS_URL}/apps/flickr/connection',
|
||||
docUrl: 'https://automatisch.io/docs/flickr',
|
||||
primaryColor: '000000',
|
||||
primaryColor: '#000000',
|
||||
supportsConnections: true,
|
||||
baseUrl: 'https://www.flickr.com/',
|
||||
apiBaseUrl: 'https://www.flickr.com/services',
|
||||
|
@@ -11,7 +11,7 @@ export default defineApp({
|
||||
supportsConnections: true,
|
||||
baseUrl: 'https://flowers-software.com',
|
||||
apiBaseUrl: 'https://webapp.flowers-software.com/api',
|
||||
primaryColor: '02AFC7',
|
||||
primaryColor: '#02AFC7',
|
||||
beforeRequest: [addAuthHeader],
|
||||
auth,
|
||||
triggers,
|
||||
|
@@ -10,7 +10,7 @@ export default defineApp({
|
||||
supportsConnections: false,
|
||||
baseUrl: '',
|
||||
apiBaseUrl: '',
|
||||
primaryColor: '001F52',
|
||||
primaryColor: '#001F52',
|
||||
actions,
|
||||
dynamicFields,
|
||||
});
|
||||
|
@@ -11,7 +11,7 @@ export default defineApp({
|
||||
apiBaseUrl: '',
|
||||
iconUrl: '{BASE_URL}/apps/ghost/assets/favicon.svg',
|
||||
authDocUrl: '{DOCS_URL}/apps/ghost/connection',
|
||||
primaryColor: '15171A',
|
||||
primaryColor: '#15171A',
|
||||
supportsConnections: true,
|
||||
beforeRequest: [setBaseUrl, addAuthHeader],
|
||||
auth,
|
||||
|
@@ -12,7 +12,7 @@ export default defineApp({
|
||||
apiBaseUrl: 'https://api.github.com',
|
||||
iconUrl: '{BASE_URL}/apps/github/assets/favicon.svg',
|
||||
authDocUrl: '{DOCS_URL}/apps/github/connection',
|
||||
primaryColor: '000000',
|
||||
primaryColor: '#000000',
|
||||
supportsConnections: true,
|
||||
beforeRequest: [addAuthHeader],
|
||||
auth,
|
||||
|
@@ -12,7 +12,7 @@ export default defineApp({
|
||||
apiBaseUrl: 'https://gitlab.com',
|
||||
iconUrl: '{BASE_URL}/apps/gitlab/assets/favicon.svg',
|
||||
authDocUrl: '{DOCS_URL}/apps/gitlab/connection',
|
||||
primaryColor: 'FC6D26',
|
||||
primaryColor: '#FC6D26',
|
||||
supportsConnections: true,
|
||||
beforeRequest: [setBaseUrl, addAuthHeader],
|
||||
auth,
|
||||
|
@@ -11,7 +11,7 @@ export default defineApp({
|
||||
apiBaseUrl: 'https://www.googleapis.com/calendar',
|
||||
iconUrl: '{BASE_URL}/apps/google-calendar/assets/favicon.svg',
|
||||
authDocUrl: '{DOCS_URL}/apps/google-calendar/connection',
|
||||
primaryColor: '448AFF',
|
||||
primaryColor: '#448AFF',
|
||||
supportsConnections: true,
|
||||
beforeRequest: [addAuthHeader],
|
||||
auth,
|
||||
|
@@ -11,7 +11,7 @@ export default defineApp({
|
||||
apiBaseUrl: 'https://www.googleapis.com/drive',
|
||||
iconUrl: '{BASE_URL}/apps/google-drive/assets/favicon.svg',
|
||||
authDocUrl: '{DOCS_URL}/apps/google-drive/connection',
|
||||
primaryColor: '1FA463',
|
||||
primaryColor: '#1FA463',
|
||||
supportsConnections: true,
|
||||
beforeRequest: [addAuthHeader],
|
||||
auth,
|
||||
|
@@ -11,7 +11,7 @@ export default defineApp({
|
||||
apiBaseUrl: 'https://forms.googleapis.com',
|
||||
iconUrl: '{BASE_URL}/apps/google-forms/assets/favicon.svg',
|
||||
authDocUrl: '{DOCS_URL}/apps/google-forms/connection',
|
||||
primaryColor: '673AB7',
|
||||
primaryColor: '#673AB7',
|
||||
supportsConnections: true,
|
||||
beforeRequest: [addAuthHeader],
|
||||
auth,
|
||||
|
@@ -13,7 +13,7 @@ export default defineApp({
|
||||
apiBaseUrl: 'https://sheets.googleapis.com',
|
||||
iconUrl: '{BASE_URL}/apps/google-sheets/assets/favicon.svg',
|
||||
authDocUrl: '{DOCS_URL}/apps/google-sheets/connection',
|
||||
primaryColor: '0F9D58',
|
||||
primaryColor: '#0F9D58',
|
||||
supportsConnections: true,
|
||||
beforeRequest: [addAuthHeader],
|
||||
auth,
|
||||
|
@@ -12,7 +12,7 @@ export default defineApp({
|
||||
apiBaseUrl: 'https://tasks.googleapis.com',
|
||||
iconUrl: '{BASE_URL}/apps/google-tasks/assets/favicon.svg',
|
||||
authDocUrl: '{DOCS_URL}/apps/google-tasks/connection',
|
||||
primaryColor: '0066DA',
|
||||
primaryColor: '#0066DA',
|
||||
supportsConnections: true,
|
||||
beforeRequest: [addAuthHeader],
|
||||
auth,
|
||||
|
@@ -11,7 +11,7 @@ export default defineApp({
|
||||
apiBaseUrl: 'https://app.tryhelix.ai',
|
||||
iconUrl: '{BASE_URL}/apps/helix/assets/favicon.svg',
|
||||
authDocUrl: '{DOCS_URL}/apps/helix/connection',
|
||||
primaryColor: '000000',
|
||||
primaryColor: '#000000',
|
||||
supportsConnections: true,
|
||||
beforeRequest: [setBaseUrl, addAuthHeader],
|
||||
auth,
|
||||
|
@@ -9,6 +9,6 @@ export default defineApp({
|
||||
supportsConnections: false,
|
||||
baseUrl: '',
|
||||
apiBaseUrl: '',
|
||||
primaryColor: '000000',
|
||||
primaryColor: '#000000',
|
||||
actions,
|
||||
});
|
||||
|
@@ -11,7 +11,7 @@ export default defineApp({
|
||||
supportsConnections: true,
|
||||
baseUrl: 'https://www.hubspot.com',
|
||||
apiBaseUrl: 'https://api.hubapi.com',
|
||||
primaryColor: 'F95C35',
|
||||
primaryColor: '#F95C35',
|
||||
beforeRequest: [addAuthHeader],
|
||||
auth,
|
||||
actions,
|
||||
|
@@ -13,7 +13,7 @@ export default defineApp({
|
||||
apiBaseUrl: 'https://invoicing.co/api',
|
||||
iconUrl: '{BASE_URL}/apps/invoice-ninja/assets/favicon.svg',
|
||||
authDocUrl: '{DOCS_URL}/apps/invoice-ninja/connection',
|
||||
primaryColor: '000000',
|
||||
primaryColor: '#000000',
|
||||
supportsConnections: true,
|
||||
beforeRequest: [setBaseUrl, addAuthHeader],
|
||||
auth,
|
||||
|
@@ -9,11 +9,11 @@ export default defineApp({
|
||||
name: 'Jotform',
|
||||
key: 'jotform',
|
||||
iconUrl: '{BASE_URL}/apps/jotform/assets/favicon.svg',
|
||||
authDocUrl: 'https://automatisch.io/docs/apps/jotform/connection',
|
||||
authDocUrl: '{DOCS_URL}/apps/jotform/connection',
|
||||
supportsConnections: true,
|
||||
baseUrl: 'https://www.jotform.com',
|
||||
apiBaseUrl: 'https://api.jotform.com',
|
||||
primaryColor: 'FF6100',
|
||||
primaryColor: '#FF6100',
|
||||
beforeRequest: [setBaseUrl, addAuthHeader],
|
||||
auth,
|
||||
triggers,
|
||||
|
@@ -12,8 +12,8 @@ export default defineApp({
|
||||
baseUrl: 'https://mailchimp.com',
|
||||
apiBaseUrl: '',
|
||||
iconUrl: '{BASE_URL}/apps/mailchimp/assets/favicon.svg',
|
||||
authDocUrl: 'https://automatisch.io/docs/apps/mailchimp/connection',
|
||||
primaryColor: '000000',
|
||||
authDocUrl: '{DOCS_URL}/apps/mailchimp/connection',
|
||||
primaryColor: '#000000',
|
||||
supportsConnections: true,
|
||||
beforeRequest: [setBaseUrl, addAuthHeader],
|
||||
auth,
|
||||
|
@@ -7,11 +7,11 @@ export default defineApp({
|
||||
name: 'MailerLite',
|
||||
key: 'mailerlite',
|
||||
iconUrl: '{BASE_URL}/apps/mailerlite/assets/favicon.svg',
|
||||
authDocUrl: 'https://automatisch.io/docs/apps/mailerlite/connection',
|
||||
authDocUrl: '{DOCS_URL}/apps/mailerlite/connection',
|
||||
supportsConnections: true,
|
||||
baseUrl: 'https://www.mailerlite.com',
|
||||
apiBaseUrl: 'https://connect.mailerlite.com/api',
|
||||
primaryColor: '09C269',
|
||||
primaryColor: '#09C269',
|
||||
beforeRequest: [addAuthHeader],
|
||||
auth,
|
||||
triggers,
|
||||
|
@@ -13,7 +13,7 @@ export default defineApp({
|
||||
authDocUrl: '{DOCS_URL}/apps/mattermost/connection',
|
||||
baseUrl: 'https://mattermost.com',
|
||||
apiBaseUrl: '', // there is no cloud version of this app, user always need to provide address of own instance when creating connection
|
||||
primaryColor: '4a154b',
|
||||
primaryColor: '#4a154b',
|
||||
supportsConnections: true,
|
||||
beforeRequest: [setBaseUrl, addXRequestedWithHeader, addAuthHeader],
|
||||
auth,
|
||||
|
@@ -11,7 +11,7 @@ export default defineApp({
|
||||
apiBaseUrl: 'https://api.miro.com',
|
||||
iconUrl: '{BASE_URL}/apps/miro/assets/favicon.svg',
|
||||
authDocUrl: '{DOCS_URL}/apps/miro/connection',
|
||||
primaryColor: 'F2CA02',
|
||||
primaryColor: '#F2CA02',
|
||||
supportsConnections: true,
|
||||
beforeRequest: [addAuthHeader],
|
||||
auth,
|
||||
|
@@ -13,7 +13,7 @@ export default defineApp({
|
||||
apiBaseUrl: 'https://api.notion.com',
|
||||
iconUrl: '{BASE_URL}/apps/notion/assets/favicon.svg',
|
||||
authDocUrl: '{DOCS_URL}/apps/notion/connection',
|
||||
primaryColor: '000000',
|
||||
primaryColor: '#000000',
|
||||
supportsConnections: true,
|
||||
beforeRequest: [addAuthHeader, addNotionVersionHeader],
|
||||
auth,
|
||||
|
@@ -11,7 +11,7 @@ export default defineApp({
|
||||
supportsConnections: true,
|
||||
baseUrl: 'https://ntfy.sh',
|
||||
apiBaseUrl: 'https://ntfy.sh',
|
||||
primaryColor: '56bda8',
|
||||
primaryColor: '#56bda8',
|
||||
beforeRequest: [addAuthHeader],
|
||||
auth,
|
||||
actions,
|
||||
|
@@ -10,7 +10,7 @@ export default defineApp({
|
||||
supportsConnections: true,
|
||||
baseUrl: 'https://odoo.com',
|
||||
apiBaseUrl: '',
|
||||
primaryColor: '9c5789',
|
||||
primaryColor: '#9c5789',
|
||||
auth,
|
||||
actions,
|
||||
});
|
||||
|
@@ -11,7 +11,7 @@ export default defineApp({
|
||||
apiBaseUrl: 'https://api.openai.com',
|
||||
iconUrl: '{BASE_URL}/apps/openai/assets/favicon.svg',
|
||||
authDocUrl: '{DOCS_URL}/apps/openai/connection',
|
||||
primaryColor: '000000',
|
||||
primaryColor: '#000000',
|
||||
supportsConnections: true,
|
||||
beforeRequest: [addAuthHeader],
|
||||
auth,
|
||||
|
@@ -13,7 +13,7 @@ export default defineApp({
|
||||
apiBaseUrl: '',
|
||||
iconUrl: '{BASE_URL}/apps/pipedrive/assets/favicon.svg',
|
||||
authDocUrl: '{DOCS_URL}/apps/pipedrive/connection',
|
||||
primaryColor: 'FFFFFF',
|
||||
primaryColor: '#FFFFFF',
|
||||
supportsConnections: true,
|
||||
beforeRequest: [setBaseUrl, addAuthHeader],
|
||||
auth,
|
||||
|
@@ -12,7 +12,7 @@ export default defineApp({
|
||||
supportsConnections: true,
|
||||
baseUrl: 'https://placetel.de',
|
||||
apiBaseUrl: 'https://api.placetel.de',
|
||||
primaryColor: '069dd9',
|
||||
primaryColor: '#069dd9',
|
||||
beforeRequest: [addAuthHeader],
|
||||
auth,
|
||||
triggers,
|
||||
|
@@ -10,7 +10,7 @@ export default defineApp({
|
||||
supportsConnections: true,
|
||||
baseUrl: '',
|
||||
apiBaseUrl: '',
|
||||
primaryColor: '336791',
|
||||
primaryColor: '#336791',
|
||||
auth,
|
||||
actions,
|
||||
});
|
||||
|
@@ -10,7 +10,7 @@ export default defineApp({
|
||||
apiBaseUrl: 'https://api.pushover.net',
|
||||
iconUrl: '{BASE_URL}/apps/pushover/assets/favicon.svg',
|
||||
authDocUrl: '{DOCS_URL}/apps/pushover/connection',
|
||||
primaryColor: '249DF1',
|
||||
primaryColor: '#249DF1',
|
||||
supportsConnections: true,
|
||||
auth,
|
||||
actions,
|
||||
|
@@ -11,7 +11,7 @@ export default defineApp({
|
||||
apiBaseUrl: 'https://oauth.reddit.com',
|
||||
iconUrl: '{BASE_URL}/apps/reddit/assets/favicon.svg',
|
||||
authDocUrl: '{DOCS_URL}/apps/reddit/connection',
|
||||
primaryColor: 'FF4500',
|
||||
primaryColor: '#FF4500',
|
||||
supportsConnections: true,
|
||||
beforeRequest: [addAuthHeader],
|
||||
auth,
|
||||
|
@@ -11,7 +11,7 @@ export default defineApp({
|
||||
supportsConnections: true,
|
||||
baseUrl: 'https://www.remove.bg',
|
||||
apiBaseUrl: 'https://api.remove.bg/v1.0',
|
||||
primaryColor: '55636c',
|
||||
primaryColor: '#55636c',
|
||||
beforeRequest: [addAuthHeader],
|
||||
auth,
|
||||
actions,
|
||||
|
@@ -9,6 +9,6 @@ export default defineApp({
|
||||
supportsConnections: false,
|
||||
baseUrl: '',
|
||||
apiBaseUrl: '',
|
||||
primaryColor: 'ff8800',
|
||||
primaryColor: '#ff8800',
|
||||
triggers,
|
||||
});
|
||||
|
@@ -13,7 +13,7 @@ export default defineApp({
|
||||
supportsConnections: true,
|
||||
baseUrl: 'https://salesforce.com',
|
||||
apiBaseUrl: '',
|
||||
primaryColor: '00A1E0',
|
||||
primaryColor: '#00A1E0',
|
||||
beforeRequest: [addAuthHeader],
|
||||
auth,
|
||||
triggers,
|
||||
|
@@ -9,7 +9,7 @@ export default defineApp({
|
||||
authDocUrl: '{DOCS_URL}/apps/scheduler/connection',
|
||||
baseUrl: '',
|
||||
apiBaseUrl: '',
|
||||
primaryColor: '0059F7',
|
||||
primaryColor: '#0059F7',
|
||||
supportsConnections: false,
|
||||
triggers,
|
||||
});
|
||||
|
@@ -12,7 +12,7 @@ export default defineApp({
|
||||
apiBaseUrl: '',
|
||||
iconUrl: '{BASE_URL}/apps/self-hosted-llm/assets/favicon.svg',
|
||||
authDocUrl: '{DOCS_URL}/apps/self-hosted-llm/connection',
|
||||
primaryColor: '000000',
|
||||
primaryColor: '#000000',
|
||||
supportsConnections: true,
|
||||
beforeRequest: [setBaseUrl, addAuthHeader],
|
||||
auth,
|
||||
|
@@ -13,7 +13,7 @@ export default defineApp({
|
||||
supportsConnections: true,
|
||||
baseUrl: 'https://signalwire.com',
|
||||
apiBaseUrl: '',
|
||||
primaryColor: '044cf6',
|
||||
primaryColor: '#044cf6',
|
||||
beforeRequest: [addAuthHeader],
|
||||
auth,
|
||||
triggers,
|
||||
|
@@ -13,7 +13,7 @@ export default defineApp({
|
||||
supportsConnections: true,
|
||||
baseUrl: 'https://slack.com',
|
||||
apiBaseUrl: 'https://slack.com/api',
|
||||
primaryColor: '4a154b',
|
||||
primaryColor: '#4a154b',
|
||||
beforeRequest: [addAuthHeader],
|
||||
auth,
|
||||
actions,
|
||||
|
@@ -10,7 +10,7 @@ export default defineApp({
|
||||
supportsConnections: true,
|
||||
baseUrl: '',
|
||||
apiBaseUrl: '',
|
||||
primaryColor: '2DAAE1',
|
||||
primaryColor: '#2DAAE1',
|
||||
auth,
|
||||
actions,
|
||||
});
|
||||
|
@@ -11,7 +11,7 @@ export default defineApp({
|
||||
supportsConnections: true,
|
||||
baseUrl: 'https://spotify.com',
|
||||
apiBaseUrl: 'https://api.spotify.com',
|
||||
primaryColor: '000000',
|
||||
primaryColor: '#000000',
|
||||
beforeRequest: [addAuthHeader],
|
||||
auth,
|
||||
actions,
|
||||
|
@@ -11,7 +11,7 @@ export default defineApp({
|
||||
supportsConnections: true,
|
||||
baseUrl: 'https://www.strava.com',
|
||||
apiBaseUrl: 'https://www.strava.com/api',
|
||||
primaryColor: 'fc4c01',
|
||||
primaryColor: '#fc4c01',
|
||||
beforeRequest: [addAuthHeader],
|
||||
auth,
|
||||
actions,
|
||||
|
@@ -11,7 +11,7 @@ export default defineApp({
|
||||
supportsConnections: true,
|
||||
baseUrl: 'https://stripe.com',
|
||||
apiBaseUrl: 'https://api.stripe.com',
|
||||
primaryColor: '635bff',
|
||||
primaryColor: '#635bff',
|
||||
beforeRequest: [addAuthHeader],
|
||||
auth,
|
||||
triggers,
|
||||
|
@@ -11,7 +11,7 @@ export default defineApp({
|
||||
supportsConnections: true,
|
||||
baseUrl: 'https://telegram.org',
|
||||
apiBaseUrl: 'https://api.telegram.org',
|
||||
primaryColor: '2AABEE',
|
||||
primaryColor: '#2AABEE',
|
||||
beforeRequest: [addAuthHeader],
|
||||
auth,
|
||||
actions,
|
||||
|
@@ -13,7 +13,7 @@ export default defineApp({
|
||||
supportsConnections: true,
|
||||
baseUrl: 'https://todoist.com',
|
||||
apiBaseUrl: 'https://api.todoist.com/rest/v2',
|
||||
primaryColor: 'e44332',
|
||||
primaryColor: '#e44332',
|
||||
beforeRequest: [addAuthHeader],
|
||||
auth,
|
||||
triggers,
|
||||
|
@@ -12,7 +12,7 @@ export default defineApp({
|
||||
iconUrl: '{BASE_URL}/apps/trello/assets/favicon.svg',
|
||||
authDocUrl: '{DOCS_URL}/apps/trello/connection',
|
||||
supportsConnections: true,
|
||||
primaryColor: '0079bf',
|
||||
primaryColor: '#0079bf',
|
||||
beforeRequest: [addAuthHeader],
|
||||
auth,
|
||||
actions,
|
||||
|
@@ -13,7 +13,7 @@ export default defineApp({
|
||||
supportsConnections: true,
|
||||
baseUrl: 'https://twilio.com',
|
||||
apiBaseUrl: 'https://api.twilio.com',
|
||||
primaryColor: 'e1000f',
|
||||
primaryColor: '#e1000f',
|
||||
beforeRequest: [addAuthHeader],
|
||||
auth,
|
||||
triggers,
|
||||
|
@@ -12,7 +12,7 @@ export default defineApp({
|
||||
supportsConnections: true,
|
||||
baseUrl: 'https://twitter.com',
|
||||
apiBaseUrl: 'https://api.twitter.com',
|
||||
primaryColor: '1da1f2',
|
||||
primaryColor: '#1da1f2',
|
||||
beforeRequest: [addAuthHeader],
|
||||
auth,
|
||||
triggers,
|
||||
|
@@ -12,7 +12,7 @@ export default defineApp({
|
||||
supportsConnections: true,
|
||||
baseUrl: 'https://typeform.com',
|
||||
apiBaseUrl: 'https://api.typeform.com',
|
||||
primaryColor: '262627',
|
||||
primaryColor: '#262627',
|
||||
beforeRequest: [addAuthHeader],
|
||||
auth,
|
||||
triggers,
|
||||
|
@@ -14,7 +14,7 @@ export default defineApp({
|
||||
supportsConnections: true,
|
||||
baseUrl: '',
|
||||
apiBaseUrl: '',
|
||||
primaryColor: '39a86d',
|
||||
primaryColor: '#39a86d',
|
||||
beforeRequest: [setBaseUrl, addAuthHeader],
|
||||
auth,
|
||||
triggers,
|
||||
|
@@ -10,7 +10,7 @@ export default defineApp({
|
||||
supportsConnections: false,
|
||||
baseUrl: '',
|
||||
apiBaseUrl: '',
|
||||
primaryColor: '0059F7',
|
||||
primaryColor: '#0059F7',
|
||||
actions,
|
||||
triggers,
|
||||
});
|
||||
|
@@ -13,7 +13,7 @@ export default defineApp({
|
||||
supportsConnections: true,
|
||||
baseUrl: 'https://wordpress.com',
|
||||
apiBaseUrl: '',
|
||||
primaryColor: '464342',
|
||||
primaryColor: '#464342',
|
||||
beforeRequest: [setBaseUrl, addAuthHeader],
|
||||
auth,
|
||||
triggers,
|
||||
|
@@ -4,6 +4,7 @@ export default defineTrigger({
|
||||
name: 'New comment',
|
||||
key: 'newComment',
|
||||
description: 'Triggers when a new comment is created.',
|
||||
pollInterval: 15,
|
||||
arguments: [
|
||||
{
|
||||
label: 'Status',
|
||||
|
@@ -3,6 +3,7 @@ import defineTrigger from '../../../../helpers/define-trigger.js';
|
||||
export default defineTrigger({
|
||||
name: 'New page',
|
||||
key: 'newPage',
|
||||
pollInterval: 15,
|
||||
description: 'Triggers when a new page is created.',
|
||||
arguments: [
|
||||
{
|
||||
|
@@ -3,6 +3,7 @@ import defineTrigger from '../../../../helpers/define-trigger.js';
|
||||
export default defineTrigger({
|
||||
name: 'New post',
|
||||
key: 'newPost',
|
||||
pollInterval: 15,
|
||||
description: 'Triggers when a new post is created.',
|
||||
arguments: [
|
||||
{
|
||||
|
@@ -11,7 +11,7 @@ export default defineApp({
|
||||
apiBaseUrl: 'https://api.xero.com',
|
||||
iconUrl: '{BASE_URL}/apps/xero/assets/favicon.svg',
|
||||
authDocUrl: '{DOCS_URL}/apps/xero/connection',
|
||||
primaryColor: '13B5EA',
|
||||
primaryColor: '#13B5EA',
|
||||
supportsConnections: true,
|
||||
beforeRequest: [addAuthHeader],
|
||||
auth,
|
||||
|
@@ -10,7 +10,7 @@ export default defineApp({
|
||||
apiBaseUrl: 'https://api.ynab.com/v1',
|
||||
iconUrl: '{BASE_URL}/apps/you-need-a-budget/assets/favicon.svg',
|
||||
authDocUrl: '{DOCS_URL}/apps/you-need-a-budget/connection',
|
||||
primaryColor: '19223C',
|
||||
primaryColor: '#19223C',
|
||||
supportsConnections: true,
|
||||
beforeRequest: [addAuthHeader],
|
||||
auth,
|
||||
|
@@ -10,7 +10,7 @@ export default defineApp({
|
||||
apiBaseUrl: 'https://www.googleapis.com/youtube',
|
||||
iconUrl: '{BASE_URL}/apps/youtube/assets/favicon.svg',
|
||||
authDocUrl: '{DOCS_URL}/apps/youtube/connection',
|
||||
primaryColor: 'FF0000',
|
||||
primaryColor: '#FF0000',
|
||||
supportsConnections: true,
|
||||
beforeRequest: [addAuthHeader],
|
||||
auth,
|
||||
|
@@ -3,6 +3,7 @@ import defineTrigger from '../../../../helpers/define-trigger.js';
|
||||
export default defineTrigger({
|
||||
name: 'New video by search',
|
||||
key: 'newVideoBySearch',
|
||||
pollInterval: 15,
|
||||
description:
|
||||
'Triggers when a new video is uploaded that matches a specific search string.',
|
||||
arguments: [
|
||||
|
@@ -3,6 +3,7 @@ import defineTrigger from '../../../../helpers/define-trigger.js';
|
||||
export default defineTrigger({
|
||||
name: 'New video in channel',
|
||||
key: 'newVideoInChannel',
|
||||
pollInterval: 15,
|
||||
description:
|
||||
'Triggers when a new video is published to a specific Youtube channel.',
|
||||
arguments: [
|
||||
|
@@ -12,7 +12,7 @@ export default defineApp({
|
||||
apiBaseUrl: '',
|
||||
iconUrl: '{BASE_URL}/apps/zendesk/assets/favicon.svg',
|
||||
authDocUrl: '{DOCS_URL}/apps/zendesk/connection',
|
||||
primaryColor: '17494d',
|
||||
primaryColor: '#17494d',
|
||||
supportsConnections: true,
|
||||
beforeRequest: [addAuthHeader],
|
||||
auth,
|
||||
|
@@ -2,7 +2,7 @@ import appConfig from './app.js';
|
||||
|
||||
const corsOptions = {
|
||||
origin: appConfig.webAppUrl,
|
||||
methods: 'GET,HEAD,POST,DELETE',
|
||||
methods: 'GET,HEAD,POST,PATCH,DELETE',
|
||||
credentials: true,
|
||||
optionsSuccessStatus: 200,
|
||||
};
|
||||
|
@@ -11,5 +11,5 @@ export default async (request, response) => {
|
||||
|
||||
await accessToken.revoke();
|
||||
|
||||
response.status(204).send();
|
||||
response.status(204).end();
|
||||
};
|
||||
|
@@ -0,0 +1,25 @@
|
||||
import { renderObject } from '../../../../../helpers/renderer.js';
|
||||
import AppConfig from '../../../../../models/app-config.js';
|
||||
|
||||
export default async (request, response) => {
|
||||
const appConfig = await AppConfig.query()
|
||||
.findOne({ key: request.params.appKey })
|
||||
.throwIfNotFound();
|
||||
|
||||
const appAuthClient = await appConfig
|
||||
.$relatedQuery('appAuthClients')
|
||||
.insert(appAuthClientParams(request));
|
||||
|
||||
renderObject(response, appAuthClient, { status: 201 });
|
||||
};
|
||||
|
||||
const appAuthClientParams = (request) => {
|
||||
const { active, appKey, name, formattedAuthDefaults } = request.body;
|
||||
|
||||
return {
|
||||
active,
|
||||
appKey,
|
||||
name,
|
||||
formattedAuthDefaults,
|
||||
};
|
||||
};
|
@@ -0,0 +1,94 @@
|
||||
import { vi, describe, it, expect, beforeEach } from 'vitest';
|
||||
import request from 'supertest';
|
||||
|
||||
import app from '../../../../../app.js';
|
||||
import createAuthTokenByUserId from '../../../../../helpers/create-auth-token-by-user-id.js';
|
||||
import { createUser } from '../../../../../../test/factories/user.js';
|
||||
import { createRole } from '../../../../../../test/factories/role.js';
|
||||
import createAppAuthClientMock from '../../../../../../test/mocks/rest/api/v1/admin/apps/create-auth-client.js';
|
||||
import { createAppConfig } from '../../../../../../test/factories/app-config.js';
|
||||
import * as license from '../../../../../helpers/license.ee.js';
|
||||
|
||||
describe('POST /api/v1/admin/apps/:appKey/auth-clients', () => {
|
||||
let currentUser, adminRole, token;
|
||||
|
||||
beforeEach(async () => {
|
||||
vi.spyOn(license, 'hasValidLicense').mockResolvedValue(true);
|
||||
|
||||
adminRole = await createRole({ name: 'Admin' });
|
||||
currentUser = await createUser({ roleId: adminRole.id });
|
||||
|
||||
token = await createAuthTokenByUserId(currentUser.id);
|
||||
});
|
||||
|
||||
it('should return created response for valid app config', async () => {
|
||||
await createAppConfig({
|
||||
key: 'gitlab',
|
||||
});
|
||||
|
||||
const appAuthClient = {
|
||||
active: true,
|
||||
appKey: 'gitlab',
|
||||
name: 'First auth client',
|
||||
formattedAuthDefaults: {
|
||||
clientid: 'sample client ID',
|
||||
clientSecret: 'sample client secret',
|
||||
instanceUrl: 'https://gitlab.com',
|
||||
oAuthRedirectUrl: 'http://localhost:3001/app/gitlab/connection/add',
|
||||
},
|
||||
};
|
||||
|
||||
const response = await request(app)
|
||||
.post('/api/v1/admin/apps/gitlab/auth-clients')
|
||||
.set('Authorization', token)
|
||||
.send(appAuthClient)
|
||||
.expect(201);
|
||||
|
||||
const expectedPayload = createAppAuthClientMock(appAuthClient);
|
||||
expect(response.body).toMatchObject(expectedPayload);
|
||||
});
|
||||
|
||||
it('should return not found response for not existing app config', async () => {
|
||||
const appAuthClient = {
|
||||
active: true,
|
||||
appKey: 'gitlab',
|
||||
name: 'First auth client',
|
||||
formattedAuthDefaults: {
|
||||
clientid: 'sample client ID',
|
||||
clientSecret: 'sample client secret',
|
||||
instanceUrl: 'https://gitlab.com',
|
||||
oAuthRedirectUrl: 'http://localhost:3001/app/gitlab/connection/add',
|
||||
},
|
||||
};
|
||||
|
||||
await request(app)
|
||||
.post('/api/v1/admin/apps/gitlab/auth-clients')
|
||||
.set('Authorization', token)
|
||||
.send(appAuthClient)
|
||||
.expect(404);
|
||||
});
|
||||
|
||||
it('should return bad request response for missing required fields', async () => {
|
||||
await createAppConfig({
|
||||
key: 'gitlab',
|
||||
});
|
||||
|
||||
const appAuthClient = {
|
||||
appKey: 'gitlab',
|
||||
};
|
||||
|
||||
const response = await request(app)
|
||||
.post('/api/v1/admin/apps/gitlab/auth-clients')
|
||||
.set('Authorization', token)
|
||||
.send(appAuthClient)
|
||||
.expect(422);
|
||||
|
||||
expect(response.body.meta.type).toEqual('ModelValidation');
|
||||
expect(response.body.errors).toMatchObject({
|
||||
name: ["must have required property 'name'"],
|
||||
formattedAuthDefaults: [
|
||||
"must have required property 'formattedAuthDefaults'",
|
||||
],
|
||||
});
|
||||
});
|
||||
});
|
@@ -0,0 +1,21 @@
|
||||
import { renderObject } from '../../../../../helpers/renderer.js';
|
||||
import AppConfig from '../../../../../models/app-config.js';
|
||||
|
||||
export default async (request, response) => {
|
||||
const createdAppConfig = await AppConfig.query().insertAndFetch(
|
||||
appConfigParams(request)
|
||||
);
|
||||
|
||||
renderObject(response, createdAppConfig, { status: 201 });
|
||||
};
|
||||
|
||||
const appConfigParams = (request) => {
|
||||
const { allowCustomConnection, shared, disabled } = request.body;
|
||||
|
||||
return {
|
||||
key: request.params.appKey,
|
||||
allowCustomConnection,
|
||||
shared,
|
||||
disabled,
|
||||
};
|
||||
};
|
@@ -0,0 +1,67 @@
|
||||
import { vi, describe, it, expect, beforeEach } from 'vitest';
|
||||
import request from 'supertest';
|
||||
|
||||
import app from '../../../../../app.js';
|
||||
import createAuthTokenByUserId from '../../../../../helpers/create-auth-token-by-user-id.js';
|
||||
import { createUser } from '../../../../../../test/factories/user.js';
|
||||
import { createRole } from '../../../../../../test/factories/role.js';
|
||||
import createAppConfigMock from '../../../../../../test/mocks/rest/api/v1/admin/apps/create-config.js';
|
||||
import { createAppConfig } from '../../../../../../test/factories/app-config.js';
|
||||
import * as license from '../../../../../helpers/license.ee.js';
|
||||
|
||||
describe('POST /api/v1/admin/apps/:appKey/config', () => {
|
||||
let currentUser, adminRole, token;
|
||||
|
||||
beforeEach(async () => {
|
||||
vi.spyOn(license, 'hasValidLicense').mockResolvedValue(true);
|
||||
|
||||
adminRole = await createRole({ name: 'Admin' });
|
||||
currentUser = await createUser({ roleId: adminRole.id });
|
||||
|
||||
token = await createAuthTokenByUserId(currentUser.id);
|
||||
});
|
||||
|
||||
it('should return created app config', async () => {
|
||||
const appConfig = {
|
||||
allowCustomConnection: true,
|
||||
shared: true,
|
||||
disabled: false,
|
||||
};
|
||||
|
||||
const response = await request(app)
|
||||
.post('/api/v1/admin/apps/gitlab/config')
|
||||
.set('Authorization', token)
|
||||
.send(appConfig)
|
||||
.expect(201);
|
||||
|
||||
const expectedPayload = createAppConfigMock({
|
||||
...appConfig,
|
||||
key: 'gitlab',
|
||||
});
|
||||
expect(response.body).toMatchObject(expectedPayload);
|
||||
});
|
||||
|
||||
it('should return HTTP 422 for already existing app config', async () => {
|
||||
const appConfig = {
|
||||
key: 'gitlab',
|
||||
allowCustomConnection: true,
|
||||
shared: true,
|
||||
disabled: false,
|
||||
};
|
||||
|
||||
await createAppConfig(appConfig);
|
||||
|
||||
const response = await request(app)
|
||||
.post('/api/v1/admin/apps/gitlab/config')
|
||||
.set('Authorization', token)
|
||||
.send({
|
||||
disabled: false,
|
||||
})
|
||||
.expect(422);
|
||||
|
||||
expect(response.body.meta.type).toEqual('UniqueViolationError');
|
||||
expect(response.body.errors).toMatchObject({
|
||||
key: ["'key' must be unique."],
|
||||
});
|
||||
});
|
||||
});
|
@@ -15,7 +15,7 @@ describe('GET /api/v1/admin/apps/:appKey/auth-clients/:appAuthClientId', () => {
|
||||
beforeEach(async () => {
|
||||
vi.spyOn(license, 'hasValidLicense').mockResolvedValue(true);
|
||||
|
||||
adminRole = await createRole({ key: 'admin' });
|
||||
adminRole = await createRole({ name: 'Admin' });
|
||||
currentUser = await createUser({ roleId: adminRole.id });
|
||||
|
||||
currentAppAuthClient = await createAppAuthClient({
|
||||
|
@@ -14,7 +14,7 @@ describe('GET /api/v1/admin/apps/:appKey/auth-clients', () => {
|
||||
beforeEach(async () => {
|
||||
vi.spyOn(license, 'hasValidLicense').mockResolvedValue(true);
|
||||
|
||||
adminRole = await createRole({ key: 'admin' });
|
||||
adminRole = await createRole({ name: 'Admin' });
|
||||
currentUser = await createUser({ roleId: adminRole.id });
|
||||
|
||||
token = await createAuthTokenByUserId(currentUser.id);
|
||||
|
@@ -0,0 +1,22 @@
|
||||
import { renderObject } from '../../../../../helpers/renderer.js';
|
||||
import AppAuthClient from '../../../../../models/app-auth-client.js';
|
||||
|
||||
export default async (request, response) => {
|
||||
const appAuthClient = await AppAuthClient.query()
|
||||
.findById(request.params.appAuthClientId)
|
||||
.throwIfNotFound();
|
||||
|
||||
await appAuthClient.$query().patchAndFetch(appAuthClientParams(request));
|
||||
|
||||
renderObject(response, appAuthClient);
|
||||
};
|
||||
|
||||
const appAuthClientParams = (request) => {
|
||||
const { active, name, formattedAuthDefaults } = request.body;
|
||||
|
||||
return {
|
||||
active,
|
||||
name,
|
||||
formattedAuthDefaults,
|
||||
};
|
||||
};
|
@@ -0,0 +1,104 @@
|
||||
import { vi, describe, it, expect, beforeEach } from 'vitest';
|
||||
import request from 'supertest';
|
||||
import Crypto from 'crypto';
|
||||
|
||||
import app from '../../../../../app.js';
|
||||
import createAuthTokenByUserId from '../../../../../helpers/create-auth-token-by-user-id.js';
|
||||
import { createUser } from '../../../../../../test/factories/user.js';
|
||||
import { createRole } from '../../../../../../test/factories/role.js';
|
||||
import updateAppAuthClientMock from '../../../../../../test/mocks/rest/api/v1/admin/apps/update-auth-client.js';
|
||||
import { createAppConfig } from '../../../../../../test/factories/app-config.js';
|
||||
import { createAppAuthClient } from '../../../../../../test/factories/app-auth-client.js';
|
||||
import * as license from '../../../../../helpers/license.ee.js';
|
||||
|
||||
describe('PATCH /api/v1/admin/apps/:appKey/auth-clients', () => {
|
||||
let currentUser, adminRole, token;
|
||||
|
||||
beforeEach(async () => {
|
||||
vi.spyOn(license, 'hasValidLicense').mockResolvedValue(true);
|
||||
|
||||
adminRole = await createRole({ name: 'Admin' });
|
||||
currentUser = await createUser({ roleId: adminRole.id });
|
||||
|
||||
token = await createAuthTokenByUserId(currentUser.id);
|
||||
|
||||
await createAppConfig({
|
||||
key: 'gitlab',
|
||||
});
|
||||
});
|
||||
|
||||
it('should return updated entity for valid app auth client', async () => {
|
||||
const appAuthClient = {
|
||||
active: true,
|
||||
appKey: 'gitlab',
|
||||
formattedAuthDefaults: {
|
||||
clientid: 'sample client ID',
|
||||
clientSecret: 'sample client secret',
|
||||
instanceUrl: 'https://gitlab.com',
|
||||
oAuthRedirectUrl: 'http://localhost:3001/app/gitlab/connection/add',
|
||||
},
|
||||
};
|
||||
|
||||
const existingAppAuthClient = await createAppAuthClient({
|
||||
appKey: 'gitlab',
|
||||
name: 'First auth client',
|
||||
});
|
||||
|
||||
const response = await request(app)
|
||||
.patch(
|
||||
`/api/v1/admin/apps/gitlab/auth-clients/${existingAppAuthClient.id}`
|
||||
)
|
||||
.set('Authorization', token)
|
||||
.send(appAuthClient)
|
||||
.expect(200);
|
||||
|
||||
const expectedPayload = updateAppAuthClientMock({
|
||||
...existingAppAuthClient,
|
||||
...appAuthClient,
|
||||
});
|
||||
|
||||
expect(response.body).toMatchObject(expectedPayload);
|
||||
});
|
||||
|
||||
it('should return not found response for not existing app auth client', async () => {
|
||||
const notExistingAppAuthClientId = Crypto.randomUUID();
|
||||
|
||||
await request(app)
|
||||
.patch(
|
||||
`/api/v1/admin/apps/gitlab/auth-clients/${notExistingAppAuthClientId}`
|
||||
)
|
||||
.set('Authorization', token)
|
||||
.expect(404);
|
||||
});
|
||||
|
||||
it('should return bad request response for invalid UUID', async () => {
|
||||
await request(app)
|
||||
.patch('/api/v1/admin/apps/gitlab/auth-clients/invalidAuthClientUUID')
|
||||
.set('Authorization', token)
|
||||
.expect(400);
|
||||
});
|
||||
|
||||
it('should return HTTP 422 for invalid payload', async () => {
|
||||
const appAuthClient = {
|
||||
formattedAuthDefaults: 'invalid input',
|
||||
};
|
||||
|
||||
const existingAppAuthClient = await createAppAuthClient({
|
||||
appKey: 'gitlab',
|
||||
name: 'First auth client',
|
||||
});
|
||||
|
||||
const response = await request(app)
|
||||
.patch(
|
||||
`/api/v1/admin/apps/gitlab/auth-clients/${existingAppAuthClient.id}`
|
||||
)
|
||||
.set('Authorization', token)
|
||||
.send(appAuthClient)
|
||||
.expect(422);
|
||||
|
||||
expect(response.body.meta.type).toBe('ModelValidation');
|
||||
expect(response.body.errors).toMatchObject({
|
||||
formattedAuthDefaults: ['must be object'],
|
||||
});
|
||||
});
|
||||
});
|
@@ -0,0 +1,24 @@
|
||||
import { renderObject } from '../../../../../helpers/renderer.js';
|
||||
import AppConfig from '../../../../../models/app-config.js';
|
||||
|
||||
export default async (request, response) => {
|
||||
const appConfig = await AppConfig.query()
|
||||
.findOne({
|
||||
key: request.params.appKey,
|
||||
})
|
||||
.throwIfNotFound();
|
||||
|
||||
await appConfig.$query().patchAndFetch(appConfigParams(request));
|
||||
|
||||
renderObject(response, appConfig);
|
||||
};
|
||||
|
||||
const appConfigParams = (request) => {
|
||||
const { allowCustomConnection, shared, disabled } = request.body;
|
||||
|
||||
return {
|
||||
allowCustomConnection,
|
||||
shared,
|
||||
disabled,
|
||||
};
|
||||
};
|
@@ -0,0 +1,91 @@
|
||||
import { vi, describe, it, expect, beforeEach } from 'vitest';
|
||||
import request from 'supertest';
|
||||
|
||||
import app from '../../../../../app.js';
|
||||
import createAuthTokenByUserId from '../../../../../helpers/create-auth-token-by-user-id.js';
|
||||
import { createUser } from '../../../../../../test/factories/user.js';
|
||||
import { createRole } from '../../../../../../test/factories/role.js';
|
||||
import createAppConfigMock from '../../../../../../test/mocks/rest/api/v1/admin/apps/create-config.js';
|
||||
import { createAppConfig } from '../../../../../../test/factories/app-config.js';
|
||||
import * as license from '../../../../../helpers/license.ee.js';
|
||||
|
||||
describe('PATCH /api/v1/admin/apps/:appKey/config', () => {
|
||||
let currentUser, adminRole, token;
|
||||
|
||||
beforeEach(async () => {
|
||||
vi.spyOn(license, 'hasValidLicense').mockResolvedValue(true);
|
||||
|
||||
adminRole = await createRole({ name: 'Admin' });
|
||||
currentUser = await createUser({ roleId: adminRole.id });
|
||||
|
||||
token = await createAuthTokenByUserId(currentUser.id);
|
||||
});
|
||||
|
||||
it('should return updated app config', async () => {
|
||||
const appConfig = {
|
||||
key: 'gitlab',
|
||||
allowCustomConnection: true,
|
||||
shared: true,
|
||||
disabled: false,
|
||||
};
|
||||
|
||||
await createAppConfig(appConfig);
|
||||
|
||||
const newAppConfigValues = {
|
||||
shared: false,
|
||||
disabled: true,
|
||||
allowCustomConnection: false,
|
||||
};
|
||||
|
||||
const response = await request(app)
|
||||
.patch('/api/v1/admin/apps/gitlab/config')
|
||||
.set('Authorization', token)
|
||||
.send(newAppConfigValues)
|
||||
.expect(200);
|
||||
|
||||
const expectedPayload = createAppConfigMock({
|
||||
...newAppConfigValues,
|
||||
key: 'gitlab',
|
||||
});
|
||||
|
||||
expect(response.body).toMatchObject(expectedPayload);
|
||||
});
|
||||
|
||||
it('should return not found response for unexisting app config', async () => {
|
||||
const appConfig = {
|
||||
shared: false,
|
||||
disabled: true,
|
||||
allowCustomConnection: false,
|
||||
};
|
||||
|
||||
await request(app)
|
||||
.patch('/api/v1/admin/apps/gitlab/config')
|
||||
.set('Authorization', token)
|
||||
.send(appConfig)
|
||||
.expect(404);
|
||||
});
|
||||
|
||||
it('should return HTTP 422 for invalid app config data', async () => {
|
||||
const appConfig = {
|
||||
key: 'gitlab',
|
||||
allowCustomConnection: true,
|
||||
shared: true,
|
||||
disabled: false,
|
||||
};
|
||||
|
||||
await createAppConfig(appConfig);
|
||||
|
||||
const response = await request(app)
|
||||
.patch('/api/v1/admin/apps/gitlab/config')
|
||||
.set('Authorization', token)
|
||||
.send({
|
||||
disabled: 'invalid value type',
|
||||
})
|
||||
.expect(422);
|
||||
|
||||
expect(response.body.meta.type).toEqual('ModelValidation');
|
||||
expect(response.body.errors).toMatchObject({
|
||||
disabled: ['must be boolean'],
|
||||
});
|
||||
});
|
||||
});
|
@@ -0,0 +1,28 @@
|
||||
import { renderObject } from '../../../../../helpers/renderer.js';
|
||||
import Config from '../../../../../models/config.js';
|
||||
|
||||
export default async (request, response) => {
|
||||
const config = await Config.query().updateFirstOrInsert(
|
||||
configParams(request)
|
||||
);
|
||||
|
||||
renderObject(response, config);
|
||||
};
|
||||
|
||||
const configParams = (request) => {
|
||||
const {
|
||||
logoSvgData,
|
||||
palettePrimaryDark,
|
||||
palettePrimaryLight,
|
||||
palettePrimaryMain,
|
||||
title,
|
||||
} = request.body;
|
||||
|
||||
return {
|
||||
logoSvgData,
|
||||
palettePrimaryDark,
|
||||
palettePrimaryLight,
|
||||
palettePrimaryMain,
|
||||
title,
|
||||
};
|
||||
};
|
@@ -0,0 +1,88 @@
|
||||
import { vi, describe, it, expect, beforeEach } from 'vitest';
|
||||
import request from 'supertest';
|
||||
|
||||
import app from '../../../../../app.js';
|
||||
import createAuthTokenByUserId from '../../../../../helpers/create-auth-token-by-user-id.js';
|
||||
import { createUser } from '../../../../../../test/factories/user.js';
|
||||
import { createRole } from '../../../../../../test/factories/role.js';
|
||||
import { updateConfig } from '../../../../../../test/factories/config.js';
|
||||
import * as license from '../../../../../helpers/license.ee.js';
|
||||
|
||||
describe('PATCH /api/v1/admin/config', () => {
|
||||
let currentUser, adminRole, token;
|
||||
|
||||
beforeEach(async () => {
|
||||
vi.spyOn(license, 'hasValidLicense').mockResolvedValue(true);
|
||||
|
||||
adminRole = await createRole({ name: 'Admin' });
|
||||
currentUser = await createUser({ roleId: adminRole.id });
|
||||
|
||||
token = await createAuthTokenByUserId(currentUser.id);
|
||||
});
|
||||
|
||||
it('should return updated config', async () => {
|
||||
const title = 'Test environment - Automatisch';
|
||||
const palettePrimaryMain = '#00adef';
|
||||
const palettePrimaryDark = '#222222';
|
||||
const palettePrimaryLight = '#f90707';
|
||||
const logoSvgData =
|
||||
'<svg width="25" height="25" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 100 100"><rect width="100%" height="100%" fill="white" /><text x="10" y="40" font-family="Arial" font-size="40" fill="black">A</text></svg>';
|
||||
|
||||
const appConfig = {
|
||||
title,
|
||||
palettePrimaryMain: palettePrimaryMain,
|
||||
palettePrimaryDark: palettePrimaryDark,
|
||||
palettePrimaryLight: palettePrimaryLight,
|
||||
logoSvgData: logoSvgData,
|
||||
};
|
||||
|
||||
await updateConfig(appConfig);
|
||||
|
||||
const newTitle = 'Updated title';
|
||||
|
||||
const newConfigValues = {
|
||||
title: newTitle,
|
||||
};
|
||||
|
||||
const response = await request(app)
|
||||
.patch('/api/v1/admin/config')
|
||||
.set('Authorization', token)
|
||||
.send(newConfigValues)
|
||||
.expect(200);
|
||||
|
||||
expect(response.body.data.title).toEqual(newTitle);
|
||||
expect(response.body.meta.type).toEqual('Config');
|
||||
});
|
||||
|
||||
it('should return created config for unexisting config', async () => {
|
||||
const newTitle = 'Updated title';
|
||||
|
||||
const newConfigValues = {
|
||||
title: newTitle,
|
||||
};
|
||||
|
||||
const response = await request(app)
|
||||
.patch('/api/v1/admin/config')
|
||||
.set('Authorization', token)
|
||||
.send(newConfigValues)
|
||||
.expect(200);
|
||||
|
||||
expect(response.body.data.title).toEqual(newTitle);
|
||||
expect(response.body.meta.type).toEqual('Config');
|
||||
});
|
||||
|
||||
it('should return null for deleted config entry', async () => {
|
||||
const newConfigValues = {
|
||||
title: null,
|
||||
};
|
||||
|
||||
const response = await request(app)
|
||||
.patch('/api/v1/admin/config')
|
||||
.set('Authorization', token)
|
||||
.send(newConfigValues)
|
||||
.expect(200);
|
||||
|
||||
expect(response.body.data.title).toBeNull();
|
||||
expect(response.body.meta.type).toEqual('Config');
|
||||
});
|
||||
});
|
@@ -11,7 +11,7 @@ describe('GET /api/v1/admin/permissions/catalog', () => {
|
||||
let role, currentUser, token;
|
||||
|
||||
beforeEach(async () => {
|
||||
role = await createRole({ key: 'admin' });
|
||||
role = await createRole({ name: 'Admin' });
|
||||
currentUser = await createUser({ roleId: role.id });
|
||||
|
||||
token = await createAuthTokenByUserId(currentUser.id);
|
||||
|
@@ -0,0 +1,22 @@
|
||||
import { renderObject } from '../../../../../helpers/renderer.js';
|
||||
import Role from '../../../../../models/role.js';
|
||||
|
||||
export default async (request, response) => {
|
||||
const roleData = roleParams(request);
|
||||
|
||||
const roleWithPermissions = await Role.query().insertGraphAndFetch(roleData, {
|
||||
relate: ['permissions'],
|
||||
});
|
||||
|
||||
renderObject(response, roleWithPermissions, { status: 201 });
|
||||
};
|
||||
|
||||
const roleParams = (request) => {
|
||||
const { name, description, permissions } = request.body;
|
||||
|
||||
return {
|
||||
name,
|
||||
description,
|
||||
permissions,
|
||||
};
|
||||
};
|
@@ -0,0 +1,109 @@
|
||||
import { vi, describe, it, expect, beforeEach } from 'vitest';
|
||||
import request from 'supertest';
|
||||
import app from '../../../../../app.js';
|
||||
import Role from '../../../../../models/role.js';
|
||||
import createAuthTokenByUserId from '../../../../../helpers/create-auth-token-by-user-id.js';
|
||||
import { createRole } from '../../../../../../test/factories/role.js';
|
||||
import { createUser } from '../../../../../../test/factories/user.js';
|
||||
import createRoleMock from '../../../../../../test/mocks/rest/api/v1/admin/roles/create-role.ee.js';
|
||||
import * as license from '../../../../../helpers/license.ee.js';
|
||||
|
||||
describe('POST /api/v1/admin/roles', () => {
|
||||
let role, currentUser, token;
|
||||
|
||||
beforeEach(async () => {
|
||||
vi.spyOn(license, 'hasValidLicense').mockResolvedValue(true);
|
||||
|
||||
role = await createRole({ name: 'Admin' });
|
||||
currentUser = await createUser({ roleId: role.id });
|
||||
|
||||
token = await createAuthTokenByUserId(currentUser.id);
|
||||
});
|
||||
|
||||
it('should return the created role along with permissions', async () => {
|
||||
const roleData = {
|
||||
name: 'Viewer',
|
||||
description: '',
|
||||
permissions: [
|
||||
{
|
||||
action: 'read',
|
||||
subject: 'Flow',
|
||||
conditions: ['isCreator'],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const response = await request(app)
|
||||
.post('/api/v1/admin/roles')
|
||||
.set('Authorization', token)
|
||||
.send(roleData)
|
||||
.expect(201);
|
||||
|
||||
const createdRole = await Role.query()
|
||||
.withGraphFetched({ permissions: true })
|
||||
.findOne({ name: 'Viewer' })
|
||||
.throwIfNotFound();
|
||||
|
||||
const expectedPayload = await createRoleMock(
|
||||
{
|
||||
...createdRole,
|
||||
...roleData,
|
||||
isAdmin: createdRole.isAdmin,
|
||||
},
|
||||
[
|
||||
{
|
||||
...createdRole.permissions[0],
|
||||
...roleData.permissions[0],
|
||||
},
|
||||
]
|
||||
);
|
||||
|
||||
expect(response.body).toEqual(expectedPayload);
|
||||
});
|
||||
|
||||
it('should return unprocessable entity response for invalid role data', async () => {
|
||||
const roleData = {
|
||||
description: '',
|
||||
permissions: [],
|
||||
};
|
||||
|
||||
const response = await request(app)
|
||||
.post('/api/v1/admin/roles')
|
||||
.set('Authorization', token)
|
||||
.send(roleData)
|
||||
.expect(422);
|
||||
|
||||
expect(response.body).toStrictEqual({
|
||||
errors: {
|
||||
name: ["must have required property 'name'"],
|
||||
},
|
||||
meta: {
|
||||
type: 'ModelValidation',
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it('should return unprocessable entity response for duplicate role', async () => {
|
||||
await createRole({ name: 'Viewer' });
|
||||
|
||||
const roleData = {
|
||||
name: 'Viewer',
|
||||
permissions: [],
|
||||
};
|
||||
|
||||
const response = await request(app)
|
||||
.post('/api/v1/admin/roles')
|
||||
.set('Authorization', token)
|
||||
.send(roleData)
|
||||
.expect(422);
|
||||
|
||||
expect(response.body).toStrictEqual({
|
||||
errors: {
|
||||
name: ["'name' must be unique."],
|
||||
},
|
||||
meta: {
|
||||
type: 'UniqueViolationError',
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
@@ -0,0 +1,11 @@
|
||||
import Role from '../../../../../models/role.js';
|
||||
|
||||
export default async (request, response) => {
|
||||
const role = await Role.query()
|
||||
.findById(request.params.roleId)
|
||||
.throwIfNotFound();
|
||||
|
||||
await role.deleteWithPermissions();
|
||||
|
||||
response.status(204).end();
|
||||
};
|
@@ -0,0 +1,112 @@
|
||||
import Crypto from 'node:crypto';
|
||||
import { vi, describe, it, expect, beforeEach } from 'vitest';
|
||||
import request from 'supertest';
|
||||
import app from '../../../../../app.js';
|
||||
import createAuthTokenByUserId from '../../../../../helpers/create-auth-token-by-user-id.js';
|
||||
import { createRole } from '../../../../../../test/factories/role.js';
|
||||
import { createPermission } from '../../../../../../test/factories/permission.js';
|
||||
import { createSamlAuthProvider } from '../../../../../../test/factories/saml-auth-provider.ee.js';
|
||||
import { createUser } from '../../../../../../test/factories/user.js';
|
||||
import * as license from '../../../../../helpers/license.ee.js';
|
||||
|
||||
describe('DELETE /api/v1/admin/roles/:roleId', () => {
|
||||
let adminRole, currentUser, token;
|
||||
|
||||
beforeEach(async () => {
|
||||
vi.spyOn(license, 'hasValidLicense').mockResolvedValue(true);
|
||||
|
||||
adminRole = await createRole({ name: 'Admin' });
|
||||
|
||||
currentUser = await createUser({ roleId: adminRole.id });
|
||||
|
||||
token = await createAuthTokenByUserId(currentUser.id);
|
||||
});
|
||||
|
||||
it('should return HTTP 204 for unused role', async () => {
|
||||
const role = await createRole();
|
||||
const permission = await createPermission({ roleId: role.id });
|
||||
|
||||
await request(app)
|
||||
.delete(`/api/v1/admin/roles/${role.id}`)
|
||||
.set('Authorization', token)
|
||||
.expect(204);
|
||||
|
||||
const refetchedRole = await role.$query();
|
||||
const refetchedPermission = await permission.$query();
|
||||
|
||||
expect(refetchedRole).toBeUndefined();
|
||||
expect(refetchedPermission).toBeUndefined();
|
||||
});
|
||||
|
||||
it('should return HTTP 404 for not existing role UUID', async () => {
|
||||
const notExistingRoleUUID = Crypto.randomUUID();
|
||||
|
||||
await request(app)
|
||||
.delete(`/api/v1/admin/roles/${notExistingRoleUUID}`)
|
||||
.set('Authorization', token)
|
||||
.expect(404);
|
||||
});
|
||||
|
||||
it('should return not authorized response for deleting admin role', async () => {
|
||||
await request(app)
|
||||
.delete(`/api/v1/admin/roles/${adminRole.id}`)
|
||||
.set('Authorization', token)
|
||||
.expect(403);
|
||||
});
|
||||
|
||||
it('should return unprocessable entity response for role used by users', async () => {
|
||||
const role = await createRole();
|
||||
await createUser({ roleId: role.id });
|
||||
|
||||
const response = await request(app)
|
||||
.delete(`/api/v1/admin/roles/${role.id}`)
|
||||
.set('Authorization', token)
|
||||
.expect(422);
|
||||
|
||||
expect(response.body).toStrictEqual({
|
||||
errors: {
|
||||
role: [`All users must be migrated away from the "${role.name}" role.`],
|
||||
},
|
||||
meta: {
|
||||
type: 'ValidationError',
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it('should return unprocessable entity response for role used by saml auth providers', async () => {
|
||||
const samlAuthProvider = await createSamlAuthProvider();
|
||||
|
||||
const response = await request(app)
|
||||
.delete(`/api/v1/admin/roles/${samlAuthProvider.defaultRoleId}`)
|
||||
.set('Authorization', token)
|
||||
.expect(422);
|
||||
|
||||
expect(response.body).toStrictEqual({
|
||||
errors: {
|
||||
samlAuthProvider: [
|
||||
'You need to change the default role in the SAML configuration before deleting this role.',
|
||||
],
|
||||
},
|
||||
meta: {
|
||||
type: 'ValidationError',
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it('should not delete role and permissions on unsuccessful response', async () => {
|
||||
const role = await createRole();
|
||||
const permission = await createPermission({ roleId: role.id });
|
||||
await createUser({ roleId: role.id });
|
||||
|
||||
await request(app)
|
||||
.delete(`/api/v1/admin/roles/${role.id}`)
|
||||
.set('Authorization', token)
|
||||
.expect(422);
|
||||
|
||||
const refetchedRole = await role.$query();
|
||||
const refetchedPermission = await permission.$query();
|
||||
|
||||
expect(refetchedRole).toStrictEqual(role);
|
||||
expect(refetchedPermission).toStrictEqual(permission);
|
||||
});
|
||||
});
|
@@ -13,7 +13,7 @@ describe('GET /api/v1/admin/roles/:roleId', () => {
|
||||
let role, currentUser, token, permissionOne, permissionTwo;
|
||||
|
||||
beforeEach(async () => {
|
||||
role = await createRole({ key: 'admin' });
|
||||
role = await createRole({ name: 'Admin' });
|
||||
permissionOne = await createPermission({ roleId: role.id });
|
||||
permissionTwo = await createPermission({ roleId: role.id });
|
||||
currentUser = await createUser({ roleId: role.id });
|
||||
|
@@ -11,8 +11,8 @@ describe('GET /api/v1/admin/roles', () => {
|
||||
let roleOne, roleTwo, currentUser, token;
|
||||
|
||||
beforeEach(async () => {
|
||||
roleOne = await createRole({ key: 'admin' });
|
||||
roleTwo = await createRole({ key: 'user' });
|
||||
roleOne = await createRole({ name: 'Admin' });
|
||||
roleTwo = await createRole({ name: 'User' });
|
||||
currentUser = await createUser({ roleId: roleOne.id });
|
||||
|
||||
token = await createAuthTokenByUserId(currentUser.id);
|
||||
|
@@ -0,0 +1,24 @@
|
||||
import { renderObject } from '../../../../../helpers/renderer.js';
|
||||
import Role from '../../../../../models/role.js';
|
||||
|
||||
export default async (request, response) => {
|
||||
const role = await Role.query()
|
||||
.findById(request.params.roleId)
|
||||
.throwIfNotFound();
|
||||
|
||||
const updatedRoleWithPermissions = await role.updateWithPermissions(
|
||||
roleParams(request)
|
||||
);
|
||||
|
||||
renderObject(response, updatedRoleWithPermissions);
|
||||
};
|
||||
|
||||
const roleParams = (request) => {
|
||||
const { name, description, permissions } = request.body;
|
||||
|
||||
return {
|
||||
name,
|
||||
description,
|
||||
permissions,
|
||||
};
|
||||
};
|
@@ -0,0 +1,177 @@
|
||||
import { vi, describe, it, expect, beforeEach } from 'vitest';
|
||||
import request from 'supertest';
|
||||
import app from '../../../../../app.js';
|
||||
import createAuthTokenByUserId from '../../../../../helpers/create-auth-token-by-user-id.js';
|
||||
import { createRole } from '../../../../../../test/factories/role.js';
|
||||
import { createPermission } from '../../../../../../test/factories/permission.js';
|
||||
import { createUser } from '../../../../../../test/factories/user.js';
|
||||
import updateRoleMock from '../../../../../../test/mocks/rest/api/v1/admin/roles/update-role.ee.js';
|
||||
import * as license from '../../../../../helpers/license.ee.js';
|
||||
|
||||
describe('PATCH /api/v1/admin/roles/:roleId', () => {
|
||||
let adminRole, viewerRole, currentUser, token;
|
||||
|
||||
beforeEach(async () => {
|
||||
vi.spyOn(license, 'hasValidLicense').mockResolvedValue(true);
|
||||
|
||||
adminRole = await createRole({ name: 'Admin' });
|
||||
viewerRole = await createRole({ name: 'Viewer' });
|
||||
|
||||
await createPermission({
|
||||
action: 'read',
|
||||
subject: 'Connection',
|
||||
});
|
||||
|
||||
await createPermission({
|
||||
action: 'read',
|
||||
subject: 'Flow',
|
||||
});
|
||||
|
||||
currentUser = await createUser({ roleId: adminRole.id });
|
||||
|
||||
token = await createAuthTokenByUserId(currentUser.id);
|
||||
});
|
||||
|
||||
it('should return the updated role along with permissions', async () => {
|
||||
const roleData = {
|
||||
name: 'Updated role name',
|
||||
description: 'A new description',
|
||||
permissions: [
|
||||
{
|
||||
action: 'read',
|
||||
subject: 'Execution',
|
||||
conditions: ['isCreator'],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const response = await request(app)
|
||||
.patch(`/api/v1/admin/roles/${viewerRole.id}`)
|
||||
.set('Authorization', token)
|
||||
.send(roleData)
|
||||
.expect(200);
|
||||
|
||||
const refetchedViewerRole = await viewerRole
|
||||
.$query()
|
||||
.withGraphFetched({ permissions: true });
|
||||
|
||||
const expectedPayload = await updateRoleMock(
|
||||
{
|
||||
...refetchedViewerRole,
|
||||
...roleData,
|
||||
isAdmin: false,
|
||||
},
|
||||
[
|
||||
{
|
||||
...refetchedViewerRole.permissions[0],
|
||||
...roleData.permissions[0],
|
||||
},
|
||||
]
|
||||
);
|
||||
|
||||
expect(response.body).toStrictEqual(expectedPayload);
|
||||
});
|
||||
|
||||
it('should return the updated role with sanitized permissions', async () => {
|
||||
const validPermission = {
|
||||
action: 'create',
|
||||
subject: 'Connection',
|
||||
conditions: ['isCreator'],
|
||||
};
|
||||
|
||||
const invalidPermission = {
|
||||
action: 'publish',
|
||||
subject: 'Connection',
|
||||
conditions: ['isCreator'],
|
||||
};
|
||||
|
||||
const roleData = {
|
||||
permissions: [validPermission, invalidPermission],
|
||||
};
|
||||
|
||||
const response = await request(app)
|
||||
.patch(`/api/v1/admin/roles/${viewerRole.id}`)
|
||||
.set('Authorization', token)
|
||||
.send(roleData)
|
||||
.expect(200);
|
||||
|
||||
const refetchedViewerRole = await viewerRole.$query().withGraphFetched({
|
||||
permissions: true,
|
||||
});
|
||||
|
||||
const expectedPayload = updateRoleMock(refetchedViewerRole, [
|
||||
{
|
||||
...refetchedViewerRole.permissions[0],
|
||||
...validPermission,
|
||||
},
|
||||
]);
|
||||
|
||||
expect(response.body).toStrictEqual(expectedPayload);
|
||||
});
|
||||
|
||||
it('should return not authorized response for updating admin role', async () => {
|
||||
const roleData = {
|
||||
name: 'Updated role name',
|
||||
description: 'A new description',
|
||||
permissions: [
|
||||
{
|
||||
action: 'read',
|
||||
subject: 'Execution',
|
||||
conditions: ['isCreator'],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
await request(app)
|
||||
.patch(`/api/v1/admin/roles/${adminRole.id}`)
|
||||
.set('Authorization', token)
|
||||
.send(roleData)
|
||||
.expect(403);
|
||||
});
|
||||
|
||||
it('should return unprocessable entity response for invalid role data', async () => {
|
||||
const roleData = {
|
||||
description: 123,
|
||||
permissions: [],
|
||||
};
|
||||
|
||||
const response = await request(app)
|
||||
.patch(`/api/v1/admin/roles/${viewerRole.id}`)
|
||||
.set('Authorization', token)
|
||||
.send(roleData)
|
||||
.expect(422);
|
||||
|
||||
expect(response.body).toStrictEqual({
|
||||
errors: {
|
||||
description: ['must be string,null'],
|
||||
},
|
||||
meta: {
|
||||
type: 'ModelValidation',
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it('should return unique violation response for duplicate role data', async () => {
|
||||
await createRole({ name: 'Editor' });
|
||||
|
||||
const roleData = {
|
||||
name: 'Editor',
|
||||
permissions: [],
|
||||
};
|
||||
|
||||
const response = await request(app)
|
||||
.patch(`/api/v1/admin/roles/${viewerRole.id}`)
|
||||
.set('Authorization', token)
|
||||
.send(roleData)
|
||||
.expect(422);
|
||||
|
||||
expect(response.body).toStrictEqual({
|
||||
errors: {
|
||||
name: ["'name' must be unique."],
|
||||
},
|
||||
meta: {
|
||||
type: 'UniqueViolationError',
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user