diff --git a/CHANGELOG.md b/CHANGELOG.md index d200de3..c8209d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # SauceNaoAPI Changelog +## 0.11.0 + +* Versions updates: + * `Kotlin`: `1.6.10` -> `1.6.21` + * `Serialization`: `1.3.2` -> `1.3.3` + * `Klock`: `2.6.3` -> `2.7.0` + * `Ktor`: `1.6.8` -> `2.0.1` + ## 0.10.1 * Versions updates: diff --git a/gradle.properties b/gradle.properties index 3506cd0..3fdfddd 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,3 @@ kotlin.code.style=official -library_version=0.10.1 +library_version=0.11.0 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index b2a6d90..88f0046 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,13 +1,13 @@ [versions] -kt = "1.6.10" -kt-serialization = "1.3.2" -kt-coroutines = "1.6.0" +kt = "1.6.21" +kt-serialization = "1.3.3" +kt-coroutines = "1.6.1" -klock = "2.6.3" -ktor = "1.6.8" +klock = "2.7.0" +ktor = "2.0.1" -gh-release = "2.2.12" +gh-release = "2.3.7" [libraries] diff --git a/kotlin-js-store/yarn.lock b/kotlin-js-store/yarn.lock index c0ea3c8..bba6b0d 100644 --- a/kotlin-js-store/yarn.lock +++ b/kotlin-js-store/yarn.lock @@ -31,9 +31,9 @@ "@types/estree" "*" "@types/eslint@*": - version "8.4.1" - resolved "https://registry.yarnpkg.com/@types/eslint/-/eslint-8.4.1.tgz#c48251553e8759db9e656de3efc846954ac32304" - integrity sha512-GE44+DNEyxxh2Kc6ro/VkIj+9ma0pO0bwv9+uHSyBrikYOHr8zYcdPvnBOp1aw8s+CjRvuSx7CyWqRrNFQ59mA== + version "8.4.2" + resolved "https://registry.yarnpkg.com/@types/eslint/-/eslint-8.4.2.tgz#48f2ac58ab9c631cb68845c3d956b28f79fad575" + integrity sha512-Z1nseZON+GEnFjJc04sv4NSALGjhFwy6K0HXt7qsn5ArfAKtb63dXNJHf+1YW6IpOIYRBGUbu3GwJdj8DGnCjA== dependencies: "@types/estree" "*" "@types/json-schema" "*" @@ -49,14 +49,14 @@ integrity sha512-C6N5s2ZFtuZRj54k2/zyRhNDjJwwcViAM3Nbm8zjBpbqAdZ00mr0CFxvSKeO8Y/e03WVFLpQMdHYVfUd6SB+Hw== "@types/json-schema@*", "@types/json-schema@^7.0.8": - version "7.0.9" - resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.9.tgz#97edc9037ea0c38585320b28964dde3b39e4660d" - integrity sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ== + version "7.0.11" + resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.11.tgz#d421b6c527a3037f7c84433fd2c4229e016863d3" + integrity sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ== "@types/node@*", "@types/node@>=10.0.0": - version "17.0.21" - resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.21.tgz#864b987c0c68d07b4345845c3e63b75edd143644" - integrity sha512-DBZCJbhII3r90XbQxI8Y9IjjiiOGlZ0Hr32omXIZvwwZ7p4DMMXGrKXVyPfuoBOri9XNtL0UK69jYIBIsRX3QQ== + version "17.0.33" + resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.33.tgz#3c1879b276dc63e73030bb91165e62a4509cd506" + integrity sha512-miWq2m2FiQZmaHfdZNcbpp9PuXg34W5JZ5CrJ/BaS70VuhoJENBEQybeiYSaPBRNq6KQGnjfEnc/F3PN++D+XQ== "@ungap/promise-all-settled@1.1.2": version "1.1.2" @@ -212,9 +212,9 @@ integrity sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ== abab@^2.0.5: - version "2.0.5" - resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.5.tgz#c0b678fb32d60fc1219c784d6a826fe385aeb79a" - integrity sha512-9IK9EadsbHo6jLWIpxpR6pL0sazTXV6+SQv25ZB+F7Bj9mJNaOc4nCRabwd5M/JwmUa8idz6Eci6eKfJryPs6Q== + version "2.0.6" + resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.6.tgz#41b80f2c871d19686216b82309231cfd3cb3d291" + integrity sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA== abort-controller@3.0.0: version "3.0.0" @@ -237,9 +237,9 @@ acorn-import-assertions@^1.7.6: integrity sha512-m7VZ3jwz4eK6A4Vtt8Ew1/mNbP24u0FhdyfA7fSvnJR6LMdfOYnmuIrrJAgrYfYJ10F/otaHTtrtrtmHdMNzEw== acorn@^8.4.1, acorn@^8.5.0: - version "8.7.0" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.7.0.tgz#90951fde0f8f09df93549481e5fc141445b791cf" - integrity sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ== + version "8.7.1" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.7.1.tgz#0197122c843d1bf6d0a5e83220a788f278f63c30" + integrity sha512-Xx54uLJQZ19lKygFXOWsscKUbsBZW0CPykPhVQdhIeIwrbPmJzqeASDInc8nKBnp/JT6igTs82qPXz069H8I/A== ajv-keywords@^3.5.2: version "3.5.2" @@ -286,11 +286,6 @@ argparse@^2.0.1: resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38" integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== -async-limiter@~1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/async-limiter/-/async-limiter-1.0.1.tgz#dd379e94f0db8310b08291f9d64c3209766617fd" - integrity sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ== - balanced-match@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" @@ -312,20 +307,22 @@ binary-extensions@^2.0.0: integrity sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA== body-parser@^1.19.0: - version "1.19.2" - resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.19.2.tgz#4714ccd9c157d44797b8b5607d72c0b89952f26e" - integrity sha512-SAAwOxgoCKMGs9uUAUFHygfLAyaniaoun6I8mFY9pRAJL9+Kec34aU+oIjDhTycub1jozEfEwx1W1IuOYxVSFw== + version "1.20.0" + resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.20.0.tgz#3de69bd89011c11573d7bfee6a64f11b6bd27cc5" + integrity sha512-DfJ+q6EPcGKZD1QWUjSpqp+Q7bDQTsQIF4zfUAtZ6qk+H/3/QRhg9CEp39ss+/T2vw0+HaidC0ecJj/DRLIaKg== dependencies: bytes "3.1.2" content-type "~1.0.4" debug "2.6.9" - depd "~1.1.2" - http-errors "1.8.1" + depd "2.0.0" + destroy "1.2.0" + http-errors "2.0.0" iconv-lite "0.4.24" - on-finished "~2.3.0" - qs "6.9.7" - raw-body "2.4.3" + on-finished "2.4.1" + qs "6.10.3" + raw-body "2.5.1" type-is "~1.6.18" + unpipe "1.0.0" brace-expansion@^1.1.7: version "1.1.11" @@ -348,14 +345,14 @@ browser-stdout@1.3.1: integrity sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw== browserslist@^4.14.5: - version "4.20.0" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.20.0.tgz#35951e3541078c125d36df76056e94738a52ebe9" - integrity sha512-bnpOoa+DownbciXj0jVGENf8VYQnE2LNWomhYuCsMmmx9Jd9lwq0WXODuwpSsp8AVdKM2/HorrzxAfbKvWTByQ== + version "4.20.3" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.20.3.tgz#eb7572f49ec430e054f56d52ff0ebe9be915f8bf" + integrity sha512-NBhymBQl1zM0Y5dQT/O+xiLP9/rzOIQdKM/eMJBAq7yBgaB6krIYLGejrwVYnSHZdqjscB1SPuAjHwxjvN6Wdg== dependencies: - caniuse-lite "^1.0.30001313" - electron-to-chromium "^1.4.76" + caniuse-lite "^1.0.30001332" + electron-to-chromium "^1.4.118" escalade "^3.1.1" - node-releases "^2.0.2" + node-releases "^2.0.3" picocolors "^1.0.0" buffer-from@^1.0.0: @@ -368,15 +365,23 @@ bytes@3.1.2: resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.2.tgz#8b0beeb98605adf1b128fa4386403c009e0221a5" integrity sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg== +call-bind@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.2.tgz#b1d4e89e688119c3c9a903ad30abb2f6a919be3c" + integrity sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA== + dependencies: + function-bind "^1.1.1" + get-intrinsic "^1.0.2" + camelcase@^6.0.0: version "6.3.0" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a" integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== -caniuse-lite@^1.0.30001313: - version "1.0.30001314" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001314.tgz#65c7f9fb7e4594fca0a333bec1d8939662377596" - integrity sha512-0zaSO+TnCHtHJIbpLroX7nsD+vYuOVjl3uzFbJO1wMVbuveJA0RK2WcQA9ZUIOiO0/ArMiMgHJLxfEZhQiC0kw== +caniuse-lite@^1.0.30001332: + version "1.0.30001341" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001341.tgz#59590c8ffa8b5939cf4161f00827b8873ad72498" + integrity sha512-2SodVrFFtvGENGCv0ChVJIDQ0KPaS1cg7/qtfMaICgeMolDdo/Z2OD32F0Aq9yl6F4YFwGPBS5AaPqNYiW4PoA== chalk@^4.1.0: version "4.1.2" @@ -523,10 +528,10 @@ custom-event@~1.0.0: resolved "https://registry.yarnpkg.com/custom-event/-/custom-event-1.0.1.tgz#5d02a46850adf1b4a317946a3928fccb5bfd0425" integrity sha1-XQKkaFCt8bSjF5RqOSj8y1v9BCU= -date-format@^4.0.4: - version "4.0.4" - resolved "https://registry.yarnpkg.com/date-format/-/date-format-4.0.4.tgz#b58036e29e74121fca3e1b3e0dc4a62c65faa233" - integrity sha512-/jyf4rhB17ge328HJuJjAcmRtCsGd+NDeAtahRBTaK6vSPR6MO5HlrAit3Nn7dVjaa6sowW0WXt8yQtLyZQFRg== +date-format@^4.0.9: + version "4.0.9" + resolved "https://registry.yarnpkg.com/date-format/-/date-format-4.0.9.tgz#4788015ac56dedebe83b03bc361f00c1ddcf1923" + integrity sha512-+8J+BOUpSrlKLQLeF8xJJVTxS8QfRSuJgwxSVvslzgO3E6khbI0F5mMEPf5mTYhCCm4h99knYP6H3W9n3BQFrg== debug@2.6.9: version "2.6.9" @@ -542,10 +547,10 @@ debug@4.3.2: dependencies: ms "2.1.2" -debug@^4.3.3, debug@~4.3.1: - version "4.3.3" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.3.tgz#04266e0b70a98d4462e6e288e38259213332b664" - integrity sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q== +debug@^4.3.4, debug@~4.3.1: + version "4.3.4" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" + integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== dependencies: ms "2.1.2" @@ -554,10 +559,15 @@ decamelize@^4.0.0: resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-4.0.0.tgz#aa472d7bf660eb15f3494efd531cab7f2a709837" integrity sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ== -depd@~1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/depd/-/depd-1.1.2.tgz#9bcd52e14c097763e749b274c4346ed2e560b5a9" - integrity sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak= +depd@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/depd/-/depd-2.0.0.tgz#b696163cc757560d09cf22cc8fad1571b79e76df" + integrity sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw== + +destroy@1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/destroy/-/destroy-1.2.0.tgz#4803735509ad8be552934c67df614f94e66fa015" + integrity sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg== di@^0.0.1: version "0.0.1" @@ -592,10 +602,10 @@ ee-first@1.1.1: resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" integrity sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0= -electron-to-chromium@^1.4.76: - version "1.4.81" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.81.tgz#a9ce8997232fb9fb0ec53de8931a85b18c0a7383" - integrity sha512-Gs7xVpIZ7tYYSDA+WgpzwpPvfGwUk3KSIjJ0akuj5XQHFdyQnsUoM76EA4CIHXNLPiVwTwOFay9RMb0ChG3OBw== +electron-to-chromium@^1.4.118: + version "1.4.137" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.137.tgz#186180a45617283f1c012284458510cd99d6787f" + integrity sha512-0Rcpald12O11BUogJagX3HsCN3FE83DSqWjgXoHo5a72KUKMSfI39XBgJpgNNxS9fuGzytaFjE06kZkiVFy2qA== emoji-regex@^8.0.0: version "8.0.0" @@ -628,9 +638,9 @@ engine.io@~4.1.0: ws "~7.4.2" enhanced-resolve@^5.8.3: - version "5.9.2" - resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.9.2.tgz#0224dcd6a43389ebfb2d55efee517e5466772dd9" - integrity sha512-GIm3fQfwLJ8YZx2smuHpBKkXC1yOk+OBEmKckVyL0i/ea8mqDEykK3ld5dgH1QYPNyT/lIllxV2LULnxCHaHkA== + version "5.9.3" + resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.9.3.tgz#44a342c012cbc473254af5cc6ae20ebd0aae5d88" + integrity sha512-Bq9VSor+kjvW3f9/MiiR4eE3XYgOl7/rS8lnSxbRbF3kS0B2r+Y9w5krBWxZgDxASVZbdYrn5wT4j/Wb0J9qow== dependencies: graceful-fs "^4.2.4" tapable "^2.2.0" @@ -787,19 +797,19 @@ flatted@^3.2.5: integrity sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg== follow-redirects@^1.0.0: - version "1.14.9" - resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.9.tgz#dd4ea157de7bfaf9ea9b3fbd85aa16951f78d8d7" - integrity sha512-MQDfihBQYMcyy5dhRDJUHcw7lb2Pv/TuE6xP1vyraLukNDHKbDxDNaOE3NbCAdKQApno+GPRyo1YAp89yCjK4w== + version "1.15.0" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.0.tgz#06441868281c86d0dda4ad8bdaead2d02dca89d4" + integrity sha512-aExlJShTV4qOUOL7yF1U5tvLCB0xQuudbf6toyYA0E/acBNw71mvjFTnLaRp50aQaYocMR0a/RMMBIHeZnGyjQ== format-util@1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/format-util/-/format-util-1.0.5.tgz#1ffb450c8a03e7bccffe40643180918cc297d271" integrity sha512-varLbTj0e0yVyRpqQhuWV+8hlePAgaoFRhNFj50BNjEIrw1/DphHSObtqwskVCPWNgzwPoQrZAbfa/SBiicNeg== -fs-extra@^10.0.1: - version "10.0.1" - resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-10.0.1.tgz#27de43b4320e833f6867cc044bfce29fdf0ef3b8" - integrity sha512-NbdoVMZso2Lsrn/QwLXOy6rm0ufY2zEOKCDzJR/0kBsb0E6qed0P3iYK+Ath3BfvXEeu4JhEtXLgILx5psUfag== +fs-extra@^10.1.0: + version "10.1.0" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-10.1.0.tgz#02873cfbc4084dde127eaa5f9905eef2325d1abf" + integrity sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ== dependencies: graceful-fs "^4.2.0" jsonfile "^6.0.1" @@ -825,6 +835,15 @@ get-caller-file@^2.0.5: resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== +get-intrinsic@^1.0.2: + version "1.1.1" + resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.1.1.tgz#15f59f376f855c446963948f0d24cd3637b4abc6" + integrity sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q== + dependencies: + function-bind "^1.1.1" + has "^1.0.3" + has-symbols "^1.0.1" + get-stream@^6.0.0: version "6.0.1" resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.1.tgz#a262d8eef67aced57c2852ad6167526a43cbf7b7" @@ -855,14 +874,14 @@ glob@7.1.7: path-is-absolute "^1.0.0" glob@^7.1.3, glob@^7.1.7: - version "7.2.0" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.0.tgz#d15535af7732e02e948f4c41628bd910293f6023" - integrity sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q== + version "7.2.2" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.2.tgz#29deb38e1ef90f132d5958abe9c3ee8e87f3c318" + integrity sha512-NzDgHDiJwKYByLrL5lONmQFpK/2G78SMMfo+E9CuGlX4IkvfKDsiQSNPwAYxEy+e6p7ZQ3uslSLlwlJcqezBmQ== dependencies: fs.realpath "^1.0.0" inflight "^1.0.4" inherits "2" - minimatch "^3.0.4" + minimatch "^3.1.1" once "^1.3.0" path-is-absolute "^1.0.0" @@ -872,9 +891,9 @@ google-protobuf@3.12.2: integrity sha512-4CZhpuRr1d6HjlyrxoXoocoGFnRYgKULgMtikMddA9ztRyYR59Aondv2FioyxWVamRo0rF2XpYawkTCBEQOSkA== graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.4, graceful-fs@^4.2.6: - version "4.2.9" - resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.9.tgz#041b05df45755e587a24942279b9d113146e1c96" - integrity sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ== + version "4.2.10" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.10.tgz#147d3a006da4ca3ce14728c7aefc287c367d7a6c" + integrity sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA== growl@1.10.5: version "1.10.5" @@ -886,6 +905,11 @@ has-flag@^4.0.0: resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== +has-symbols@^1.0.1: + version "1.0.3" + resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.3.tgz#bb7b2c4349251dce87b125f7bdf874aa7c8b39f8" + integrity sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A== + has@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796" @@ -898,15 +922,15 @@ he@1.2.0: resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== -http-errors@1.8.1: - version "1.8.1" - resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-1.8.1.tgz#7c3f28577cbc8a207388455dbd62295ed07bd68c" - integrity sha512-Kpk9Sm7NmI+RHhnj6OIWDI1d6fIoFAtFt9RLaTMRlg/8w49juAStsrBgp0Dp4OdxdVbRIeKhtCUvoi/RuAhO4g== +http-errors@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-2.0.0.tgz#b7774a1486ef73cf7667ac9ae0858c012c57b9d3" + integrity sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ== dependencies: - depd "~1.1.2" + depd "2.0.0" inherits "2.0.4" setprototypeof "1.2.0" - statuses ">= 1.5.0 < 2" + statuses "2.0.1" toidentifier "1.0.1" http-proxy@^1.18.1: @@ -971,9 +995,9 @@ is-binary-path@~2.1.0: binary-extensions "^2.0.0" is-core-module@^2.8.1: - version "2.8.1" - resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.8.1.tgz#f59fdfca701d5879d0a6b100a40aa1560ce27211" - integrity sha512-SdNCUs284hr40hFTFP6l0IfZ/RSrMXF3qgoRHd3/79unUTvrFO/JoXwkGm+5J/Oe3E/b5GsnG330uUNgRpu1PA== + version "2.9.0" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.9.0.tgz#e1c34429cd51c6dd9e09e0799e396e27b19a9c69" + integrity sha512-+5FPy5PnwmO3lvfMb0AsoPaBG+5KHUI0wYFXOtYPnVVVspTFUuMZNfNaNVRt3FZadstu2c8x23vykRW/NBoU6A== dependencies: has "^1.0.3" @@ -1022,9 +1046,9 @@ is-unicode-supported@^0.1.0: integrity sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw== isbinaryfile@^4.0.8: - version "4.0.8" - resolved "https://registry.yarnpkg.com/isbinaryfile/-/isbinaryfile-4.0.8.tgz#5d34b94865bd4946633ecc78a026fc76c5b11fcf" - integrity sha512-53h6XFniq77YdW+spoRrebh0mnmTxRPTlcuIArO57lmMdq4uBKFKaeTjnb92oYWrSn/LVL+LT+Hap2tFQj8V+w== + version "4.0.10" + resolved "https://registry.yarnpkg.com/isbinaryfile/-/isbinaryfile-4.0.10.tgz#0c5b5e30c2557a2f06febd37b7322946aaee42b3" + integrity sha512-iHrqe5shvBUcFbmZq9zOQHBoeOhZJu6RQGrDpBgenUm/Am+F3JM2MgQj+rK3Z601fzrL5gLZWtAPH2OBaSVcyw== isexe@^2.0.0: version "2.0.0" @@ -1136,9 +1160,9 @@ kind-of@^6.0.2: integrity sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw== loader-runner@^4.2.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-4.2.0.tgz#d7022380d66d14c5fb1d496b89864ebcfd478384" - integrity sha512-92+huvxMvYlMzMt0iIOukcwYBFpkYJdpl2xsZ7LrlayO7E8SOv+JJUEK17B/dJIHAOLMfh2dZZ/Y18WgmGtYNw== + version "4.3.0" + resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-4.3.0.tgz#c1b4a163b99f614830353b16755e7149ac2314e1" + integrity sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg== locate-path@^5.0.0: version "5.0.0" @@ -1154,6 +1178,11 @@ locate-path@^6.0.0: dependencies: p-locate "^5.0.0" +lodash.sortby@^4.7.0: + version "4.7.0" + resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438" + integrity sha1-7dFMgk4sycHgsKG0K7UhBRakJDg= + lodash@^4.17.15, lodash@^4.17.21: version "4.17.21" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" @@ -1168,15 +1197,15 @@ log-symbols@4.1.0: is-unicode-supported "^0.1.0" log4js@^6.3.0: - version "6.4.2" - resolved "https://registry.yarnpkg.com/log4js/-/log4js-6.4.2.tgz#45ec783835acc525b397f52cf086e26994fe3b70" - integrity sha512-k80cggS2sZQLBwllpT1p06GtfvzMmSdUCkW96f0Hj83rKGJDAu2vZjt9B9ag2vx8Zz1IXzxoLgqvRJCdMKybGg== + version "6.4.6" + resolved "https://registry.yarnpkg.com/log4js/-/log4js-6.4.6.tgz#1878aa3f09973298ecb441345fe9dd714e355c15" + integrity sha512-1XMtRBZszmVZqPAOOWczH+Q94AI42mtNWjvjA5RduKTSWjEc56uOBbyM1CJnfN4Ym0wSd8cQ43zOojlSHgRDAw== dependencies: - date-format "^4.0.4" - debug "^4.3.3" + date-format "^4.0.9" + debug "^4.3.4" flatted "^3.2.5" rfdc "^1.3.0" - streamroller "^3.0.4" + streamroller "^3.0.8" media-typer@0.3.0: version "0.3.0" @@ -1188,17 +1217,17 @@ merge-stream@^2.0.0: resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== -mime-db@1.51.0: - version "1.51.0" - resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.51.0.tgz#d9ff62451859b18342d960850dc3cfb77e63fb0c" - integrity sha512-5y8A56jg7XVQx2mbv1lu49NR4dokRnhZYTtL+KGfaa27uq4pSTXkwQkFJl4pkRMyNFz/EtYDSkiiEHx3F7UN6g== +mime-db@1.52.0: + version "1.52.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70" + integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== mime-types@^2.1.27, mime-types@~2.1.24, mime-types@~2.1.34: - version "2.1.34" - resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.34.tgz#5a712f9ec1503511a945803640fafe09d3793c24" - integrity sha512-6cP692WwGIs9XXdOO4++N+7qjqv0rqxxVvJ3VHPh/Sc9mVZcQP+ZGhkKiTvWMQRr2tbHkJP/Yn7Y0npb3ZBs4A== + version "2.1.35" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a" + integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== dependencies: - mime-db "1.51.0" + mime-db "1.52.0" mime@^2.5.2: version "2.6.0" @@ -1217,7 +1246,7 @@ minimatch@3.0.4: dependencies: brace-expansion "^1.1.7" -minimatch@^3.0.4: +minimatch@^3.0.4, minimatch@^3.1.1: version "3.1.2" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== @@ -1225,9 +1254,9 @@ minimatch@^3.0.4: brace-expansion "^1.1.7" minimist@^1.2.3: - version "1.2.5" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602" - integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw== + version "1.2.6" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44" + integrity sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q== mocha@9.1.2: version "9.1.2" @@ -1289,15 +1318,17 @@ neo-async@^2.6.2: resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f" integrity sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw== -node-fetch@2.6.0: - version "2.6.0" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.0.tgz#e633456386d4aa55863f676a7ab0daa8fdecb0fd" - integrity sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA== +node-fetch@2.6.7: + version "2.6.7" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.7.tgz#24de9fba827e3b4ae44dc8b20256a379160052ad" + integrity sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ== + dependencies: + whatwg-url "^5.0.0" -node-releases@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.2.tgz#7139fe71e2f4f11b47d4d2986aaf8c48699e0c01" - integrity sha512-XxYDdcQ6eKqp/YjI+tb2C5WM2LgjnZrfYg4vgQt49EK268b6gYCHsBLrK2qvJo4FmCtqmKezb0WZFK4fkrZNsg== +node-releases@^2.0.3: + version "2.0.4" + resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.4.tgz#f38252370c43854dc48aa431c766c6c398f40476" + integrity sha512-gbMzqQtTtDz/00jQzZ21PQzdI9PyLYqUSvD0p3naOhX4odFji0ZxYdnVwPTxmSwkmxhcFImpozceidSG+AgoPQ== normalize-path@^3.0.0, normalize-path@~3.0.0: version "3.0.0" @@ -1316,6 +1347,18 @@ object-assign@^4: resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM= +object-inspect@^1.9.0: + version "1.12.0" + resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.12.0.tgz#6e2c120e868fd1fd18cb4f18c31741d0d6e776f0" + integrity sha512-Ho2z80bVIvJloH+YzRmpZVQe87+qASmBUKZDWgx9cu+KDrX2ZDH/3tMy+gXbZETVGs2M8YdxObOh7XAtim9Y0g== + +on-finished@2.4.1: + version "2.4.1" + resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.4.1.tgz#58c8c44116e54845ad57f14ab10b03533184ac3f" + integrity sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg== + dependencies: + ee-first "1.1.1" + on-finished@~2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.3.0.tgz#20f1336481b083cd75337992a16971aa2d906947" @@ -1422,10 +1465,12 @@ qjobs@^1.2.0: resolved "https://registry.yarnpkg.com/qjobs/-/qjobs-1.2.0.tgz#c45e9c61800bd087ef88d7e256423bdd49e5d071" integrity sha512-8YOJEHtxpySA3fFDyCRxA+UUV+fA+rTWnuWvylOK/NCjhY+b4ocCtmu8TtsWb+mYeU+GCHf/S66KZF/AsteKHg== -qs@6.9.7: - version "6.9.7" - resolved "https://registry.yarnpkg.com/qs/-/qs-6.9.7.tgz#4610846871485e1e048f44ae3b94033f0e675afe" - integrity sha512-IhMFgUmuNpyRfxA90umL7ByLlgRXu6tIfKPpF5TmcfRLlLCckfP/g3IQmju6jjpu+Hh8rA+2p6A27ZSPOOHdKw== +qs@6.10.3: + version "6.10.3" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.10.3.tgz#d6cde1b2ffca87b5aa57889816c5f81535e22e8e" + integrity sha512-wr7M2E0OFRfIfJZjKGieI8lBKb7fRCH4Fv5KNPEs7gJ8jadvotdsS08PzOKR7opXhZ/Xkjtt3WF9g38drmyRqQ== + dependencies: + side-channel "^1.0.4" randombytes@^2.1.0: version "2.1.0" @@ -1439,13 +1484,13 @@ range-parser@^1.2.1: resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.1.tgz#3cf37023d199e1c24d1a55b84800c2f3e6468031" integrity sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg== -raw-body@2.4.3: - version "2.4.3" - resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.4.3.tgz#8f80305d11c2a0a545c2d9d89d7a0286fcead43c" - integrity sha512-UlTNLIcu0uzb4D2f4WltY6cVjLi+/jEN4lgEUj3E04tpMDpUlkBo/eSn6zou9hum2VMNpCCUone0O0WeJim07g== +raw-body@2.5.1: + version "2.5.1" + resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.5.1.tgz#fe1b1628b181b700215e5fd42389f98b71392857" + integrity sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig== dependencies: bytes "3.1.2" - http-errors "1.8.1" + http-errors "2.0.0" iconv-lite "0.4.24" unpipe "1.0.0" @@ -1556,6 +1601,15 @@ shebang-regex@^3.0.0: resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== +side-channel@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.0.4.tgz#efce5c8fdc104ee751b25c58d4290011fa5ea2cf" + integrity sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw== + dependencies: + call-bind "^1.0.0" + get-intrinsic "^1.0.2" + object-inspect "^1.9.0" + signal-exit@^3.0.3: version "3.0.7" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" @@ -1625,24 +1679,31 @@ source-map@^0.6.0, source-map@^0.6.1: resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== -source-map@~0.7.2: - version "0.7.3" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.3.tgz#5302f8169031735226544092e64981f751750383" - integrity sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ== +source-map@~0.8.0-beta.0: + version "0.8.0-beta.0" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.8.0-beta.0.tgz#d4c1bb42c3f7ee925f005927ba10709e0d1d1f11" + integrity sha512-2ymg6oRBpebeZi9UUNsgQ89bhx01TcTkmNTGnNO88imTmbSgy4nfujrgVEFKWpMTEGA11EDkTt7mqObTPdigIA== + dependencies: + whatwg-url "^7.0.0" -"statuses@>= 1.5.0 < 2", statuses@~1.5.0: +statuses@2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/statuses/-/statuses-2.0.1.tgz#55cb000ccf1d48728bd23c685a063998cf1a1b63" + integrity sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ== + +statuses@~1.5.0: version "1.5.0" resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c" integrity sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow= -streamroller@^3.0.4: - version "3.0.4" - resolved "https://registry.yarnpkg.com/streamroller/-/streamroller-3.0.4.tgz#27ad87339d829483f89c5f33fd60ea6731e4183c" - integrity sha512-GI9NzeD+D88UFuIlJkKNDH/IsuR+qIN7Qh8EsmhoRZr9bQoehTraRgwtLUkZbpcAw+hLPfHOypmppz8YyGK68w== +streamroller@^3.0.8: + version "3.0.8" + resolved "https://registry.yarnpkg.com/streamroller/-/streamroller-3.0.8.tgz#84b190e4080ee311ca1ebe0444e30ac8eedd028d" + integrity sha512-VI+ni3czbFZrd1MrlybxykWZ8sMDCMtTU7YJyhgb9M5X6d1DDxLdJr+gSnmRpXPMnIWxWKMaAE8K0WumBp3lDg== dependencies: - date-format "^4.0.4" - debug "^4.3.3" - fs-extra "^10.0.1" + date-format "^4.0.9" + debug "^4.3.4" + fs-extra "^10.1.0" string-width@^4.1.0, string-width@^4.2.0: version "4.2.3" @@ -1706,13 +1767,13 @@ terser-webpack-plugin@^5.1.3: terser "^5.7.2" terser@^5.7.2: - version "5.12.0" - resolved "https://registry.yarnpkg.com/terser/-/terser-5.12.0.tgz#728c6bff05f7d1dcb687d8eace0644802a9dae8a" - integrity sha512-R3AUhNBGWiFc77HXag+1fXpAxTAFRQTJemlJKjAgD9r8xXTpjNKqIXwHM/o7Rh+O0kUJtS3WQVdBeMKFk5sw9A== + version "5.13.1" + resolved "https://registry.yarnpkg.com/terser/-/terser-5.13.1.tgz#66332cdc5a01b04a224c9fad449fc1a18eaa1799" + integrity sha512-hn4WKOfwnwbYfe48NgrQjqNOH9jzLqRcIfbYytOXCOv46LBfWr9bDS17MQqOi+BWGD0sJK3Sj5NC/gJjiojaoA== dependencies: acorn "^8.5.0" commander "^2.20.0" - source-map "~0.7.2" + source-map "~0.8.0-beta.0" source-map-support "~0.5.20" tmp@^0.2.1: @@ -1734,6 +1795,18 @@ toidentifier@1.0.1: resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.1.tgz#3be34321a88a820ed1bd80dfaa33e479fbb8dd35" integrity sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA== +tr46@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/tr46/-/tr46-1.0.1.tgz#a8b13fd6bfd2489519674ccde55ba3693b706d09" + integrity sha1-qLE/1r/SSJUZZ0zN5VujaTtwbQk= + dependencies: + punycode "^2.1.0" + +tr46@~0.0.3: + version "0.0.3" + resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" + integrity sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o= + type-is@~1.6.18: version "1.6.18" resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.18.tgz#4e552cd05df09467dcbc4ef739de89f2cf37c131" @@ -1797,6 +1870,16 @@ watchpack@^2.2.0: glob-to-regexp "^0.4.1" graceful-fs "^4.1.2" +webidl-conversions@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" + integrity sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE= + +webidl-conversions@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-4.0.2.tgz#a855980b1f0b6b359ba1d5d9fb39ae941faa63ad" + integrity sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg== + webpack-cli@4.9.0: version "4.9.0" resolved "https://registry.yarnpkg.com/webpack-cli/-/webpack-cli-4.9.0.tgz#dc43e6e0f80dd52e89cbf73d5294bcd7ad6eb343" @@ -1866,6 +1949,23 @@ webpack@5.57.1: watchpack "^2.2.0" webpack-sources "^3.2.0" +whatwg-url@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d" + integrity sha1-lmRU6HZUYuN2RNNib2dCzotwll0= + dependencies: + tr46 "~0.0.3" + webidl-conversions "^3.0.0" + +whatwg-url@^7.0.0: + version "7.1.0" + resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-7.1.0.tgz#c2c492f1eca612988efd3d2266be1b9fc6170d06" + integrity sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg== + dependencies: + lodash.sortby "^4.7.0" + tr46 "^1.0.1" + webidl-conversions "^4.0.2" + which@2.0.2, which@^2.0.1: version "2.0.2" resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" @@ -1904,12 +2004,10 @@ wrappy@1: resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= -ws@6.2.1: - version "6.2.1" - resolved "https://registry.yarnpkg.com/ws/-/ws-6.2.1.tgz#442fdf0a47ed64f59b6a5d8ff130f4748ed524fb" - integrity sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA== - dependencies: - async-limiter "~1.0.0" +ws@8.5.0: + version "8.5.0" + resolved "https://registry.yarnpkg.com/ws/-/ws-8.5.0.tgz#bfb4be96600757fe5382de12c670dab984a1ed4f" + integrity sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg== ws@~7.4.2: version "7.4.6" diff --git a/src/commonMain/kotlin/dev/inmo/saucenaoapi/SauceNaoAPI.kt b/src/commonMain/kotlin/dev/inmo/saucenaoapi/SauceNaoAPI.kt index 9c32c45..fcbce0e 100644 --- a/src/commonMain/kotlin/dev/inmo/saucenaoapi/SauceNaoAPI.kt +++ b/src/commonMain/kotlin/dev/inmo/saucenaoapi/SauceNaoAPI.kt @@ -5,18 +5,16 @@ import dev.inmo.saucenaoapi.exceptions.sauceNaoAPIException import dev.inmo.saucenaoapi.models.* import dev.inmo.saucenaoapi.utils.* import io.ktor.client.HttpClient -import io.ktor.client.features.ClientRequestException +import io.ktor.client.plugins.ClientRequestException import io.ktor.client.request.* import io.ktor.client.request.forms.MultiPartFormDataContent import io.ktor.client.request.forms.formData -import io.ktor.client.statement.HttpResponse -import io.ktor.client.statement.readText +import io.ktor.client.statement.bodyAsText import io.ktor.http.* import io.ktor.utils.io.core.Input import kotlinx.coroutines.* import kotlinx.coroutines.channels.Channel import kotlinx.serialization.json.Json -import kotlin.coroutines.* private const val API_TOKEN_FIELD = "api_key" private const val OUTPUT_TYPE_FIELD = "output_type" @@ -40,26 +38,30 @@ val defaultSauceNaoParser = Json { data class SauceNaoAPI( private val apiToken: String? = null, - private val outputType: dev.inmo.saucenaoapi.OutputType = dev.inmo.saucenaoapi.JsonOutputType, private val client: HttpClient = HttpClient(), private val searchUrl: String = SEARCH_URL, private val scope: CoroutineScope = CoroutineScope(Dispatchers.Default), private val parser: Json = defaultSauceNaoParser ) : SauceCloseable { - private val requestsChannel = Channel, HttpRequestBuilder>>(Channel.UNLIMITED) - private val timeManager = TimeManager(scope) - private val quotaManager = RequestQuotaManager(scope) + private val requestsChannel = Channel, HttpRequestBuilder>>(Channel.UNLIMITED) + private val subscope = CoroutineScope(scope.coroutineContext + SupervisorJob(scope.coroutineContext.job)).also { + it.coroutineContext.job.invokeOnCompletion { + requestsChannel.close(it) + } + } + private val timeManager = TimeManager(subscope) + private val quotaManager = RequestQuotaManager(subscope) val limitsState: LimitsState get() = quotaManager.limitsState - private val requestsJob = scope.launch { + private val requestsJob = subscope.launch { for ((callback, requestBuilder) in requestsChannel) { quotaManager.getQuota() launch { try { val answer = makeRequest(requestBuilder) - callback.resume(answer) + callback.complete(answer) quotaManager.updateQuota(answer.header, timeManager) } catch (e: TooManyRequestsException) { @@ -67,7 +69,7 @@ data class SauceNaoAPI( requestsChannel.send(callback to requestBuilder) } catch (e: Exception) { try { - callback.resumeWithException(e) + callback.completeExceptionally(e) } catch (e: IllegalStateException) { // may happen when already resumed and api was closed // do nothing } @@ -80,7 +82,7 @@ data class SauceNaoAPI( url: String, resultsCount: Int? = null, minSimilarity: Float? = null - ): SauceNaoAnswer? = makeRequest( + ): SauceNaoAnswer = makeRequest( url.asSauceRequestSubject, resultsCount = resultsCount, minSimilarity = minSimilarity @@ -91,18 +93,29 @@ data class SauceNaoAPI( mimeType: ContentType, resultsCount: Int? = null, minSimilarity: Float? = null - ): SauceNaoAnswer? = makeRequest( + ): SauceNaoAnswer = makeRequest( mediaInput.asSauceRequestSubject(mimeType), resultsCount = resultsCount, minSimilarity = minSimilarity ) + suspend fun request( + file: MPPFile, + resultsCount: Int? = null, + minSimilarity: Float? = null + ): SauceNaoAnswer = request( + file.input, + file.contentType, + resultsCount = resultsCount, + minSimilarity = minSimilarity + ) + suspend fun requestByDb( url: String, db: Int, resultsCount: Int? = null, minSimilarity: Float? = null - ): SauceNaoAnswer? = makeRequest( + ): SauceNaoAnswer = makeRequest( url.asSauceRequestSubject, db = db, resultsCount = resultsCount, @@ -114,7 +127,7 @@ data class SauceNaoAPI( dbmask: Int, resultsCount: Int? = null, minSimilarity: Float? = null - ): SauceNaoAnswer? = makeRequest( + ): SauceNaoAnswer = makeRequest( url.asSauceRequestSubject, dbmask = dbmask, resultsCount = resultsCount, @@ -126,7 +139,7 @@ data class SauceNaoAPI( dbmaski: Int, resultsCount: Int? = null, minSimilarity: Float? = null - ): SauceNaoAnswer? = makeRequest( + ): SauceNaoAnswer = makeRequest( url.asSauceRequestSubject, dbmaski = dbmaski, resultsCount = resultsCount, @@ -137,8 +150,8 @@ data class SauceNaoAPI( builder: HttpRequestBuilder ): SauceNaoAnswer { return try { - val call = client.request(builder) - val answerText = call.readText() + val call = client.request(builder) + val answerText = call.bodyAsText() timeManager.addTimeAndClear() parser.decodeFromString( SauceNaoAnswerSerializer, @@ -156,29 +169,32 @@ data class SauceNaoAPI( dbmaski: Int? = null, resultsCount: Int? = null, minSimilarity: Float? = null - ): SauceNaoAnswer? { - return suspendCoroutine { - requestsChannel.trySend( - it to HttpRequestBuilder().apply { - url(searchUrl) + ): SauceNaoAnswer { + val deferred = CompletableDeferred() - apiToken ?.also { parameter(API_TOKEN_FIELD, it) } - parameter(OUTPUT_TYPE_FIELD, outputType.typeCode) - db ?.also { parameter(DB_FIELD, it) } - dbmask ?.also { parameter(DBMASK_FIELD, it) } - dbmaski ?.also { parameter(DBMASKI_FIELD, it) } - resultsCount ?.also { parameter(RESULTS_COUNT_FIELD, it) } - minSimilarity ?.also { parameter(MINIMAL_SIMILARITY_FIELD, it) } + requestsChannel.trySend( + deferred to HttpRequestBuilder().apply { + url(searchUrl) - when (request) { - is UrlSauceRequestSubject -> { - parameter(URL_FIELD, request.url) - } - is InputRequestSubject -> { - val mimeType = request.mimeType + apiToken ?.also { parameter(API_TOKEN_FIELD, it) } + parameter(OUTPUT_TYPE_FIELD, JsonOutputType.typeCode) + db ?.also { parameter(DB_FIELD, it) } + dbmask ?.also { parameter(DBMASK_FIELD, it) } + dbmaski ?.also { parameter(DBMASKI_FIELD, it) } + resultsCount ?.also { parameter(RESULTS_COUNT_FIELD, it) } + minSimilarity ?.also { parameter(MINIMAL_SIMILARITY_FIELD, it) } - method = HttpMethod.Post - body = MultiPartFormDataContent(formData { + when (request) { + is UrlSauceRequestSubject -> { + parameter(URL_FIELD, request.url) + } + is InputRequestSubject -> { + val mimeType = request.mimeType + + method = HttpMethod.Post + setBody( + MultiPartFormDataContent( + formData { appendInput( FILE_FIELD, Headers.build { @@ -197,19 +213,18 @@ data class SauceNaoAPI( }, block = request::input ) - }) - } + } + ) + ) } } - ) - } + } + ) + + return deferred.await() } override fun close() { - requestsChannel.close() - client.close() - requestsJob.cancel() - timeManager.close() - quotaManager.close() + subscope.cancel() } } diff --git a/src/commonMain/kotlin/dev/inmo/saucenaoapi/exceptions/TooManyRequestsException.kt b/src/commonMain/kotlin/dev/inmo/saucenaoapi/exceptions/TooManyRequestsException.kt index 57df9cf..4024a14 100644 --- a/src/commonMain/kotlin/dev/inmo/saucenaoapi/exceptions/TooManyRequestsException.kt +++ b/src/commonMain/kotlin/dev/inmo/saucenaoapi/exceptions/TooManyRequestsException.kt @@ -1,17 +1,17 @@ package dev.inmo.saucenaoapi.exceptions +import com.soywiz.klock.TimeSpan import dev.inmo.saucenaoapi.additional.LONG_TIME_RECALCULATING_MILLIS import dev.inmo.saucenaoapi.additional.SHORT_TIME_RECALCULATING_MILLIS -import com.soywiz.klock.TimeSpan -import io.ktor.client.features.ClientRequestException -import io.ktor.client.statement.readText +import io.ktor.client.plugins.ClientRequestException +import io.ktor.client.statement.bodyAsText import io.ktor.http.HttpStatusCode.Companion.TooManyRequests import io.ktor.utils.io.errors.IOException internal suspend fun ClientRequestException.sauceNaoAPIException(): Exception { return when (response.status) { TooManyRequests -> { - val answerContent = response.readText() + val answerContent = response.bodyAsText() when { answerContent.contains("daily limit") -> TooManyRequestsLongException(answerContent) else -> TooManyRequestsShortException(answerContent) diff --git a/src/commonMain/kotlin/dev/inmo/saucenaoapi/utils/MPPFile.kt b/src/commonMain/kotlin/dev/inmo/saucenaoapi/utils/MPPFile.kt new file mode 100644 index 0000000..620eca5 --- /dev/null +++ b/src/commonMain/kotlin/dev/inmo/saucenaoapi/utils/MPPFile.kt @@ -0,0 +1,9 @@ +package dev.inmo.saucenaoapi.utils + +import io.ktor.http.ContentType +import io.ktor.utils.io.core.Input + +expect class MPPFile + +expect val MPPFile.input: Input +expect val MPPFile.contentType: ContentType diff --git a/src/commonMain/kotlin/dev/inmo/saucenaoapi/utils/RequestQuotaManager.kt b/src/commonMain/kotlin/dev/inmo/saucenaoapi/utils/RequestQuotaManager.kt index 9a4b060..4843527 100644 --- a/src/commonMain/kotlin/dev/inmo/saucenaoapi/utils/RequestQuotaManager.kt +++ b/src/commonMain/kotlin/dev/inmo/saucenaoapi/utils/RequestQuotaManager.kt @@ -1,21 +1,20 @@ package dev.inmo.saucenaoapi.utils +import com.soywiz.klock.DateTime import dev.inmo.saucenaoapi.additional.LONG_TIME_RECALCULATING_MILLIS import dev.inmo.saucenaoapi.additional.SHORT_TIME_RECALCULATING_MILLIS import dev.inmo.saucenaoapi.exceptions.TooManyRequestsException import dev.inmo.saucenaoapi.exceptions.TooManyRequestsLongException import dev.inmo.saucenaoapi.models.Header import dev.inmo.saucenaoapi.models.LimitsState -import com.soywiz.klock.DateTime import kotlinx.coroutines.* import kotlinx.coroutines.channels.Channel -import kotlin.coroutines.suspendCoroutine import kotlin.math.max import kotlin.math.min internal class RequestQuotaManager ( scope: CoroutineScope -) : SauceCloseable { +) { private var longQuota = 1 private var shortQuota = 1 private var longMaxQuota = 1 @@ -35,6 +34,10 @@ internal class RequestQuotaManager ( for (callback in quotaActions) { callback() } + }.also { + it.invokeOnCompletion { + quotaActions.close(it) + } } private suspend fun updateQuota( @@ -83,21 +86,16 @@ internal class RequestQuotaManager ( ) suspend fun getQuota() { - return suspendCoroutine { - lateinit var callback: suspend () -> Unit - callback = suspend { - if (longQuota > 0 && shortQuota > 0) { - it.resumeWith(Result.success(Unit)) - } else { - quotaActions.send(callback) - } + val job = Job() + lateinit var callback: suspend () -> Unit + callback = suspend { + if (longQuota > 0 && shortQuota > 0) { + job.complete() + } else { + quotaActions.send(callback) } - quotaActions.trySend(callback) } - } - - override fun close() { - quotaJob.cancel() - quotaActions.close() + quotaActions.trySend(callback) + return job.join() } } diff --git a/src/commonMain/kotlin/dev/inmo/saucenaoapi/utils/SauceCloseable.kt b/src/commonMain/kotlin/dev/inmo/saucenaoapi/utils/SauceCloseable.kt index 4070f66..c18c04f 100644 --- a/src/commonMain/kotlin/dev/inmo/saucenaoapi/utils/SauceCloseable.kt +++ b/src/commonMain/kotlin/dev/inmo/saucenaoapi/utils/SauceCloseable.kt @@ -6,12 +6,13 @@ interface SauceCloseable { fun close() } -fun SauceCloseable.use(block: (SauceCloseable) -> T): T = try { +inline fun SauceCloseable.use(block: (SauceCloseable) -> T): T = try { block(this) } finally { close() } +@Deprecated("Useless") suspend fun SauceCloseable.useSafe(block: suspend (SauceCloseable) -> T): T = try { supervisorScope { block(this@useSafe) diff --git a/src/commonMain/kotlin/dev/inmo/saucenaoapi/utils/TimeManager.kt b/src/commonMain/kotlin/dev/inmo/saucenaoapi/utils/TimeManager.kt index 538f88e..af675eb 100644 --- a/src/commonMain/kotlin/dev/inmo/saucenaoapi/utils/TimeManager.kt +++ b/src/commonMain/kotlin/dev/inmo/saucenaoapi/utils/TimeManager.kt @@ -1,13 +1,10 @@ package dev.inmo.saucenaoapi.utils +import com.soywiz.klock.DateTime import dev.inmo.saucenaoapi.additional.LONG_TIME_RECALCULATING_MILLIS import dev.inmo.saucenaoapi.additional.SHORT_TIME_RECALCULATING_MILLIS -import com.soywiz.klock.DateTime -import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.* import kotlinx.coroutines.channels.Channel -import kotlinx.coroutines.launch -import kotlin.coroutines.Continuation -import kotlin.coroutines.suspendCoroutine private fun MutableList.clearTooOldTimes(relatedTo: DateTime = DateTime.now()) { val limitValue = relatedTo - LONG_TIME_RECALCULATING_MILLIS @@ -38,16 +35,16 @@ private data class TimeManagerTimeAdder( } private data class TimeManagerMostOldestInLongGetter( - private val continuation: Continuation + private val deferred: CompletableDeferred ) : TimeManagerAction { override suspend fun makeChangeWith(times: MutableList) { times.clearTooOldTimes() - continuation.resumeWith(Result.success(times.minOrNull())) + deferred.complete(times.minOrNull()) } } private data class TimeManagerMostOldestInShortGetter( - private val continuation: Continuation + private val deferred: CompletableDeferred ) : TimeManagerAction { override suspend fun makeChangeWith(times: MutableList) { times.clearTooOldTimes() @@ -56,19 +53,17 @@ private data class TimeManagerMostOldestInShortGetter( val limitTime = now - SHORT_TIME_RECALCULATING_MILLIS - continuation.resumeWith( - Result.success( - times.asSequence().filter { - limitTime < it - }.minOrNull() - ) + deferred.complete( + times.asSequence().filter { + limitTime < it + }.minOrNull() ) } } internal class TimeManager( scope: CoroutineScope -) : SauceCloseable { +) { private val actionsChannel = Channel(Channel.UNLIMITED) private val timeUpdateJob = scope.launch { @@ -76,6 +71,10 @@ internal class TimeManager( for (action in actionsChannel) { action(times) } + }.also { + it.invokeOnCompletion { + actionsChannel.close(it) + } } suspend fun addTimeAndClear() { @@ -83,21 +82,20 @@ internal class TimeManager( } suspend fun getMostOldestInLongPeriod(): DateTime? { - return suspendCoroutine { - actionsChannel.trySend( - TimeManagerMostOldestInLongGetter(it) - ) + val deferred = CompletableDeferred() + return if (actionsChannel.trySend(TimeManagerMostOldestInLongGetter(deferred)).isSuccess) { + deferred.await() + } else { + null } } suspend fun getMostOldestInShortPeriod(): DateTime? { - return suspendCoroutine { - actionsChannel.trySend(TimeManagerMostOldestInShortGetter(it)) + val deferred = CompletableDeferred() + return if (actionsChannel.trySend(TimeManagerMostOldestInShortGetter(deferred)).isSuccess) { + deferred.await() + } else { + null } } - - override fun close() { - actionsChannel.close() - timeUpdateJob.cancel() - } } diff --git a/src/jsMain/kotlin/dev/inmo/saucenaoapi/utils/ActualMPPFile.kt b/src/jsMain/kotlin/dev/inmo/saucenaoapi/utils/ActualMPPFile.kt new file mode 100644 index 0000000..5ed733e --- /dev/null +++ b/src/jsMain/kotlin/dev/inmo/saucenaoapi/utils/ActualMPPFile.kt @@ -0,0 +1,18 @@ +package dev.inmo.saucenaoapi.utils + +import io.ktor.http.ContentType +import io.ktor.utils.io.core.ByteReadPacket +import io.ktor.utils.io.core.Input +import org.khronos.webgl.Int8Array +import org.w3c.files.File +import org.w3c.files.FileReaderSync + +actual typealias MPPFile = File + +actual val MPPFile.input: Input + get() { + val reader = FileReaderSync() + return ByteReadPacket(Int8Array(reader.readAsArrayBuffer(this)) as ByteArray) + } +actual val MPPFile.contentType: ContentType + get() = ContentType.parse(type) diff --git a/src/jvmMain/kotlin/dev/inmo/saucenaoapi/utils/ActualMPPFile.kt b/src/jvmMain/kotlin/dev/inmo/saucenaoapi/utils/ActualMPPFile.kt new file mode 100644 index 0000000..73fd4e5 --- /dev/null +++ b/src/jvmMain/kotlin/dev/inmo/saucenaoapi/utils/ActualMPPFile.kt @@ -0,0 +1,14 @@ +package dev.inmo.saucenaoapi.utils + +import io.ktor.http.ContentType +import io.ktor.utils.io.core.Input +import io.ktor.utils.io.streams.asInput +import java.io.File +import java.nio.file.Files + +actual typealias MPPFile = File + +actual val MPPFile.input: Input + get() = inputStream().asInput() +actual val MPPFile.contentType: ContentType + get() = ContentType.parse(Files.probeContentType(toPath())) diff --git a/src/jvmTest/kotlin/Launcher.kt b/src/jvmTest/kotlin/Launcher.kt index 43a5d47..bfdce82 100644 --- a/src/jvmTest/kotlin/Launcher.kt +++ b/src/jvmTest/kotlin/Launcher.kt @@ -1,30 +1,27 @@ import dev.inmo.saucenaoapi.SauceNaoAPI -import dev.inmo.saucenaoapi.utils.useSafe -import io.ktor.http.ContentType -import io.ktor.utils.io.streams.asInput +import io.ktor.client.HttpClient import kotlinx.coroutines.* import java.io.File -import java.nio.file.Files suspend fun main(vararg args: String) { val (key, requestSubject) = args - val scope = CoroutineScope(Dispatchers.Default) - - val api = SauceNaoAPI(key, scope = scope) - api.useSafe { _ -> - println( - when { - requestSubject.startsWith("/") -> File(requestSubject).let { - api.request( - it.inputStream().asInput(), - ContentType.parse(Files.probeContentType(it.toPath())) - ) - } - else -> api.request(requestSubject) - } - ) + val client = HttpClient() + val scope = CoroutineScope(Dispatchers.IO).also { + it.coroutineContext.job.invokeOnCompletion { + client.close() + } } + val api = SauceNaoAPI(key, client, scope = scope) + println( + when { + requestSubject.startsWith("/") -> File(requestSubject).let { + api.request(it) + } + else -> api.request(requestSubject) + } + ) + scope.cancel() }