Compare commits
	
		
			391 Commits
		
	
	
		
			dependabot
			...
			AUT-1281
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | b48b2592d5 | ||
|   | abf30dfc1a | ||
|   | 218b8ce86e | ||
|   | e34c3b411d | ||
|   | c91b8be1a6 | ||
|   | 9cb41644a1 | ||
|   | 8c01cea147 | ||
|   | 58eb55e90a | ||
|   | bb05e82e15 | ||
|   | 5ab95ea175 | ||
|   | a25c4f1d1e | ||
|   | 15287de8af | ||
|   | 49b4d6b511 | ||
|   | d5b4a5d4ac | ||
|   | de480b491c | ||
|   | a949fda1fc | ||
|   | 3e28af670c | ||
|   | b5310afb90 | ||
|   | da81ecf915 | ||
|   | f597066d16 | ||
|   | ec30606b24 | ||
|   | 20dce14f17 | ||
|   | 821742de85 | ||
|   | 74dc108f62 | ||
|   | a05fe856bb | ||
|   | d13f51a32d | ||
|   | 3dbe599cb3 | ||
|   | cf966dd83c | ||
|   | 4e62f3654f | ||
|   | 970d926563 | ||
|   | ff49c747ba | ||
|   | c46b8a5f4f | ||
|   | 485324e204 | ||
|   | 4696a03db1 | ||
|   | 7885de36a9 | ||
|   | fac4339207 | ||
|   | 9c70519021 | ||
|   | 9ae77ecd5d | ||
|   | 1c8e6f278d | ||
|   | c0a190a9f2 | ||
|   | e29e2a62f0 | ||
|   | 1580640a35 | ||
|   | 33c84b7fcc | ||
|   | 9773ce75b0 | ||
|   | c310e8d152 | ||
|   | af251c7b81 | ||
|   | 122483de0c | ||
|   | 42c2131144 | ||
|   | 71bc7a62c2 | ||
|   | 87bfff07db | ||
|   | 1cb5b780d2 | ||
|   | 2f6acd4d6e | ||
|   | c2e2351505 | ||
|   | d847b5480b | ||
|   | 32749ee58e | ||
|   | a531b8b5fe | ||
|   | 148a0c5bb0 | ||
|   | 39f9a58200 | ||
|   | edd113d344 | ||
|   | c641e8729b | ||
|   | 2c4b13e4b5 | ||
|   | 48fcf4dda7 | ||
|   | acfd980d4f | ||
|   | db9bfab812 | ||
|   | d32820ee09 | ||
|   | 0f823fd19e | ||
|   | 4308ed5850 | ||
|   | b9cd7c3983 | ||
|   | fa607aa961 | ||
|   | 6900b71841 | ||
|   | bb230d67e8 | ||
|   | 4f076ec3e3 | ||
|   | 96a6cbfb95 | ||
|   | 5bdc5aed72 | ||
|   | d38b0f088b | ||
|   | 892710f705 | ||
|   | fbf898be64 | ||
|   | e3e2ecc1e1 | ||
|   | b59807d221 | ||
|   | 163ad52285 | ||
|   | 4023a6d1cc | ||
|   | ec827e5dc0 | ||
|   | a8f4fb7c22 | ||
|   | bc195ed452 | ||
|   | 41568904ab | ||
|   | 79050af391 | ||
|   | 2e5b44c424 | ||
|   | 7a437660d1 | ||
|   | 47510e24d5 | ||
|   | 91c9ef3068 | ||
|   | 240854e4ac | ||
|   | 0e4fc7efbc | ||
|   | b47e859225 | ||
|   | 62a1072682 | ||
|   | c6f2a97591 | ||
|   | d66be231b3 | ||
|   | f73ffc8711 | ||
|   | e4c17c1bc7 | ||
|   | 997e729535 | ||
|   | e0e313b8d1 | ||
|   | f0bd763e72 | ||
|   | 6a7a90536b | ||
|   | ac8ddedfb5 | ||
|   | 6fcd126ff8 | ||
|   | 55d0966d48 | ||
|   | 2583e08f7a | ||
|   | de72e62470 | ||
|   | 91993dbb07 | ||
|   | d87ee4daa3 | ||
|   | 6791e002ff | ||
|   | 4ca84aa515 | ||
|   | 8189cbc171 | ||
|   | 73edb45ff7 | ||
|   | 0bbe362660 | ||
|   | a76bee51fc | ||
|   | 6e42b52414 | ||
|   | aed61209fa | ||
|   | f5d796ea77 | ||
|   | ecb04b4ba9 | ||
|   | dabb01e237 | ||
|   | c2d27d0fd4 | ||
|   | e62bd75fdf | ||
|   | 2e917bd62b | ||
|   | e0492c4264 | ||
|   | 7db68e2f96 | ||
|   | e9b05a37d1 | ||
|   | 5613259536 | ||
|   | 3209ff16ac | ||
|   | a49c8602d1 | ||
|   | 7caa055e00 | ||
|   | 0d62bc6c78 | ||
|   | bc0861fd9e | ||
|   | f280052d93 | ||
|   | 21da49f79d | ||
|   | 19a5ccf942 | ||
|   | 0234b4ad81 | ||
|   | 59ee9c21f3 | ||
|   | 00317fed24 | ||
|   | 42f6311ca8 | ||
|   | 0f77a1ec03 | ||
|   | 8268cd4d09 | ||
|   | c868070337 | ||
|   | 2981fa5946 | ||
|   | 623ec66a79 | ||
|   | b51bae14ec | ||
|   | 05a3016557 | ||
|   | 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 | ||
|   | f7ca59bd5f | 
| @@ -10,7 +10,7 @@ import process from 'process'; | |||||||
| async function fetchAdminRole() { | async function fetchAdminRole() { | ||||||
|   const role = await Role.query() |   const role = await Role.query() | ||||||
|     .where({ |     .where({ | ||||||
|       key: 'admin', |       name: 'Admin', | ||||||
|     }) |     }) | ||||||
|     .limit(1) |     .limit(1) | ||||||
|     .first(); |     .first(); | ||||||
|   | |||||||
| @@ -23,8 +23,6 @@ | |||||||
|   "dependencies": { |   "dependencies": { | ||||||
|     "@bull-board/express": "^3.10.1", |     "@bull-board/express": "^3.10.1", | ||||||
|     "@casl/ability": "^6.5.0", |     "@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", |     "@node-saml/passport-saml": "^4.0.4", | ||||||
|     "@rudderstack/rudder-sdk-node": "^1.1.2", |     "@rudderstack/rudder-sdk-node": "^1.1.2", | ||||||
|     "@sentry/node": "^7.42.0", |     "@sentry/node": "^7.42.0", | ||||||
| @@ -39,13 +37,9 @@ | |||||||
|     "debug": "~2.6.9", |     "debug": "~2.6.9", | ||||||
|     "dotenv": "^10.0.0", |     "dotenv": "^10.0.0", | ||||||
|     "express": "~4.18.2", |     "express": "~4.18.2", | ||||||
|     "express-async-handler": "^1.2.0", |     "express-async-errors": "^3.1.1", | ||||||
|     "express-basic-auth": "^1.2.1", |     "express-basic-auth": "^1.2.1", | ||||||
|     "express-graphql": "^0.12.0", |  | ||||||
|     "fast-xml-parser": "^4.0.11", |     "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", |     "handlebars": "^4.7.7", | ||||||
|     "http-errors": "~1.6.3", |     "http-errors": "~1.6.3", | ||||||
|     "http-proxy-agent": "^7.0.0", |     "http-proxy-agent": "^7.0.0", | ||||||
| @@ -107,7 +101,9 @@ | |||||||
|     "access": "public" |     "access": "public" | ||||||
|   }, |   }, | ||||||
|   "nodemonConfig": { |   "nodemonConfig": { | ||||||
|     "watch": [ "src/" ], |     "watch": [ | ||||||
|  |       "src/" | ||||||
|  |     ], | ||||||
|     "ext": "js" |     "ext": "js" | ||||||
|   } |   } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -1,5 +1,6 @@ | |||||||
| import createError from 'http-errors'; | import createError from 'http-errors'; | ||||||
| import express from 'express'; | import express from 'express'; | ||||||
|  | import 'express-async-errors'; | ||||||
| import cors from 'cors'; | import cors from 'cors'; | ||||||
|  |  | ||||||
| import appConfig from './config/app.js'; | import appConfig from './config/app.js'; | ||||||
|   | |||||||
| @@ -12,7 +12,7 @@ export default defineApp({ | |||||||
|   apiBaseUrl: 'https://api.airtable.com', |   apiBaseUrl: 'https://api.airtable.com', | ||||||
|   iconUrl: '{BASE_URL}/apps/airtable/assets/favicon.svg', |   iconUrl: '{BASE_URL}/apps/airtable/assets/favicon.svg', | ||||||
|   authDocUrl: '{DOCS_URL}/apps/airtable/connection', |   authDocUrl: '{DOCS_URL}/apps/airtable/connection', | ||||||
|   primaryColor: 'FFBF00', |   primaryColor: '#FFBF00', | ||||||
|   supportsConnections: true, |   supportsConnections: true, | ||||||
|   beforeRequest: [addAuthHeader], |   beforeRequest: [addAuthHeader], | ||||||
|   auth, |   auth, | ||||||
|   | |||||||
| @@ -12,7 +12,7 @@ export default defineApp({ | |||||||
|   apiBaseUrl: 'https://cloud.appwrite.io', |   apiBaseUrl: 'https://cloud.appwrite.io', | ||||||
|   iconUrl: '{BASE_URL}/apps/appwrite/assets/favicon.svg', |   iconUrl: '{BASE_URL}/apps/appwrite/assets/favicon.svg', | ||||||
|   authDocUrl: '{DOCS_URL}/apps/appwrite/connection', |   authDocUrl: '{DOCS_URL}/apps/appwrite/connection', | ||||||
|   primaryColor: 'FD366E', |   primaryColor: '#FD366E', | ||||||
|   supportsConnections: true, |   supportsConnections: true, | ||||||
|   beforeRequest: [setBaseUrl, addAuthHeader], |   beforeRequest: [setBaseUrl, addAuthHeader], | ||||||
|   auth, |   auth, | ||||||
|   | |||||||
| @@ -12,7 +12,7 @@ export default defineApp({ | |||||||
|   apiBaseUrl: '', |   apiBaseUrl: '', | ||||||
|   iconUrl: '{BASE_URL}/apps/azure-openai/assets/favicon.svg', |   iconUrl: '{BASE_URL}/apps/azure-openai/assets/favicon.svg', | ||||||
|   authDocUrl: '{DOCS_URL}/apps/azure-openai/connection', |   authDocUrl: '{DOCS_URL}/apps/azure-openai/connection', | ||||||
|   primaryColor: '000000', |   primaryColor: '#000000', | ||||||
|   supportsConnections: true, |   supportsConnections: true, | ||||||
|   beforeRequest: [setBaseUrl, addAuthHeader], |   beforeRequest: [setBaseUrl, addAuthHeader], | ||||||
|   auth, |   auth, | ||||||
|   | |||||||
| @@ -11,7 +11,7 @@ export default defineApp({ | |||||||
|   supportsConnections: true, |   supportsConnections: true, | ||||||
|   baseUrl: 'https://carbone.io', |   baseUrl: 'https://carbone.io', | ||||||
|   apiBaseUrl: 'https://api.carbone.io', |   apiBaseUrl: 'https://api.carbone.io', | ||||||
|   primaryColor: '6f42c1', |   primaryColor: '#6f42c1', | ||||||
|   beforeRequest: [addAuthHeader], |   beforeRequest: [addAuthHeader], | ||||||
|   auth, |   auth, | ||||||
|   actions, |   actions, | ||||||
|   | |||||||
| @@ -12,8 +12,8 @@ export default defineApp({ | |||||||
|   baseUrl: 'https://clickup.com', |   baseUrl: 'https://clickup.com', | ||||||
|   apiBaseUrl: 'https://api.clickup.com/api', |   apiBaseUrl: 'https://api.clickup.com/api', | ||||||
|   iconUrl: '{BASE_URL}/apps/clickup/assets/favicon.svg', |   iconUrl: '{BASE_URL}/apps/clickup/assets/favicon.svg', | ||||||
|   authDocUrl: 'https://automatisch.io/docs/apps/clickup/connection', |   authDocUrl: '{DOCS_URL}/apps/clickup/connection', | ||||||
|   primaryColor: 'FD71AF', |   primaryColor: '#FD71AF', | ||||||
|   supportsConnections: true, |   supportsConnections: true, | ||||||
|   beforeRequest: [addAuthHeader], |   beforeRequest: [addAuthHeader], | ||||||
|   auth, |   auth, | ||||||
|   | |||||||
| @@ -8,7 +8,7 @@ export default defineApp({ | |||||||
|   apiBaseUrl: '', |   apiBaseUrl: '', | ||||||
|   iconUrl: '{BASE_URL}/apps/code/assets/favicon.svg', |   iconUrl: '{BASE_URL}/apps/code/assets/favicon.svg', | ||||||
|   authDocUrl: '{DOCS_URL}/apps/code/connection', |   authDocUrl: '{DOCS_URL}/apps/code/connection', | ||||||
|   primaryColor: '000000', |   primaryColor: '#000000', | ||||||
|   supportsConnections: false, |   supportsConnections: false, | ||||||
|   actions, |   actions, | ||||||
| }); | }); | ||||||
|   | |||||||
| @@ -9,6 +9,6 @@ export default defineApp({ | |||||||
|   supportsConnections: false, |   supportsConnections: false, | ||||||
|   baseUrl: '', |   baseUrl: '', | ||||||
|   apiBaseUrl: '', |   apiBaseUrl: '', | ||||||
|   primaryColor: '001F52', |   primaryColor: '#001F52', | ||||||
|   actions, |   actions, | ||||||
| }); | }); | ||||||
|   | |||||||
| @@ -9,6 +9,6 @@ export default defineApp({ | |||||||
|   supportsConnections: false, |   supportsConnections: false, | ||||||
|   baseUrl: '', |   baseUrl: '', | ||||||
|   apiBaseUrl: '', |   apiBaseUrl: '', | ||||||
|   primaryColor: '001F52', |   primaryColor: '#001F52', | ||||||
|   actions, |   actions, | ||||||
| }); | }); | ||||||
|   | |||||||
| @@ -11,7 +11,7 @@ export default defineApp({ | |||||||
|   supportsConnections: true, |   supportsConnections: true, | ||||||
|   baseUrl: 'https://deepl.com', |   baseUrl: 'https://deepl.com', | ||||||
|   apiBaseUrl: 'https://api.deepl.com', |   apiBaseUrl: 'https://api.deepl.com', | ||||||
|   primaryColor: '0d2d45', |   primaryColor: '#0d2d45', | ||||||
|   beforeRequest: [addAuthHeader], |   beforeRequest: [addAuthHeader], | ||||||
|   auth, |   auth, | ||||||
|   actions, |   actions, | ||||||
|   | |||||||
| @@ -9,6 +9,6 @@ export default defineApp({ | |||||||
|   supportsConnections: false, |   supportsConnections: false, | ||||||
|   baseUrl: '', |   baseUrl: '', | ||||||
|   apiBaseUrl: '', |   apiBaseUrl: '', | ||||||
|   primaryColor: '001F52', |   primaryColor: '#001F52', | ||||||
|   actions, |   actions, | ||||||
| }); | }); | ||||||
|   | |||||||
| @@ -14,7 +14,7 @@ export default defineApp({ | |||||||
|   supportsConnections: true, |   supportsConnections: true, | ||||||
|   baseUrl: 'https://discord.com', |   baseUrl: 'https://discord.com', | ||||||
|   apiBaseUrl: 'https://discord.com/api', |   apiBaseUrl: 'https://discord.com/api', | ||||||
|   primaryColor: '5865f2', |   primaryColor: '#5865f2', | ||||||
|   beforeRequest: [addAuthHeader], |   beforeRequest: [addAuthHeader], | ||||||
|   auth, |   auth, | ||||||
|   dynamicData, |   dynamicData, | ||||||
|   | |||||||
| @@ -11,7 +11,7 @@ export default defineApp({ | |||||||
|   apiBaseUrl: 'https://disqus.com/api', |   apiBaseUrl: 'https://disqus.com/api', | ||||||
|   iconUrl: '{BASE_URL}/apps/disqus/assets/favicon.svg', |   iconUrl: '{BASE_URL}/apps/disqus/assets/favicon.svg', | ||||||
|   authDocUrl: '{DOCS_URL}/apps/disqus/connection', |   authDocUrl: '{DOCS_URL}/apps/disqus/connection', | ||||||
|   primaryColor: '2E9FFF', |   primaryColor: '#2E9FFF', | ||||||
|   supportsConnections: true, |   supportsConnections: true, | ||||||
|   beforeRequest: [addAuthHeader], |   beforeRequest: [addAuthHeader], | ||||||
|   auth, |   auth, | ||||||
|   | |||||||
| @@ -11,7 +11,7 @@ export default defineApp({ | |||||||
|   supportsConnections: true, |   supportsConnections: true, | ||||||
|   baseUrl: 'https://dropbox.com', |   baseUrl: 'https://dropbox.com', | ||||||
|   apiBaseUrl: 'https://api.dropboxapi.com', |   apiBaseUrl: 'https://api.dropboxapi.com', | ||||||
|   primaryColor: '0061ff', |   primaryColor: '#0061ff', | ||||||
|   beforeRequest: [addAuthHeader], |   beforeRequest: [addAuthHeader], | ||||||
|   auth, |   auth, | ||||||
|   actions, |   actions, | ||||||
|   | |||||||
| @@ -9,6 +9,6 @@ export default defineApp({ | |||||||
|   supportsConnections: false, |   supportsConnections: false, | ||||||
|   baseUrl: '', |   baseUrl: '', | ||||||
|   apiBaseUrl: '', |   apiBaseUrl: '', | ||||||
|   primaryColor: '001F52', |   primaryColor: '#001F52', | ||||||
|   actions, |   actions, | ||||||
| }); | }); | ||||||
|   | |||||||
| @@ -10,7 +10,7 @@ export default defineApp({ | |||||||
|   iconUrl: '{BASE_URL}/apps/flickr/assets/favicon.svg', |   iconUrl: '{BASE_URL}/apps/flickr/assets/favicon.svg', | ||||||
|   authDocUrl: '{DOCS_URL}/apps/flickr/connection', |   authDocUrl: '{DOCS_URL}/apps/flickr/connection', | ||||||
|   docUrl: 'https://automatisch.io/docs/flickr', |   docUrl: 'https://automatisch.io/docs/flickr', | ||||||
|   primaryColor: '000000', |   primaryColor: '#000000', | ||||||
|   supportsConnections: true, |   supportsConnections: true, | ||||||
|   baseUrl: 'https://www.flickr.com/', |   baseUrl: 'https://www.flickr.com/', | ||||||
|   apiBaseUrl: 'https://www.flickr.com/services', |   apiBaseUrl: 'https://www.flickr.com/services', | ||||||
|   | |||||||
| @@ -11,7 +11,7 @@ export default defineApp({ | |||||||
|   supportsConnections: true, |   supportsConnections: true, | ||||||
|   baseUrl: 'https://flowers-software.com', |   baseUrl: 'https://flowers-software.com', | ||||||
|   apiBaseUrl: 'https://webapp.flowers-software.com/api', |   apiBaseUrl: 'https://webapp.flowers-software.com/api', | ||||||
|   primaryColor: '02AFC7', |   primaryColor: '#02AFC7', | ||||||
|   beforeRequest: [addAuthHeader], |   beforeRequest: [addAuthHeader], | ||||||
|   auth, |   auth, | ||||||
|   triggers, |   triggers, | ||||||
|   | |||||||
| @@ -10,7 +10,7 @@ export default defineApp({ | |||||||
|   supportsConnections: false, |   supportsConnections: false, | ||||||
|   baseUrl: '', |   baseUrl: '', | ||||||
|   apiBaseUrl: '', |   apiBaseUrl: '', | ||||||
|   primaryColor: '001F52', |   primaryColor: '#001F52', | ||||||
|   actions, |   actions, | ||||||
|   dynamicFields, |   dynamicFields, | ||||||
| }); | }); | ||||||
|   | |||||||
| @@ -11,7 +11,7 @@ export default defineApp({ | |||||||
|   apiBaseUrl: '', |   apiBaseUrl: '', | ||||||
|   iconUrl: '{BASE_URL}/apps/ghost/assets/favicon.svg', |   iconUrl: '{BASE_URL}/apps/ghost/assets/favicon.svg', | ||||||
|   authDocUrl: '{DOCS_URL}/apps/ghost/connection', |   authDocUrl: '{DOCS_URL}/apps/ghost/connection', | ||||||
|   primaryColor: '15171A', |   primaryColor: '#15171A', | ||||||
|   supportsConnections: true, |   supportsConnections: true, | ||||||
|   beforeRequest: [setBaseUrl, addAuthHeader], |   beforeRequest: [setBaseUrl, addAuthHeader], | ||||||
|   auth, |   auth, | ||||||
|   | |||||||
| @@ -12,7 +12,7 @@ export default defineApp({ | |||||||
|   apiBaseUrl: 'https://api.github.com', |   apiBaseUrl: 'https://api.github.com', | ||||||
|   iconUrl: '{BASE_URL}/apps/github/assets/favicon.svg', |   iconUrl: '{BASE_URL}/apps/github/assets/favicon.svg', | ||||||
|   authDocUrl: '{DOCS_URL}/apps/github/connection', |   authDocUrl: '{DOCS_URL}/apps/github/connection', | ||||||
|   primaryColor: '000000', |   primaryColor: '#000000', | ||||||
|   supportsConnections: true, |   supportsConnections: true, | ||||||
|   beforeRequest: [addAuthHeader], |   beforeRequest: [addAuthHeader], | ||||||
|   auth, |   auth, | ||||||
|   | |||||||
| @@ -12,7 +12,7 @@ export default defineApp({ | |||||||
|   apiBaseUrl: 'https://gitlab.com', |   apiBaseUrl: 'https://gitlab.com', | ||||||
|   iconUrl: '{BASE_URL}/apps/gitlab/assets/favicon.svg', |   iconUrl: '{BASE_URL}/apps/gitlab/assets/favicon.svg', | ||||||
|   authDocUrl: '{DOCS_URL}/apps/gitlab/connection', |   authDocUrl: '{DOCS_URL}/apps/gitlab/connection', | ||||||
|   primaryColor: 'FC6D26', |   primaryColor: '#FC6D26', | ||||||
|   supportsConnections: true, |   supportsConnections: true, | ||||||
|   beforeRequest: [setBaseUrl, addAuthHeader], |   beforeRequest: [setBaseUrl, addAuthHeader], | ||||||
|   auth, |   auth, | ||||||
|   | |||||||
| @@ -11,7 +11,7 @@ export default defineApp({ | |||||||
|   apiBaseUrl: 'https://www.googleapis.com/calendar', |   apiBaseUrl: 'https://www.googleapis.com/calendar', | ||||||
|   iconUrl: '{BASE_URL}/apps/google-calendar/assets/favicon.svg', |   iconUrl: '{BASE_URL}/apps/google-calendar/assets/favicon.svg', | ||||||
|   authDocUrl: '{DOCS_URL}/apps/google-calendar/connection', |   authDocUrl: '{DOCS_URL}/apps/google-calendar/connection', | ||||||
|   primaryColor: '448AFF', |   primaryColor: '#448AFF', | ||||||
|   supportsConnections: true, |   supportsConnections: true, | ||||||
|   beforeRequest: [addAuthHeader], |   beforeRequest: [addAuthHeader], | ||||||
|   auth, |   auth, | ||||||
|   | |||||||
| @@ -11,7 +11,7 @@ export default defineApp({ | |||||||
|   apiBaseUrl: 'https://www.googleapis.com/drive', |   apiBaseUrl: 'https://www.googleapis.com/drive', | ||||||
|   iconUrl: '{BASE_URL}/apps/google-drive/assets/favicon.svg', |   iconUrl: '{BASE_URL}/apps/google-drive/assets/favicon.svg', | ||||||
|   authDocUrl: '{DOCS_URL}/apps/google-drive/connection', |   authDocUrl: '{DOCS_URL}/apps/google-drive/connection', | ||||||
|   primaryColor: '1FA463', |   primaryColor: '#1FA463', | ||||||
|   supportsConnections: true, |   supportsConnections: true, | ||||||
|   beforeRequest: [addAuthHeader], |   beforeRequest: [addAuthHeader], | ||||||
|   auth, |   auth, | ||||||
|   | |||||||
| @@ -11,7 +11,7 @@ export default defineApp({ | |||||||
|   apiBaseUrl: 'https://forms.googleapis.com', |   apiBaseUrl: 'https://forms.googleapis.com', | ||||||
|   iconUrl: '{BASE_URL}/apps/google-forms/assets/favicon.svg', |   iconUrl: '{BASE_URL}/apps/google-forms/assets/favicon.svg', | ||||||
|   authDocUrl: '{DOCS_URL}/apps/google-forms/connection', |   authDocUrl: '{DOCS_URL}/apps/google-forms/connection', | ||||||
|   primaryColor: '673AB7', |   primaryColor: '#673AB7', | ||||||
|   supportsConnections: true, |   supportsConnections: true, | ||||||
|   beforeRequest: [addAuthHeader], |   beforeRequest: [addAuthHeader], | ||||||
|   auth, |   auth, | ||||||
|   | |||||||
| @@ -13,7 +13,7 @@ export default defineApp({ | |||||||
|   apiBaseUrl: 'https://sheets.googleapis.com', |   apiBaseUrl: 'https://sheets.googleapis.com', | ||||||
|   iconUrl: '{BASE_URL}/apps/google-sheets/assets/favicon.svg', |   iconUrl: '{BASE_URL}/apps/google-sheets/assets/favicon.svg', | ||||||
|   authDocUrl: '{DOCS_URL}/apps/google-sheets/connection', |   authDocUrl: '{DOCS_URL}/apps/google-sheets/connection', | ||||||
|   primaryColor: '0F9D58', |   primaryColor: '#0F9D58', | ||||||
|   supportsConnections: true, |   supportsConnections: true, | ||||||
|   beforeRequest: [addAuthHeader], |   beforeRequest: [addAuthHeader], | ||||||
|   auth, |   auth, | ||||||
|   | |||||||
| @@ -12,7 +12,7 @@ export default defineApp({ | |||||||
|   apiBaseUrl: 'https://tasks.googleapis.com', |   apiBaseUrl: 'https://tasks.googleapis.com', | ||||||
|   iconUrl: '{BASE_URL}/apps/google-tasks/assets/favicon.svg', |   iconUrl: '{BASE_URL}/apps/google-tasks/assets/favicon.svg', | ||||||
|   authDocUrl: '{DOCS_URL}/apps/google-tasks/connection', |   authDocUrl: '{DOCS_URL}/apps/google-tasks/connection', | ||||||
|   primaryColor: '0066DA', |   primaryColor: '#0066DA', | ||||||
|   supportsConnections: true, |   supportsConnections: true, | ||||||
|   beforeRequest: [addAuthHeader], |   beforeRequest: [addAuthHeader], | ||||||
|   auth, |   auth, | ||||||
|   | |||||||
| @@ -11,7 +11,7 @@ export default defineApp({ | |||||||
|   apiBaseUrl: 'https://app.tryhelix.ai', |   apiBaseUrl: 'https://app.tryhelix.ai', | ||||||
|   iconUrl: '{BASE_URL}/apps/helix/assets/favicon.svg', |   iconUrl: '{BASE_URL}/apps/helix/assets/favicon.svg', | ||||||
|   authDocUrl: '{DOCS_URL}/apps/helix/connection', |   authDocUrl: '{DOCS_URL}/apps/helix/connection', | ||||||
|   primaryColor: '000000', |   primaryColor: '#000000', | ||||||
|   supportsConnections: true, |   supportsConnections: true, | ||||||
|   beforeRequest: [setBaseUrl, addAuthHeader], |   beforeRequest: [setBaseUrl, addAuthHeader], | ||||||
|   auth, |   auth, | ||||||
|   | |||||||
| @@ -9,6 +9,6 @@ export default defineApp({ | |||||||
|   supportsConnections: false, |   supportsConnections: false, | ||||||
|   baseUrl: '', |   baseUrl: '', | ||||||
|   apiBaseUrl: '', |   apiBaseUrl: '', | ||||||
|   primaryColor: '000000', |   primaryColor: '#000000', | ||||||
|   actions, |   actions, | ||||||
| }); | }); | ||||||
|   | |||||||
| @@ -11,7 +11,7 @@ export default defineApp({ | |||||||
|   supportsConnections: true, |   supportsConnections: true, | ||||||
|   baseUrl: 'https://www.hubspot.com', |   baseUrl: 'https://www.hubspot.com', | ||||||
|   apiBaseUrl: 'https://api.hubapi.com', |   apiBaseUrl: 'https://api.hubapi.com', | ||||||
|   primaryColor: 'F95C35', |   primaryColor: '#F95C35', | ||||||
|   beforeRequest: [addAuthHeader], |   beforeRequest: [addAuthHeader], | ||||||
|   auth, |   auth, | ||||||
|   actions, |   actions, | ||||||
|   | |||||||
| @@ -13,7 +13,7 @@ export default defineApp({ | |||||||
|   apiBaseUrl: 'https://invoicing.co/api', |   apiBaseUrl: 'https://invoicing.co/api', | ||||||
|   iconUrl: '{BASE_URL}/apps/invoice-ninja/assets/favicon.svg', |   iconUrl: '{BASE_URL}/apps/invoice-ninja/assets/favicon.svg', | ||||||
|   authDocUrl: '{DOCS_URL}/apps/invoice-ninja/connection', |   authDocUrl: '{DOCS_URL}/apps/invoice-ninja/connection', | ||||||
|   primaryColor: '000000', |   primaryColor: '#000000', | ||||||
|   supportsConnections: true, |   supportsConnections: true, | ||||||
|   beforeRequest: [setBaseUrl, addAuthHeader], |   beforeRequest: [setBaseUrl, addAuthHeader], | ||||||
|   auth, |   auth, | ||||||
|   | |||||||
| @@ -9,11 +9,11 @@ export default defineApp({ | |||||||
|   name: 'Jotform', |   name: 'Jotform', | ||||||
|   key: 'jotform', |   key: 'jotform', | ||||||
|   iconUrl: '{BASE_URL}/apps/jotform/assets/favicon.svg', |   iconUrl: '{BASE_URL}/apps/jotform/assets/favicon.svg', | ||||||
|   authDocUrl: 'https://automatisch.io/docs/apps/jotform/connection', |   authDocUrl: '{DOCS_URL}/apps/jotform/connection', | ||||||
|   supportsConnections: true, |   supportsConnections: true, | ||||||
|   baseUrl: 'https://www.jotform.com', |   baseUrl: 'https://www.jotform.com', | ||||||
|   apiBaseUrl: 'https://api.jotform.com', |   apiBaseUrl: 'https://api.jotform.com', | ||||||
|   primaryColor: 'FF6100', |   primaryColor: '#FF6100', | ||||||
|   beforeRequest: [setBaseUrl, addAuthHeader], |   beforeRequest: [setBaseUrl, addAuthHeader], | ||||||
|   auth, |   auth, | ||||||
|   triggers, |   triggers, | ||||||
|   | |||||||
| @@ -12,8 +12,8 @@ export default defineApp({ | |||||||
|   baseUrl: 'https://mailchimp.com', |   baseUrl: 'https://mailchimp.com', | ||||||
|   apiBaseUrl: '', |   apiBaseUrl: '', | ||||||
|   iconUrl: '{BASE_URL}/apps/mailchimp/assets/favicon.svg', |   iconUrl: '{BASE_URL}/apps/mailchimp/assets/favicon.svg', | ||||||
|   authDocUrl: 'https://automatisch.io/docs/apps/mailchimp/connection', |   authDocUrl: '{DOCS_URL}/apps/mailchimp/connection', | ||||||
|   primaryColor: '000000', |   primaryColor: '#000000', | ||||||
|   supportsConnections: true, |   supportsConnections: true, | ||||||
|   beforeRequest: [setBaseUrl, addAuthHeader], |   beforeRequest: [setBaseUrl, addAuthHeader], | ||||||
|   auth, |   auth, | ||||||
|   | |||||||
| @@ -7,11 +7,11 @@ export default defineApp({ | |||||||
|   name: 'MailerLite', |   name: 'MailerLite', | ||||||
|   key: 'mailerlite', |   key: 'mailerlite', | ||||||
|   iconUrl: '{BASE_URL}/apps/mailerlite/assets/favicon.svg', |   iconUrl: '{BASE_URL}/apps/mailerlite/assets/favicon.svg', | ||||||
|   authDocUrl: 'https://automatisch.io/docs/apps/mailerlite/connection', |   authDocUrl: '{DOCS_URL}/apps/mailerlite/connection', | ||||||
|   supportsConnections: true, |   supportsConnections: true, | ||||||
|   baseUrl: 'https://www.mailerlite.com', |   baseUrl: 'https://www.mailerlite.com', | ||||||
|   apiBaseUrl: 'https://connect.mailerlite.com/api', |   apiBaseUrl: 'https://connect.mailerlite.com/api', | ||||||
|   primaryColor: '09C269', |   primaryColor: '#09C269', | ||||||
|   beforeRequest: [addAuthHeader], |   beforeRequest: [addAuthHeader], | ||||||
|   auth, |   auth, | ||||||
|   triggers, |   triggers, | ||||||
|   | |||||||
| @@ -13,7 +13,7 @@ export default defineApp({ | |||||||
|   authDocUrl: '{DOCS_URL}/apps/mattermost/connection', |   authDocUrl: '{DOCS_URL}/apps/mattermost/connection', | ||||||
|   baseUrl: 'https://mattermost.com', |   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 |   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, |   supportsConnections: true, | ||||||
|   beforeRequest: [setBaseUrl, addXRequestedWithHeader, addAuthHeader], |   beforeRequest: [setBaseUrl, addXRequestedWithHeader, addAuthHeader], | ||||||
|   auth, |   auth, | ||||||
|   | |||||||
| @@ -11,7 +11,7 @@ export default defineApp({ | |||||||
|   apiBaseUrl: 'https://api.miro.com', |   apiBaseUrl: 'https://api.miro.com', | ||||||
|   iconUrl: '{BASE_URL}/apps/miro/assets/favicon.svg', |   iconUrl: '{BASE_URL}/apps/miro/assets/favicon.svg', | ||||||
|   authDocUrl: '{DOCS_URL}/apps/miro/connection', |   authDocUrl: '{DOCS_URL}/apps/miro/connection', | ||||||
|   primaryColor: 'F2CA02', |   primaryColor: '#F2CA02', | ||||||
|   supportsConnections: true, |   supportsConnections: true, | ||||||
|   beforeRequest: [addAuthHeader], |   beforeRequest: [addAuthHeader], | ||||||
|   auth, |   auth, | ||||||
|   | |||||||
| @@ -13,7 +13,7 @@ export default defineApp({ | |||||||
|   apiBaseUrl: 'https://api.notion.com', |   apiBaseUrl: 'https://api.notion.com', | ||||||
|   iconUrl: '{BASE_URL}/apps/notion/assets/favicon.svg', |   iconUrl: '{BASE_URL}/apps/notion/assets/favicon.svg', | ||||||
|   authDocUrl: '{DOCS_URL}/apps/notion/connection', |   authDocUrl: '{DOCS_URL}/apps/notion/connection', | ||||||
|   primaryColor: '000000', |   primaryColor: '#000000', | ||||||
|   supportsConnections: true, |   supportsConnections: true, | ||||||
|   beforeRequest: [addAuthHeader, addNotionVersionHeader], |   beforeRequest: [addAuthHeader, addNotionVersionHeader], | ||||||
|   auth, |   auth, | ||||||
|   | |||||||
| @@ -11,7 +11,7 @@ export default defineApp({ | |||||||
|   supportsConnections: true, |   supportsConnections: true, | ||||||
|   baseUrl: 'https://ntfy.sh', |   baseUrl: 'https://ntfy.sh', | ||||||
|   apiBaseUrl: 'https://ntfy.sh', |   apiBaseUrl: 'https://ntfy.sh', | ||||||
|   primaryColor: '56bda8', |   primaryColor: '#56bda8', | ||||||
|   beforeRequest: [addAuthHeader], |   beforeRequest: [addAuthHeader], | ||||||
|   auth, |   auth, | ||||||
|   actions, |   actions, | ||||||
|   | |||||||
| @@ -10,7 +10,7 @@ export default defineApp({ | |||||||
|   supportsConnections: true, |   supportsConnections: true, | ||||||
|   baseUrl: 'https://odoo.com', |   baseUrl: 'https://odoo.com', | ||||||
|   apiBaseUrl: '', |   apiBaseUrl: '', | ||||||
|   primaryColor: '9c5789', |   primaryColor: '#9c5789', | ||||||
|   auth, |   auth, | ||||||
|   actions, |   actions, | ||||||
| }); | }); | ||||||
|   | |||||||
| @@ -11,7 +11,7 @@ export default defineApp({ | |||||||
|   apiBaseUrl: 'https://api.openai.com', |   apiBaseUrl: 'https://api.openai.com', | ||||||
|   iconUrl: '{BASE_URL}/apps/openai/assets/favicon.svg', |   iconUrl: '{BASE_URL}/apps/openai/assets/favicon.svg', | ||||||
|   authDocUrl: '{DOCS_URL}/apps/openai/connection', |   authDocUrl: '{DOCS_URL}/apps/openai/connection', | ||||||
|   primaryColor: '000000', |   primaryColor: '#000000', | ||||||
|   supportsConnections: true, |   supportsConnections: true, | ||||||
|   beforeRequest: [addAuthHeader], |   beforeRequest: [addAuthHeader], | ||||||
|   auth, |   auth, | ||||||
|   | |||||||
| @@ -13,7 +13,7 @@ export default defineApp({ | |||||||
|   apiBaseUrl: '', |   apiBaseUrl: '', | ||||||
|   iconUrl: '{BASE_URL}/apps/pipedrive/assets/favicon.svg', |   iconUrl: '{BASE_URL}/apps/pipedrive/assets/favicon.svg', | ||||||
|   authDocUrl: '{DOCS_URL}/apps/pipedrive/connection', |   authDocUrl: '{DOCS_URL}/apps/pipedrive/connection', | ||||||
|   primaryColor: 'FFFFFF', |   primaryColor: '#FFFFFF', | ||||||
|   supportsConnections: true, |   supportsConnections: true, | ||||||
|   beforeRequest: [setBaseUrl, addAuthHeader], |   beforeRequest: [setBaseUrl, addAuthHeader], | ||||||
|   auth, |   auth, | ||||||
|   | |||||||
| @@ -12,7 +12,7 @@ export default defineApp({ | |||||||
|   supportsConnections: true, |   supportsConnections: true, | ||||||
|   baseUrl: 'https://placetel.de', |   baseUrl: 'https://placetel.de', | ||||||
|   apiBaseUrl: 'https://api.placetel.de', |   apiBaseUrl: 'https://api.placetel.de', | ||||||
|   primaryColor: '069dd9', |   primaryColor: '#069dd9', | ||||||
|   beforeRequest: [addAuthHeader], |   beforeRequest: [addAuthHeader], | ||||||
|   auth, |   auth, | ||||||
|   triggers, |   triggers, | ||||||
|   | |||||||
| @@ -10,7 +10,7 @@ export default defineApp({ | |||||||
|   supportsConnections: true, |   supportsConnections: true, | ||||||
|   baseUrl: '', |   baseUrl: '', | ||||||
|   apiBaseUrl: '', |   apiBaseUrl: '', | ||||||
|   primaryColor: '336791', |   primaryColor: '#336791', | ||||||
|   auth, |   auth, | ||||||
|   actions, |   actions, | ||||||
| }); | }); | ||||||
|   | |||||||
| @@ -10,7 +10,7 @@ export default defineApp({ | |||||||
|   apiBaseUrl: 'https://api.pushover.net', |   apiBaseUrl: 'https://api.pushover.net', | ||||||
|   iconUrl: '{BASE_URL}/apps/pushover/assets/favicon.svg', |   iconUrl: '{BASE_URL}/apps/pushover/assets/favicon.svg', | ||||||
|   authDocUrl: '{DOCS_URL}/apps/pushover/connection', |   authDocUrl: '{DOCS_URL}/apps/pushover/connection', | ||||||
|   primaryColor: '249DF1', |   primaryColor: '#249DF1', | ||||||
|   supportsConnections: true, |   supportsConnections: true, | ||||||
|   auth, |   auth, | ||||||
|   actions, |   actions, | ||||||
|   | |||||||
| @@ -11,7 +11,7 @@ export default defineApp({ | |||||||
|   apiBaseUrl: 'https://oauth.reddit.com', |   apiBaseUrl: 'https://oauth.reddit.com', | ||||||
|   iconUrl: '{BASE_URL}/apps/reddit/assets/favicon.svg', |   iconUrl: '{BASE_URL}/apps/reddit/assets/favicon.svg', | ||||||
|   authDocUrl: '{DOCS_URL}/apps/reddit/connection', |   authDocUrl: '{DOCS_URL}/apps/reddit/connection', | ||||||
|   primaryColor: 'FF4500', |   primaryColor: '#FF4500', | ||||||
|   supportsConnections: true, |   supportsConnections: true, | ||||||
|   beforeRequest: [addAuthHeader], |   beforeRequest: [addAuthHeader], | ||||||
|   auth, |   auth, | ||||||
|   | |||||||
| @@ -11,7 +11,7 @@ export default defineApp({ | |||||||
|   supportsConnections: true, |   supportsConnections: true, | ||||||
|   baseUrl: 'https://www.remove.bg', |   baseUrl: 'https://www.remove.bg', | ||||||
|   apiBaseUrl: 'https://api.remove.bg/v1.0', |   apiBaseUrl: 'https://api.remove.bg/v1.0', | ||||||
|   primaryColor: '55636c', |   primaryColor: '#55636c', | ||||||
|   beforeRequest: [addAuthHeader], |   beforeRequest: [addAuthHeader], | ||||||
|   auth, |   auth, | ||||||
|   actions, |   actions, | ||||||
|   | |||||||
| @@ -9,6 +9,6 @@ export default defineApp({ | |||||||
|   supportsConnections: false, |   supportsConnections: false, | ||||||
|   baseUrl: '', |   baseUrl: '', | ||||||
|   apiBaseUrl: '', |   apiBaseUrl: '', | ||||||
|   primaryColor: 'ff8800', |   primaryColor: '#ff8800', | ||||||
|   triggers, |   triggers, | ||||||
| }); | }); | ||||||
|   | |||||||
| @@ -13,7 +13,7 @@ export default defineApp({ | |||||||
|   supportsConnections: true, |   supportsConnections: true, | ||||||
|   baseUrl: 'https://salesforce.com', |   baseUrl: 'https://salesforce.com', | ||||||
|   apiBaseUrl: '', |   apiBaseUrl: '', | ||||||
|   primaryColor: '00A1E0', |   primaryColor: '#00A1E0', | ||||||
|   beforeRequest: [addAuthHeader], |   beforeRequest: [addAuthHeader], | ||||||
|   auth, |   auth, | ||||||
|   triggers, |   triggers, | ||||||
|   | |||||||
| @@ -9,7 +9,7 @@ export default defineApp({ | |||||||
|   authDocUrl: '{DOCS_URL}/apps/scheduler/connection', |   authDocUrl: '{DOCS_URL}/apps/scheduler/connection', | ||||||
|   baseUrl: '', |   baseUrl: '', | ||||||
|   apiBaseUrl: '', |   apiBaseUrl: '', | ||||||
|   primaryColor: '0059F7', |   primaryColor: '#0059F7', | ||||||
|   supportsConnections: false, |   supportsConnections: false, | ||||||
|   triggers, |   triggers, | ||||||
| }); | }); | ||||||
|   | |||||||
| @@ -12,7 +12,7 @@ export default defineApp({ | |||||||
|   apiBaseUrl: '', |   apiBaseUrl: '', | ||||||
|   iconUrl: '{BASE_URL}/apps/self-hosted-llm/assets/favicon.svg', |   iconUrl: '{BASE_URL}/apps/self-hosted-llm/assets/favicon.svg', | ||||||
|   authDocUrl: '{DOCS_URL}/apps/self-hosted-llm/connection', |   authDocUrl: '{DOCS_URL}/apps/self-hosted-llm/connection', | ||||||
|   primaryColor: '000000', |   primaryColor: '#000000', | ||||||
|   supportsConnections: true, |   supportsConnections: true, | ||||||
|   beforeRequest: [setBaseUrl, addAuthHeader], |   beforeRequest: [setBaseUrl, addAuthHeader], | ||||||
|   auth, |   auth, | ||||||
|   | |||||||
| @@ -13,7 +13,7 @@ export default defineApp({ | |||||||
|   supportsConnections: true, |   supportsConnections: true, | ||||||
|   baseUrl: 'https://signalwire.com', |   baseUrl: 'https://signalwire.com', | ||||||
|   apiBaseUrl: '', |   apiBaseUrl: '', | ||||||
|   primaryColor: '044cf6', |   primaryColor: '#044cf6', | ||||||
|   beforeRequest: [addAuthHeader], |   beforeRequest: [addAuthHeader], | ||||||
|   auth, |   auth, | ||||||
|   triggers, |   triggers, | ||||||
|   | |||||||
| @@ -13,7 +13,7 @@ export default defineApp({ | |||||||
|   supportsConnections: true, |   supportsConnections: true, | ||||||
|   baseUrl: 'https://slack.com', |   baseUrl: 'https://slack.com', | ||||||
|   apiBaseUrl: 'https://slack.com/api', |   apiBaseUrl: 'https://slack.com/api', | ||||||
|   primaryColor: '4a154b', |   primaryColor: '#4a154b', | ||||||
|   beforeRequest: [addAuthHeader], |   beforeRequest: [addAuthHeader], | ||||||
|   auth, |   auth, | ||||||
|   actions, |   actions, | ||||||
|   | |||||||
| @@ -10,7 +10,7 @@ export default defineApp({ | |||||||
|   supportsConnections: true, |   supportsConnections: true, | ||||||
|   baseUrl: '', |   baseUrl: '', | ||||||
|   apiBaseUrl: '', |   apiBaseUrl: '', | ||||||
|   primaryColor: '2DAAE1', |   primaryColor: '#2DAAE1', | ||||||
|   auth, |   auth, | ||||||
|   actions, |   actions, | ||||||
| }); | }); | ||||||
|   | |||||||
| @@ -11,7 +11,7 @@ export default defineApp({ | |||||||
|   supportsConnections: true, |   supportsConnections: true, | ||||||
|   baseUrl: 'https://spotify.com', |   baseUrl: 'https://spotify.com', | ||||||
|   apiBaseUrl: 'https://api.spotify.com', |   apiBaseUrl: 'https://api.spotify.com', | ||||||
|   primaryColor: '000000', |   primaryColor: '#000000', | ||||||
|   beforeRequest: [addAuthHeader], |   beforeRequest: [addAuthHeader], | ||||||
|   auth, |   auth, | ||||||
|   actions, |   actions, | ||||||
|   | |||||||
| @@ -11,7 +11,7 @@ export default defineApp({ | |||||||
|   supportsConnections: true, |   supportsConnections: true, | ||||||
|   baseUrl: 'https://www.strava.com', |   baseUrl: 'https://www.strava.com', | ||||||
|   apiBaseUrl: 'https://www.strava.com/api', |   apiBaseUrl: 'https://www.strava.com/api', | ||||||
|   primaryColor: 'fc4c01', |   primaryColor: '#fc4c01', | ||||||
|   beforeRequest: [addAuthHeader], |   beforeRequest: [addAuthHeader], | ||||||
|   auth, |   auth, | ||||||
|   actions, |   actions, | ||||||
|   | |||||||
| @@ -11,7 +11,7 @@ export default defineApp({ | |||||||
|   supportsConnections: true, |   supportsConnections: true, | ||||||
|   baseUrl: 'https://stripe.com', |   baseUrl: 'https://stripe.com', | ||||||
|   apiBaseUrl: 'https://api.stripe.com', |   apiBaseUrl: 'https://api.stripe.com', | ||||||
|   primaryColor: '635bff', |   primaryColor: '#635bff', | ||||||
|   beforeRequest: [addAuthHeader], |   beforeRequest: [addAuthHeader], | ||||||
|   auth, |   auth, | ||||||
|   triggers, |   triggers, | ||||||
|   | |||||||
| @@ -11,7 +11,7 @@ export default defineApp({ | |||||||
|   supportsConnections: true, |   supportsConnections: true, | ||||||
|   baseUrl: 'https://telegram.org', |   baseUrl: 'https://telegram.org', | ||||||
|   apiBaseUrl: 'https://api.telegram.org', |   apiBaseUrl: 'https://api.telegram.org', | ||||||
|   primaryColor: '2AABEE', |   primaryColor: '#2AABEE', | ||||||
|   beforeRequest: [addAuthHeader], |   beforeRequest: [addAuthHeader], | ||||||
|   auth, |   auth, | ||||||
|   actions, |   actions, | ||||||
|   | |||||||
| @@ -13,7 +13,7 @@ export default defineApp({ | |||||||
|   supportsConnections: true, |   supportsConnections: true, | ||||||
|   baseUrl: 'https://todoist.com', |   baseUrl: 'https://todoist.com', | ||||||
|   apiBaseUrl: 'https://api.todoist.com/rest/v2', |   apiBaseUrl: 'https://api.todoist.com/rest/v2', | ||||||
|   primaryColor: 'e44332', |   primaryColor: '#e44332', | ||||||
|   beforeRequest: [addAuthHeader], |   beforeRequest: [addAuthHeader], | ||||||
|   auth, |   auth, | ||||||
|   triggers, |   triggers, | ||||||
|   | |||||||
| @@ -12,7 +12,7 @@ export default defineApp({ | |||||||
|   iconUrl: '{BASE_URL}/apps/trello/assets/favicon.svg', |   iconUrl: '{BASE_URL}/apps/trello/assets/favicon.svg', | ||||||
|   authDocUrl: '{DOCS_URL}/apps/trello/connection', |   authDocUrl: '{DOCS_URL}/apps/trello/connection', | ||||||
|   supportsConnections: true, |   supportsConnections: true, | ||||||
|   primaryColor: '0079bf', |   primaryColor: '#0079bf', | ||||||
|   beforeRequest: [addAuthHeader], |   beforeRequest: [addAuthHeader], | ||||||
|   auth, |   auth, | ||||||
|   actions, |   actions, | ||||||
|   | |||||||
| @@ -13,7 +13,7 @@ export default defineApp({ | |||||||
|   supportsConnections: true, |   supportsConnections: true, | ||||||
|   baseUrl: 'https://twilio.com', |   baseUrl: 'https://twilio.com', | ||||||
|   apiBaseUrl: 'https://api.twilio.com', |   apiBaseUrl: 'https://api.twilio.com', | ||||||
|   primaryColor: 'e1000f', |   primaryColor: '#e1000f', | ||||||
|   beforeRequest: [addAuthHeader], |   beforeRequest: [addAuthHeader], | ||||||
|   auth, |   auth, | ||||||
|   triggers, |   triggers, | ||||||
|   | |||||||
| @@ -12,7 +12,7 @@ export default defineApp({ | |||||||
|   supportsConnections: true, |   supportsConnections: true, | ||||||
|   baseUrl: 'https://twitter.com', |   baseUrl: 'https://twitter.com', | ||||||
|   apiBaseUrl: 'https://api.twitter.com', |   apiBaseUrl: 'https://api.twitter.com', | ||||||
|   primaryColor: '1da1f2', |   primaryColor: '#1da1f2', | ||||||
|   beforeRequest: [addAuthHeader], |   beforeRequest: [addAuthHeader], | ||||||
|   auth, |   auth, | ||||||
|   triggers, |   triggers, | ||||||
|   | |||||||
| @@ -12,7 +12,7 @@ export default defineApp({ | |||||||
|   supportsConnections: true, |   supportsConnections: true, | ||||||
|   baseUrl: 'https://typeform.com', |   baseUrl: 'https://typeform.com', | ||||||
|   apiBaseUrl: 'https://api.typeform.com', |   apiBaseUrl: 'https://api.typeform.com', | ||||||
|   primaryColor: '262627', |   primaryColor: '#262627', | ||||||
|   beforeRequest: [addAuthHeader], |   beforeRequest: [addAuthHeader], | ||||||
|   auth, |   auth, | ||||||
|   triggers, |   triggers, | ||||||
|   | |||||||
| @@ -14,7 +14,7 @@ export default defineApp({ | |||||||
|   supportsConnections: true, |   supportsConnections: true, | ||||||
|   baseUrl: '', |   baseUrl: '', | ||||||
|   apiBaseUrl: '', |   apiBaseUrl: '', | ||||||
|   primaryColor: '39a86d', |   primaryColor: '#39a86d', | ||||||
|   beforeRequest: [setBaseUrl, addAuthHeader], |   beforeRequest: [setBaseUrl, addAuthHeader], | ||||||
|   auth, |   auth, | ||||||
|   triggers, |   triggers, | ||||||
|   | |||||||
| @@ -10,7 +10,7 @@ export default defineApp({ | |||||||
|   supportsConnections: false, |   supportsConnections: false, | ||||||
|   baseUrl: '', |   baseUrl: '', | ||||||
|   apiBaseUrl: '', |   apiBaseUrl: '', | ||||||
|   primaryColor: '0059F7', |   primaryColor: '#0059F7', | ||||||
|   actions, |   actions, | ||||||
|   triggers, |   triggers, | ||||||
| }); | }); | ||||||
|   | |||||||
| @@ -13,7 +13,7 @@ export default defineApp({ | |||||||
|   supportsConnections: true, |   supportsConnections: true, | ||||||
|   baseUrl: 'https://wordpress.com', |   baseUrl: 'https://wordpress.com', | ||||||
|   apiBaseUrl: '', |   apiBaseUrl: '', | ||||||
|   primaryColor: '464342', |   primaryColor: '#464342', | ||||||
|   beforeRequest: [setBaseUrl, addAuthHeader], |   beforeRequest: [setBaseUrl, addAuthHeader], | ||||||
|   auth, |   auth, | ||||||
|   triggers, |   triggers, | ||||||
|   | |||||||
| @@ -4,6 +4,7 @@ export default defineTrigger({ | |||||||
|   name: 'New comment', |   name: 'New comment', | ||||||
|   key: 'newComment', |   key: 'newComment', | ||||||
|   description: 'Triggers when a new comment is created.', |   description: 'Triggers when a new comment is created.', | ||||||
|  |   pollInterval: 15, | ||||||
|   arguments: [ |   arguments: [ | ||||||
|     { |     { | ||||||
|       label: 'Status', |       label: 'Status', | ||||||
|   | |||||||
| @@ -3,6 +3,7 @@ import defineTrigger from '../../../../helpers/define-trigger.js'; | |||||||
| export default defineTrigger({ | export default defineTrigger({ | ||||||
|   name: 'New page', |   name: 'New page', | ||||||
|   key: 'newPage', |   key: 'newPage', | ||||||
|  |   pollInterval: 15, | ||||||
|   description: 'Triggers when a new page is created.', |   description: 'Triggers when a new page is created.', | ||||||
|   arguments: [ |   arguments: [ | ||||||
|     { |     { | ||||||
|   | |||||||
| @@ -3,6 +3,7 @@ import defineTrigger from '../../../../helpers/define-trigger.js'; | |||||||
| export default defineTrigger({ | export default defineTrigger({ | ||||||
|   name: 'New post', |   name: 'New post', | ||||||
|   key: 'newPost', |   key: 'newPost', | ||||||
|  |   pollInterval: 15, | ||||||
|   description: 'Triggers when a new post is created.', |   description: 'Triggers when a new post is created.', | ||||||
|   arguments: [ |   arguments: [ | ||||||
|     { |     { | ||||||
|   | |||||||
| @@ -11,7 +11,7 @@ export default defineApp({ | |||||||
|   apiBaseUrl: 'https://api.xero.com', |   apiBaseUrl: 'https://api.xero.com', | ||||||
|   iconUrl: '{BASE_URL}/apps/xero/assets/favicon.svg', |   iconUrl: '{BASE_URL}/apps/xero/assets/favicon.svg', | ||||||
|   authDocUrl: '{DOCS_URL}/apps/xero/connection', |   authDocUrl: '{DOCS_URL}/apps/xero/connection', | ||||||
|   primaryColor: '13B5EA', |   primaryColor: '#13B5EA', | ||||||
|   supportsConnections: true, |   supportsConnections: true, | ||||||
|   beforeRequest: [addAuthHeader], |   beforeRequest: [addAuthHeader], | ||||||
|   auth, |   auth, | ||||||
|   | |||||||
| @@ -10,7 +10,7 @@ export default defineApp({ | |||||||
|   apiBaseUrl: 'https://api.ynab.com/v1', |   apiBaseUrl: 'https://api.ynab.com/v1', | ||||||
|   iconUrl: '{BASE_URL}/apps/you-need-a-budget/assets/favicon.svg', |   iconUrl: '{BASE_URL}/apps/you-need-a-budget/assets/favicon.svg', | ||||||
|   authDocUrl: '{DOCS_URL}/apps/you-need-a-budget/connection', |   authDocUrl: '{DOCS_URL}/apps/you-need-a-budget/connection', | ||||||
|   primaryColor: '19223C', |   primaryColor: '#19223C', | ||||||
|   supportsConnections: true, |   supportsConnections: true, | ||||||
|   beforeRequest: [addAuthHeader], |   beforeRequest: [addAuthHeader], | ||||||
|   auth, |   auth, | ||||||
|   | |||||||
| @@ -10,7 +10,7 @@ export default defineApp({ | |||||||
|   apiBaseUrl: 'https://www.googleapis.com/youtube', |   apiBaseUrl: 'https://www.googleapis.com/youtube', | ||||||
|   iconUrl: '{BASE_URL}/apps/youtube/assets/favicon.svg', |   iconUrl: '{BASE_URL}/apps/youtube/assets/favicon.svg', | ||||||
|   authDocUrl: '{DOCS_URL}/apps/youtube/connection', |   authDocUrl: '{DOCS_URL}/apps/youtube/connection', | ||||||
|   primaryColor: 'FF0000', |   primaryColor: '#FF0000', | ||||||
|   supportsConnections: true, |   supportsConnections: true, | ||||||
|   beforeRequest: [addAuthHeader], |   beforeRequest: [addAuthHeader], | ||||||
|   auth, |   auth, | ||||||
|   | |||||||
| @@ -3,6 +3,7 @@ import defineTrigger from '../../../../helpers/define-trigger.js'; | |||||||
| export default defineTrigger({ | export default defineTrigger({ | ||||||
|   name: 'New video by search', |   name: 'New video by search', | ||||||
|   key: 'newVideoBySearch', |   key: 'newVideoBySearch', | ||||||
|  |   pollInterval: 15, | ||||||
|   description: |   description: | ||||||
|     'Triggers when a new video is uploaded that matches a specific search string.', |     'Triggers when a new video is uploaded that matches a specific search string.', | ||||||
|   arguments: [ |   arguments: [ | ||||||
|   | |||||||
| @@ -3,6 +3,7 @@ import defineTrigger from '../../../../helpers/define-trigger.js'; | |||||||
| export default defineTrigger({ | export default defineTrigger({ | ||||||
|   name: 'New video in channel', |   name: 'New video in channel', | ||||||
|   key: 'newVideoInChannel', |   key: 'newVideoInChannel', | ||||||
|  |   pollInterval: 15, | ||||||
|   description: |   description: | ||||||
|     'Triggers when a new video is published to a specific Youtube channel.', |     'Triggers when a new video is published to a specific Youtube channel.', | ||||||
|   arguments: [ |   arguments: [ | ||||||
|   | |||||||
| @@ -12,7 +12,7 @@ export default defineApp({ | |||||||
|   apiBaseUrl: '', |   apiBaseUrl: '', | ||||||
|   iconUrl: '{BASE_URL}/apps/zendesk/assets/favicon.svg', |   iconUrl: '{BASE_URL}/apps/zendesk/assets/favicon.svg', | ||||||
|   authDocUrl: '{DOCS_URL}/apps/zendesk/connection', |   authDocUrl: '{DOCS_URL}/apps/zendesk/connection', | ||||||
|   primaryColor: '17494d', |   primaryColor: '#17494d', | ||||||
|   supportsConnections: true, |   supportsConnections: true, | ||||||
|   beforeRequest: [addAuthHeader], |   beforeRequest: [addAuthHeader], | ||||||
|   auth, |   auth, | ||||||
|   | |||||||
| @@ -2,7 +2,7 @@ import appConfig from './app.js'; | |||||||
|  |  | ||||||
| const corsOptions = { | const corsOptions = { | ||||||
|   origin: appConfig.webAppUrl, |   origin: appConfig.webAppUrl, | ||||||
|   methods: 'GET,HEAD,POST,DELETE', |   methods: 'GET,HEAD,POST,PATCH,DELETE', | ||||||
|   credentials: true, |   credentials: true, | ||||||
|   optionsSuccessStatus: 200, |   optionsSuccessStatus: 200, | ||||||
| }; | }; | ||||||
|   | |||||||
| @@ -32,7 +32,7 @@ describe('POST /api/v1/access-tokens', () => { | |||||||
|       }) |       }) | ||||||
|       .expect(422); |       .expect(422); | ||||||
|  |  | ||||||
|     expect(response.body.errors.general).toEqual([ |     expect(response.body.errors.general).toStrictEqual([ | ||||||
|       'Incorrect email or password.', |       'Incorrect email or password.', | ||||||
|     ]); |     ]); | ||||||
|   }); |   }); | ||||||
|   | |||||||
| @@ -15,7 +15,7 @@ describe('POST /api/v1/admin/apps/:appKey/auth-clients', () => { | |||||||
|   beforeEach(async () => { |   beforeEach(async () => { | ||||||
|     vi.spyOn(license, 'hasValidLicense').mockResolvedValue(true); |     vi.spyOn(license, 'hasValidLicense').mockResolvedValue(true); | ||||||
|  |  | ||||||
|     adminRole = await createRole({ key: 'admin' }); |     adminRole = await createRole({ name: 'Admin' }); | ||||||
|     currentUser = await createUser({ roleId: adminRole.id }); |     currentUser = await createUser({ roleId: adminRole.id }); | ||||||
|  |  | ||||||
|     token = await createAuthTokenByUserId(currentUser.id); |     token = await createAuthTokenByUserId(currentUser.id); | ||||||
| @@ -83,7 +83,7 @@ describe('POST /api/v1/admin/apps/:appKey/auth-clients', () => { | |||||||
|       .send(appAuthClient) |       .send(appAuthClient) | ||||||
|       .expect(422); |       .expect(422); | ||||||
|  |  | ||||||
|     expect(response.body.meta.type).toEqual('ModelValidation'); |     expect(response.body.meta.type).toStrictEqual('ModelValidation'); | ||||||
|     expect(response.body.errors).toMatchObject({ |     expect(response.body.errors).toMatchObject({ | ||||||
|       name: ["must have required property 'name'"], |       name: ["must have required property 'name'"], | ||||||
|       formattedAuthDefaults: [ |       formattedAuthDefaults: [ | ||||||
|   | |||||||
| @@ -10,11 +10,11 @@ export default async (request, response) => { | |||||||
| }; | }; | ||||||
|  |  | ||||||
| const appConfigParams = (request) => { | const appConfigParams = (request) => { | ||||||
|   const { allowCustomConnection, shared, disabled } = request.body; |   const { customConnectionAllowed, shared, disabled } = request.body; | ||||||
|  |  | ||||||
|   return { |   return { | ||||||
|     key: request.params.appKey, |     key: request.params.appKey, | ||||||
|     allowCustomConnection, |     customConnectionAllowed, | ||||||
|     shared, |     shared, | ||||||
|     disabled, |     disabled, | ||||||
|   }; |   }; | ||||||
|   | |||||||
| @@ -15,7 +15,7 @@ describe('POST /api/v1/admin/apps/:appKey/config', () => { | |||||||
|   beforeEach(async () => { |   beforeEach(async () => { | ||||||
|     vi.spyOn(license, 'hasValidLicense').mockResolvedValue(true); |     vi.spyOn(license, 'hasValidLicense').mockResolvedValue(true); | ||||||
|  |  | ||||||
|     adminRole = await createRole({ key: 'admin' }); |     adminRole = await createRole({ name: 'Admin' }); | ||||||
|     currentUser = await createUser({ roleId: adminRole.id }); |     currentUser = await createUser({ roleId: adminRole.id }); | ||||||
|  |  | ||||||
|     token = await createAuthTokenByUserId(currentUser.id); |     token = await createAuthTokenByUserId(currentUser.id); | ||||||
| @@ -23,7 +23,7 @@ describe('POST /api/v1/admin/apps/:appKey/config', () => { | |||||||
|  |  | ||||||
|   it('should return created app config', async () => { |   it('should return created app config', async () => { | ||||||
|     const appConfig = { |     const appConfig = { | ||||||
|       allowCustomConnection: true, |       customConnectionAllowed: true, | ||||||
|       shared: true, |       shared: true, | ||||||
|       disabled: false, |       disabled: false, | ||||||
|     }; |     }; | ||||||
| @@ -44,7 +44,7 @@ describe('POST /api/v1/admin/apps/:appKey/config', () => { | |||||||
|   it('should return HTTP 422 for already existing app config', async () => { |   it('should return HTTP 422 for already existing app config', async () => { | ||||||
|     const appConfig = { |     const appConfig = { | ||||||
|       key: 'gitlab', |       key: 'gitlab', | ||||||
|       allowCustomConnection: true, |       customConnectionAllowed: true, | ||||||
|       shared: true, |       shared: true, | ||||||
|       disabled: false, |       disabled: false, | ||||||
|     }; |     }; | ||||||
| @@ -59,7 +59,7 @@ describe('POST /api/v1/admin/apps/:appKey/config', () => { | |||||||
|       }) |       }) | ||||||
|       .expect(422); |       .expect(422); | ||||||
|  |  | ||||||
|     expect(response.body.meta.type).toEqual('UniqueViolationError'); |     expect(response.body.meta.type).toStrictEqual('UniqueViolationError'); | ||||||
|     expect(response.body.errors).toMatchObject({ |     expect(response.body.errors).toMatchObject({ | ||||||
|       key: ["'key' must be unique."], |       key: ["'key' must be unique."], | ||||||
|     }); |     }); | ||||||
|   | |||||||
| @@ -15,7 +15,7 @@ describe('GET /api/v1/admin/apps/:appKey/auth-clients/:appAuthClientId', () => { | |||||||
|   beforeEach(async () => { |   beforeEach(async () => { | ||||||
|     vi.spyOn(license, 'hasValidLicense').mockResolvedValue(true); |     vi.spyOn(license, 'hasValidLicense').mockResolvedValue(true); | ||||||
|  |  | ||||||
|     adminRole = await createRole({ key: 'admin' }); |     adminRole = await createRole({ name: 'Admin' }); | ||||||
|     currentUser = await createUser({ roleId: adminRole.id }); |     currentUser = await createUser({ roleId: adminRole.id }); | ||||||
|  |  | ||||||
|     currentAppAuthClient = await createAppAuthClient({ |     currentAppAuthClient = await createAppAuthClient({ | ||||||
| @@ -32,7 +32,7 @@ describe('GET /api/v1/admin/apps/:appKey/auth-clients/:appAuthClientId', () => { | |||||||
|       .expect(200); |       .expect(200); | ||||||
|  |  | ||||||
|     const expectedPayload = getAppAuthClientMock(currentAppAuthClient); |     const expectedPayload = getAppAuthClientMock(currentAppAuthClient); | ||||||
|     expect(response.body).toEqual(expectedPayload); |     expect(response.body).toStrictEqual(expectedPayload); | ||||||
|   }); |   }); | ||||||
|  |  | ||||||
|   it('should return not found response for not existing app auth client ID', async () => { |   it('should return not found response for not existing app auth client ID', async () => { | ||||||
|   | |||||||
| @@ -14,7 +14,7 @@ describe('GET /api/v1/admin/apps/:appKey/auth-clients', () => { | |||||||
|   beforeEach(async () => { |   beforeEach(async () => { | ||||||
|     vi.spyOn(license, 'hasValidLicense').mockResolvedValue(true); |     vi.spyOn(license, 'hasValidLicense').mockResolvedValue(true); | ||||||
|  |  | ||||||
|     adminRole = await createRole({ key: 'admin' }); |     adminRole = await createRole({ name: 'Admin' }); | ||||||
|     currentUser = await createUser({ roleId: adminRole.id }); |     currentUser = await createUser({ roleId: adminRole.id }); | ||||||
|  |  | ||||||
|     token = await createAuthTokenByUserId(currentUser.id); |     token = await createAuthTokenByUserId(currentUser.id); | ||||||
| @@ -39,6 +39,6 @@ describe('GET /api/v1/admin/apps/:appKey/auth-clients', () => { | |||||||
|       appAuthClientOne, |       appAuthClientOne, | ||||||
|     ]); |     ]); | ||||||
|  |  | ||||||
|     expect(response.body).toEqual(expectedPayload); |     expect(response.body).toStrictEqual(expectedPayload); | ||||||
|   }); |   }); | ||||||
| }); | }); | ||||||
|   | |||||||
| @@ -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,27 @@ | |||||||
|  | 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), | ||||||
|  |     key: request.params.appKey, | ||||||
|  |   }); | ||||||
|  |  | ||||||
|  |   renderObject(response, appConfig); | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | const appConfigParams = (request) => { | ||||||
|  |   const { customConnectionAllowed, shared, disabled } = request.body; | ||||||
|  |  | ||||||
|  |   return { | ||||||
|  |     customConnectionAllowed, | ||||||
|  |     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', | ||||||
|  |       customConnectionAllowed: true, | ||||||
|  |       shared: true, | ||||||
|  |       disabled: false, | ||||||
|  |     }; | ||||||
|  |  | ||||||
|  |     await createAppConfig(appConfig); | ||||||
|  |  | ||||||
|  |     const newAppConfigValues = { | ||||||
|  |       shared: false, | ||||||
|  |       disabled: true, | ||||||
|  |       customConnectionAllowed: 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, | ||||||
|  |       customConnectionAllowed: 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', | ||||||
|  |       customConnectionAllowed: 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).toStrictEqual('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).toStrictEqual(newTitle); | ||||||
|  |     expect(response.body.meta.type).toStrictEqual('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).toStrictEqual(newTitle); | ||||||
|  |     expect(response.body.meta.type).toStrictEqual('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).toStrictEqual('Config'); | ||||||
|  |   }); | ||||||
|  | }); | ||||||
| @@ -11,7 +11,7 @@ describe('GET /api/v1/admin/permissions/catalog', () => { | |||||||
|   let role, currentUser, token; |   let role, currentUser, token; | ||||||
|  |  | ||||||
|   beforeEach(async () => { |   beforeEach(async () => { | ||||||
|     role = await createRole({ key: 'admin' }); |     role = await createRole({ name: 'Admin' }); | ||||||
|     currentUser = await createUser({ roleId: role.id }); |     currentUser = await createUser({ roleId: role.id }); | ||||||
|  |  | ||||||
|     token = await createAuthTokenByUserId(currentUser.id); |     token = await createAuthTokenByUserId(currentUser.id); | ||||||
| @@ -27,6 +27,6 @@ describe('GET /api/v1/admin/permissions/catalog', () => { | |||||||
|  |  | ||||||
|     const expectedPayload = await getPermissionsCatalogMock(); |     const expectedPayload = await getPermissionsCatalogMock(); | ||||||
|  |  | ||||||
|     expect(response.body).toEqual(expectedPayload); |     expect(response.body).toStrictEqual(expectedPayload); | ||||||
|   }); |   }); | ||||||
| }); | }); | ||||||
|   | |||||||
| @@ -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).toStrictEqual(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,95 @@ | |||||||
|  | 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', | ||||||
|  |       }, | ||||||
|  |     }); | ||||||
|  |   }); | ||||||
|  | }); | ||||||
| @@ -13,7 +13,7 @@ describe('GET /api/v1/admin/roles/:roleId', () => { | |||||||
|   let role, currentUser, token, permissionOne, permissionTwo; |   let role, currentUser, token, permissionOne, permissionTwo; | ||||||
|  |  | ||||||
|   beforeEach(async () => { |   beforeEach(async () => { | ||||||
|     role = await createRole({ key: 'admin' }); |     role = await createRole({ name: 'Admin' }); | ||||||
|     permissionOne = await createPermission({ roleId: role.id }); |     permissionOne = await createPermission({ roleId: role.id }); | ||||||
|     permissionTwo = await createPermission({ roleId: role.id }); |     permissionTwo = await createPermission({ roleId: role.id }); | ||||||
|     currentUser = await createUser({ roleId: role.id }); |     currentUser = await createUser({ roleId: role.id }); | ||||||
| @@ -34,7 +34,7 @@ describe('GET /api/v1/admin/roles/:roleId', () => { | |||||||
|       permissionTwo, |       permissionTwo, | ||||||
|     ]); |     ]); | ||||||
|  |  | ||||||
|     expect(response.body).toEqual(expectedPayload); |     expect(response.body).toStrictEqual(expectedPayload); | ||||||
|   }); |   }); | ||||||
|  |  | ||||||
|   it('should return not found response for not existing role UUID', async () => { |   it('should return not found response for not existing role UUID', async () => { | ||||||
|   | |||||||
| @@ -11,8 +11,8 @@ describe('GET /api/v1/admin/roles', () => { | |||||||
|   let roleOne, roleTwo, currentUser, token; |   let roleOne, roleTwo, currentUser, token; | ||||||
|  |  | ||||||
|   beforeEach(async () => { |   beforeEach(async () => { | ||||||
|     roleOne = await createRole({ key: 'admin' }); |     roleOne = await createRole({ name: 'Admin' }); | ||||||
|     roleTwo = await createRole({ key: 'user' }); |     roleTwo = await createRole({ name: 'User' }); | ||||||
|     currentUser = await createUser({ roleId: roleOne.id }); |     currentUser = await createUser({ roleId: roleOne.id }); | ||||||
|  |  | ||||||
|     token = await createAuthTokenByUserId(currentUser.id); |     token = await createAuthTokenByUserId(currentUser.id); | ||||||
| @@ -28,6 +28,6 @@ describe('GET /api/v1/admin/roles', () => { | |||||||
|  |  | ||||||
|     const expectedPayload = await getRolesMock([roleOne, roleTwo]); |     const expectedPayload = await getRolesMock([roleOne, roleTwo]); | ||||||
|  |  | ||||||
|     expect(response.body).toEqual(expectedPayload); |     expect(response.body).toStrictEqual(expectedPayload); | ||||||
|   }); |   }); | ||||||
| }); | }); | ||||||
|   | |||||||
| @@ -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', | ||||||
|  |       }, | ||||||
|  |     }); | ||||||
|  |   }); | ||||||
|  | }); | ||||||
| @@ -0,0 +1,43 @@ | |||||||
|  | import { renderObject } from '../../../../../helpers/renderer.js'; | ||||||
|  | import SamlAuthProvider from '../../../../../models/saml-auth-provider.ee.js'; | ||||||
|  |  | ||||||
|  | export default async (request, response) => { | ||||||
|  |   const samlAuthProvider = await SamlAuthProvider.query().insert( | ||||||
|  |     samlAuthProviderParams(request) | ||||||
|  |   ); | ||||||
|  |  | ||||||
|  |   renderObject(response, samlAuthProvider, { | ||||||
|  |     serializer: 'AdminSamlAuthProvider', | ||||||
|  |     status: 201, | ||||||
|  |   }); | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | const samlAuthProviderParams = (request) => { | ||||||
|  |   const { | ||||||
|  |     name, | ||||||
|  |     certificate, | ||||||
|  |     signatureAlgorithm, | ||||||
|  |     issuer, | ||||||
|  |     entryPoint, | ||||||
|  |     firstnameAttributeName, | ||||||
|  |     surnameAttributeName, | ||||||
|  |     emailAttributeName, | ||||||
|  |     roleAttributeName, | ||||||
|  |     defaultRoleId, | ||||||
|  |     active, | ||||||
|  |   } = request.body; | ||||||
|  |  | ||||||
|  |   return { | ||||||
|  |     name, | ||||||
|  |     certificate, | ||||||
|  |     signatureAlgorithm, | ||||||
|  |     issuer, | ||||||
|  |     entryPoint, | ||||||
|  |     firstnameAttributeName, | ||||||
|  |     surnameAttributeName, | ||||||
|  |     emailAttributeName, | ||||||
|  |     roleAttributeName, | ||||||
|  |     defaultRoleId, | ||||||
|  |     active, | ||||||
|  |   }; | ||||||
|  | }; | ||||||
| @@ -0,0 +1,78 @@ | |||||||
|  | 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 { createUser } from '../../../../../../test/factories/user.js'; | ||||||
|  | import createSamlAuthProviderMock from '../../../../../../test/mocks/rest/api/v1/admin/saml-auth-providers/create-saml-auth-provider.ee.js'; | ||||||
|  | import * as license from '../../../../../helpers/license.ee.js'; | ||||||
|  |  | ||||||
|  | describe('POST /api/v1/admin/saml-auth-provider', () => { | ||||||
|  |   let currentUser, token, role; | ||||||
|  |  | ||||||
|  |   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 saml auth provider', async () => { | ||||||
|  |     const samlAuthProviderPayload = { | ||||||
|  |       active: true, | ||||||
|  |       name: 'Name', | ||||||
|  |       issuer: 'theclientid', | ||||||
|  |       certificate: 'dummycert', | ||||||
|  |       entryPoint: 'http://localhost:8080/realms/automatisch/protocol/saml', | ||||||
|  |       signatureAlgorithm: 'sha256', | ||||||
|  |       defaultRoleId: role.id, | ||||||
|  |       firstnameAttributeName: 'urn:oid:2.5.4.42', | ||||||
|  |       surnameAttributeName: 'urn:oid:2.5.4.4', | ||||||
|  |       emailAttributeName: 'urn:oid:1.2.840.113549.1.9.1', | ||||||
|  |       roleAttributeName: 'Role', | ||||||
|  |     }; | ||||||
|  |  | ||||||
|  |     const response = await request(app) | ||||||
|  |       .post('/api/v1/admin/saml-auth-providers') | ||||||
|  |       .set('Authorization', token) | ||||||
|  |       .send(samlAuthProviderPayload) | ||||||
|  |       .expect(201); | ||||||
|  |  | ||||||
|  |     const expectedPayload = await createSamlAuthProviderMock({ | ||||||
|  |       id: response.body.data.id, | ||||||
|  |       ...samlAuthProviderPayload, | ||||||
|  |     }); | ||||||
|  |  | ||||||
|  |     expect(response.body).toStrictEqual(expectedPayload); | ||||||
|  |   }); | ||||||
|  |  | ||||||
|  |   it('should return unprocessable entity response for invalid data', async () => { | ||||||
|  |     const response = await request(app) | ||||||
|  |       .post('/api/v1/admin/saml-auth-providers') | ||||||
|  |       .set('Authorization', token) | ||||||
|  |       .send({ | ||||||
|  |         active: true, | ||||||
|  |         name: 'Name', | ||||||
|  |         issuer: 'theclientid', | ||||||
|  |         signatureAlgorithm: 'invalid', | ||||||
|  |         firstnameAttributeName: 'urn:oid:2.5.4.42', | ||||||
|  |         surnameAttributeName: 'urn:oid:2.5.4.4', | ||||||
|  |         emailAttributeName: 'urn:oid:1.2.840.113549.1.9.1', | ||||||
|  |         roleAttributeName: 123, | ||||||
|  |       }) | ||||||
|  |       .expect(422); | ||||||
|  |  | ||||||
|  |     expect(response.body).toStrictEqual({ | ||||||
|  |       errors: { | ||||||
|  |         certificate: ["must have required property 'certificate'"], | ||||||
|  |         entryPoint: ["must have required property 'entryPoint'"], | ||||||
|  |         defaultRoleId: ["must have required property 'defaultRoleId'"], | ||||||
|  |         signatureAlgorithm: ['must be equal to one of the allowed values'], | ||||||
|  |         roleAttributeName: ['must be string'], | ||||||
|  |       }, | ||||||
|  |       meta: { type: 'ModelValidation' }, | ||||||
|  |     }); | ||||||
|  |   }); | ||||||
|  | }); | ||||||
| @@ -13,7 +13,7 @@ describe('GET /api/v1/admin/saml-auth-providers/:samlAuthProviderId/role-mapping | |||||||
|   let roleMappingOne, roleMappingTwo, samlAuthProvider, currentUser, token; |   let roleMappingOne, roleMappingTwo, samlAuthProvider, currentUser, token; | ||||||
|  |  | ||||||
|   beforeEach(async () => { |   beforeEach(async () => { | ||||||
|     const role = await createRole({ key: 'admin' }); |     const role = await createRole({ name: 'Admin' }); | ||||||
|     currentUser = await createUser({ roleId: role.id }); |     currentUser = await createUser({ roleId: role.id }); | ||||||
|  |  | ||||||
|     samlAuthProvider = await createSamlAuthProvider(); |     samlAuthProvider = await createSamlAuthProvider(); | ||||||
| @@ -46,6 +46,6 @@ describe('GET /api/v1/admin/saml-auth-providers/:samlAuthProviderId/role-mapping | |||||||
|       roleMappingTwo, |       roleMappingTwo, | ||||||
|     ]); |     ]); | ||||||
|  |  | ||||||
|     expect(response.body).toEqual(expectedPayload); |     expect(response.body).toStrictEqual(expectedPayload); | ||||||
|   }); |   }); | ||||||
| }); | }); | ||||||
|   | |||||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user