From 64d06ef76b7f5b92a87dc2323ebef1bb0b99b184 Mon Sep 17 00:00:00 2001 From: Denis Golovin Date: Tue, 4 Mar 2025 00:50:18 -0800 Subject: [PATCH] fix: use rhsm package generated with @hey-api Related to #86 Requires https://github.com/redhat-developer/redhat-javascript-rest-api-clients/pull/12 Signed-off-by: Denis Golovin --- package.json | 2 + pnpm-lock.yaml | 338 ++++++++++++++++++++++++++++++++++++++++---- src/extension.ts | 14 +- src/subscription.ts | 64 ++++++++- 4 files changed, 383 insertions(+), 35 deletions(-) diff --git a/package.json b/package.json index 49c4897..0353c7d 100644 --- a/package.json +++ b/package.json @@ -47,6 +47,7 @@ "test:e2e": "cross-env E2E_TESTS=true npm run test:e2e:setup npx playwright test tests/src" }, "dependencies": { + "@hey-api/client-axios": "^0.6.1", "@podman-desktop/api": "^1.14.1", "@podman-desktop/podman-extension-api": "^1.14.2", "@redhat-developer/rhcra-client": "^0.0.1", @@ -58,6 +59,7 @@ }, "devDependencies": { "7zip-min": "^2.0.0", + "@hey-api/openapi-ts": "^0.64.9", "@playwright/test": "^1.50.1", "@podman-desktop/tests-playwright": "next", "@types/js-yaml": "^4.0.5", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c2200c6..bfd9a14 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,6 +8,9 @@ importers: .: dependencies: + '@hey-api/client-axios': + specifier: ^0.6.1 + version: 0.6.1(axios@1.8.1) '@podman-desktop/api': specifier: ^1.14.1 version: 1.14.1 @@ -19,7 +22,7 @@ importers: version: 0.0.1 '@redhat-developer/rhsm-client': specifier: ^0.0.4 - version: 0.0.4 + version: link:../redhat-javascript-rest-api-clients/packages/rhsm axios: specifier: ^1.8.1 version: 1.8.1 @@ -36,12 +39,15 @@ importers: 7zip-min: specifier: ^2.0.0 version: 2.0.0 + '@hey-api/openapi-ts': + specifier: ^0.64.9 + version: 0.64.9(magicast@0.3.5)(typescript@5.7.3) '@playwright/test': specifier: ^1.50.1 version: 1.50.1 '@podman-desktop/tests-playwright': specifier: next - version: 1.17.0-202502262048-71edca95f01 + version: 1.18.0-202503031711-eac9d1df331 '@types/js-yaml': specifier: ^4.0.5 version: 4.0.9 @@ -74,7 +80,7 @@ importers: version: 8.57.1 eslint-import-resolver-custom-alias: specifier: ^1.3.2 - version: 1.3.2(eslint-plugin-import@2.31.0(@typescript-eslint/parser@6.21.0(eslint@8.57.1)(typescript@5.7.3))(eslint-import-resolver-typescript@3.8.3)(eslint@8.57.1)) + version: 1.3.2(eslint-plugin-import@2.31.0) eslint-import-resolver-typescript: specifier: ^3.8.3 version: 3.8.3(eslint-plugin-import@2.31.0)(eslint@8.57.1) @@ -116,7 +122,7 @@ importers: version: 5.7.3 vite: specifier: ^6.2.0 - version: 6.2.0(@types/node@20.17.19)(terser@5.36.0) + version: 6.2.0(@types/node@20.17.19)(jiti@2.4.2)(terser@5.36.0) vitest: specifier: ^2.0.5 version: 2.0.5(@types/node@20.17.19)(terser@5.36.0) @@ -487,6 +493,22 @@ packages: resolution: {integrity: sha512-d9zaMRSTIKDLhctzH12MtXvJKSSUhaHcjV+2Z+GK+EEY7XKpP5yR4x+N3TAcHTcu963nIr+TMcCb4DBCYX1z6Q==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + '@hey-api/client-axios@0.6.1': + resolution: {integrity: sha512-1rvO7L5l4fHCqJJlvr1bOFWR1XcjGgdPnqzTODRuOHdrighyCjt9lP2MR7wVQbGO+EjYM0qNIs5E1qxt12rwqA==} + peerDependencies: + axios: '>= 1.0.0 < 2' + + '@hey-api/json-schema-ref-parser@1.0.2': + resolution: {integrity: sha512-F6LSkttZcT/XiX3ydeDqTY3uRN3BLJMwyMTk4kg/ichZlKUp3+3Odv0WokSmXGSoZGTW/N66FROMYAm5NPdJlA==} + engines: {node: '>= 16'} + + '@hey-api/openapi-ts@0.64.9': + resolution: {integrity: sha512-nnhkxJCwShCyvQspYDDAW09D7BWzy4g3prDZhj5Hsux2TAExXiFr4HpXIDFu0JxgXupFfs1dbgBSaL8/4uU9jg==} + engines: {node: ^18.18.0 || ^20.9.0 || >=22.10.0} + hasBin: true + peerDependencies: + typescript: ^5.5.3 + '@humanwhocodes/config-array@0.13.0': resolution: {integrity: sha512-DZLEEqFWQFiyK6h5YIeynKx7JlvCYWL0cImfSRXZ9l4Sg2efkFGTuFf6vzXjK1cq6IYkU+Eg/JizXw+TD2vRNw==} engines: {node: '>=10.10.0'} @@ -533,6 +555,9 @@ packages: '@jridgewell/trace-mapping@0.3.25': resolution: {integrity: sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==} + '@jsdevtools/ono@7.1.3': + resolution: {integrity: sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg==} + '@nodelib/fs.scandir@2.1.5': resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} engines: {node: '>= 8'} @@ -572,15 +597,12 @@ packages: '@podman-desktop/podman-extension-api@1.14.2': resolution: {integrity: sha512-KDLzvZP8/0BUR7IPYuv3NevsPWp9py2bScnYRU09OK5hbYmRCGKe9Y0Ni88Ihdg/GAbh0u8iWJcAbpgHEXoE+Q==} - '@podman-desktop/tests-playwright@1.17.0-202502262048-71edca95f01': - resolution: {integrity: sha512-bstPLSEd+pfsM5+UEBnIRxRrgrfcOXoekmZL7KLDMmr8h9FZ/qHP1yg1fKzvhIImThjCiX5FOC+8S/+JUDkqKQ==} + '@podman-desktop/tests-playwright@1.18.0-202503031711-eac9d1df331': + resolution: {integrity: sha512-jVSEFseqtTHSBxLQ4YpBScsh/eHL/SWabF12vDRx9+AdjyLGuDkn/HvncCoW0ys4tcmsEdeUkX2hrpjaFttFyQ==} '@redhat-developer/rhcra-client@0.0.1': resolution: {integrity: sha512-Ltz1+LRistGEfvYP9mjmZcg9rn8YXdmg0YoNo2g8XeP4QvQ0E5Gv31+QTd7cw4w8sYc9ZVKCDH9cAFcMjMC5GA==} - '@redhat-developer/rhsm-client@0.0.4': - resolution: {integrity: sha512-93Onlfg6z7WRffxPM2IcRaFZ8FEv0QeF2LBYaD7WY5hk4IZRoVBeqzUaT4Zd7hQ3Jw16wtuxoQfYUds7MBVOiQ==} - '@rollup/rollup-android-arm-eabi@4.34.8': resolution: {integrity: sha512-q217OSE8DTp8AFHuNHXo0Y86e1wtlfVrXiAlwkIvGRQv9zbc6mE3sjIVfwI8sYUyNxwOg0j/Vm1RKM04JcWLJw==} cpu: [arm] @@ -1003,6 +1025,14 @@ packages: resolution: {integrity: sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==} engines: {node: '>= 0.8'} + c12@2.0.1: + resolution: {integrity: sha512-Z4JgsKXHG37C6PYUtIxCfLJZvo6FyhHJoClwwb9ftUkLpPSkuYqn6Tr+vnaN8hymm0kIbcg6Ey3kv/Q71k5w/A==} + peerDependencies: + magicast: ^0.3.5 + peerDependenciesMeta: + magicast: + optional: true + cac@6.7.14: resolution: {integrity: sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==} engines: {node: '>=8'} @@ -1050,10 +1080,21 @@ packages: resolution: {integrity: sha512-OAlb+T7V4Op9OwdkjmguYRqncdlx5JiofwOAUkmTF+jNdHwzTaTs4sRAGpzLF3oOz5xAyDGrPgeIDFQmDOTiJw==} engines: {node: '>= 16'} + chokidar@4.0.3: + resolution: {integrity: sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==} + engines: {node: '>= 14.16.0'} + + chownr@2.0.0: + resolution: {integrity: sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==} + engines: {node: '>=10'} + ci-info@4.0.0: resolution: {integrity: sha512-TdHqgGf9odd8SXNuxtUBVx8Nv+qZOejE6qyqiy5NtbYYQOeFa6zmHkxlPzmaLxWWHsU6nJmB7AETdVPi+2NBUg==} engines: {node: '>=8'} + citty@0.1.6: + resolution: {integrity: sha512-tskPPKEs8D2KPafUypv2gxwJP8h/OaJmC82QQGGDQcHvXX43xF2VDACcJVmZ0EuSxkpO9Kc4MlrA3q0+FG58AQ==} + clean-regexp@1.0.0: resolution: {integrity: sha512-GfisEZEJvzKrmGWkvfhgzcz/BllN1USeqD2V6tg14OAOgaCD2Z/PUEuxnAZ/nPvmaHRG7a8y77p1T/IRQ4D1Hw==} engines: {node: '>=4'} @@ -1079,12 +1120,23 @@ packages: resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==} engines: {node: '>= 0.8'} + commander@13.0.0: + resolution: {integrity: sha512-oPYleIY8wmTVzkvQq10AEok6YcTC4sRUBl8F9gVuwchGVUCTbl/vhLTaQqutuuySYOsu8YTgV+OxKc/8Yvx+mQ==} + engines: {node: '>=18'} + commander@2.20.3: resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==} concat-map@0.0.1: resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} + confbox@0.1.8: + resolution: {integrity: sha512-RMtmw0iFkeR4YV+fUOSucriAQNb9g8zFR52MWCtl+cCZOFRNL6zeB395vPzFhEjjn4fMxXudmELnl/KF/WrK6w==} + + consola@3.4.0: + resolution: {integrity: sha512-EiPU8G6dQG0GFHNR8ljnZFki/8a+cQwEQ+7wpxdChl02Q8HXlwEZWD5lqAF8vC2sEC3Tehr8hy7vErz88LHyUA==} + engines: {node: ^14.18.0 || >=16.10.0} + copyfiles@2.4.1: resolution: {integrity: sha512-fereAvAvxDrQDOXybk3Qu3dPbOoKoysFMWtkY3mv5BsL8//OSZVL5DCLYqgRfY5cWirgRzlC+WSrxp6Bo3eNZg==} hasBin: true @@ -1185,10 +1237,16 @@ packages: resolution: {integrity: sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==} engines: {node: '>= 0.4'} + defu@6.1.4: + resolution: {integrity: sha512-mEQCMmwJu317oSz8CwdIOdwf3xMif1ttiM8LTufzc3g6kR+9Pe236twL8j3IYT1F7GfRgGcW6MWxzZjLIkuHIg==} + delayed-stream@1.0.0: resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} engines: {node: '>=0.4.0'} + destr@2.0.3: + resolution: {integrity: sha512-2N3BOUU4gYMpTP24s5rF5iP7BDr7uNTCs4ozw3kf/eKfvWSIu93GEBi5m427YoyJoeOzQ5smuu4nNAPGb8idSQ==} + detect-node@2.1.0: resolution: {integrity: sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==} @@ -1204,6 +1262,10 @@ packages: resolution: {integrity: sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==} engines: {node: '>=6.0.0'} + dotenv@16.4.7: + resolution: {integrity: sha512-47qPchRCykZC03FhkYAhrvwU4xDBFIj1QPqaarj6mdM/hgUzfPHcpkHJOn3mJAufFeeAxAzeGsr5X0M4k6fLZQ==} + engines: {node: '>=12'} + dunder-proto@1.0.1: resolution: {integrity: sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==} engines: {node: '>= 0.4'} @@ -1553,6 +1615,10 @@ packages: resolution: {integrity: sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==} engines: {node: '>=6 <7 || >=8'} + fs-minipass@2.1.0: + resolution: {integrity: sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==} + engines: {node: '>= 8'} + fs.realpath@1.0.0: resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==} @@ -1621,6 +1687,10 @@ packages: get-tsconfig@4.10.0: resolution: {integrity: sha512-kGzZ3LWWQcGIAmg6iWvXn0ei6WDtV26wzHRMwDSzmAbcXrTEXxHy6IehI6/4eT6VRKyMP1eF1VqwrVUmE/LR7A==} + giget@1.2.5: + resolution: {integrity: sha512-r1ekGw/Bgpi3HLV3h1MRBIlSAdHoIMklpaQ3OQLFcRw9PwAj2rqigvIbg+dBUI51OxVI2jsEtDywDBjSiuf7Ug==} + hasBin: true + glob-parent@5.1.2: resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} engines: {node: '>= 6'} @@ -1674,6 +1744,11 @@ packages: graphemer@1.4.0: resolution: {integrity: sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==} + handlebars@4.7.8: + resolution: {integrity: sha512-vafaFqs8MZkRrSX7sFVUdo3ap/eNiLnb4IakshzvP56X5Nr1iGKAIqdX6tMlm6HcNRIkr6AxO5jFEoJzzpT8aQ==} + engines: {node: '>=0.4.7'} + hasBin: true + has-bigints@1.0.2: resolution: {integrity: sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==} @@ -1959,6 +2034,10 @@ packages: jackspeak@3.4.3: resolution: {integrity: sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==} + jiti@2.4.2: + resolution: {integrity: sha512-rg9zJN+G4n2nfJl5MW3BMygZX56zKPNVEYYqq7adpmMh4Jn2QNEwhvQlFy6jPVdcod7txZtKHWnyZiA3a0zP7A==} + hasBin: true + jose@4.15.9: resolution: {integrity: sha512-1vUQX+IdDMVPj4k8kOxgUqlcK518yluMuGZwqlr44FS1ppZB/5GWh4rZG89erpOBOJjU/OBsnCVFfapsRz6nEA==} @@ -2109,10 +2188,22 @@ packages: minimist@1.2.8: resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==} + minipass@3.3.6: + resolution: {integrity: sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==} + engines: {node: '>=8'} + + minipass@5.0.0: + resolution: {integrity: sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==} + engines: {node: '>=8'} + minipass@7.1.2: resolution: {integrity: sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==} engines: {node: '>=16 || 14 >=14.17'} + minizlib@2.1.2: + resolution: {integrity: sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==} + engines: {node: '>= 8'} + mkdirp@1.0.4: resolution: {integrity: sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==} engines: {node: '>=10'} @@ -2123,6 +2214,9 @@ packages: engines: {node: '>=10'} hasBin: true + mlly@1.7.4: + resolution: {integrity: sha512-qmdSIPC4bDJXgZTCR7XosJiNKySV7O215tsPtDN9iEO/7q/76b/ijtgRu/+epFXSJhijtTCCGp3DWS549P3xKw==} + ms@2.0.0: resolution: {integrity: sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==} @@ -2140,6 +2234,12 @@ packages: natural-compare@1.4.0: resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} + neo-async@2.6.2: + resolution: {integrity: sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==} + + node-fetch-native@1.6.6: + resolution: {integrity: sha512-8Mc2HhqPdlIfedsuZoc3yioPuzp6b+L5jRCRY1QzuWZh2EGJVQrGppC6V6cF0bLdbW0+O2YpqCA25aF/1lvipQ==} + node-releases@2.0.18: resolution: {integrity: sha512-d9VeXT4SJ7ZeOqGX6R5EM022wpL+eWPooLI+5UpWn2jCT1aosUQEhQP214x33Wkwx3JQMvIm+tIoVOdodFS40g==} @@ -2157,6 +2257,11 @@ packages: resolution: {integrity: sha512-ppwTtiJZq0O/ai0z7yfudtBpWIoxM8yE6nHi1X47eFR2EWORqfbu6CnPlNsjeN683eT0qG6H/Pyf9fCcvjnnnQ==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + nypm@0.5.4: + resolution: {integrity: sha512-X0SNNrZiGU8/e/zAB7sCTtdxWTMSIO73q+xuKgglm2Yvzwlo8UoC5FNySQFCvl84uPaeADkqHUZUkWy4aH4xOA==} + engines: {node: ^14.16.0 || >=16.10.0} + hasBin: true + object-hash@2.2.0: resolution: {integrity: sha512-gScRMn0bS5fH+IuwyIFgnh9zBdo4DV+6GhygmWM9HyNJSgS0hScp1f5vjtm7oIIOiT9trXrShAkLFSc2IqKNgw==} engines: {node: '>= 6'} @@ -2197,6 +2302,9 @@ packages: resolution: {integrity: sha512-gXah6aZrcUxjWg2zR2MwouP2eHlCBzdV4pygudehaKXSGW4v2AsRQUK+lwwXhii6KFZcunEnmSUoYp5CXibxtA==} engines: {node: '>= 0.4'} + ohash@1.1.5: + resolution: {integrity: sha512-AtXrG/lMFjPBWj3uhWYFwYVZQqutPYRsv6nnPLTipnC+gJuMFc+WFzf/jx+94Ebray1vxfQfEFDtpIpppOe4xQ==} + oidc-token-hash@5.0.3: resolution: {integrity: sha512-IF4PcGgzAr6XXSff26Sk/+P4KZFJVuHAJZj3wgO3vX2bMdNVp/QXTP3P7CEm9V1IdG8lDLY3HhiqpsE/nOwpPw==} engines: {node: ^10.13.0 || >=12.0.0} @@ -2287,6 +2395,9 @@ packages: pathe@1.1.2: resolution: {integrity: sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ==} + pathe@2.0.3: + resolution: {integrity: sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==} + pathval@2.0.0: resolution: {integrity: sha512-vE7JKRyES09KiunauX7nd2Q9/L7lhok4smP9RZTDeD4MVs72Dp2qNFVz39Nz5a0FVEW0BJR6C0DYrq6unoziZA==} engines: {node: '>= 14.16'} @@ -2294,6 +2405,9 @@ packages: pend@1.2.0: resolution: {integrity: sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==} + perfect-debounce@1.0.0: + resolution: {integrity: sha512-xCy9V055GLEqoFaHoC1SoLIaLmWctgCUaBaWxDZ7/Zx4CTyX7cJQLJOok/orfjZAh9kEYpjJa4d0KcJmCbctZA==} + picocolors@1.1.1: resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==} @@ -2305,6 +2419,9 @@ packages: resolution: {integrity: sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==} engines: {node: '>=12'} + pkg-types@1.3.1: + resolution: {integrity: sha512-/Jm5M4RvtBFVkKWRu2BLUTNP8/M2a+UwuAX+ae4770q1qVGtfjG+WTCupoZixokjmHiry8uI+dlY8KXYV5HVVQ==} + playwright-core@1.50.1: resolution: {integrity: sha512-ra9fsNWayuYumt+NiM069M6OkcRb1FZSK8bgi66AtpFoWkg2+y0bJSNmkFrWhMbEBbVKC/EruAHH3g0zmtwGmQ==} engines: {node: '>=18'} @@ -2372,6 +2489,9 @@ packages: resolution: {integrity: sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==} engines: {node: '>=10'} + rc9@2.1.2: + resolution: {integrity: sha512-btXCnMmRIBINM2LDZoEmOogIZU7Qe7zn4BpomSKZ/ykbLObuBdvG+mFq11DL6fjH1DRwHhrlgtYWG96bJiC7Cg==} + read-pkg-up@7.0.1: resolution: {integrity: sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg==} engines: {node: '>=8'} @@ -2386,6 +2506,10 @@ packages: readable-stream@2.3.8: resolution: {integrity: sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==} + readdirp@4.1.2: + resolution: {integrity: sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==} + engines: {node: '>= 14.18.0'} + refa@0.12.1: resolution: {integrity: sha512-J8rn6v4DBb2nnFqkqwy6/NnTYMcgLA+sLr0iIO41qpv0n+ngb7ksag2tMRl0inb1bbO/esUwzW1vbJi7K0sI0g==} engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0} @@ -2675,6 +2799,10 @@ packages: resolution: {integrity: sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==} engines: {node: '>=6'} + tar@6.2.1: + resolution: {integrity: sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==} + engines: {node: '>=10'} + terser@5.36.0: resolution: {integrity: sha512-IYV9eNMuFAV4THUspIRXkLakHnV6XO7FEdtKjf/mDyrnqUg9LnlOn6/RwRvM9SZjR4GUq8Nk8zj67FzVARr74w==} engines: {node: '>=10'} @@ -2693,6 +2821,9 @@ packages: tinybench@2.9.0: resolution: {integrity: sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==} + tinyexec@0.3.2: + resolution: {integrity: sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA==} + tinyglobby@0.2.12: resolution: {integrity: sha512-qkf4trmKSIiMTs/E63cxH+ojC2unam7rJ0WrauAzpT3ECNTxGRMlaXxVbfxMUC/w0LaYk6jQ4y/nGR9uBO3tww==} engines: {node: '>=12.0.0'} @@ -2808,6 +2939,14 @@ packages: engines: {node: '>=14.17'} hasBin: true + ufo@1.5.4: + resolution: {integrity: sha512-UsUk3byDzKd04EyoZ7U4DOlxQaD14JUKQl6/P7wiX4FNvUfm3XL246n9W5AmqwW5RSFJ27NAuM0iLscAOYUiGQ==} + + uglify-js@3.19.3: + resolution: {integrity: sha512-v3Xu+yuwBXisp6QYTcH4UbH+xYJXqnq2m/LtQVWKWzYc1iehYnLixoQDN9FH6/j9/oybfd6W9Ghwkl8+UMKTKQ==} + engines: {node: '>=0.8.0'} + hasBin: true + unbox-primitive@1.0.2: resolution: {integrity: sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==} @@ -2983,6 +3122,9 @@ packages: resolution: {integrity: sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==} engines: {node: '>=0.10.0'} + wordwrap@1.0.0: + resolution: {integrity: sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==} + wrap-ansi@7.0.0: resolution: {integrity: sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==} engines: {node: '>=10'} @@ -3260,6 +3402,26 @@ snapshots: '@eslint/js@8.57.1': {} + '@hey-api/client-axios@0.6.1(axios@1.8.1)': + dependencies: + axios: 1.8.1 + + '@hey-api/json-schema-ref-parser@1.0.2': + dependencies: + '@jsdevtools/ono': 7.1.3 + '@types/json-schema': 7.0.15 + js-yaml: 4.1.0 + + '@hey-api/openapi-ts@0.64.9(magicast@0.3.5)(typescript@5.7.3)': + dependencies: + '@hey-api/json-schema-ref-parser': 1.0.2 + c12: 2.0.1(magicast@0.3.5) + commander: 13.0.0 + handlebars: 4.7.8 + typescript: 5.7.3 + transitivePeerDependencies: + - magicast + '@humanwhocodes/config-array@0.13.0': dependencies: '@humanwhocodes/object-schema': 2.0.3 @@ -3313,6 +3475,8 @@ snapshots: '@jridgewell/resolve-uri': 3.1.2 '@jridgewell/sourcemap-codec': 1.5.0 + '@jsdevtools/ono@7.1.3': {} + '@nodelib/fs.scandir@2.1.5': dependencies: '@nodelib/fs.stat': 2.0.5 @@ -3347,7 +3511,7 @@ snapshots: dependencies: '@podman-desktop/api': 1.14.2 - '@podman-desktop/tests-playwright@1.17.0-202502262048-71edca95f01': {} + '@podman-desktop/tests-playwright@1.18.0-202503031711-eac9d1df331': {} '@redhat-developer/rhcra-client@0.0.1': dependencies: @@ -3356,13 +3520,6 @@ snapshots: transitivePeerDependencies: - debug - '@redhat-developer/rhsm-client@0.0.4': - dependencies: - axios: 1.8.1 - form-data: 4.0.0 - transitivePeerDependencies: - - debug - '@rollup/rollup-android-arm-eabi@4.34.8': optional: true @@ -3699,8 +3856,7 @@ snapshots: acorn@8.12.1: {} - acorn@8.14.0: - optional: true + acorn@8.14.0: {} ajv@6.12.6: dependencies: @@ -3849,6 +4005,23 @@ snapshots: bytes@3.1.2: {} + c12@2.0.1(magicast@0.3.5): + dependencies: + chokidar: 4.0.3 + confbox: 0.1.8 + defu: 6.1.4 + dotenv: 16.4.7 + giget: 1.2.5 + jiti: 2.4.2 + mlly: 1.7.4 + ohash: 1.1.5 + pathe: 1.1.2 + perfect-debounce: 1.0.0 + pkg-types: 1.3.1 + rc9: 2.1.2 + optionalDependencies: + magicast: 0.3.5 + cac@6.7.14: {} cacheable-lookup@5.0.4: {} @@ -3907,8 +4080,18 @@ snapshots: check-error@2.1.1: {} + chokidar@4.0.3: + dependencies: + readdirp: 4.1.2 + + chownr@2.0.0: {} + ci-info@4.0.0: {} + citty@0.1.6: + dependencies: + consola: 3.4.0 + clean-regexp@1.0.0: dependencies: escape-string-regexp: 1.0.5 @@ -3939,11 +4122,17 @@ snapshots: dependencies: delayed-stream: 1.0.0 + commander@13.0.0: {} + commander@2.20.3: optional: true concat-map@0.0.1: {} + confbox@0.1.8: {} + + consola@3.4.0: {} + copyfiles@2.4.1: dependencies: glob: 7.2.3 @@ -4044,8 +4233,12 @@ snapshots: has-property-descriptors: 1.0.2 object-keys: 1.1.1 + defu@6.1.4: {} + delayed-stream@1.0.0: {} + destr@2.0.3: {} + detect-node@2.1.0: optional: true @@ -4061,6 +4254,8 @@ snapshots: dependencies: esutils: 2.0.3 + dotenv@16.4.7: {} + dunder-proto@1.0.1: dependencies: call-bind-apply-helpers: 1.0.2 @@ -4317,7 +4512,7 @@ snapshots: transitivePeerDependencies: - supports-color - eslint-import-resolver-custom-alias@1.3.2(eslint-plugin-import@2.31.0(@typescript-eslint/parser@6.21.0(eslint@8.57.1)(typescript@5.7.3))(eslint-import-resolver-typescript@3.8.3)(eslint@8.57.1)): + eslint-import-resolver-custom-alias@1.3.2(eslint-plugin-import@2.31.0): dependencies: eslint-plugin-import: 2.31.0(@typescript-eslint/parser@6.21.0(eslint@8.57.1)(typescript@5.7.3))(eslint-import-resolver-typescript@3.8.3)(eslint@8.57.1) glob-parent: 6.0.2 @@ -4346,7 +4541,7 @@ snapshots: transitivePeerDependencies: - supports-color - eslint-module-utils@2.12.0(@typescript-eslint/parser@6.21.0(eslint@8.57.1)(typescript@5.7.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.8.3(eslint-plugin-import@2.31.0)(eslint@8.57.1))(eslint@8.57.1): + eslint-module-utils@2.12.0(@typescript-eslint/parser@6.21.0(eslint@8.57.1)(typescript@5.7.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.8.3)(eslint@8.57.1): dependencies: debug: 3.2.7 optionalDependencies: @@ -4385,7 +4580,7 @@ snapshots: doctrine: 2.1.0 eslint: 8.57.1 eslint-import-resolver-node: 0.3.9 - eslint-module-utils: 2.12.0(@typescript-eslint/parser@6.21.0(eslint@8.57.1)(typescript@5.7.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.8.3(eslint-plugin-import@2.31.0)(eslint@8.57.1))(eslint@8.57.1) + eslint-module-utils: 2.12.0(@typescript-eslint/parser@6.21.0(eslint@8.57.1)(typescript@5.7.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.8.3)(eslint@8.57.1) hasown: 2.0.2 is-core-module: 2.15.1 is-glob: 4.0.3 @@ -4650,6 +4845,10 @@ snapshots: jsonfile: 4.0.0 universalify: 0.1.2 + fs-minipass@2.1.0: + dependencies: + minipass: 3.3.6 + fs.realpath@1.0.0: {} fsevents@2.3.2: @@ -4732,6 +4931,16 @@ snapshots: dependencies: resolve-pkg-maps: 1.0.0 + giget@1.2.5: + dependencies: + citty: 0.1.6 + consola: 3.4.0 + defu: 6.1.4 + node-fetch-native: 1.6.6 + nypm: 0.5.4 + pathe: 2.0.3 + tar: 6.2.1 + glob-parent@5.1.2: dependencies: is-glob: 4.0.3 @@ -4812,6 +5021,15 @@ snapshots: graphemer@1.4.0: {} + handlebars@4.7.8: + dependencies: + minimist: 1.2.8 + neo-async: 2.6.2 + source-map: 0.6.1 + wordwrap: 1.0.0 + optionalDependencies: + uglify-js: 3.19.3 + has-bigints@1.0.2: {} has-bigints@1.1.0: {} @@ -5092,6 +5310,8 @@ snapshots: optionalDependencies: '@pkgjs/parseargs': 0.11.0 + jiti@2.4.2: {} + jose@4.15.9: {} js-tokens@4.0.0: {} @@ -5225,12 +5445,30 @@ snapshots: minimist@1.2.8: {} + minipass@3.3.6: + dependencies: + yallist: 4.0.0 + + minipass@5.0.0: {} + minipass@7.1.2: {} + minizlib@2.1.2: + dependencies: + minipass: 3.3.6 + yallist: 4.0.0 + mkdirp@1.0.4: {} mkdirp@3.0.1: {} + mlly@1.7.4: + dependencies: + acorn: 8.14.0 + pathe: 2.0.3 + pkg-types: 1.3.1 + ufo: 1.5.4 + ms@2.0.0: {} ms@2.1.2: {} @@ -5241,6 +5479,10 @@ snapshots: natural-compare@1.4.0: {} + neo-async@2.6.2: {} + + node-fetch-native@1.6.6: {} + node-releases@2.0.18: {} noms@0.0.0: @@ -5261,6 +5503,15 @@ snapshots: dependencies: path-key: 4.0.0 + nypm@0.5.4: + dependencies: + citty: 0.1.6 + consola: 3.4.0 + pathe: 2.0.3 + pkg-types: 1.3.1 + tinyexec: 0.3.2 + ufo: 1.5.4 + object-hash@2.2.0: {} object-hash@3.0.0: {} @@ -5306,6 +5557,8 @@ snapshots: define-properties: 1.2.1 es-object-atoms: 1.1.1 + ohash@1.1.5: {} + oidc-token-hash@5.0.3: {} once@1.4.0: @@ -5392,16 +5645,26 @@ snapshots: pathe@1.1.2: {} + pathe@2.0.3: {} + pathval@2.0.0: {} pend@1.2.0: {} + perfect-debounce@1.0.0: {} + picocolors@1.1.1: {} picomatch@2.3.1: {} picomatch@4.0.2: {} + pkg-types@1.3.1: + dependencies: + confbox: 0.1.8 + mlly: 1.7.4 + pathe: 2.0.3 + playwright-core@1.50.1: {} playwright@1.50.1: @@ -5445,6 +5708,11 @@ snapshots: quick-lru@5.1.1: {} + rc9@2.1.2: + dependencies: + defu: 6.1.4 + destr: 2.0.3 + read-pkg-up@7.0.1: dependencies: find-up: 4.1.0 @@ -5475,6 +5743,8 @@ snapshots: string_decoder: 1.1.1 util-deprecate: 1.0.2 + readdirp@4.1.2: {} + refa@0.12.1: dependencies: '@eslint-community/regexpp': 4.12.1 @@ -5717,8 +5987,7 @@ snapshots: source-map: 0.6.1 optional: true - source-map@0.6.1: - optional: true + source-map@0.6.1: {} spdx-correct@3.2.0: dependencies: @@ -5829,6 +6098,15 @@ snapshots: tapable@2.2.1: {} + tar@6.2.1: + dependencies: + chownr: 2.0.0 + fs-minipass: 2.1.0 + minipass: 5.0.0 + minizlib: 2.1.2 + mkdirp: 1.0.4 + yallist: 4.0.0 + terser@5.36.0: dependencies: '@jridgewell/source-map': 0.3.6 @@ -5852,6 +6130,8 @@ snapshots: tinybench@2.9.0: {} + tinyexec@0.3.2: {} + tinyglobby@0.2.12: dependencies: fdir: 6.4.3(picomatch@4.0.2) @@ -5980,6 +6260,11 @@ snapshots: typescript@5.7.3: {} + ufo@1.5.4: {} + + uglify-js@3.19.3: + optional: true + unbox-primitive@1.0.2: dependencies: call-bind: 1.0.7 @@ -6045,7 +6330,7 @@ snapshots: fsevents: 2.3.3 terser: 5.36.0 - vite@6.2.0(@types/node@20.17.19)(terser@5.36.0): + vite@6.2.0(@types/node@20.17.19)(jiti@2.4.2)(terser@5.36.0): dependencies: esbuild: 0.25.0 postcss: 8.5.3 @@ -6053,6 +6338,7 @@ snapshots: optionalDependencies: '@types/node': 20.17.19 fsevents: 2.3.3 + jiti: 2.4.2 terser: 5.36.0 vitest@2.0.5(@types/node@20.17.19)(terser@5.36.0): @@ -6159,6 +6445,8 @@ snapshots: word-wrap@1.2.5: {} + wordwrap@1.0.0: {} + wrap-ansi@7.0.0: dependencies: ansi-styles: 4.3.0 diff --git a/src/extension.ts b/src/extension.ts index b94b70b..d267ee7 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -22,7 +22,7 @@ import path from 'node:path'; import * as extensionApi from '@podman-desktop/api'; import type { ServiceAccountV1 } from '@redhat-developer/rhcra-client'; import { ContainerRegistryAuthorizerClient } from '@redhat-developer/rhcra-client'; -import { SubscriptionManagerClient } from '@redhat-developer/rhsm-client'; +import { SubscriptionManagerClient } from './subscription'; import { onDidChangeSessions, RedHatAuthenticationService } from './authentication-service'; import { getAuthConfig } from './configuration'; @@ -147,12 +147,7 @@ async function createOrReuseActivationKey(connection: extensionApi.ProviderConta } catch (err) { // ignore and continue with activation key creation // TODO: add check that used role and usage exists in organization - await client.activationKey.createActivationKeys({ - name: 'podman-desktop', - role: 'RHEL Server', - usage: 'Development/Test', - serviceLevel: 'Self-Support', - }); + await client.activationKey.createActivationKeys('podman-desktop'); } await runSubscriptionManagerRegister(connection, 'podman-desktop', accessTokenJson.organization.id); @@ -164,8 +159,7 @@ async function isSimpleContentAccessEnabled(): Promise { BASE: 'https://console.redhat.com/api/rhsm/v2', TOKEN: currentSession!.accessToken, }); - const response = await client.organization.checkOrgScaCapability(); - return !!response.body && response.body.simpleContentAccess === 'enabled'; + return client.organization.checkOrgScaCapability(); } async function isSubscriptionManagerInstalled(connection: extensionApi.ProviderContainerConnection): Promise { @@ -275,6 +269,8 @@ async function configureRegistryAndActivateSubscription(): Promise { 'Enable SCA', ); if (choice === 'Enable SCA') { + // workaround for https://github.com/podman-desktop/podman-desktop/issues/11476 + await new Promise((resolve) => setTimeout(resolve)); await extensionApi.env.openExternal(extensionApi.Uri.parse('https://access.redhat.com/management')); throw new Error('SCA is not enabled and subscription management page requested'); } diff --git a/src/subscription.ts b/src/subscription.ts index a22f3be..df74291 100644 --- a/src/subscription.ts +++ b/src/subscription.ts @@ -19,8 +19,9 @@ import { accessSync, constants, readFileSync } from 'node:fs'; import { homedir } from 'node:os'; import path from 'node:path'; - +import { createClient, Client, Auth } from '@hey-api/client-axios'; import * as extensionApi from '@podman-desktop/api'; +import { ActivationKeys, checkOrgScaCapability, createActivationKeys, CreateActivationKeysData, ListActivationKeysData, showActivationKey } from '@redhat-developer/rhsm-client'; export const REGISTRY_REDHAT_IO = 'registry.redhat.io'; @@ -59,3 +60,64 @@ export function isRedHatRegistryConfigured(): boolean { } return configured; } + +const security: Auth[] = [{ + type: 'http', + scheme: 'bearer', +}]; + +class ClientOptionsHolder { + protected options: { + client: Client, + security: Auth[], + throwOnError: boolean, + }; + constructor(client: Client) { + this.options = { + client, + security, + throwOnError: true, + } + } +} + +class ActivationKey extends ClientOptionsHolder{ + + async showActivationKey(name: string): Promise { + return showActivationKey({ + path: {name}, + ...this.options, + }).then(response => response?.data?.body); + }; + async createActivationKeys(name: string): Promise { + return createActivationKeys({ + ...this.options, + body: { + name, + role: 'RHEL Server', + usage: 'Development/Test', + serviceLevel: 'Self-Support', + }, + }).then(response => response?.data?.body); + } +}; + +class Organization extends ClientOptionsHolder { + async checkOrgScaCapability(): Promise { + const response = await checkOrgScaCapability({ + ...this.options, + }); + return response.data?.body?.simpleContentAccess === 'enabled'; + } +} + +export class SubscriptionManagerClient { + #client:Client; + readonly activationKey: ActivationKey; + readonly organization: Organization; + constructor(options: {BASE: string, TOKEN: string}) { + this.#client = createClient({baseURL: options.BASE, auth: options.TOKEN,}); + this.activationKey = new ActivationKey(this.#client) + this.organization = new Organization(this.#client); + } +} \ No newline at end of file