diff --git a/package.json b/package.json index c6797f2e..edea4c25 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "lemmy-js-client", "description": "A javascript / typescript client for Lemmy", - "version": "0.20.0-reports-combined.3", + "version": "0.20.0-image-api-rework.8", "author": "Dessalines ", "license": "AGPL-3.0", "main": "./dist/index.js", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 54e83be4..276dd3fd 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -13,16 +13,16 @@ importers: version: 22.10.5 '@typescript-eslint/eslint-plugin': specifier: ^8.7.0 - version: 8.19.1(@typescript-eslint/parser@8.19.1(eslint@9.18.0)(typescript@5.7.3))(eslint@9.18.0)(typescript@5.7.3) + version: 8.19.0(@typescript-eslint/parser@8.19.0(eslint@9.17.0)(typescript@5.7.2))(eslint@9.17.0)(typescript@5.7.2) '@typescript-eslint/parser': specifier: ^8.7.0 - version: 8.19.1(eslint@9.18.0)(typescript@5.7.3) + version: 8.19.0(eslint@9.17.0)(typescript@5.7.2) eslint: specifier: ^9.11.1 - version: 9.18.0 + version: 9.17.0 eslint-plugin-prettier: specifier: ^5.2.1 - version: 5.2.1(eslint-config-prettier@9.1.0(eslint@9.18.0))(eslint@9.18.0)(prettier@3.4.2) + version: 5.2.1(eslint-config-prettier@9.1.0(eslint@9.17.0))(eslint@9.17.0)(prettier@3.4.2) husky: specifier: ^9.1.4 version: 9.1.7 @@ -37,7 +37,7 @@ importers: version: 0.0.7(prettier@3.4.2) prettier-plugin-organize-imports: specifier: ^4.0.0 - version: 4.1.0(prettier@3.4.2)(typescript@5.7.3) + version: 4.1.0(prettier@3.4.2)(typescript@5.7.2) prettier-plugin-packagejson: specifier: ^2.5.1 version: 2.5.6(prettier@3.4.2) @@ -46,13 +46,13 @@ importers: version: 2.4.0 typedoc: specifier: ^0.27.0 - version: 0.27.6(typescript@5.7.3) + version: 0.27.6(typescript@5.7.2) typescript: specifier: ^5.5.4 - version: 5.7.3 + version: 5.7.2 typescript-eslint: specifier: ^8.7.0 - version: 8.19.1(eslint@9.18.0)(typescript@5.7.3) + version: 8.19.0(eslint@9.17.0)(typescript@5.7.2) packages: @@ -145,24 +145,24 @@ packages: resolution: {integrity: sha512-fo6Mtm5mWyKjA/Chy1BYTdn5mGJoDNjC7C64ug20ADsRDGrA85bN3uK3MaKbeRkRuuIEAR5N33Jr1pbm411/PA==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@eslint/core@0.10.0': - resolution: {integrity: sha512-gFHJ+xBOo4G3WRlR1e/3G8A6/KZAH6zcE/hkLRCZTi/B9avAG365QhFA8uOGzTMqgTghpn7/fSnscW++dpMSAw==} + '@eslint/core@0.9.1': + resolution: {integrity: sha512-GuUdqkyyzQI5RMIWkHhvTWLCyLo1jNK3vzkSyaExH5kHPDHcuL2VOpHjmMY+y3+NC69qAKToBqldTBgYeLSr9Q==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} '@eslint/eslintrc@3.2.0': resolution: {integrity: sha512-grOjVNN8P3hjJn/eIETF1wwd12DdnwFDoyceUJLYYdkpbwq3nLi+4fqrTAONx7XDALqlL220wC/RHSC/QTI/0w==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@eslint/js@9.18.0': - resolution: {integrity: sha512-fK6L7rxcq6/z+AaQMtiFTkvbHkBLNlwyRxHpKawP0x3u9+NC6MQTnFW+AdpwC6gfHTW0051cokQgtTN2FqlxQA==} + '@eslint/js@9.17.0': + resolution: {integrity: sha512-Sxc4hqcs1kTu0iID3kcZDW3JHq2a77HO9P8CP6YEA/FpH3Ll8UXE2r/86Rz9YJLKme39S9vU5OWNjC6Xl0Cr3w==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} '@eslint/object-schema@2.1.5': resolution: {integrity: sha512-o0bhxnL89h5Bae5T318nFoFzGy+YE5i/gGkoPAgkmTVdRKTiv3p8JHevPiPaMwoloKfEiiaHlawCqaZMqRm+XQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@eslint/plugin-kit@0.2.5': - resolution: {integrity: sha512-lB05FkqEdUg2AA0xEbUz0SnkXT1LcCTa438W4IWTUh4hdOnVbQyOJ81OrDXsJk/LSiJHubgGEFoR5EHq1NsH1A==} + '@eslint/plugin-kit@0.2.4': + resolution: {integrity: sha512-zSkKow6H5Kdm0ZUQUB2kV5JIXqoG0+uH5YADhaEHswm664N9Db8dXSi0nMJpacpMf+MyyglF1vnZohpEg5yUtg==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} '@gerrit0/mini-shiki@1.24.4': @@ -246,51 +246,51 @@ packages: '@types/unist@3.0.3': resolution: {integrity: sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==} - '@typescript-eslint/eslint-plugin@8.19.1': - resolution: {integrity: sha512-tJzcVyvvb9h/PB96g30MpxACd9IrunT7GF9wfA9/0TJ1LxGOJx1TdPzSbBBnNED7K9Ka8ybJsnEpiXPktolTLg==} + '@typescript-eslint/eslint-plugin@8.19.0': + resolution: {integrity: sha512-NggSaEZCdSrFddbctrVjkVZvFC6KGfKfNK0CU7mNK/iKHGKbzT4Wmgm08dKpcZECBu9f5FypndoMyRHkdqfT1Q==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: '@typescript-eslint/parser': ^8.0.0 || ^8.0.0-alpha.0 eslint: ^8.57.0 || ^9.0.0 typescript: '>=4.8.4 <5.8.0' - '@typescript-eslint/parser@8.19.1': - resolution: {integrity: sha512-67gbfv8rAwawjYx3fYArwldTQKoYfezNUT4D5ioWetr/xCrxXxvleo3uuiFuKfejipvq+og7mjz3b0G2bVyUCw==} + '@typescript-eslint/parser@8.19.0': + resolution: {integrity: sha512-6M8taKyOETY1TKHp0x8ndycipTVgmp4xtg5QpEZzXxDhNvvHOJi5rLRkLr8SK3jTgD5l4fTlvBiRdfsuWydxBw==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: eslint: ^8.57.0 || ^9.0.0 typescript: '>=4.8.4 <5.8.0' - '@typescript-eslint/scope-manager@8.19.1': - resolution: {integrity: sha512-60L9KIuN/xgmsINzonOcMDSB8p82h95hoBfSBtXuO4jlR1R9L1xSkmVZKgCPVfavDlXihh4ARNjXhh1gGnLC7Q==} + '@typescript-eslint/scope-manager@8.19.0': + resolution: {integrity: sha512-hkoJiKQS3GQ13TSMEiuNmSCvhz7ujyqD1x3ShbaETATHrck+9RaDdUbt+osXaUuns9OFwrDTTrjtwsU8gJyyRA==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@typescript-eslint/type-utils@8.19.1': - resolution: {integrity: sha512-Rp7k9lhDKBMRJB/nM9Ksp1zs4796wVNyihG9/TU9R6KCJDNkQbc2EOKjrBtLYh3396ZdpXLtr/MkaSEmNMtykw==} + '@typescript-eslint/type-utils@8.19.0': + resolution: {integrity: sha512-TZs0I0OSbd5Aza4qAMpp1cdCYVnER94IziudE3JU328YUHgWu9gwiwhag+fuLeJ2LkWLXI+F/182TbG+JaBdTg==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: eslint: ^8.57.0 || ^9.0.0 typescript: '>=4.8.4 <5.8.0' - '@typescript-eslint/types@8.19.1': - resolution: {integrity: sha512-JBVHMLj7B1K1v1051ZaMMgLW4Q/jre5qGK0Ew6UgXz1Rqh+/xPzV1aW581OM00X6iOfyr1be+QyW8LOUf19BbA==} + '@typescript-eslint/types@8.19.0': + resolution: {integrity: sha512-8XQ4Ss7G9WX8oaYvD4OOLCjIQYgRQxO+qCiR2V2s2GxI9AUpo7riNwo6jDhKtTcaJjT8PY54j2Yb33kWtSJsmA==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@typescript-eslint/typescript-estree@8.19.1': - resolution: {integrity: sha512-jk/TZwSMJlxlNnqhy0Eod1PNEvCkpY6MXOXE/WLlblZ6ibb32i2We4uByoKPv1d0OD2xebDv4hbs3fm11SMw8Q==} + '@typescript-eslint/typescript-estree@8.19.0': + resolution: {integrity: sha512-WW9PpDaLIFW9LCbucMSdYUuGeFUz1OkWYS/5fwZwTA+l2RwlWFdJvReQqMUMBw4yJWJOfqd7An9uwut2Oj8sLw==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: typescript: '>=4.8.4 <5.8.0' - '@typescript-eslint/utils@8.19.1': - resolution: {integrity: sha512-IxG5gLO0Ne+KaUc8iW1A+XuKLd63o4wlbI1Zp692n1xojCl/THvgIKXJXBZixTh5dd5+yTJ/VXH7GJaaw21qXA==} + '@typescript-eslint/utils@8.19.0': + resolution: {integrity: sha512-PTBG+0oEMPH9jCZlfg07LCB2nYI0I317yyvXGfxnvGvw4SHIOuRnQ3kadyyXY6tGdChusIHIbM5zfIbp4M6tCg==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: eslint: ^8.57.0 || ^9.0.0 typescript: '>=4.8.4 <5.8.0' - '@typescript-eslint/visitor-keys@8.19.1': - resolution: {integrity: sha512-fzmjU8CHK853V/avYZAvuVut3ZTfwN5YtMaoi+X9Y9MA9keaWNHC3zEQ9zvyX/7Hj+5JkNyK1l7TOR2hevHB6Q==} + '@typescript-eslint/visitor-keys@8.19.0': + resolution: {integrity: sha512-mCFtBbFBJDCNCWUl5y6sZSCHXw1DEFEk3c/M3nRK2a4XUB8StGFtmcEMizdjKuBzB6e/smJAAWYug3VrdLMr1w==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} acorn-jsx@5.3.2: @@ -512,8 +512,8 @@ packages: resolution: {integrity: sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - eslint@9.18.0: - resolution: {integrity: sha512-+waTfRWQlSbpt3KWE+CjrPPYnbq9kfZIYUqapc0uBXyjTp8aYXZDsUH16m39Ryq3NjAVP4tjuF7KaukeqoCoaA==} + eslint@9.17.0: + resolution: {integrity: sha512-evtlNcpJg+cZLcnVKwsai8fExnqjGPicK7gnUtlNuzu+Fv9bI0aLpND5T44VLQtoMEnI57LoXO9XAkIXwohKrA==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} hasBin: true peerDependencies: @@ -560,8 +560,8 @@ packages: fast-diff@1.3.0: resolution: {integrity: sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==} - fast-glob@3.3.3: - resolution: {integrity: sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==} + fast-glob@3.3.2: + resolution: {integrity: sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==} engines: {node: '>=8.6.0'} fast-json-stable-stringify@2.1.0: @@ -1095,11 +1095,11 @@ packages: resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} engines: {node: '>=8.0'} - ts-api-utils@2.0.0: - resolution: {integrity: sha512-xCt/TOAc+EOHS1XPnijD3/yzpH6qg2xppZO1YDqGoVsNXfQfzHpOdNuXwrwOU8u4ITXJyDCTyt8w5g1sZv9ynQ==} - engines: {node: '>=18.12'} + ts-api-utils@1.4.3: + resolution: {integrity: sha512-i3eMG77UTMD0hZhgRS562pv83RC6ukSAC2GMNWc+9dieh/+jDM5u5YG+NHX6VNDRHQcHwmsTHctP9LhbC3WxVw==} + engines: {node: '>=16'} peerDependencies: - typescript: '>=4.8.4' + typescript: '>=4.2.0' tslib@2.7.0: resolution: {integrity: sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA==} @@ -1118,8 +1118,8 @@ packages: peerDependencies: typescript: 5.0.x || 5.1.x || 5.2.x || 5.3.x || 5.4.x || 5.5.x || 5.6.x || 5.7.x - typescript-eslint@8.19.1: - resolution: {integrity: sha512-LKPUQpdEMVOeKluHi8md7rwLcoXHhwvWp3x+sJkMuq3gGm9yaYJtPo8sRZSblMFJ5pcOGCAak/scKf1mvZDlQw==} + typescript-eslint@8.19.0: + resolution: {integrity: sha512-Ni8sUkVWYK4KAcTtPjQ/UTiRk6jcsuDhPpxULapUDi8A/l8TSBk+t1GtJA1RsCzIJg0q6+J7bf35AwQigENWRQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: eslint: ^8.57.0 || ^9.0.0 @@ -1130,8 +1130,8 @@ packages: engines: {node: '>=4.2.0'} hasBin: true - typescript@5.7.3: - resolution: {integrity: sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw==} + typescript@5.7.2: + resolution: {integrity: sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==} engines: {node: '>=14.17'} hasBin: true @@ -1294,9 +1294,9 @@ snapshots: '@babel/helper-validator-identifier': 7.24.7 to-fast-properties: 2.0.0 - '@eslint-community/eslint-utils@4.4.1(eslint@9.18.0)': + '@eslint-community/eslint-utils@4.4.1(eslint@9.17.0)': dependencies: - eslint: 9.18.0 + eslint: 9.17.0 eslint-visitor-keys: 3.4.3 '@eslint-community/regexpp@4.12.1': {} @@ -1309,7 +1309,7 @@ snapshots: transitivePeerDependencies: - supports-color - '@eslint/core@0.10.0': + '@eslint/core@0.9.1': dependencies: '@types/json-schema': 7.0.15 @@ -1327,13 +1327,12 @@ snapshots: transitivePeerDependencies: - supports-color - '@eslint/js@9.18.0': {} + '@eslint/js@9.17.0': {} '@eslint/object-schema@2.1.5': {} - '@eslint/plugin-kit@0.2.5': + '@eslint/plugin-kit@0.2.4': dependencies: - '@eslint/core': 0.10.0 levn: 0.4.1 '@gerrit0/mini-shiki@1.24.4': @@ -1412,81 +1411,81 @@ snapshots: '@types/unist@3.0.3': {} - '@typescript-eslint/eslint-plugin@8.19.1(@typescript-eslint/parser@8.19.1(eslint@9.18.0)(typescript@5.7.3))(eslint@9.18.0)(typescript@5.7.3)': + '@typescript-eslint/eslint-plugin@8.19.0(@typescript-eslint/parser@8.19.0(eslint@9.17.0)(typescript@5.7.2))(eslint@9.17.0)(typescript@5.7.2)': dependencies: '@eslint-community/regexpp': 4.12.1 - '@typescript-eslint/parser': 8.19.1(eslint@9.18.0)(typescript@5.7.3) - '@typescript-eslint/scope-manager': 8.19.1 - '@typescript-eslint/type-utils': 8.19.1(eslint@9.18.0)(typescript@5.7.3) - '@typescript-eslint/utils': 8.19.1(eslint@9.18.0)(typescript@5.7.3) - '@typescript-eslint/visitor-keys': 8.19.1 - eslint: 9.18.0 + '@typescript-eslint/parser': 8.19.0(eslint@9.17.0)(typescript@5.7.2) + '@typescript-eslint/scope-manager': 8.19.0 + '@typescript-eslint/type-utils': 8.19.0(eslint@9.17.0)(typescript@5.7.2) + '@typescript-eslint/utils': 8.19.0(eslint@9.17.0)(typescript@5.7.2) + '@typescript-eslint/visitor-keys': 8.19.0 + eslint: 9.17.0 graphemer: 1.4.0 ignore: 5.3.2 natural-compare: 1.4.0 - ts-api-utils: 2.0.0(typescript@5.7.3) - typescript: 5.7.3 + ts-api-utils: 1.4.3(typescript@5.7.2) + typescript: 5.7.2 transitivePeerDependencies: - supports-color - '@typescript-eslint/parser@8.19.1(eslint@9.18.0)(typescript@5.7.3)': + '@typescript-eslint/parser@8.19.0(eslint@9.17.0)(typescript@5.7.2)': dependencies: - '@typescript-eslint/scope-manager': 8.19.1 - '@typescript-eslint/types': 8.19.1 - '@typescript-eslint/typescript-estree': 8.19.1(typescript@5.7.3) - '@typescript-eslint/visitor-keys': 8.19.1 + '@typescript-eslint/scope-manager': 8.19.0 + '@typescript-eslint/types': 8.19.0 + '@typescript-eslint/typescript-estree': 8.19.0(typescript@5.7.2) + '@typescript-eslint/visitor-keys': 8.19.0 debug: 4.4.0 - eslint: 9.18.0 - typescript: 5.7.3 + eslint: 9.17.0 + typescript: 5.7.2 transitivePeerDependencies: - supports-color - '@typescript-eslint/scope-manager@8.19.1': + '@typescript-eslint/scope-manager@8.19.0': dependencies: - '@typescript-eslint/types': 8.19.1 - '@typescript-eslint/visitor-keys': 8.19.1 + '@typescript-eslint/types': 8.19.0 + '@typescript-eslint/visitor-keys': 8.19.0 - '@typescript-eslint/type-utils@8.19.1(eslint@9.18.0)(typescript@5.7.3)': + '@typescript-eslint/type-utils@8.19.0(eslint@9.17.0)(typescript@5.7.2)': dependencies: - '@typescript-eslint/typescript-estree': 8.19.1(typescript@5.7.3) - '@typescript-eslint/utils': 8.19.1(eslint@9.18.0)(typescript@5.7.3) + '@typescript-eslint/typescript-estree': 8.19.0(typescript@5.7.2) + '@typescript-eslint/utils': 8.19.0(eslint@9.17.0)(typescript@5.7.2) debug: 4.4.0 - eslint: 9.18.0 - ts-api-utils: 2.0.0(typescript@5.7.3) - typescript: 5.7.3 + eslint: 9.17.0 + ts-api-utils: 1.4.3(typescript@5.7.2) + typescript: 5.7.2 transitivePeerDependencies: - supports-color - '@typescript-eslint/types@8.19.1': {} + '@typescript-eslint/types@8.19.0': {} - '@typescript-eslint/typescript-estree@8.19.1(typescript@5.7.3)': + '@typescript-eslint/typescript-estree@8.19.0(typescript@5.7.2)': dependencies: - '@typescript-eslint/types': 8.19.1 - '@typescript-eslint/visitor-keys': 8.19.1 + '@typescript-eslint/types': 8.19.0 + '@typescript-eslint/visitor-keys': 8.19.0 debug: 4.4.0 - fast-glob: 3.3.3 + fast-glob: 3.3.2 is-glob: 4.0.3 minimatch: 9.0.5 semver: 7.6.3 - ts-api-utils: 2.0.0(typescript@5.7.3) - typescript: 5.7.3 + ts-api-utils: 1.4.3(typescript@5.7.2) + typescript: 5.7.2 transitivePeerDependencies: - supports-color - '@typescript-eslint/utils@8.19.1(eslint@9.18.0)(typescript@5.7.3)': + '@typescript-eslint/utils@8.19.0(eslint@9.17.0)(typescript@5.7.2)': dependencies: - '@eslint-community/eslint-utils': 4.4.1(eslint@9.18.0) - '@typescript-eslint/scope-manager': 8.19.1 - '@typescript-eslint/types': 8.19.1 - '@typescript-eslint/typescript-estree': 8.19.1(typescript@5.7.3) - eslint: 9.18.0 - typescript: 5.7.3 + '@eslint-community/eslint-utils': 4.4.1(eslint@9.17.0) + '@typescript-eslint/scope-manager': 8.19.0 + '@typescript-eslint/types': 8.19.0 + '@typescript-eslint/typescript-estree': 8.19.0(typescript@5.7.2) + eslint: 9.17.0 + typescript: 5.7.2 transitivePeerDependencies: - supports-color - '@typescript-eslint/visitor-keys@8.19.1': + '@typescript-eslint/visitor-keys@8.19.0': dependencies: - '@typescript-eslint/types': 8.19.1 + '@typescript-eslint/types': 8.19.0 eslint-visitor-keys: 4.2.0 acorn-jsx@5.3.2(acorn@8.14.0): @@ -1647,19 +1646,19 @@ snapshots: escape-string-regexp@4.0.0: {} - eslint-config-prettier@9.1.0(eslint@9.18.0): + eslint-config-prettier@9.1.0(eslint@9.17.0): dependencies: - eslint: 9.18.0 + eslint: 9.17.0 optional: true - eslint-plugin-prettier@5.2.1(eslint-config-prettier@9.1.0(eslint@9.18.0))(eslint@9.18.0)(prettier@3.4.2): + eslint-plugin-prettier@5.2.1(eslint-config-prettier@9.1.0(eslint@9.17.0))(eslint@9.17.0)(prettier@3.4.2): dependencies: - eslint: 9.18.0 + eslint: 9.17.0 prettier: 3.4.2 prettier-linter-helpers: 1.0.0 synckit: 0.9.1 optionalDependencies: - eslint-config-prettier: 9.1.0(eslint@9.18.0) + eslint-config-prettier: 9.1.0(eslint@9.17.0) eslint-scope@8.2.0: dependencies: @@ -1670,15 +1669,15 @@ snapshots: eslint-visitor-keys@4.2.0: {} - eslint@9.18.0: + eslint@9.17.0: dependencies: - '@eslint-community/eslint-utils': 4.4.1(eslint@9.18.0) + '@eslint-community/eslint-utils': 4.4.1(eslint@9.17.0) '@eslint-community/regexpp': 4.12.1 '@eslint/config-array': 0.19.1 - '@eslint/core': 0.10.0 + '@eslint/core': 0.9.1 '@eslint/eslintrc': 3.2.0 - '@eslint/js': 9.18.0 - '@eslint/plugin-kit': 0.2.5 + '@eslint/js': 9.17.0 + '@eslint/plugin-kit': 0.2.4 '@humanfs/node': 0.16.6 '@humanwhocodes/module-importer': 1.0.1 '@humanwhocodes/retry': 0.4.1 @@ -1747,7 +1746,7 @@ snapshots: fast-diff@1.3.0: {} - fast-glob@3.3.3: + fast-glob@3.3.2: dependencies: '@nodelib/fs.stat': 2.0.5 '@nodelib/fs.walk': 1.2.8 @@ -2098,10 +2097,10 @@ snapshots: transitivePeerDependencies: - supports-color - prettier-plugin-organize-imports@4.1.0(prettier@3.4.2)(typescript@5.7.3): + prettier-plugin-organize-imports@4.1.0(prettier@3.4.2)(typescript@5.7.2): dependencies: prettier: 3.4.2 - typescript: 5.7.3 + typescript: 5.7.2 prettier-plugin-packagejson@2.5.6(prettier@3.4.2): dependencies: @@ -2227,9 +2226,9 @@ snapshots: dependencies: is-number: 7.0.0 - ts-api-utils@2.0.0(typescript@5.7.3): + ts-api-utils@1.4.3(typescript@5.7.2): dependencies: - typescript: 5.7.3 + typescript: 5.7.2 tslib@2.7.0: {} @@ -2239,28 +2238,28 @@ snapshots: dependencies: prelude-ls: 1.2.1 - typedoc@0.27.6(typescript@5.7.3): + typedoc@0.27.6(typescript@5.7.2): dependencies: '@gerrit0/mini-shiki': 1.24.4 lunr: 2.3.9 markdown-it: 14.1.0 minimatch: 9.0.5 - typescript: 5.7.3 + typescript: 5.7.2 yaml: 2.6.1 - typescript-eslint@8.19.1(eslint@9.18.0)(typescript@5.7.3): + typescript-eslint@8.19.0(eslint@9.17.0)(typescript@5.7.2): dependencies: - '@typescript-eslint/eslint-plugin': 8.19.1(@typescript-eslint/parser@8.19.1(eslint@9.18.0)(typescript@5.7.3))(eslint@9.18.0)(typescript@5.7.3) - '@typescript-eslint/parser': 8.19.1(eslint@9.18.0)(typescript@5.7.3) - '@typescript-eslint/utils': 8.19.1(eslint@9.18.0)(typescript@5.7.3) - eslint: 9.18.0 - typescript: 5.7.3 + '@typescript-eslint/eslint-plugin': 8.19.0(@typescript-eslint/parser@8.19.0(eslint@9.17.0)(typescript@5.7.2))(eslint@9.17.0)(typescript@5.7.2) + '@typescript-eslint/parser': 8.19.0(eslint@9.17.0)(typescript@5.7.2) + '@typescript-eslint/utils': 8.19.0(eslint@9.17.0)(typescript@5.7.2) + eslint: 9.17.0 + typescript: 5.7.2 transitivePeerDependencies: - supports-color typescript@3.9.10: {} - typescript@5.7.3: {} + typescript@5.7.2: {} uc.micro@2.1.0: {} diff --git a/putTypesInIndex.js b/putTypesInIndex.js index 8d41ef8f..4a30b484 100644 --- a/putTypesInIndex.js +++ b/putTypesInIndex.js @@ -5,7 +5,7 @@ const exportRegex = /export\s+(?:enum|interface|type)\s+([A-Za-z0-9_]+)/g; const baseExports = [ 'export * from "./http";', - 'export {UploadImage,UploadImageResponse,ImageFile,DeleteImage} from "./other_types";', + 'export {UploadImage} from "./other_types";', ]; async function putTypesInIndex() { diff --git a/src/http.ts b/src/http.ts index c0b72943..5f0e6c73 100644 --- a/src/http.ts +++ b/src/http.ts @@ -117,12 +117,7 @@ import { SearchResponse } from "./types/SearchResponse"; import { SiteResponse } from "./types/SiteResponse"; import { TransferCommunity } from "./types/TransferCommunity"; import { VerifyEmail } from "./types/VerifyEmail"; -import { - DeleteImage, - UploadImage, - UploadImageResponse, - VERSION, -} from "./other_types"; +import { UploadImage, VERSION } from "./other_types"; import { HideCommunity } from "./types/HideCommunity"; import { GenerateTotpSecretResponse } from "./types/GenerateTotpSecretResponse"; import { UpdateTotp } from "./types/UpdateTotp"; @@ -159,11 +154,14 @@ import { MyUserInfo } from "./types/MyUserInfo"; import { UserBlockInstanceParams } from "./types/UserBlockInstanceParams"; import { AdminAllowInstanceParams } from "./types/AdminAllowInstanceParams"; import { AdminBlockInstanceParams } from "./types/AdminBlockInstanceParams"; +import { DeleteImageParams } from "./types/DeleteImageParams"; +import { UploadImageResponse } from "./types/UploadImageResponse"; enum HttpType { Get = "GET", Post = "POST", Put = "PUT", + Delete = "DELETE", } type RequestOptions = Pick; @@ -174,7 +172,6 @@ type RequestOptions = Pick; export class LemmyHttp { #apiUrl: string; #headers: { [key: string]: string } = {}; - #pictrsUrl: string; #fetchFunction: typeof fetch = fetch.bind(globalThis); /** @@ -190,7 +187,6 @@ export class LemmyHttp { }, ) { this.#apiUrl = `${baseUrl.replace(/\/+$/, "")}/api/${VERSION}`; - this.#pictrsUrl = `${baseUrl}/pictrs/image`; if (options?.headers) { this.#headers = options.headers; @@ -1840,65 +1836,225 @@ export class LemmyHttp { } /** - * Upload an image to the server. + * Upload new user avatar. + * + * `HTTP.Post /account/avatar` */ - async uploadImage( - { image }: UploadImage, + async uploadUserAvatar( + image: UploadImage, options?: RequestOptions, - ): Promise { - const formData = createFormData(image); + ): Promise { + return this.#upload("/account/avatar", image, options); + } - let url: string | undefined = undefined; - let delete_url: string | undefined = undefined; + /** + * Delete the user avatar. + * + * `HTTP.Delete /account/avatar` + */ + async deleteUserAvatar(options?: RequestOptions): Promise { + return this.#wrapper( + HttpType.Delete, + "/account/avatar", + {}, + options, + ); + } - const response = await this.#fetchFunction(this.#pictrsUrl, { - ...options, - method: HttpType.Post, - body: formData as unknown as BodyInit, - headers: this.#headers, - }); + /** + * Upload new user banner. + * + * `HTTP.Post /account/banner` + */ + async uploadUserBanner( + image: UploadImage, + options?: RequestOptions, + ): Promise { + return this.#upload("/account/banner", image, options); + } - if (response.status === 413) { - return { msg: "too_large" }; - } + /** + * Delete the user banner. + * + * `HTTP.Delete /account/banner` + */ + async deleteUserBanner(options?: RequestOptions): Promise { + return this.#wrapper( + HttpType.Delete, + "/account/banner", + {}, + options, + ); + } - const responseJson = await response.json(); + /** + * Upload new community icon. + * + * `HTTP.Post /community/icon` + */ + async uploadCommunityIcon( + image: UploadImage, + options?: RequestOptions, + ): Promise { + return this.#upload("/community/icon", image, options); + } - if (responseJson.msg === "ok") { - const { file: hash, delete_token: deleteToken } = responseJson.files[0]; - delete_url = `${this.#pictrsUrl}/delete/${deleteToken}/${hash}`; - url = `${this.#pictrsUrl}/${hash}`; - } + /** + * Delete the community icon. + * + * `HTTP.Delete /community/icon` + */ + async deleteCommunityIcon( + options?: RequestOptions, + ): Promise { + return this.#wrapper( + HttpType.Delete, + "/community/icon", + {}, + options, + ); + } - return { - ...responseJson, - url, - delete_url, - }; + /** + * Upload new community banner. + * + * `HTTP.Post /community/banner` + */ + async uploadCommunityBanner( + image: UploadImage, + options?: RequestOptions, + ): Promise { + return this.#upload("/community/banner", image, options); } /** - * Delete a pictrs image + * Delete the community banner. + * + * `HTTP.Delete /community/banner` */ - async deleteImage( - { token, filename }: DeleteImage, + async deleteCommunityBanner( options?: RequestOptions, - ): Promise { - const deleteUrl = `${this.#pictrsUrl}/delete/${token}/${filename}`; + ): Promise { + return this.#wrapper( + HttpType.Delete, + "/community/banner", + {}, + options, + ); + } - const response = await this.#fetchFunction(deleteUrl, { - ...options, - method: HttpType.Get, - headers: this.#headers, - }); + /** + * Upload new site icon. + * + * `HTTP.Post /site/icon` + */ + async uploadSiteIcon( + image: UploadImage, + options?: RequestOptions, + ): Promise { + return this.#upload("/site/icon", image, options); + } - return response.status == 204; + /** + * Delete the site icon. + * + * `HTTP.Delete /site/icon` + */ + async deleteSiteIcon(options?: RequestOptions): Promise { + return this.#wrapper( + HttpType.Delete, + "/site/icon", + {}, + options, + ); + } + + /** + * Upload new site banner. + * + * `HTTP.Post /site/banner` + */ + async uploadSiteBanner( + image: UploadImage, + options?: RequestOptions, + ): Promise { + return this.#upload("/site/banner", image, options); + } + + /** + * Delete the site banner. + * + * `HTTP.Delete /site/banner` + */ + async deleteSiteBanner(options?: RequestOptions): Promise { + return this.#wrapper( + HttpType.Delete, + "/site/banner", + {}, + options, + ); + } + + /** + * Upload an image to the server. + * + * `HTTP.Post /image` + */ + async uploadImage( + image: UploadImage, + options?: RequestOptions, + ): Promise { + return this.#upload("/image", image, options); + } + + /** + * Delete a pictrs image + * + * `HTTP.Delete /image` + */ + async deleteImage(form: DeleteImageParams, options?: RequestOptions) { + return this.#wrapper( + HttpType.Delete, + "/image", + form, + options, + ); + } + + /** + * Health check for image functionality + * + * `HTTP.Get /image/health` + */ + async imageHealth(options?: RequestOptions) { + return this.#wrapper( + HttpType.Get, + "/image/health", + {}, + options, + ); } #buildFullUrl(endpoint: string) { return `${this.#apiUrl}${endpoint}`; } + async #upload( + path: string, + { image }: UploadImage, + options?: RequestOptions, + ): Promise { + const formData = createFormData(image); + + const response = await this.#fetchFunction(this.#buildFullUrl(path), { + ...options, + method: HttpType.Post, + body: formData as unknown as BodyInit, + headers: this.#headers, + }); + return response.json(); + } + async #wrapper( type_: HttpType, endpoint: string, diff --git a/src/index.ts b/src/index.ts index 72acbd50..e496d6ee 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,10 +1,5 @@ export * from "./http"; -export { - UploadImage, - UploadImageResponse, - ImageFile, - DeleteImage, -} from "./other_types"; +export { UploadImage } from "./other_types"; export { ActivityId } from "./types/ActivityId"; export { AddAdmin } from "./types/AddAdmin"; export { AddAdminResponse } from "./types/AddAdminResponse"; @@ -85,6 +80,7 @@ export { DeleteAccount } from "./types/DeleteAccount"; export { DeleteComment } from "./types/DeleteComment"; export { DeleteCommunity } from "./types/DeleteCommunity"; export { DeleteCustomEmoji } from "./types/DeleteCustomEmoji"; +export { DeleteImageParams } from "./types/DeleteImageParams"; export { DeleteOAuthProvider } from "./types/DeleteOAuthProvider"; export { DeletePost } from "./types/DeletePost"; export { DeletePrivateMessage } from "./types/DeletePrivateMessage"; @@ -138,6 +134,8 @@ export { GetUnreadRegistrationApplicationCountResponse } from "./types/GetUnread export { HideCommunity } from "./types/HideCommunity"; export { HidePost } from "./types/HidePost"; export { ImageDetails } from "./types/ImageDetails"; +export { ImageGetParams } from "./types/ImageGetParams"; +export { ImageProxyParams } from "./types/ImageProxyParams"; export { Instance } from "./types/Instance"; export { InstanceId } from "./types/InstanceId"; export { InstanceWithFederationState } from "./types/InstanceWithFederationState"; @@ -291,6 +289,7 @@ export { TransferCommunity } from "./types/TransferCommunity"; export { UpdateTagline } from "./types/UpdateTagline"; export { UpdateTotp } from "./types/UpdateTotp"; export { UpdateTotpResponse } from "./types/UpdateTotpResponse"; +export { UploadImageResponse } from "./types/UploadImageResponse"; export { UserBlockInstanceParams } from "./types/UserBlockInstanceParams"; export { VerifyEmail } from "./types/VerifyEmail"; export { VoteView } from "./types/VoteView"; diff --git a/src/other_types.ts b/src/other_types.ts index 27e2e333..b3be06c8 100644 --- a/src/other_types.ts +++ b/src/other_types.ts @@ -3,23 +3,3 @@ export const VERSION = "v4"; export interface UploadImage { image: File | Buffer; } - -export interface UploadImageResponse { - /** - * Is "ok" if the upload was successful; is something else otherwise. - */ - msg: string; - files?: ImageFile[]; - url?: string; - delete_url?: string; -} - -export interface ImageFile { - file: string; - delete_token: string; -} - -export interface DeleteImage { - token: string; - filename: string; -} diff --git a/src/types/CreateSite.ts b/src/types/CreateSite.ts index f36bfde6..a7c9de6c 100644 --- a/src/types/CreateSite.ts +++ b/src/types/CreateSite.ts @@ -14,8 +14,6 @@ export type CreateSite = { name: string; sidebar?: string; description?: string; - icon?: string; - banner?: string; enable_nsfw?: boolean; community_creation_admin_only?: boolean; require_email_verification?: boolean; diff --git a/src/types/DeleteImageParams.ts b/src/types/DeleteImageParams.ts new file mode 100644 index 00000000..626a45a5 --- /dev/null +++ b/src/types/DeleteImageParams.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type DeleteImageParams = { filename: string; token: string }; diff --git a/src/types/EditCommunity.ts b/src/types/EditCommunity.ts index 8fb1b529..627fb527 100644 --- a/src/types/EditCommunity.ts +++ b/src/types/EditCommunity.ts @@ -20,14 +20,6 @@ export type EditCommunity = { * A shorter, one line description of your community. */ description?: string; - /** - * An icon URL. - */ - icon?: string; - /** - * A banner URL. - */ - banner?: string; /** * Whether its an NSFW community. */ diff --git a/src/types/EditSite.ts b/src/types/EditSite.ts index 82a0b1ef..75b4fb1e 100644 --- a/src/types/EditSite.ts +++ b/src/types/EditSite.ts @@ -20,14 +20,6 @@ export type EditSite = { * A shorter, one line description of your site. */ description?: string; - /** - * A url for your site's icon. - */ - icon?: string; - /** - * A url for your site's banner. - */ - banner?: string; /** * Whether to enable NSFW. */ diff --git a/src/types/GetSiteResponse.ts b/src/types/GetSiteResponse.ts index 0119254b..15e41769 100644 --- a/src/types/GetSiteResponse.ts +++ b/src/types/GetSiteResponse.ts @@ -35,4 +35,5 @@ export type GetSiteResponse = { oauth_providers?: Array; admin_oauth_providers?: Array; blocked_urls: Array; + image_upload_disabled: boolean; }; diff --git a/src/types/ImageGetParams.ts b/src/types/ImageGetParams.ts new file mode 100644 index 00000000..5dab2752 --- /dev/null +++ b/src/types/ImageGetParams.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type ImageGetParams = { file_type?: string; max_size?: number }; diff --git a/src/types/ImageProxyParams.ts b/src/types/ImageProxyParams.ts new file mode 100644 index 00000000..1d74299e --- /dev/null +++ b/src/types/ImageProxyParams.ts @@ -0,0 +1,7 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type ImageProxyParams = { + url: string; + file_type?: string; + max_size?: number; +}; diff --git a/src/types/LemmyErrorType.ts b/src/types/LemmyErrorType.ts index 32b9c9e9..fbc7fa45 100644 --- a/src/types/LemmyErrorType.ts +++ b/src/types/LemmyErrorType.ts @@ -22,6 +22,8 @@ export type LemmyErrorType = | { error: "pictrs_api_key_not_provided" } | { error: "no_content_type_header" } | { error: "not_an_image_type" } + | { error: "invalid_image_upload" } + | { error: "image_upload_disabled" } | { error: "not_a_mod_or_admin" } | { error: "not_top_mod" } | { error: "not_logged_in" } diff --git a/src/types/SaveUserSettings.ts b/src/types/SaveUserSettings.ts index 431a8dd2..78a37698 100644 --- a/src/types/SaveUserSettings.ts +++ b/src/types/SaveUserSettings.ts @@ -42,14 +42,6 @@ export type SaveUserSettings = { * The language of the lemmy interface */ interface_language?: string; - /** - * A URL for your avatar. - */ - avatar?: string; - /** - * A URL for your banner. - */ - banner?: string; /** * Your display name, which can contain strange characters, and does not need to be unique. */ diff --git a/src/types/SiteResponse.ts b/src/types/SiteResponse.ts index 3f241cbd..380e6437 100644 --- a/src/types/SiteResponse.ts +++ b/src/types/SiteResponse.ts @@ -7,7 +7,7 @@ import type { SiteView } from "./SiteView"; export type SiteResponse = { site_view: SiteView; /** - * deprecated, use field `tagline` or /api/v3/tagline/list + * deprecated, use field `tagline` or /api/v4/tagline/list */ taglines: Array; }; diff --git a/src/types/UploadImageResponse.ts b/src/types/UploadImageResponse.ts new file mode 100644 index 00000000..afc7d987 --- /dev/null +++ b/src/types/UploadImageResponse.ts @@ -0,0 +1,7 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type UploadImageResponse = { + image_url: string; + filename: string; + delete_token: string; +};