diff --git a/package.json b/package.json index 0f7e547..0630703 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ } }, "dependencies": { - "@gitbeaker/browser": "^35.8.1", + "@gitbeaker/rest": "^40.0.3", "@primer/octicons-react": "^19.9.0", "@primer/react": "^35.16.0", "marked": "^11.2.0", @@ -80,5 +80,8 @@ "engines": { "node": "18.x.x", "npm": ">=9" + }, + "@parcel/resolver-default": { + "packageExports": true } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index df2bb8e..6e2ec5a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -5,9 +5,9 @@ settings: excludeLinksFromLockfile: false dependencies: - '@gitbeaker/browser': - specifier: ^35.8.1 - version: 35.8.1 + '@gitbeaker/rest': + specifier: ^40.0.3 + version: 40.0.3 '@primer/octicons-react': specifier: ^19.9.0 version: 19.9.0(react@18.3.1) @@ -484,36 +484,31 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true - /@gitbeaker/browser@35.8.1: - resolution: {integrity: sha512-zkrbSLib4719eWNo8rt+TaUokiAX9GY2IwPCZivat1iilkmJemJ/LcD7Q3mFPG0K9smSegK3PONyO5Mg3gZmLw==} - engines: {node: '>=14.2.0'} - deprecated: Please use its successor @gitbeaker/rest + /@gitbeaker/core@40.0.3: + resolution: {integrity: sha512-MzeY4oCtoa9zmPIkQIdC2KU8cGmHIXwnAi0L6jjjouqjy6kcA4BydZf8W5Xsj27Rw5iiyhfj8YC1/O3CgrzvCQ==} + engines: {node: '>=18.0.0'} dependencies: - '@gitbeaker/core': 35.8.1 - '@gitbeaker/requester-utils': 35.8.1 - delay: 5.0.0 - ky: 0.28.7 + '@gitbeaker/requester-utils': 40.0.3 + qs: 6.11.2 + xcase: 2.0.1 dev: false - /@gitbeaker/core@35.8.1: - resolution: {integrity: sha512-KBrDykVKSmU9Q9Gly8KeHOgdc0lZSa435srECxuO0FGqqBcUQ82hPqUc13YFkkdOI9T1JRA3qSFajg8ds0mZKA==} - engines: {node: '>=14.2.0'} + /@gitbeaker/requester-utils@40.0.3: + resolution: {integrity: sha512-L8JpuMIsvXTHfu/2wXzkc5QyfQJSWg4XyEPStHq1ig5SAcbxxqbBoe8ed27eUXLah+PcGrPInMK4cCMxhQm41g==} + engines: {node: '>=18.0.0'} dependencies: - '@gitbeaker/requester-utils': 35.8.1 - form-data: 4.0.0 - li: 1.3.0 - mime: 3.0.0 - query-string: 7.1.3 + picomatch-browser: 2.2.6 + qs: 6.11.2 + rate-limiter-flexible: 4.0.1 xcase: 2.0.1 dev: false - /@gitbeaker/requester-utils@35.8.1: - resolution: {integrity: sha512-MFzdH+Z6eJaCZA5ruWsyvm6SXRyrQHjYVR6aY8POFraIy7ceIHOprWCs1R+0ydDZ8KtBnd8OTHjlJ0sLtSFJCg==} - engines: {node: '>=14.2.0'} + /@gitbeaker/rest@40.0.3: + resolution: {integrity: sha512-ihaA0GX3yCo4oUWbISkcjFMIw+WxDAC9L+bEYq2irz4wpv/0EpAU/0jKjggPzY4cGWL9VAyPhew77VeACv4YWw==} + engines: {node: '>=18.0.0'} dependencies: - form-data: 4.0.0 - qs: 6.11.2 - xcase: 2.0.1 + '@gitbeaker/core': 40.0.3 + '@gitbeaker/requester-utils': 40.0.3 dev: false /@github/combobox-nav@2.3.1: @@ -886,7 +881,7 @@ packages: '@parcel/fs': 2.12.0(@parcel/core@2.12.0) '@parcel/graph': 3.2.0 '@parcel/logger': 2.12.0 - '@parcel/package-manager': 2.12.0(@parcel/core@2.12.0)(@swc/helpers@0.5.11) + '@parcel/package-manager': 2.12.0(@parcel/core@2.12.0) '@parcel/plugin': 2.12.0(@parcel/core@2.12.0) '@parcel/profiler': 2.12.0 '@parcel/rust': 2.12.0 @@ -1061,14 +1056,14 @@ packages: '@parcel/plugin': 2.12.0(@parcel/core@2.12.0) '@parcel/source-map': 2.1.1 '@parcel/utils': 2.12.0 - '@swc/core': 1.5.29(@swc/helpers@0.5.11) + '@swc/core': 1.5.29 nullthrows: 1.1.1 transitivePeerDependencies: - '@parcel/core' - '@swc/helpers' dev: true - /@parcel/package-manager@2.12.0(@parcel/core@2.12.0)(@swc/helpers@0.5.11): + /@parcel/package-manager@2.12.0(@parcel/core@2.12.0): resolution: {integrity: sha512-0nvAezcjPx9FT+hIL+LS1jb0aohwLZXct7jAh7i0MLMtehOi0z1Sau+QpgMlA9rfEZZ1LIeFdnZZwqSy7Ccspw==} engines: {node: '>= 12.0.0'} peerDependencies: @@ -1082,7 +1077,7 @@ packages: '@parcel/types': 2.12.0(@parcel/core@2.12.0) '@parcel/utils': 2.12.0 '@parcel/workers': 2.12.0(@parcel/core@2.12.0) - '@swc/core': 1.5.29(@swc/helpers@0.5.11) + '@swc/core': 1.5.29 semver: 7.6.2 transitivePeerDependencies: - '@swc/helpers' @@ -1189,16 +1184,6 @@ packages: - '@swc/helpers' dev: true - /@parcel/plugin@2.12.0(@parcel/core@2.12.0)(@swc/helpers@0.5.11): - resolution: {integrity: sha512-nc/uRA8DiMoe4neBbzV6kDndh/58a4wQuGKw5oEoIwBCHUvE2W8ZFSu7ollSXUGRzfacTt4NdY8TwS73ScWZ+g==} - engines: {node: '>= 12.0.0'} - dependencies: - '@parcel/types': 2.12.0(@parcel/core@2.12.0)(@swc/helpers@0.5.11) - transitivePeerDependencies: - - '@parcel/core' - - '@swc/helpers' - dev: true - /@parcel/profiler@2.12.0: resolution: {integrity: sha512-q53fvl5LDcFYzMUtSusUBZSjQrKjMlLEBgKeQHFwkimwR1mgoseaDBDuNz0XvmzDzF1UelJ02TUKCGacU8W2qA==} engines: {node: '>= 12.0.0'} @@ -1231,6 +1216,7 @@ packages: term-size: 2.2.1 transitivePeerDependencies: - '@parcel/core' + - '@swc/helpers' dev: true /@parcel/reporter-dev-server@2.12.0(@parcel/core@2.12.0): @@ -1254,6 +1240,7 @@ packages: nullthrows: 1.1.1 transitivePeerDependencies: - '@parcel/core' + - '@swc/helpers' dev: true /@parcel/resolver-default@2.12.0(@parcel/core@2.12.0): @@ -1414,7 +1401,7 @@ packages: dependencies: '@parcel/core': 2.12.0 '@parcel/diagnostic': 2.12.0 - '@parcel/plugin': 2.12.0(@parcel/core@2.12.0)(@swc/helpers@0.5.11) + '@parcel/plugin': 2.12.0(@parcel/core@2.12.0) '@parcel/rust': 2.12.0 '@parcel/source-map': 2.1.1 '@parcel/utils': 2.12.0 @@ -1554,22 +1541,7 @@ packages: '@parcel/cache': 2.12.0(@parcel/core@2.12.0) '@parcel/diagnostic': 2.12.0 '@parcel/fs': 2.12.0(@parcel/core@2.12.0) - '@parcel/package-manager': 2.12.0(@parcel/core@2.12.0)(@swc/helpers@0.5.11) - '@parcel/source-map': 2.1.1 - '@parcel/workers': 2.12.0(@parcel/core@2.12.0) - utility-types: 3.11.0 - transitivePeerDependencies: - - '@parcel/core' - - '@swc/helpers' - dev: true - - /@parcel/types@2.12.0(@parcel/core@2.12.0)(@swc/helpers@0.5.11): - resolution: {integrity: sha512-8zAFiYNCwNTQcglIObyNwKfRYQK5ELlL13GuBOrSMxueUiI5ylgsGbTS1N7J3dAGZixHO8KhHGv5a71FILn9rQ==} - dependencies: - '@parcel/cache': 2.12.0(@parcel/core@2.12.0) - '@parcel/diagnostic': 2.12.0 - '@parcel/fs': 2.12.0(@parcel/core@2.12.0) - '@parcel/package-manager': 2.12.0(@parcel/core@2.12.0)(@swc/helpers@0.5.11) + '@parcel/package-manager': 2.12.0(@parcel/core@2.12.0) '@parcel/source-map': 2.1.1 '@parcel/workers': 2.12.0(@parcel/core@2.12.0) utility-types: 3.11.0 @@ -1736,8 +1708,6 @@ packages: '@parcel/types': 2.12.0(@parcel/core@2.12.0) '@parcel/utils': 2.12.0 nullthrows: 1.1.1 - transitivePeerDependencies: - - '@swc/helpers' dev: true /@primer/behaviors@1.5.1: @@ -1992,7 +1962,7 @@ packages: dev: true optional: true - /@swc/core@1.5.29(@swc/helpers@0.5.11): + /@swc/core@1.5.29: resolution: {integrity: sha512-nvTtHJI43DUSOAf3h9XsqYg8YXKc0/N4il9y4j0xAkO0ekgDNo+3+jbw6MInawjKJF9uulyr+f5bAutTsOKVlw==} engines: {node: '>=10'} requiresBuild: true @@ -2003,7 +1973,6 @@ packages: optional: true dependencies: '@swc/counter': 0.1.3 - '@swc/helpers': 0.5.11 '@swc/types': 0.1.8 optionalDependencies: '@swc/core-darwin-arm64': 1.5.29 @@ -2513,10 +2482,6 @@ packages: resolution: {integrity: sha512-baNZyqaaLhyLVKm/DlvdW051MSgO6b8eVfIezl9E5PqWxFgzLm/wQntEW4zOytVburDEr0JlALEpdOFwvErLsg==} dev: true - /asynckit@0.4.0: - resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} - dev: false - /available-typed-arrays@1.0.5: resolution: {integrity: sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==} engines: {node: '>= 0.4'} @@ -2712,13 +2677,6 @@ packages: resolution: {integrity: sha512-zW190nQTIoXcGCaU08DvVNFTmQhUpnJfVuAKfWqUQkflXKpaDdpaYoM0iluLS9lgJNHyBF58KKA2FBEwkD7wog==} dev: false - /combined-stream@1.0.8: - resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==} - engines: {node: '>= 0.8'} - dependencies: - delayed-stream: 1.0.0 - dev: false - /comma-separated-tokens@2.0.3: resolution: {integrity: sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==} dev: false @@ -2897,11 +2855,6 @@ packages: character-entities: 2.0.2 dev: false - /decode-uri-component@0.2.2: - resolution: {integrity: sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ==} - engines: {node: '>=0.10'} - dev: false - /deep-is@0.1.4: resolution: {integrity: sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==} dev: true @@ -2937,16 +2890,6 @@ packages: object-keys: 1.1.1 dev: true - /delay@5.0.0: - resolution: {integrity: sha512-ReEBKkIfe4ya47wlPYf/gu5ib6yUG0/Aez0JQZQz94kiWtRQvZIQbTiehsnwHvLSWJnQdhVeqYue7Id1dKr0qw==} - engines: {node: '>=10'} - dev: false - - /delayed-stream@1.0.0: - resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} - engines: {node: '>=0.4.0'} - dev: false - /dequal@2.0.3: resolution: {integrity: sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==} engines: {node: '>=6'} @@ -3471,11 +3414,6 @@ packages: to-regex-range: 5.0.1 dev: true - /filter-obj@1.1.0: - resolution: {integrity: sha512-8rXg1ZnX7xzy2NGDVkBVaAy+lSlPNwad13BtgSlLuxfIslyt5Vg64U7tFcCt4WS1R0hvtnQybT/IyCkGZ3DpXQ==} - engines: {node: '>=0.10.0'} - dev: false - /find-up@5.0.0: resolution: {integrity: sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==} engines: {node: '>=10'} @@ -3507,15 +3445,6 @@ packages: is-callable: 1.2.7 dev: true - /form-data@4.0.0: - resolution: {integrity: sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==} - engines: {node: '>= 6'} - dependencies: - asynckit: 0.4.0 - combined-stream: 1.0.8 - mime-types: 2.1.35 - dev: false - /fs.realpath@1.0.0: resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==} dev: true @@ -4160,11 +4089,6 @@ packages: engines: {node: '>=6'} dev: false - /ky@0.28.7: - resolution: {integrity: sha512-a23i6qSr/ep15vdtw/zyEQIDLoUaKDg9Jf04CYl/0ns/wXNYna26zJpI+MeIFaPeDvkrjLPrKtKOiiI3IE53RQ==} - engines: {node: '>=12'} - dev: false - /lazystream@1.0.1: resolution: {integrity: sha512-b94GiNHQNy6JNTrt5w6zNyffMrNkXZb3KTkCZJb2V1xaEGCk093vkZ2jk3tpaeP33/OiXC+WvK9AxUebnf5nbw==} engines: {node: '>= 0.6.3'} @@ -4180,10 +4104,6 @@ packages: type-check: 0.4.0 dev: true - /li@1.3.0: - resolution: {integrity: sha512-z34TU6GlMram52Tss5mt1m//ifRIpKH5Dqm7yUVOdHI+BQCs9qGPHFaCUTIzsWX7edN30aa2WrPwR7IO10FHaw==} - dev: false - /lightningcss-darwin-arm64@1.25.1: resolution: {integrity: sha512-G4Dcvv85bs5NLENcu/s1f7ehzE3D5ThnlWSDwE190tWXRQCQaqwcuHe+MGSVI/slm0XrxnaayXY+cNl3cSricw==} engines: {node: '>= 12.0.0'} @@ -4597,24 +4517,6 @@ packages: picomatch: 2.3.1 dev: true - /mime-db@1.52.0: - resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} - engines: {node: '>= 0.6'} - dev: false - - /mime-types@2.1.35: - resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==} - engines: {node: '>= 0.6'} - dependencies: - mime-db: 1.52.0 - dev: false - - /mime@3.0.0: - resolution: {integrity: sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A==} - engines: {node: '>=10.0.0'} - hasBin: true - dev: false - /minimatch@3.1.2: resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==} dependencies: @@ -4824,7 +4726,7 @@ packages: '@parcel/events': 2.12.0 '@parcel/fs': 2.12.0(@parcel/core@2.12.0) '@parcel/logger': 2.12.0 - '@parcel/package-manager': 2.12.0(@parcel/core@2.12.0)(@swc/helpers@0.5.11) + '@parcel/package-manager': 2.12.0(@parcel/core@2.12.0) '@parcel/reporter-cli': 2.12.0(@parcel/core@2.12.0) '@parcel/reporter-dev-server': 2.12.0(@parcel/core@2.12.0) '@parcel/reporter-tracer': 2.12.0(@parcel/core@2.12.0) @@ -4895,6 +4797,11 @@ packages: /picocolors@1.0.1: resolution: {integrity: sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==} + /picomatch-browser@2.2.6: + resolution: {integrity: sha512-0ypsOQt9D4e3hziV8O4elD9uN0z/jtUEfxVRtNaAAtXIyUx9m/SzlO020i8YNL2aL/E6blOvvHQcin6HZlFy/w==} + engines: {node: '>=8.6'} + dev: false + /picomatch@2.3.1: resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} engines: {node: '>=8.6'} @@ -4988,16 +4895,6 @@ packages: side-channel: 1.0.4 dev: false - /query-string@7.1.3: - resolution: {integrity: sha512-hh2WYhq4fi8+b+/2Kg9CEge4fDPvHS534aOOvOZeQ3+Vf2mCFsaFBYj0i+iXcAq6I9Vzp5fjMFBlONvayDC1qg==} - engines: {node: '>=6'} - dependencies: - decode-uri-component: 0.2.2 - filter-obj: 1.1.0 - split-on-first: 1.1.0 - strict-uri-encode: 2.0.0 - dev: false - /queue-microtask@1.2.3: resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} dev: true @@ -5006,6 +4903,10 @@ packages: resolution: {integrity: sha512-kJt5qhMxoszgU/62PLP1CJytzd2NKetjSRnyuj31fDd3Rlcz3fzlFdFLD1SItunPwyqEOkca6GbV612BWfaBag==} dev: true + /rate-limiter-flexible@4.0.1: + resolution: {integrity: sha512-2/dGHpDFpeA0+755oUkW+EKyklqLS9lu0go9pDsbhqQjZcxfRyJ6LA4JI0+HAdZ2bemD/oOjUeZQB2lCZqXQfQ==} + dev: false + /react-dom@18.3.1(react@18.3.1): resolution: {integrity: sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==} peerDependencies: @@ -5370,11 +5271,6 @@ packages: resolution: {integrity: sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q==} dev: false - /split-on-first@1.1.0: - resolution: {integrity: sha512-43ZssAJaMusuKWL8sKUBQXHWOpq8d6CfN/u1p4gUzfJkM05C8rxTmYrkIPTXapZpORA6LkkzcUulJ8FqA7Uudw==} - engines: {node: '>=6'} - dev: false - /srcset@4.0.0: resolution: {integrity: sha512-wvLeHgcVHKO8Sc/H/5lkGreJQVeYMm9rlmt8PuR1xE31rIuXhuzznUUqAt8MqLhB3MqJdFzlNAfpcWnxiFUcPw==} engines: {node: '>=12'} @@ -5392,11 +5288,6 @@ packages: queue-tick: 1.0.1 dev: true - /strict-uri-encode@2.0.0: - resolution: {integrity: sha512-QwiXZgpRcKkhTj2Scnn++4PKtWsH0kpzZ62L2R6c/LUVYv7hVnZqcg2+sMuT6R7Jusu1vviK/MFsu6kNJfWlEQ==} - engines: {node: '>=4'} - dev: false - /string.prototype.matchall@4.0.11: resolution: {integrity: sha512-NUdh0aDavY2og7IbBPenWqR9exH+E26Sv8e0/eTe1tltDGZL+GtBkDAnnyBtmekfK6/Dq3MkcGtzXFEd1LQrtg==} engines: {node: '>= 0.4'} diff --git a/src/background/endpoints/getLatestDataFromGitLab.ts b/src/background/endpoints/getLatestDataFromGitLab.ts index 94f9440..2436aad 100644 --- a/src/background/endpoints/getLatestDataFromGitLab.ts +++ b/src/background/endpoints/getLatestDataFromGitLab.ts @@ -5,13 +5,14 @@ import { setBadge } from '../utils/setBadge'; import { removeDuplicateObjectFromArray } from '../../popup/helpers'; import { initGitlabApi } from '../utils/initGitlabApi'; +import { MergeRequestSchemaWithBasicLabels } from '@gitbeaker/rest'; export const getLatestDataFromGitLab = async (): Promise => { console.log('>> POLLING GITLAB API'); const settings = await getSettings(); const gitlabApi = initGitlabApi(settings); - const currentUser = await gitlabApi.Users.current(); + const currentUser = await gitlabApi.Users.showCurrentUser(); /** Fetching MR "To Review" */ @@ -20,7 +21,7 @@ export const getLatestDataFromGitLab = async (): Promise => { scope: 'assigned_to_me', perPage: 100, maxPages: 5 - }); + }) as Promise; const mrReceivedRequest = gitlabApi.MergeRequests.all({ state: 'opened', @@ -28,7 +29,7 @@ export const getLatestDataFromGitLab = async (): Promise => { reviewer_id: currentUser.id, perPage: 100, maxPages: 5 - }); + }) as Promise; /** Fetching MR "Under review" */ @@ -37,7 +38,7 @@ export const getLatestDataFromGitLab = async (): Promise => { scope: 'created_by_me', perPage: 100, maxPages: 5 - }); + }) as Promise; /** Fetching "Issues" */ @@ -50,9 +51,9 @@ export const getLatestDataFromGitLab = async (): Promise => { /** Fetching "Todos" */ - const todosRequest = gitlabApi.Todos.all({ + const todosRequest = gitlabApi.TodoLists.all({ state: 'pending', - per_page: 100, + perPage: 100, maxPages: 5 }); diff --git a/src/background/endpoints/getMembersOfGroup.ts b/src/background/endpoints/getMembersOfGroup.ts index 40f43be..7969d24 100644 --- a/src/background/endpoints/getMembersOfGroup.ts +++ b/src/background/endpoints/getMembersOfGroup.ts @@ -2,18 +2,19 @@ import { getSettings } from '../utils/getSettings'; import { GroupMember } from '../types'; import { initGitlabApi } from '../utils/initGitlabApi'; import { removeDuplicateObjectFromArray } from '../../popup/helpers'; +import { ExpandedMergeRequestSchema, MemberSchema } from '@gitbeaker/rest'; export const getMembersOfGroup = async (groupId: number): Promise => { const settings = await getSettings(); const gitlabApi = initGitlabApi(settings); - const groupMembers = await gitlabApi.GroupMembers.all(groupId); + const groupMembers = (await gitlabApi.GroupMembers.all(groupId)) as MemberSchema[]; const groupMembersWithCount = groupMembers.map((member) => { return { ...member, mergeRequestsCount: 0 }; }); - const groupMergeRequests = await gitlabApi.MergeRequests.all({ + const groupMergeRequests = (await gitlabApi.MergeRequests.all({ groupId, state: 'opened' - }); + })) as ExpandedMergeRequestSchema[]; groupMergeRequests.forEach((mr) => { removeDuplicateObjectFromArray([...(mr.assignees ?? []), ...(mr.reviewers ?? [])], 'id').forEach((assignee) => { diff --git a/src/background/endpoints/getProjectsList.ts b/src/background/endpoints/getProjectsList.ts index f26262d..791a107 100644 --- a/src/background/endpoints/getProjectsList.ts +++ b/src/background/endpoints/getProjectsList.ts @@ -1,9 +1,8 @@ import { getSettings } from '../utils/getSettings'; -import { GitlabTypes } from '../types'; import { initGitlabApi } from '../utils/initGitlabApi'; -export const getProjectsList = async (): Promise => { +export const getProjectsList = async () => { const settings = await getSettings(); const gitlabApi = initGitlabApi(settings); - return await gitlabApi.Groups.all({ min_access_level: 30, top_level_only: true, perPage: 100, maxPages: 5 }); + return gitlabApi.Groups.all({ minAccessLevel: 30, topLevelOnly: true, perPage: 100 }); }; diff --git a/src/background/endpoints/setTodoAsDone.ts b/src/background/endpoints/setTodoAsDone.ts index 34769e0..da0b2e4 100644 --- a/src/background/endpoints/setTodoAsDone.ts +++ b/src/background/endpoints/setTodoAsDone.ts @@ -1,17 +1,21 @@ import * as browser from 'webextension-polyfill'; import { getSettings } from '../utils/getSettings'; -import { GitlabTypes } from '../types'; import { initGitlabApi } from '../utils/initGitlabApi'; +import { TodoSchema } from '@gitbeaker/rest'; export const setTodoAsDone = async (id: number | undefined): Promise => { + if (!id) { + return; + } + const settings = await getSettings(); const gitlabApi = initGitlabApi(settings); - await gitlabApi.Todos.done({ todoId: id }); + await gitlabApi.TodoLists.done({ todoId: id }); const storage = await browser.storage.local.get(['todos']); - const currentTodos: GitlabTypes.TodoSchema[] = storage.todos; + const currentTodos: TodoSchema[] = storage.todos; const newTodos = id ? currentTodos.filter((todo) => todo.id !== id) : []; diff --git a/src/background/types.ts b/src/background/types.ts index 6db4948..d9d7ad3 100644 --- a/src/background/types.ts +++ b/src/background/types.ts @@ -1,17 +1,21 @@ -import { Gitlab, Types as GitlabTypes } from '@gitbeaker/browser'; -export { Types as GitlabTypes } from '@gitbeaker/browser'; +import { + Gitlab, + ExpandedMergeRequestSchema, + MergeRequestLevelMergeRequestApprovalSchema, + ApprovedByEntity, + UserSchema +} from '@gitbeaker/rest'; export type GitlabAPI = InstanceType; -export interface MergeRequestsDetails extends GitlabTypes.MergeRequestSchema { - approvals: Approvals | GitlabTypes.MergeRequestLevelMergeRequestApprovalSchema; - pipeline?: GitlabTypes.PipelineSchema; +export interface MergeRequestsDetails extends ExpandedMergeRequestSchema { + approvals: Approvals | MergeRequestLevelMergeRequestApprovalSchema; } export interface Approvals { user_has_approved: boolean; approved: boolean; - approved_by: GitlabTypes.ApprovedByEntity[]; + approved_by: ApprovedByEntity[]; // missing types here } @@ -22,6 +26,6 @@ export interface GetSettingsResponse { alertBadgeCounters: number[]; } -export interface GroupMember extends GitlabTypes.UserSchema { +export interface GroupMember extends UserSchema { mergeRequestsCount: number; } diff --git a/src/background/utils/fetchMRExtraInfo.ts b/src/background/utils/fetchMRExtraInfo.ts index 520a3fe..cd59936 100644 --- a/src/background/utils/fetchMRExtraInfo.ts +++ b/src/background/utils/fetchMRExtraInfo.ts @@ -1,10 +1,15 @@ +import { + ExpandedMergeRequestSchema, + MergeRequestLevelMergeRequestApprovalSchema, + MergeRequestSchemaWithBasicLabels +} from '@gitbeaker/rest'; import { GitLabIsCE } from '../errors'; -import { MergeRequestsDetails, GitlabAPI, GitlabTypes } from '../types'; +import { MergeRequestsDetails, GitlabAPI } from '../types'; interface FetchMRExtraInfoParams { gitlabCE: boolean; gitlabApi: GitlabAPI; - mrList: GitlabTypes.MergeRequestSchema[]; + mrList: MergeRequestSchemaWithBasicLabels[]; } export const fetchMRExtraInfo = async (params: FetchMRExtraInfoParams): Promise => { @@ -15,7 +20,10 @@ export const fetchMRExtraInfo = async (params: FetchMRExtraInfoParams): Promise< } const requestsToExecute = mrList.map((mr) => { - const mrDetailsRequest = gitlabApi.MergeRequests.show(mr.project_id, mr.iid); + const mrDetailsRequest = gitlabApi.MergeRequests.show( + mr.project_id, + mr.iid + ) as Promise; if (gitlabCE === true) { return Promise.all([ @@ -31,15 +39,15 @@ export const fetchMRExtraInfo = async (params: FetchMRExtraInfoParams): Promise< return Promise.all([ mrDetailsRequest, - gitlabApi.MergeRequestApprovals.configuration(mr.project_id, { - mergerequestIid: mr.iid - }) + gitlabApi.MergeRequestApprovals.showConfiguration(mr.project_id, { + mergerequestIId: mr.iid + }) as Promise ]); }); const mrDetails = await Promise.all(requestsToExecute); - const mrWithDetails: MergeRequestsDetails[] = mrDetails.map((mr) => { + const mrWithDetails = mrDetails.map((mr) => { const mrDetails = mr[0]; const approvals = mr[1]; diff --git a/src/background/utils/initGitlabApi.ts b/src/background/utils/initGitlabApi.ts index ed9bcab..f9a4c61 100644 --- a/src/background/utils/initGitlabApi.ts +++ b/src/background/utils/initGitlabApi.ts @@ -1,4 +1,4 @@ -import { Gitlab } from '@gitbeaker/browser'; +import { Gitlab } from '@gitbeaker/rest'; import { GitLabAddressNotSet, GitLabTokenNotSet } from '../../common/errors'; import { FailFetchSettings } from '../errors'; import { GetSettingsResponse, GitlabAPI } from '../types'; @@ -24,6 +24,6 @@ export const initGitlabApi = (settings: GetSettingsResponse): GitlabAPI => { return new Gitlab({ host: settings.address, token: settings.token, - requestTimeout: 10000 + queryTimeout: 10000 }); }; diff --git a/src/popup/components/AvatarWithTooltip.tsx b/src/popup/components/AvatarWithTooltip.tsx index 4bacd3a..0d8b215 100644 --- a/src/popup/components/AvatarWithTooltip.tsx +++ b/src/popup/components/AvatarWithTooltip.tsx @@ -1,8 +1,8 @@ import { Avatar, Tooltip } from '@primer/react'; import { CheckIcon } from '@primer/octicons-react'; -import { GitlabTypes } from '../../background/types'; +import { UserSchema } from '@gitbeaker/rest'; -export interface UserWithApproval extends GitlabTypes.UserSchema { +export interface UserWithApproval extends UserSchema { approved?: boolean; } diff --git a/src/popup/components/IssueItem.tsx b/src/popup/components/IssueItem.tsx index 1fa792c..ade9a80 100644 --- a/src/popup/components/IssueItem.tsx +++ b/src/popup/components/IssueItem.tsx @@ -2,31 +2,31 @@ import { Avatar, ActionList, Box, Link, Label, Tooltip, Button, Details, IconBut import { ChevronDownIcon, ChevronRightIcon, ClockIcon, CommentDiscussionIcon, PlusIcon } from '@primer/octicons-react'; import { AvatarWithTooltip } from './AvatarWithTooltip'; import { calculateTimeElapsed, cleanupDescription } from '../helpers'; -import { GitlabTypes } from '../../background/types'; import { createNewTab } from '../utils/createNewTab'; import { ProjectName } from './ProjectName'; -import { MarkdownViewer } from '@primer/react/lib-esm/drafts'; +import { MarkdownViewer } from '@primer/react/drafts'; +import { IssueSchema, UserSchema } from '@gitbeaker/rest'; import { marked } from 'marked'; interface Props { - issue: GitlabTypes.IssueSchema; + issue: IssueSchema; } export const IssueItem = ({ issue }: Props) => { const timeElapsed = calculateTimeElapsed(issue.created_at); - const author = issue.author as GitlabTypes.UserSchema; - const assignees = issue.assignees as GitlabTypes.UserSchema[]; + const author = issue.author as UserSchema; + const assignees = issue.assignees as UserSchema[]; const avatars = assignees && assignees.slice(0, 3).map((assigneeRaw) => { - const assignee = assigneeRaw as GitlabTypes.UserSchema; + const assignee = assigneeRaw as UserSchema; return ; }); const labels = issue.labels?.map((label) => { return ( -