From e721ae924709e256e765339d0e8cab590380cec5 Mon Sep 17 00:00:00 2001 From: nwjgit Date: Thu, 1 Feb 2024 18:08:18 -0600 Subject: [PATCH 01/15] volcanic ore pack --- src/lib/bankImage.ts | 6 +++++- src/lib/openables.ts | 16 ++++++++++++---- src/mahoji/commands/open.ts | 5 ++++- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/lib/bankImage.ts b/src/lib/bankImage.ts index 81ce125c06..d185b10c2f 100644 --- a/src/lib/bankImage.ts +++ b/src/lib/bankImage.ts @@ -232,7 +232,11 @@ const forcedShortNameMap = new Map([ [i('Sanguinesti staff (uncharged)'), 'Unch.'], [i('Scythe of vitur (uncharged)'), 'Unch.'], [i('Holy scythe of vitur (uncharged)'), 'Unch.'], - [i('Sanguine scythe of vitur (uncharged)'), 'Unch.'] + [i('Sanguine scythe of vitur (uncharged)'), 'Unch.'], + + // Ore Packs + [27_019, 'GF Pack'], + [27_693, 'VM Pack'] ]); function drawTitle(ctx: SKRSContext2D, title: string, canvas: Canvas) { diff --git a/src/lib/openables.ts b/src/lib/openables.ts index 4794ba333f..b83480fd28 100644 --- a/src/lib/openables.ts +++ b/src/lib/openables.ts @@ -315,12 +315,20 @@ const osjsOpenables: UnifiedOpenable[] = [ allItems: Openables.SinisterChest.table.allItems }, { - name: 'Ore pack', + name: "Ore pack (Giant's Foundry)", id: 27_019, openedItem: getOSItem(27_019), - aliases: ['ore pack'], - output: Openables.OrePack.table, - allItems: Openables.OrePack.table.allItems + aliases: ["ore pack (giant's foundry)", 'giants', 'foundry', 'giants foundry'], + output: Openables.GiantsFoundryOrePack.table, + allItems: Openables.GiantsFoundryOrePack.table.allItems + }, + { + name: 'Ore pack (Volcanic Mine)', + id: 27_693, + openedItem: getOSItem(27_693), + aliases: ['ore pack (volcanic mine)', 'volcanic', 'volcanic mine'], + output: Openables.VolcanicMineOrePack.table, + allItems: Openables.VolcanicMineOrePack.table.allItems }, { name: 'Intricate pouch', diff --git a/src/mahoji/commands/open.ts b/src/mahoji/commands/open.ts index 8678d5464d..890fd826c1 100644 --- a/src/mahoji/commands/open.ts +++ b/src/mahoji/commands/open.ts @@ -32,7 +32,10 @@ export const openCommand: OSBMahojiCommand = { val.toLowerCase().includes(value.toLowerCase()) ); }) - .map(i => ({ name: `${i[0].name} (${i[1]}x Owned)`, value: i[0].name.toLowerCase() })) + .map(i => { + const openable = allOpenables.find(o => o.id === i[0].id); + return { name: `${openable!.name} (${i[1]}x Owned)`, value: openable!.name.toLowerCase() }; + }) .concat([{ name: 'All (Open Everything)', value: 'all' }]); } }, From 8255e8eff4f49602baec0c4fd7998e30cd461247 Mon Sep 17 00:00:00 2001 From: nwjgit Date: Wed, 21 Feb 2024 11:44:06 -0600 Subject: [PATCH 02/15] update osjs --- package.json | 2 +- src/lib/data/CollectionsExport.ts | 9 +- src/lib/data/itemAliases.ts | 4 + src/mahoji/commands/open.ts | 5 +- .../giantsFoundryCommand.ts | 4 +- .../volcanicMineCommand.ts | 5 + yarn.lock | 259 +----------------- 7 files changed, 30 insertions(+), 258 deletions(-) diff --git a/package.json b/package.json index b6a6ce96c4..b3c301286e 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "murmurhash": "^2.0.1", "node-cron": "^3.0.2", "node-fetch": "^2.6.7", - "oldschooljs": "^2.3.8", + "oldschooljs": "^2.4.0", "p-queue": "^6.6.2", "piscina": "^3.2.0", "random-js": "^2.1.0", diff --git a/src/lib/data/CollectionsExport.ts b/src/lib/data/CollectionsExport.ts index f5444b37c0..983b9a773d 100644 --- a/src/lib/data/CollectionsExport.ts +++ b/src/lib/data/CollectionsExport.ts @@ -1488,7 +1488,12 @@ export const troubleBrewingCL = resolveItems([ 'Red rum (trouble brewing)', 'Blue rum (trouble brewing)' ]); -export const volcanicMineCL = resolveItems(['Ash covered tome', 'Large water container', 'Volcanic mine teleport']); +export const volcanicMineCL = resolveItems([ + 'Ash covered tome', + 'Large water container', + 'Volcanic mine teleport', + 'Dragon pickaxe (broken)' +]); export const anglerOutfit = resolveItems(['Angler hat', 'Angler top', 'Angler waders', 'Angler boots']); export const aerialFishingCL = resolveItems([ 'Golden tench', @@ -2265,8 +2270,6 @@ export const LMSBuyables: LMSBuyable[] = [ { item: getOSItem('Guthixian icon'), cost: 500 }, { item: getOSItem('Trouver parchment'), cost: 18 }, { item: getOSItem('Wilderness crabs teleport'), cost: 1 }, - { item: getOSItem('Blighted bind sack'), quantity: 300, cost: 1 }, - { item: getOSItem('Blighted snare sack'), quantity: 150, cost: 1 }, { item: getOSItem('Blighted entangle sack'), quantity: 70, cost: 1 }, { item: getOSItem('Blighted teleport spell sack'), quantity: 50, cost: 1 }, { item: getOSItem('Blighted vengeance sack'), quantity: 50, cost: 1 }, diff --git a/src/lib/data/itemAliases.ts b/src/lib/data/itemAliases.ts index ae76091853..b0c543562b 100644 --- a/src/lib/data/itemAliases.ts +++ b/src/lib/data/itemAliases.ts @@ -145,6 +145,10 @@ setItemAlias(11_901, 'Decorative quiver'); // Lamp (Genie event) setItemAlias(2528, 'Genie lamp'); +// Ore Sack +setItemAlias(27_019, "Ore pack (Giant's Foundry)"); +setItemAlias(27_693, 'Ore pack (Volcanic Mine)'); + // Birds eggs setItemAlias(5076, 'Red bird egg'); setItemAlias(5077, 'Blue bird egg'); diff --git a/src/mahoji/commands/open.ts b/src/mahoji/commands/open.ts index 890fd826c1..8678d5464d 100644 --- a/src/mahoji/commands/open.ts +++ b/src/mahoji/commands/open.ts @@ -32,10 +32,7 @@ export const openCommand: OSBMahojiCommand = { val.toLowerCase().includes(value.toLowerCase()) ); }) - .map(i => { - const openable = allOpenables.find(o => o.id === i[0].id); - return { name: `${openable!.name} (${i[1]}x Owned)`, value: openable!.name.toLowerCase() }; - }) + .map(i => ({ name: `${i[0].name} (${i[1]}x Owned)`, value: i[0].name.toLowerCase() })) .concat([{ name: 'All (Open Everything)', value: 'all' }]); } }, diff --git a/src/mahoji/lib/abstracted_commands/giantsFoundryCommand.ts b/src/mahoji/lib/abstracted_commands/giantsFoundryCommand.ts index 5bf72c7cbf..f8861c7036 100644 --- a/src/mahoji/lib/abstracted_commands/giantsFoundryCommand.ts +++ b/src/mahoji/lib/abstracted_commands/giantsFoundryCommand.ts @@ -104,9 +104,9 @@ export const giantsFoundryBuyables: { name: string; output: Bank; cost: number; }, { name: 'Ore pack', - output: new Bank().add('Ore pack', 1), + output: new Bank().add("Ore pack (Giant's Foundry)", 1), cost: 200, - aliases: [] + aliases: ["Ore pack (Giant's Foundry)"] }, { name: 'Smiths tunic', diff --git a/src/mahoji/lib/abstracted_commands/volcanicMineCommand.ts b/src/mahoji/lib/abstracted_commands/volcanicMineCommand.ts index cc7f02db2b..931afa11c2 100644 --- a/src/mahoji/lib/abstracted_commands/volcanicMineCommand.ts +++ b/src/mahoji/lib/abstracted_commands/volcanicMineCommand.ts @@ -69,6 +69,11 @@ export const VolcanicMineShop: { name: string; output: Bank; cost: number; clOnl output: new Bank({ Pyrophosphite: 1 }), cost: 70 }, + { + name: 'Ore pack', + output: new Bank({ 'Ore pack (Volcanic Mine)': 1 }), + cost: 4000 + }, { name: 'Volcanic mine teleport', output: new Bank({ 'Volcanic mine teleport': 1 }), diff --git a/yarn.lock b/yarn.lock index 91827bd5d6..3eba695af8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -868,11 +868,6 @@ resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.27.8.tgz#6667fac16c436b5434a387a34dedb013198f6e6e" integrity sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA== -"@tootallnate/once@2": - version "2.0.0" - resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-2.0.0.tgz#f544a148d3ab35801c1f633a7441fd87c2e484bf" - integrity sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A== - "@tsconfig/node10@^1.0.7": version "1.0.9" resolved "https://registry.yarnpkg.com/@tsconfig/node10/-/node10-1.0.9.tgz#df4907fc07a886922637b15e02d4cebc4c0021b2" @@ -1240,11 +1235,6 @@ resolved "https://registry.yarnpkg.com/@vladfrangu/async_event_emitter/-/async_event_emitter-2.2.2.tgz#84c5a3f8d648842cec5cc649b88df599af32ed88" integrity sha512-HIzRG7sy88UZjBJamssEczH5q7t5+axva19UbZLO6u0ySbYPrwzWiXBcC0WuHyhKKoeCyneH+FvYzKQq/zTtkQ== -abab@^2.0.6: - 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" resolved "https://registry.yarnpkg.com/abort-controller/-/abort-controller-3.0.0.tgz#eaf54d53b62bae4138e809ca225c8439a6efb392" @@ -1257,25 +1247,17 @@ abstract-logging@^2.0.1: resolved "https://registry.yarnpkg.com/abstract-logging/-/abstract-logging-2.0.1.tgz#6b0c371df212db7129b57d2e7fcf282b8bf1c839" integrity sha512-2BjRTZxTPvheOvGbBslFSYOUkr+SjPtOnrLP33f+VIWLzezQpZcqVg7ja3L4dBXmzzgwT+a029jRx5PCi3JuiA== -acorn-globals@^7.0.0: - version "7.0.1" - resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-7.0.1.tgz#0dbf05c44fa7c94332914c02066d5beff62c40c3" - integrity sha512-umOSDSDrfHbTNPuNpC2NSnnA3LUrqpevPb4T9jRx4MagXNS0rs+gwiTcAvqCRmsD6utzsrzNt+ebm00SNWiC3Q== - dependencies: - acorn "^8.1.0" - acorn-walk "^8.0.2" - acorn-jsx@^5.3.2: version "5.3.2" resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ== -acorn-walk@^8.0.2, acorn-walk@^8.1.1, acorn-walk@^8.2.0: +acorn-walk@^8.1.1, acorn-walk@^8.2.0: version "8.2.0" resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.2.0.tgz#741210f2e2426454508853a2f44d0ab83b7f69c1" integrity sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA== -acorn@^8.1.0, acorn@^8.4.1, acorn@^8.8.0, acorn@^8.8.2: +acorn@^8.4.1, acorn@^8.8.0, acorn@^8.8.2: version "8.8.2" resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.8.2.tgz#1b2f25db02af965399b9776b0c2c391276d37c4a" integrity sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw== @@ -1823,22 +1805,6 @@ cross-spawn@^7.0.0, cross-spawn@^7.0.2, cross-spawn@^7.0.3: shebang-command "^2.0.0" which "^2.0.1" -cssstyle@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/cssstyle/-/cssstyle-3.0.0.tgz#17ca9c87d26eac764bb8cfd00583cff21ce0277a" - integrity sha512-N4u2ABATi3Qplzf0hWbVCdjenim8F3ojEXpBDF5hBpjzW182MjNGLqfmQ0SkSPeQ+V86ZXgeH8aXj6kayd4jgg== - dependencies: - rrweb-cssom "^0.6.0" - -data-urls@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/data-urls/-/data-urls-4.0.0.tgz#333a454eca6f9a5b7b0f1013ff89074c3f522dd4" - integrity sha512-/mMTei/JXPqvFqQtfyTowxmJVwr2PVAeCcDxyFf6LhoOu/09TX2OX3kb2wzi4DMXcfj4OItwDOnhl5oziPnT6g== - dependencies: - abab "^2.0.6" - whatwg-mimetype "^3.0.0" - whatwg-url "^12.0.0" - date-fns@^2.29.1: version "2.29.3" resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.29.3.tgz#27402d2fc67eb442b511b70bbdf98e6411cd68a8" @@ -1865,11 +1831,6 @@ debug@^3.2.7: dependencies: ms "^2.1.1" -decimal.js@^10.4.3: - version "10.4.3" - resolved "https://registry.yarnpkg.com/decimal.js/-/decimal.js-10.4.3.tgz#1044092884d245d1b7f65725fa4ad4c6f781cc23" - integrity sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA== - deep-eql@^4.1.2: version "4.1.3" resolved "https://registry.yarnpkg.com/deep-eql/-/deep-eql-4.1.3.tgz#7c7775513092f7df98d8df9996dd085eb668cc6d" @@ -1911,7 +1872,7 @@ deep-is@^0.1.3, deep-is@~0.1.3: resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" integrity sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ= -deepmerge@^4.2.2, deepmerge@^4.3.1: +deepmerge@^4.3.1: version "4.3.1" resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.3.1.tgz#44b5f2147cd3b00d4b56137685966f26fd25dd4a" integrity sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A== @@ -2176,13 +2137,6 @@ doctrine@^3.0.0: dependencies: esutils "^2.0.2" -domexception@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/domexception/-/domexception-4.0.0.tgz#4ad1be56ccadc86fc76d033353999a8037d03673" - integrity sha512-A2is4PLG+eeSfoTMA95/s4pvAoSo2mKtiM5jlHkAVewmiO8ISFTFKZjH7UAM1Atli/OT/7JHOrJRJiMKUZKYBw== - dependencies: - webidl-conversions "^7.0.0" - dotenv-cli@^7.1.0: version "7.1.0" resolved "https://registry.yarnpkg.com/dotenv-cli/-/dotenv-cli-7.1.0.tgz#9ff360f7d1de72389027d4d9e9deccb0ef151c5e" @@ -2231,11 +2185,6 @@ enhanced-resolve@^5.8.3: graceful-fs "^4.2.4" tapable "^2.2.0" -entities@^4.4.0: - version "4.4.0" - resolved "https://registry.yarnpkg.com/entities/-/entities-4.4.0.tgz#97bdaba170339446495e653cfd2db78962900174" - integrity sha512-oYp7156SP8LkeGD0GF85ad1X9Ai79WtRsZ2gxJqtBuzH+98YUV6jkHEKlZkMbcrjJjIVJNIDP/3WL9wQkoPbWA== - error-ex@^1.3.1: version "1.3.2" resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf" @@ -2911,15 +2860,6 @@ form-data@^3.0.0: combined-stream "^1.0.8" mime-types "^2.1.12" -form-data@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.0.tgz#93919daeaf361ee529584b9b31664dc12c9fa452" - integrity sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww== - dependencies: - asynckit "^0.4.0" - combined-stream "^1.0.8" - mime-types "^2.1.12" - forwarded@0.2.0, forwarded@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.2.0.tgz#2269936428aad4c15c7ebe9779a84bf0b2a81811" @@ -3189,13 +3129,6 @@ hosted-git-info@^2.1.4: resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.9.tgz#dffc0bf9a21c02209090f2aa69429e1414daf3f9" integrity sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw== -html-encoding-sniffer@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/html-encoding-sniffer/-/html-encoding-sniffer-3.0.0.tgz#2cb1a8cf0db52414776e5b2a7a04d5dd98158de9" - integrity sha512-oWv4T4yJ52iKrufjnyZPkrN0CH3QnrUqdB6In1g5Fe1mia8GmF36gnfNySxoZtxD5+NmYw1EElVXiBk93UeskA== - dependencies: - whatwg-encoding "^2.0.0" - html-escaper@^2.0.0: version "2.0.2" resolved "https://registry.yarnpkg.com/html-escaper/-/html-escaper-2.0.2.tgz#dfd60027da36a36dfcbe236262c00a5822681453" @@ -3212,16 +3145,7 @@ http-errors@2.0.0, http-errors@^2.0.0: statuses "2.0.1" toidentifier "1.0.1" -http-proxy-agent@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz#5129800203520d434f142bc78ff3c170800f2b43" - integrity sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w== - dependencies: - "@tootallnate/once" "2" - agent-base "6" - debug "4" - -https-proxy-agent@^5.0.0, https-proxy-agent@^5.0.1: +https-proxy-agent@^5.0.0: version "5.0.1" resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz#c59ef224a04fe8b754f3db0063a25ea30d0005d6" integrity sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA== @@ -3236,13 +3160,6 @@ iconv-lite@0.4.24: dependencies: safer-buffer ">= 2.1.2 < 3" -iconv-lite@0.6.3: - version "0.6.3" - resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.6.3.tgz#a52f80bf38da1952eb5c681790719871a1a72501" - integrity sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw== - dependencies: - safer-buffer ">= 2.1.2 < 3.0.0" - ieee754@^1.1.13, ieee754@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" @@ -3446,11 +3363,6 @@ is-plain-object@^5.0.0: resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-5.0.0.tgz#4427f50ab3429e9025ea7d52e9043a9ef4159344" integrity sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q== -is-potential-custom-element-name@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz#171ed6f19e3ac554394edf78caa05784a45bebb5" - integrity sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ== - is-regex@^1.1.4: version "1.1.4" resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.1.4.tgz#eef5663cd59fa4c0ae339505323df6854bb15958" @@ -3661,38 +3573,6 @@ js-yaml@^4.1.0: dependencies: argparse "^2.0.1" -jsdom@^21.1.1: - version "21.1.1" - resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-21.1.1.tgz#ab796361e3f6c01bcfaeda1fea3c06197ac9d8ae" - integrity sha512-Jjgdmw48RKcdAIQyUD1UdBh2ecH7VqwaXPN3ehoZN6MqgVbMn+lRm1aAT1AsdJRAJpwfa4IpwgzySn61h2qu3w== - dependencies: - abab "^2.0.6" - acorn "^8.8.2" - acorn-globals "^7.0.0" - cssstyle "^3.0.0" - data-urls "^4.0.0" - decimal.js "^10.4.3" - domexception "^4.0.0" - escodegen "^2.0.0" - form-data "^4.0.0" - html-encoding-sniffer "^3.0.0" - http-proxy-agent "^5.0.0" - https-proxy-agent "^5.0.1" - is-potential-custom-element-name "^1.0.1" - nwsapi "^2.2.2" - parse5 "^7.1.2" - rrweb-cssom "^0.6.0" - saxes "^6.0.0" - symbol-tree "^3.2.4" - tough-cookie "^4.1.2" - w3c-xmlserializer "^4.0.0" - webidl-conversions "^7.0.0" - whatwg-encoding "^2.0.0" - whatwg-mimetype "^3.0.0" - whatwg-url "^12.0.1" - ws "^8.13.0" - xml-name-validator "^4.0.0" - json-parse-even-better-errors@^2.3.0: version "2.3.1" resolved "https://registry.yarnpkg.com/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz#7c47805a94319928e05777405dc12e1f7a4ee02d" @@ -4105,11 +3985,6 @@ normalize-path@^3.0.0, normalize-path@~3.0.0: resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== -nwsapi@^2.2.2: - version "2.2.2" - resolved "https://registry.yarnpkg.com/nwsapi/-/nwsapi-2.2.2.tgz#e5418863e7905df67d51ec95938d67bf801f0bb0" - integrity sha512-90yv+6538zuvUMnN+zCr8LuV6bPFdq50304114vJYJ8RDyK8D5O9Phpbd6SZWgI7PwzmmfN1upeOJlvybDSgCw== - object-inspect@^1.12.2, object-inspect@^1.9.0: version "1.12.3" resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.12.3.tgz#ba62dffd67ee256c8c086dfae69e016cd1f198b9" @@ -4152,14 +4027,13 @@ obliterator@^2.0.1: resolved "https://registry.yarnpkg.com/obliterator/-/obliterator-2.0.4.tgz#fa650e019b2d075d745e44f1effeb13a2adbe816" integrity sha512-lgHwxlxV1qIg1Eap7LgIeoBWIMFibOjbrYPIPJZcI1mmGAI2m3lNYpK12Y+GBdPQ0U1hRwSord7GIaawz962qQ== -oldschooljs@^2.3.8: - version "2.3.8" - resolved "https://registry.yarnpkg.com/oldschooljs/-/oldschooljs-2.3.8.tgz#56b788d083b68bebe01c1f7de2c9d3d258304293" - integrity sha512-e0N3ovIXdTY3yiGOLFydpQT+H0KEh9uBkGgvYg2fAGnx/lx1CObjCFg3vK3AiwWjXd85wuAVJ4lmQyehcqZSTA== +oldschooljs@^2.4.0: + version "2.4.0" + resolved "https://registry.yarnpkg.com/oldschooljs/-/oldschooljs-2.4.0.tgz#e81d2f2603e1219f8251e4ee7af54171aa1e7acd" + integrity sha512-42QHKl0Xpd2dce/jrXhzVkIg0CRWA58iX309rJknHnrETO7m+zOpwV+9JRyjczCA31b798vTK1gMwwNraOAWaw== dependencies: - deepmerge "^4.2.2" + deepmerge "^4.3.1" e "^0.2.32" - jsdom "^21.1.1" node-fetch "^2.6.7" on-exit-leak-free@^2.1.0: @@ -4307,13 +4181,6 @@ parse-ms@^2.1.0: resolved "https://registry.yarnpkg.com/parse-ms/-/parse-ms-2.1.0.tgz#348565a753d4391fa524029956b172cb7753097d" integrity sha512-kHt7kzLoS9VBZfUsiKjv43mr91ea+U05EyKkEtqp7vNbHxmaVuEqN7XxeEVnGrMtYOAxGrDElSi96K7EgO1zCA== -parse5@^7.1.2: - version "7.1.2" - resolved "https://registry.yarnpkg.com/parse5/-/parse5-7.1.2.tgz#0736bebbfd77793823240a23b7fc5e010b7f8e32" - integrity sha512-Czj1WaSVpaoj0wbhMzLmWD69anp2WH7FXMB9n1Sy8/ZFF9jolSQVMu1Ij5WIyGmcBmhk7EOndpO4mIpihVqAXw== - dependencies: - entities "^4.4.0" - path-exists@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" @@ -4575,21 +4442,11 @@ proxy-addr@^2.0.7: forwarded "0.2.0" ipaddr.js "1.9.1" -psl@^1.1.33: - version "1.8.0" - resolved "https://registry.yarnpkg.com/psl/-/psl-1.8.0.tgz#9326f8bcfb013adcc005fdff056acce020e51c24" - integrity sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ== - -punycode@^2.1.0, punycode@^2.1.1, punycode@^2.3.0: +punycode@^2.1.0: version "2.3.0" resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.0.tgz#f67fa67c94da8f4d0cfff981aee4118064199b8f" integrity sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA== -querystringify@^2.1.1: - version "2.2.0" - resolved "https://registry.yarnpkg.com/querystringify/-/querystringify-2.2.0.tgz#3345941b4153cb9d082d8eee4cda2016a9aef7f6" - integrity sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ== - queue-microtask@^1.2.2: version "1.2.3" resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243" @@ -4741,11 +4598,6 @@ requirejs@^2.3.5: resolved "https://registry.yarnpkg.com/requirejs/-/requirejs-2.3.6.tgz#e5093d9601c2829251258c0b9445d4d19fa9e7c9" integrity sha512-ipEzlWQe6RK3jkzikgCupiTbTvm4S0/CAU5GlgptkN5SO6F3u0UD0K18wy6ErDqiCyP4J4YYe1HuAShvsxePLg== -requires-port@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff" - integrity sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ== - resolve-dependency-path@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/resolve-dependency-path/-/resolve-dependency-path-2.0.0.tgz#11700e340717b865d216c66cabeb4a2a3c696736" @@ -4816,11 +4668,6 @@ rollup@^3.27.1: optionalDependencies: fsevents "~2.3.2" -rrweb-cssom@^0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/rrweb-cssom/-/rrweb-cssom-0.6.0.tgz#ed298055b97cbddcdeb278f904857629dec5e0e1" - integrity sha512-APM0Gt1KoXBz0iIkkdB/kfvGOwC4UuJFeG/c+yV7wSc7q96cG/kJ0HiYCnzivD9SB53cLV1MlHFNfOuPaadYSw== - run-parallel@^1.1.9: version "1.2.0" resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.2.0.tgz#66d1368da7bdf921eb9d95bd1a9229e7f21a43ee" @@ -4868,7 +4715,7 @@ safe-stable-stringify@^2.3.1: resolved "https://registry.yarnpkg.com/safe-stable-stringify/-/safe-stable-stringify-2.4.1.tgz#34694bd8a30575b7f94792aa51527551bd733d61" integrity sha512-dVHE6bMtS/bnL2mwualjc6IxEv1F+OCUpA46pKUj6F8uDbUM0jCCulPqRNPSnWwGNKx5etqMjZYdXtrm5KJZGA== -"safer-buffer@>= 2.1.2 < 3", "safer-buffer@>= 2.1.2 < 3.0.0": +"safer-buffer@>= 2.1.2 < 3": version "2.1.2" resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== @@ -4880,13 +4727,6 @@ sass-lookup@^3.0.0: dependencies: commander "^2.16.0" -saxes@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/saxes/-/saxes-6.0.0.tgz#fe5b4a4768df4f14a201b1ba6a65c1f3d9988cc5" - integrity sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA== - dependencies: - xmlchars "^2.2.0" - secure-json-parse@^2.4.0, secure-json-parse@^2.5.0: version "2.7.0" resolved "https://registry.yarnpkg.com/secure-json-parse/-/secure-json-parse-2.7.0.tgz#5a5f9cd6ae47df23dba3151edd06855d47e09862" @@ -5210,11 +5050,6 @@ supports-preserve-symlinks-flag@^1.0.0: resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== -symbol-tree@^3.2.4: - version "3.2.4" - resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2" - integrity sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw== - table@*, table@^6.8.0: version "6.8.1" resolved "https://registry.yarnpkg.com/table/-/table-6.8.1.tgz#ea2b71359fe03b017a5fbc296204471158080bdf" @@ -5289,23 +5124,6 @@ toidentifier@1.0.1: resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.1.tgz#3be34321a88a820ed1bd80dfaa33e479fbb8dd35" integrity sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA== -tough-cookie@^4.1.2: - version "4.1.3" - resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-4.1.3.tgz#97b9adb0728b42280aa3d814b6b999b2ff0318bf" - integrity sha512-aX/y5pVRkfRnfmuX+OdbSdXvPe6ieKX/G2s7e98f4poJHnqH3281gDPm/metm6E/WRamfx7WC4HUqkWHfQHprw== - dependencies: - psl "^1.1.33" - punycode "^2.1.1" - universalify "^0.2.0" - url-parse "^1.5.3" - -tr46@^4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/tr46/-/tr46-4.1.1.tgz#281a758dcc82aeb4fe38c7dfe4d11a395aac8469" - integrity sha512-2lv/66T7e5yNyhAAC4NaKe5nVavzuGJQVVtRYLyQ2OI8tsJ61PMLlelehb0wi2Hx6+hT/OJUWZcw8MjlSRnxvw== - dependencies: - punycode "^2.3.0" - tr46@~0.0.3: version "0.0.3" resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" @@ -5475,11 +5293,6 @@ universal-user-agent@^6.0.0: resolved "https://registry.yarnpkg.com/universal-user-agent/-/universal-user-agent-6.0.0.tgz#3381f8503b251c0d9cd21bc1de939ec9df5480ee" integrity sha512-isyNax3wXoKaulPDZWHQqbmIx1k2tb9fb3GGDBRxCscfYV2Ch7WxPArBsFEG8s/safwXTT7H4QGhaIkTp9447w== -universalify@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.2.0.tgz#6451760566fa857534745ab1dde952d1b1761be0" - integrity sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg== - unpipe@1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec" @@ -5492,14 +5305,6 @@ uri-js@^4.2.2: dependencies: punycode "^2.1.0" -url-parse@^1.5.3: - version "1.5.10" - resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.5.10.tgz#9d3c2f736c1d75dd3bd2be507dcc111f1e2ea9c1" - integrity sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ== - dependencies: - querystringify "^2.1.1" - requires-port "^1.0.0" - util-deprecate@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" @@ -5591,13 +5396,6 @@ vitest@^0.31.0: vite-node "0.31.0" why-is-node-running "^2.2.2" -w3c-xmlserializer@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/w3c-xmlserializer/-/w3c-xmlserializer-4.0.0.tgz#aebdc84920d806222936e3cdce408e32488a3073" - integrity sha512-d+BFHzbiCx6zGfz0HyQ6Rg69w9k19nviJspaj4yNscGjrHu94sVP+aRm75yEbCh+r2/yR+7q6hux9LVtbuTGBw== - dependencies: - xml-name-validator "^4.0.0" - walkdir@^0.4.1: version "0.4.1" resolved "https://registry.yarnpkg.com/walkdir/-/walkdir-0.4.1.tgz#dc119f83f4421df52e3061e514228a2db20afa39" @@ -5615,36 +5413,11 @@ webidl-conversions@^3.0.0: resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" integrity sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE= -webidl-conversions@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-7.0.0.tgz#256b4e1882be7debbf01d05f0aa2039778ea080a" - integrity sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g== - well-known-symbols@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/well-known-symbols/-/well-known-symbols-2.0.0.tgz#e9c7c07dbd132b7b84212c8174391ec1f9871ba5" integrity sha512-ZMjC3ho+KXo0BfJb7JgtQ5IBuvnShdlACNkKkdsqBmYw3bPAaJfPeYUo6tLUaT5tG/Gkh7xkpBhKRQ9e7pyg9Q== -whatwg-encoding@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/whatwg-encoding/-/whatwg-encoding-2.0.0.tgz#e7635f597fd87020858626805a2729fa7698ac53" - integrity sha512-p41ogyeMUrw3jWclHWTQg1k05DSVXPLcVxRTYsXUk+ZooOCZLcoYgPZ/HL/D/N+uQPOtcp1me1WhBEaX02mhWg== - dependencies: - iconv-lite "0.6.3" - -whatwg-mimetype@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/whatwg-mimetype/-/whatwg-mimetype-3.0.0.tgz#5fa1a7623867ff1af6ca3dc72ad6b8a4208beba7" - integrity sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q== - -whatwg-url@^12.0.0, whatwg-url@^12.0.1: - version "12.0.1" - resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-12.0.1.tgz#fd7bcc71192e7c3a2a97b9a8d6b094853ed8773c" - integrity sha512-Ed/LrqB8EPlGxjS+TrsXcpUond1mhccS3pchLhzSgPCnTimUCKj3IZE75pAs5m6heB2U2TMerKFUXheyHY+VDQ== - dependencies: - tr46 "^4.1.1" - webidl-conversions "^7.0.0" - whatwg-url@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d" @@ -5725,16 +5498,6 @@ ws@^8.13.0: resolved "https://registry.yarnpkg.com/ws/-/ws-8.13.0.tgz#9a9fb92f93cf41512a0735c8f4dd09b8a1211cd0" integrity sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA== -xml-name-validator@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/xml-name-validator/-/xml-name-validator-4.0.0.tgz#79a006e2e63149a8600f15430f0a4725d1524835" - integrity sha512-ICP2e+jsHvAj2E2lIHxa5tjXRlKDJo4IdvPvCXbXQGdzSfmSpNVyIKMvoZHjDY9DP0zV17iI85o90vRFXNccRw== - -xmlchars@^2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/xmlchars/-/xmlchars-2.2.0.tgz#060fe1bcb7f9c76fe2a17db86a9bc3ab894210cb" - integrity sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw== - y18n@^5.0.5: version "5.0.8" resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55" From 559e04787ea33832b79d01b8e7b90bf14eb383c5 Mon Sep 17 00:00:00 2001 From: nwjgit Date: Wed, 21 Feb 2024 15:32:28 -0600 Subject: [PATCH 03/15] Update prices & tests --- src/lib/data/buyables/buyables.ts | 10 +- tests/integration/commands/sacrifice.test.ts | 12 +- .../unit/snapshots/banksnapshots.test.ts.snap | 108 +++++++++--------- tests/unit/snapshots/clsnapshots.test.ts.snap | 5 +- tests/unit/util.test.ts | 4 +- 5 files changed, 70 insertions(+), 69 deletions(-) diff --git a/src/lib/data/buyables/buyables.ts b/src/lib/data/buyables/buyables.ts index eff647fe62..47d6ff5652 100644 --- a/src/lib/data/buyables/buyables.ts +++ b/src/lib/data/buyables/buyables.ts @@ -593,7 +593,7 @@ const questBuyables: Buyable[] = [ name: 'Berserker helm', gpCost: 780_000, qpRequired: 60, - ironmanPrice: 78_000 + ironmanPrice: 98_000 }, { name: 'Archer helm', @@ -795,7 +795,7 @@ const Buyables: Buyable[] = [ { name: 'Bucket', gpCost: 30, - ironmanPrice: 5 + ironmanPrice: 10 }, { name: 'Cup of hot water', @@ -891,7 +891,7 @@ const Buyables: Buyable[] = [ { name: 'Steel pickaxe', gpCost: 2000, - ironmanPrice: 500 + ironmanPrice: 600 }, { name: 'Mithril pickaxe', @@ -961,7 +961,7 @@ const Buyables: Buyable[] = [ { name: 'Adamant halberd', gpCost: 100_000, - ironmanPrice: 9600, + ironmanPrice: 50_000, qpRequired: 150, skillsNeeded: soteSkillRequirements }, @@ -1116,7 +1116,7 @@ for (const cape of allTeamCapes) { Buyables.push({ name: cape.name, outputItems: new Bank().add(cape.id), - gpCost: 5000 + gpCost: 15_000 }); } diff --git a/tests/integration/commands/sacrifice.test.ts b/tests/integration/commands/sacrifice.test.ts index e31b93c1b4..8d722b100b 100644 --- a/tests/integration/commands/sacrifice.test.ts +++ b/tests/integration/commands/sacrifice.test.ts @@ -18,28 +18,28 @@ describe('Sacrifice Command', async () => { expect(result).toEqual( `${Emoji.Incinerator} **Your Sacrifice Stats** ${Emoji.Incinerator}\n\n` + `**Current Minion Icon:** ${Emoji.Minion}\n` + - '**Sacrificed Value:** 1,635 GP\n' + + '**Sacrificed Value:** 1,922 GP\n' + '**Unique Items Sacrificed:** 2 items' ); }); test('No items provided', async () => { const result = await user.runCommand(sacrificeCommand, { items: 'aaaa' }); - expect(result).toEqual('No items were provided.\nYour current sacrificed value is: 1,635 (1.64k)'); + expect(result).toEqual('No items were provided.\nYour current sacrificed value is: 1,922 (1.92k)'); }); test('Successful', async () => { await user.addItemsToBank({ items: new Bank().add('Trout').add('Coal', 10) }); const result = await user.runCommand(sacrificeCommand, { items: '1 trout, 10 coal' }); expect(result).toEqual( - 'You sacrificed 10x Coal, 1x Trout, with a value of 1,635gp (1.64k). Your total amount sacrificed is now: 3,270. ' + 'You sacrificed 10x Coal, 1x Trout, with a value of 1,922gp (1.92k). Your total amount sacrificed is now: 3,844. ' ); const stats = await user.fetchStats({ sacrificed_bank: true }); expect(user.bank.equals(new Bank())).toBe(true); expect(new Bank(stats.sacrificed_bank as ItemBank).equals(new Bank().add('Coal', 20).add('Trout', 2))).toBe( true ); - expect(user.user.sacrificedValue).toEqual(BigInt(3270)); + expect(user.user.sacrificedValue).toEqual(BigInt(3844)); const clientSettings = await mahojiClientSettingsFetch({ economyStats_sacrificedBank: true }); expect( new Bank(clientSettings.economyStats_sacrificedBank as ItemBank).equals( @@ -49,7 +49,7 @@ describe('Sacrifice Command', async () => { await user.addItemsToBank({ items: new Bank().add('Trout').add('Cake') }); const res = await user.runCommand(sacrificeCommand, { items: '1 trout, 1 cake' }); expect(res).toEqual( - 'You sacrificed 1x Trout, 1x Cake, with a value of 206gp (206). Your total amount sacrificed is now: 3,476. ' + 'You sacrificed 1x Trout, 1x Cake, with a value of 169gp (169). Your total amount sacrificed is now: 4,013. ' ); await user.sync(); expect(user.bank.equals(new Bank())).toBe(true); @@ -57,7 +57,7 @@ describe('Sacrifice Command', async () => { expect( new Bank(stats2.sacrificed_bank as ItemBank).equals(new Bank().add('Coal', 20).add('Trout', 3).add('Cake')) ).toBe(true); - expect(user.user.sacrificedValue).toEqual(BigInt(3476)); + expect(user.user.sacrificedValue).toEqual(BigInt(4013)); const clientSettings2 = await mahojiClientSettingsFetch({ economyStats_sacrificedBank: true }); expect( diff --git a/tests/unit/snapshots/banksnapshots.test.ts.snap b/tests/unit/snapshots/banksnapshots.test.ts.snap index 4452333099..78042c047f 100644 --- a/tests/unit/snapshots/banksnapshots.test.ts.snap +++ b/tests/unit/snapshots/banksnapshots.test.ts.snap @@ -123,7 +123,7 @@ exports[`OSB Buyables 1`] = ` }, { "gpCost": 30, - "ironmanPrice": 5, + "ironmanPrice": 10, "itemCost": Bank { "bank": {}, "frozen": false, @@ -323,7 +323,7 @@ exports[`OSB Buyables 1`] = ` }, { "gpCost": 2000, - "ironmanPrice": 500, + "ironmanPrice": 600, "itemCost": Bank { "bank": {}, "frozen": false, @@ -563,7 +563,7 @@ exports[`OSB Buyables 1`] = ` }, { "gpCost": 100000, - "ironmanPrice": 9600, + "ironmanPrice": 50000, "itemCost": Bank { "bank": {}, "frozen": false, @@ -1707,7 +1707,7 @@ exports[`OSB Buyables 1`] = ` }, { "gpCost": 780000, - "ironmanPrice": 78000, + "ironmanPrice": 98000, "itemCost": Bank { "bank": {}, "frozen": false, @@ -6275,7 +6275,7 @@ exports[`OSB Buyables 1`] = ` }, }, { - "gpCost": 5000, + "gpCost": 15000, "itemCost": Bank { "bank": {}, "frozen": false, @@ -6289,7 +6289,7 @@ exports[`OSB Buyables 1`] = ` }, }, { - "gpCost": 5000, + "gpCost": 15000, "itemCost": Bank { "bank": {}, "frozen": false, @@ -6303,7 +6303,7 @@ exports[`OSB Buyables 1`] = ` }, }, { - "gpCost": 5000, + "gpCost": 15000, "itemCost": Bank { "bank": {}, "frozen": false, @@ -6317,7 +6317,7 @@ exports[`OSB Buyables 1`] = ` }, }, { - "gpCost": 5000, + "gpCost": 15000, "itemCost": Bank { "bank": {}, "frozen": false, @@ -6331,7 +6331,7 @@ exports[`OSB Buyables 1`] = ` }, }, { - "gpCost": 5000, + "gpCost": 15000, "itemCost": Bank { "bank": {}, "frozen": false, @@ -6345,7 +6345,7 @@ exports[`OSB Buyables 1`] = ` }, }, { - "gpCost": 5000, + "gpCost": 15000, "itemCost": Bank { "bank": {}, "frozen": false, @@ -6359,7 +6359,7 @@ exports[`OSB Buyables 1`] = ` }, }, { - "gpCost": 5000, + "gpCost": 15000, "itemCost": Bank { "bank": {}, "frozen": false, @@ -6373,7 +6373,7 @@ exports[`OSB Buyables 1`] = ` }, }, { - "gpCost": 5000, + "gpCost": 15000, "itemCost": Bank { "bank": {}, "frozen": false, @@ -6387,7 +6387,7 @@ exports[`OSB Buyables 1`] = ` }, }, { - "gpCost": 5000, + "gpCost": 15000, "itemCost": Bank { "bank": {}, "frozen": false, @@ -6401,7 +6401,7 @@ exports[`OSB Buyables 1`] = ` }, }, { - "gpCost": 5000, + "gpCost": 15000, "itemCost": Bank { "bank": {}, "frozen": false, @@ -6415,7 +6415,7 @@ exports[`OSB Buyables 1`] = ` }, }, { - "gpCost": 5000, + "gpCost": 15000, "itemCost": Bank { "bank": {}, "frozen": false, @@ -6429,7 +6429,7 @@ exports[`OSB Buyables 1`] = ` }, }, { - "gpCost": 5000, + "gpCost": 15000, "itemCost": Bank { "bank": {}, "frozen": false, @@ -6443,7 +6443,7 @@ exports[`OSB Buyables 1`] = ` }, }, { - "gpCost": 5000, + "gpCost": 15000, "itemCost": Bank { "bank": {}, "frozen": false, @@ -6457,7 +6457,7 @@ exports[`OSB Buyables 1`] = ` }, }, { - "gpCost": 5000, + "gpCost": 15000, "itemCost": Bank { "bank": {}, "frozen": false, @@ -6471,7 +6471,7 @@ exports[`OSB Buyables 1`] = ` }, }, { - "gpCost": 5000, + "gpCost": 15000, "itemCost": Bank { "bank": {}, "frozen": false, @@ -6485,7 +6485,7 @@ exports[`OSB Buyables 1`] = ` }, }, { - "gpCost": 5000, + "gpCost": 15000, "itemCost": Bank { "bank": {}, "frozen": false, @@ -6499,7 +6499,7 @@ exports[`OSB Buyables 1`] = ` }, }, { - "gpCost": 5000, + "gpCost": 15000, "itemCost": Bank { "bank": {}, "frozen": false, @@ -6513,7 +6513,7 @@ exports[`OSB Buyables 1`] = ` }, }, { - "gpCost": 5000, + "gpCost": 15000, "itemCost": Bank { "bank": {}, "frozen": false, @@ -6527,7 +6527,7 @@ exports[`OSB Buyables 1`] = ` }, }, { - "gpCost": 5000, + "gpCost": 15000, "itemCost": Bank { "bank": {}, "frozen": false, @@ -6541,7 +6541,7 @@ exports[`OSB Buyables 1`] = ` }, }, { - "gpCost": 5000, + "gpCost": 15000, "itemCost": Bank { "bank": {}, "frozen": false, @@ -6555,7 +6555,7 @@ exports[`OSB Buyables 1`] = ` }, }, { - "gpCost": 5000, + "gpCost": 15000, "itemCost": Bank { "bank": {}, "frozen": false, @@ -6569,7 +6569,7 @@ exports[`OSB Buyables 1`] = ` }, }, { - "gpCost": 5000, + "gpCost": 15000, "itemCost": Bank { "bank": {}, "frozen": false, @@ -6583,7 +6583,7 @@ exports[`OSB Buyables 1`] = ` }, }, { - "gpCost": 5000, + "gpCost": 15000, "itemCost": Bank { "bank": {}, "frozen": false, @@ -6597,7 +6597,7 @@ exports[`OSB Buyables 1`] = ` }, }, { - "gpCost": 5000, + "gpCost": 15000, "itemCost": Bank { "bank": {}, "frozen": false, @@ -6611,7 +6611,7 @@ exports[`OSB Buyables 1`] = ` }, }, { - "gpCost": 5000, + "gpCost": 15000, "itemCost": Bank { "bank": {}, "frozen": false, @@ -6625,7 +6625,7 @@ exports[`OSB Buyables 1`] = ` }, }, { - "gpCost": 5000, + "gpCost": 15000, "itemCost": Bank { "bank": {}, "frozen": false, @@ -6639,7 +6639,7 @@ exports[`OSB Buyables 1`] = ` }, }, { - "gpCost": 5000, + "gpCost": 15000, "itemCost": Bank { "bank": {}, "frozen": false, @@ -6653,7 +6653,7 @@ exports[`OSB Buyables 1`] = ` }, }, { - "gpCost": 5000, + "gpCost": 15000, "itemCost": Bank { "bank": {}, "frozen": false, @@ -6667,7 +6667,7 @@ exports[`OSB Buyables 1`] = ` }, }, { - "gpCost": 5000, + "gpCost": 15000, "itemCost": Bank { "bank": {}, "frozen": false, @@ -6681,7 +6681,7 @@ exports[`OSB Buyables 1`] = ` }, }, { - "gpCost": 5000, + "gpCost": 15000, "itemCost": Bank { "bank": {}, "frozen": false, @@ -6695,7 +6695,7 @@ exports[`OSB Buyables 1`] = ` }, }, { - "gpCost": 5000, + "gpCost": 15000, "itemCost": Bank { "bank": {}, "frozen": false, @@ -6709,7 +6709,7 @@ exports[`OSB Buyables 1`] = ` }, }, { - "gpCost": 5000, + "gpCost": 15000, "itemCost": Bank { "bank": {}, "frozen": false, @@ -6723,7 +6723,7 @@ exports[`OSB Buyables 1`] = ` }, }, { - "gpCost": 5000, + "gpCost": 15000, "itemCost": Bank { "bank": {}, "frozen": false, @@ -6737,7 +6737,7 @@ exports[`OSB Buyables 1`] = ` }, }, { - "gpCost": 5000, + "gpCost": 15000, "itemCost": Bank { "bank": {}, "frozen": false, @@ -6751,7 +6751,7 @@ exports[`OSB Buyables 1`] = ` }, }, { - "gpCost": 5000, + "gpCost": 15000, "itemCost": Bank { "bank": {}, "frozen": false, @@ -6765,7 +6765,7 @@ exports[`OSB Buyables 1`] = ` }, }, { - "gpCost": 5000, + "gpCost": 15000, "itemCost": Bank { "bank": {}, "frozen": false, @@ -6779,7 +6779,7 @@ exports[`OSB Buyables 1`] = ` }, }, { - "gpCost": 5000, + "gpCost": 15000, "itemCost": Bank { "bank": {}, "frozen": false, @@ -6793,7 +6793,7 @@ exports[`OSB Buyables 1`] = ` }, }, { - "gpCost": 5000, + "gpCost": 15000, "itemCost": Bank { "bank": {}, "frozen": false, @@ -6807,7 +6807,7 @@ exports[`OSB Buyables 1`] = ` }, }, { - "gpCost": 5000, + "gpCost": 15000, "itemCost": Bank { "bank": {}, "frozen": false, @@ -6821,7 +6821,7 @@ exports[`OSB Buyables 1`] = ` }, }, { - "gpCost": 5000, + "gpCost": 15000, "itemCost": Bank { "bank": {}, "frozen": false, @@ -6835,7 +6835,7 @@ exports[`OSB Buyables 1`] = ` }, }, { - "gpCost": 5000, + "gpCost": 15000, "itemCost": Bank { "bank": {}, "frozen": false, @@ -6849,7 +6849,7 @@ exports[`OSB Buyables 1`] = ` }, }, { - "gpCost": 5000, + "gpCost": 15000, "itemCost": Bank { "bank": {}, "frozen": false, @@ -6863,7 +6863,7 @@ exports[`OSB Buyables 1`] = ` }, }, { - "gpCost": 5000, + "gpCost": 15000, "itemCost": Bank { "bank": {}, "frozen": false, @@ -6877,7 +6877,7 @@ exports[`OSB Buyables 1`] = ` }, }, { - "gpCost": 5000, + "gpCost": 15000, "itemCost": Bank { "bank": {}, "frozen": false, @@ -6891,7 +6891,7 @@ exports[`OSB Buyables 1`] = ` }, }, { - "gpCost": 5000, + "gpCost": 15000, "itemCost": Bank { "bank": {}, "frozen": false, @@ -6905,7 +6905,7 @@ exports[`OSB Buyables 1`] = ` }, }, { - "gpCost": 5000, + "gpCost": 15000, "itemCost": Bank { "bank": {}, "frozen": false, @@ -6919,7 +6919,7 @@ exports[`OSB Buyables 1`] = ` }, }, { - "gpCost": 5000, + "gpCost": 15000, "itemCost": Bank { "bank": {}, "frozen": false, @@ -6933,7 +6933,7 @@ exports[`OSB Buyables 1`] = ` }, }, { - "gpCost": 5000, + "gpCost": 15000, "itemCost": Bank { "bank": {}, "frozen": false, @@ -6947,7 +6947,7 @@ exports[`OSB Buyables 1`] = ` }, }, { - "gpCost": 5000, + "gpCost": 15000, "itemCost": Bank { "bank": {}, "frozen": false, @@ -6961,7 +6961,7 @@ exports[`OSB Buyables 1`] = ` }, }, { - "gpCost": 5000, + "gpCost": 15000, "itemCost": Bank { "bank": {}, "frozen": false, diff --git a/tests/unit/snapshots/clsnapshots.test.ts.snap b/tests/unit/snapshots/clsnapshots.test.ts.snap index 9da493f6c6..b14c1690eb 100644 --- a/tests/unit/snapshots/clsnapshots.test.ts.snap +++ b/tests/unit/snapshots/clsnapshots.test.ts.snap @@ -106,7 +106,7 @@ TzHaar (10) Vardorvis (10) Venenatis and Spindel (6) Vet'ion and Calvar'ion (6) -Volcanic Mine (3) +Volcanic Mine (4) Vorkath (6) Wintertodt (10) Zalcano (4) @@ -595,6 +595,7 @@ Dragon limbs Dragon metal lump Dragon metal slice Dragon pickaxe +Dragon pickaxe (broken) Dragon pickaxe upgrade kit Dragon platebody ornament kit Dragon scimitar ornament kit @@ -1065,7 +1066,7 @@ Olmlet Onyx Orange boater Orange egg sac -Ore pack +Ore pack (Giant's Foundry) Ornate maul handle Osmumten's fang Pantaloons diff --git a/tests/unit/util.test.ts b/tests/unit/util.test.ts index 3ff7e45b4a..84faaba350 100644 --- a/tests/unit/util.test.ts +++ b/tests/unit/util.test.ts @@ -84,7 +84,7 @@ describe('util', () => { const { price } = item; let expected = reduceNumByPercent(price, 20); expect(sellPriceOfItem(item)).toEqual({ price: expected, basePrice: price }); - expect(sellPriceOfItem(getOSItem('A yellow square'))).toEqual({ price: 0, basePrice: 0 }); + expect(sellPriceOfItem(getOSItem('Yellow square'))).toEqual({ price: 0, basePrice: 0 }); }); test('sellStorePriceOfItem', () => { @@ -97,7 +97,7 @@ describe('util', () => { (((0.4 - 0.015 * Math.min(22 - 1, 10)) * Math.min(22, 11) + Math.max(22 - 11, 0) * 0.1) * cost) / 22; expect(sellStorePriceOfItem(item, 1)).toEqual({ price: expectedOneQty, basePrice: cost }); expect(sellStorePriceOfItem(item, 22)).toEqual({ price: expectedTwentytwoQty, basePrice: cost }); - expect(sellStorePriceOfItem(getOSItem('A yellow square'), 1)).toEqual({ price: 0, basePrice: 0 }); + expect(sellStorePriceOfItem(getOSItem('Yellow square'), 1)).toEqual({ price: 0, basePrice: 0 }); }); test('skillingPetRateFunction', () => { From ca15dbed1e4b39c31c2b733315dd518438e1b0cc Mon Sep 17 00:00:00 2001 From: nwjgit Date: Wed, 21 Feb 2024 16:12:38 -0600 Subject: [PATCH 04/15] Minor fix for ore pack names --- src/mahoji/lib/abstracted_commands/giantsFoundryCommand.ts | 4 ++-- src/mahoji/lib/abstracted_commands/volcanicMineCommand.ts | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/mahoji/lib/abstracted_commands/giantsFoundryCommand.ts b/src/mahoji/lib/abstracted_commands/giantsFoundryCommand.ts index f8861c7036..ff446c1877 100644 --- a/src/mahoji/lib/abstracted_commands/giantsFoundryCommand.ts +++ b/src/mahoji/lib/abstracted_commands/giantsFoundryCommand.ts @@ -103,10 +103,10 @@ export const giantsFoundryBuyables: { name: string; output: Bank; cost: number; aliases: [] }, { - name: 'Ore pack', + name: "Ore pack (Giant's Foundry)", output: new Bank().add("Ore pack (Giant's Foundry)", 1), cost: 200, - aliases: ["Ore pack (Giant's Foundry)"] + aliases: [] }, { name: 'Smiths tunic', diff --git a/src/mahoji/lib/abstracted_commands/volcanicMineCommand.ts b/src/mahoji/lib/abstracted_commands/volcanicMineCommand.ts index 931afa11c2..7176aba741 100644 --- a/src/mahoji/lib/abstracted_commands/volcanicMineCommand.ts +++ b/src/mahoji/lib/abstracted_commands/volcanicMineCommand.ts @@ -70,9 +70,10 @@ export const VolcanicMineShop: { name: string; output: Bank; cost: number; clOnl cost: 70 }, { - name: 'Ore pack', + name: 'Ore pack (Volcanic Mine)', output: new Bank({ 'Ore pack (Volcanic Mine)': 1 }), - cost: 4000 + cost: 4000, + addToCl: true }, { name: 'Volcanic mine teleport', From 100983a1c15cd8aa365d6e6acdae68a28b5ad7a3 Mon Sep 17 00:00:00 2001 From: Jonesy <69014816+nwjgit@users.noreply.github.com> Date: Thu, 22 Feb 2024 09:27:39 -0600 Subject: [PATCH 05/15] Update Larren's & Brimstone openable (#5691) --- src/lib/openables.ts | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/src/lib/openables.ts b/src/lib/openables.ts index 4794ba333f..27be09fd39 100644 --- a/src/lib/openables.ts +++ b/src/lib/openables.ts @@ -1,9 +1,12 @@ import { formatOrdinal } from '@oldschoolgg/toolkit'; import { Bank, LootTable, Openables } from 'oldschooljs'; -import { Item } from 'oldschooljs/dist/meta/types'; +import { SkillsEnum } from 'oldschooljs/dist/constants'; +import { Item, OpenableOpenOptions } from 'oldschooljs/dist/meta/types'; import { Mimic } from 'oldschooljs/dist/simulation/misc'; +import BrimstoneChest, { BrimstoneChestOpenable } from 'oldschooljs/dist/simulation/openables/BrimstoneChest'; import { HallowedSackTable } from 'oldschooljs/dist/simulation/openables/HallowedSack'; import { Implings } from 'oldschooljs/dist/simulation/openables/Implings'; +import LarransChest, { LarransChestOpenable } from 'oldschooljs/dist/simulation/openables/LarransChest'; import { ClueTiers } from './clues/clueTiers'; import { Emoji, Events, MIMIC_MONSTER_ID } from './constants'; @@ -162,7 +165,20 @@ const osjsOpenables: UnifiedOpenable[] = [ id: 23_083, openedItem: getOSItem(23_083), aliases: ['brimstone chest', 'brimstone'], - output: Openables.BrimstoneChest.table, + output: async ( + args: OpenArgs + ): Promise<{ + bank: Bank; + }> => { + const chest = new BrimstoneChestOpenable(BrimstoneChest); + const fishLvl = args.user.skillLevel(SkillsEnum.Fishing); + const brimstoneOptions: OpenableOpenOptions = { + fishLvl + }; + const openLoot: Bank = chest.open(args.quantity, brimstoneOptions); + + return { bank: openLoot }; + }, allItems: Openables.BrimstoneChest.table.allItems }, { @@ -234,7 +250,21 @@ const osjsOpenables: UnifiedOpenable[] = [ 'larrans small chest', "larran's small chest" ], - output: Openables.LarransChest.table, + output: async ( + args: OpenArgs + ): Promise<{ + bank: Bank; + }> => { + const chest = new LarransChestOpenable(LarransChest); + const fishLvl = args.user.skillLevel(SkillsEnum.Fishing); + const larransOptions: OpenableOpenOptions = { + fishLvl, + chestSize: 'big' + }; + const openLoot: Bank = chest.open(args.quantity, larransOptions); + + return { bank: openLoot }; + }, allItems: Openables.LarransChest.table.allItems }, { From 780053f5618df1eaf1312b1a8b7db19816b5fd84 Mon Sep 17 00:00:00 2001 From: themrrobert <10122432+themrrobert@users.noreply.github.com> Date: Sat, 24 Feb 2024 22:58:18 -0800 Subject: [PATCH 06/15] Fix emojis in pinned trips / gearpresets. (#5719) --- src/mahoji/commands/config.ts | 9 +++++---- src/mahoji/commands/gearpresets.ts | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/mahoji/commands/config.ts b/src/mahoji/commands/config.ts index 6c22feff83..c30216dd6e 100644 --- a/src/mahoji/commands/config.ts +++ b/src/mahoji/commands/config.ts @@ -666,14 +666,15 @@ export async function pinTripCommand( if (!trip) return 'Invalid trip.'; if (emoji) { - const cachedEmoji = globalClient.emojis.cache.get(emoji); - if ((!cachedEmoji || !emojiServers.has(cachedEmoji.guild.id)) && production) { - return "Sorry, that emoji can't be used. Only emojis in the main support server, or our emoji servers can be used."; - } const res = ParsedCustomEmojiWithGroups.exec(emoji); if (!res || !res[3]) return "That's not a valid emoji."; // eslint-disable-next-line prefer-destructuring emoji = res[3]; + + const cachedEmoji = globalClient.emojis.cache.get(emoji); + if ((!cachedEmoji || !emojiServers.has(cachedEmoji.guild.id)) && production) { + return "Sorry, that emoji can't be used. Only emojis in the main support server, or our emoji servers can be used."; + } } if (customName) { diff --git a/src/mahoji/commands/gearpresets.ts b/src/mahoji/commands/gearpresets.ts index c61a394153..7e41274156 100644 --- a/src/mahoji/commands/gearpresets.ts +++ b/src/mahoji/commands/gearpresets.ts @@ -107,14 +107,15 @@ export async function createOrEditGearSetup( } if (emoji) { - const cachedEmoji = globalClient.emojis.cache.get(emoji); - if ((!cachedEmoji || !emojiServers.has(cachedEmoji.guild.id)) && production) { - return "Sorry, that emoji can't be used. Only emojis in the main support server, or our emoji servers can be used."; - } const res = ParsedCustomEmojiWithGroups.exec(emoji); if (!res || !res[3]) return "That's not a valid emoji."; // eslint-disable-next-line prefer-destructuring emoji = res[3]; + + const cachedEmoji = globalClient.emojis.cache.get(emoji); + if ((!cachedEmoji || !emojiServers.has(cachedEmoji.guild.id)) && production) { + return "Sorry, that emoji can't be used. Only emojis in the main support server, or our emoji servers can be used."; + } } const gearData = { From a4f52519eab0193347722c2bb856b95fb40d92e5 Mon Sep 17 00:00:00 2001 From: GC <30398469+gc@users.noreply.github.com> Date: Sun, 25 Feb 2024 18:43:20 +1100 Subject: [PATCH 07/15] Fix tests (#5715) --- .env.test | 9 ++ .github/workflows/integration_tests.yml | 5 +- .github/workflows/unit_tests.yml | 2 +- docker-compose.yml | 4 +- src/lib/constants.ts | 2 +- src/lib/grandExchange.ts | 28 ++-- src/mahoji/commands/trade.ts | 4 +- src/scripts/integration-tests.ts | 22 +++- src/tasks/minions/monsterActivity.ts | 2 +- tests/integration/MUser.test.ts | 8 +- .../integration/commands/gearPresets.test.ts | 9 +- tests/integration/commands/ironman.test.ts | 56 ++++---- tests/integration/grandExchange.test.ts | 56 +++++--- tests/integration/migrateUser.test.ts | 124 ++++++++++-------- tests/integration/misc.test.ts | 3 +- tests/integration/monsterKilling.test.ts | 3 +- tests/integration/paymentConflict.test.ts | 11 +- tests/integration/rolesTask.test.ts | 14 +- tests/integration/setup.ts | 13 +- tests/integration/stats.test.ts | 3 +- tests/integration/tradeTransaction.test.ts | 7 +- tests/integration/trading.test.ts | 5 +- tests/integration/userStats.test.ts | 7 +- tests/integration/util.ts | 50 +++---- vitest.integration.config.ts | 6 +- 25 files changed, 254 insertions(+), 199 deletions(-) create mode 100644 .env.test diff --git a/.env.test b/.env.test new file mode 100644 index 0000000000..bca1e62bd3 --- /dev/null +++ b/.env.test @@ -0,0 +1,9 @@ +TZ="UTC" +ROBOCHIMP_DATABASE_URL=postgresql://postgres:postgres@localhost:5436/robochimp_integration_test?connection_limit=1000 +DATABASE_URL=postgresql://postgres:postgres@localhost:5435/osb_integration_test?pool_timeout=120&connection_limit=1000 +PATREON_CAMPAIGN_ID=1234 +PATREON_TOKEN=asdfasdfasdf +PATREON_WEBHOOK_SECRET=asdfasdfasdf +HTTP_PORT=7373 +CLIENT_ID=111398433321891634 +PRISMA_CLIENT_ENGINE_TYPE=binary \ No newline at end of file diff --git a/.github/workflows/integration_tests.yml b/.github/workflows/integration_tests.yml index 88bfb70b9f..117c536840 100644 --- a/.github/workflows/integration_tests.yml +++ b/.github/workflows/integration_tests.yml @@ -17,6 +17,9 @@ jobs: os: [ubuntu-latest] steps: + - name: Install System Packages + run: sudo apt-get install -y build-essential libpq-dev + - name: Checkout Project uses: actions/checkout@v3 - name: Use Node.js ${{ matrix.node_version }} @@ -37,6 +40,6 @@ jobs: cp config.example.ts config.ts && popd - name: Copy env - run: cp .env.example .env + run: cp .env.test .env - name: Test run: yarn test:integration diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index bdfa62cdbc..9bb15e4a59 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -37,7 +37,7 @@ jobs: cp config.example.ts config.ts && popd - name: Copy env - run: cp .env.example .env + run: cp .env.test .env - name: Generate Prisma Client run: yarn gen - name: Run ESLint on changed files diff --git a/docker-compose.yml b/docker-compose.yml index eceff3a3a8..925d2b42db 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,7 +5,7 @@ version: "3.9" services: osb: image: postgres:13-alpine - command: -c 'max_connections=100' + command: -c 'max_connections=1000' restart: always container_name: osb_database ports: @@ -18,7 +18,7 @@ services: robochimp: image: postgres:13-alpine - command: -c 'max_connections=100' + command: -c 'max_connections=1000' restart: always container_name: robochimp_database ports: diff --git a/src/lib/constants.ts b/src/lib/constants.ts index 50b28b0fac..f8ed32230d 100644 --- a/src/lib/constants.ts +++ b/src/lib/constants.ts @@ -568,7 +568,7 @@ const globalConfigSchema = z.object({ clientID: z.string().min(15).max(25), geAdminChannelID: z.string().default('') }); -dotenv.config({ path: path.resolve(process.cwd(), process.env.TEST ? '.env.example' : '.env') }); +dotenv.config({ path: path.resolve(process.cwd(), process.env.TEST ? '.env.test' : '.env') }); export const globalConfig = globalConfigSchema.parse({ patreonToken: process.env.PATREON_TOKEN, diff --git a/src/lib/grandExchange.ts b/src/lib/grandExchange.ts index 3b4789fadc..418df03f1e 100644 --- a/src/lib/grandExchange.ts +++ b/src/lib/grandExchange.ts @@ -27,7 +27,7 @@ interface CreateListingArgs { } function validateNumber(num: number) { - if (num < 0 || isNaN(num) || !Number.isInteger(num) || num > Number.MAX_SAFE_INTEGER) { + if (num < 0 || isNaN(num) || !Number.isInteger(num) || num >= Number.MAX_SAFE_INTEGER) { throw new Error(`Invalid number: ${num}.`); } } @@ -780,17 +780,21 @@ ${type} ${toKMB(quantity)} ${item.name} for ${toKMB(price)} each, for a total of } async tick() { - await this.queue.add(async () => { - if (this.isTicking) throw new Error('Already ticking.'); - try { - await this._tick(); - } catch (err: any) { - logError(err.message); - debugLog(err.message); - throw err; - } finally { - this.isTicking = false; - } + return new Promise((resolve, reject) => { + this.queue.add(async () => { + if (this.isTicking) return reject(new Error('Already ticking.')); + this.isTicking = true; + try { + await this._tick(); + } catch (err: any) { + logError(err.message); + debugLog(err.message); + return reject(err); + } finally { + this.isTicking = false; + resolve(); + } + }); }); } diff --git a/src/mahoji/commands/trade.ts b/src/mahoji/commands/trade.ts index caf5d2c3a8..ff2f531991 100644 --- a/src/mahoji/commands/trade.ts +++ b/src/mahoji/commands/trade.ts @@ -148,10 +148,10 @@ Both parties must click confirm to make the trade.`, `${senderUser.mention} sold ${itemsSent} to ${recipientUser.mention} for ${itemsReceived}.` ); if (itemsReceived.has('Coins')) { - addToGPTaxBalance(recipientUser.id, itemsReceived.amount('Coins')); + await addToGPTaxBalance(recipientUser.id, itemsReceived.amount('Coins')); } if (itemsSent.has('Coins')) { - addToGPTaxBalance(senderUser.id, itemsSent.amount('Coins')); + await addToGPTaxBalance(senderUser.id, itemsSent.amount('Coins')); } return `${discrimName(senderAPIUser)} sold ${itemsSent} to ${discrimName( diff --git a/src/scripts/integration-tests.ts b/src/scripts/integration-tests.ts index d1f0202476..6a114b8ef7 100644 --- a/src/scripts/integration-tests.ts +++ b/src/scripts/integration-tests.ts @@ -4,19 +4,29 @@ import { sleep } from 'e'; async function main() { try { execSync('docker compose up -d --wait', { stdio: 'inherit' }); + + console.log('Waiting...'); await sleep(2000); - execSync('dotenv -e .env.example -- prisma db push --schema="./prisma/schema.prisma"', { stdio: 'inherit' }); - execSync('dotenv -e .env.example -- prisma db push --schema="./prisma/robochimp.prisma"', { stdio: 'inherit' }); + console.log('Starting...'); + execSync('dotenv -e .env.test -- prisma db push --schema="./prisma/schema.prisma"', { stdio: 'inherit' }); + execSync('dotenv -e .env.test -- prisma db push --schema="./prisma/robochimp.prisma"', { stdio: 'inherit' }); execSync('yarn prebuild:scripts', { stdio: 'inherit' }); execSync('yarn build:esbuild', { stdio: 'inherit' }); - execSync('vitest run --coverage --config vitest.integration.config.ts', { - stdio: 'inherit' - }); + let runs = 1; + for (let i = 0; i < runs; i++) { + execSync('vitest run --config vitest.integration.config.ts', { + stdio: 'inherit', + encoding: 'utf-8' + }); + console.log(`Finished run ${i + 1}/${runs}`); + } } catch (err) { - throw new Error(`Failed to run integration tests: ${err}`); + throw new Error(err as any); } finally { + await sleep(5000); + console.log('Shutting down containers...'); execSync('docker-compose down', { stdio: 'inherit' }); } } diff --git a/src/tasks/minions/monsterActivity.ts b/src/tasks/minions/monsterActivity.ts index 3906a9ead5..3537fc66d9 100644 --- a/src/tasks/minions/monsterActivity.ts +++ b/src/tasks/minions/monsterActivity.ts @@ -387,6 +387,6 @@ export const monsterTask: MinionTask = { previousCL }); - handleTripFinish(user, channelID, str, image?.file.attachment, data, itemsAdded, messages); + return handleTripFinish(user, channelID, str, image?.file.attachment, data, itemsAdded, messages); } }; diff --git a/tests/integration/MUser.test.ts b/tests/integration/MUser.test.ts index f310434226..c5cf9afc1c 100644 --- a/tests/integration/MUser.test.ts +++ b/tests/integration/MUser.test.ts @@ -4,7 +4,6 @@ import { ItemBank } from 'oldschooljs/dist/meta/types'; import { convertLVLtoXP } from 'oldschooljs/dist/util'; import { describe, expect, test } from 'vitest'; -import { prisma } from '../../src/lib/settings/prisma'; import { SkillsEnum } from '../../src/lib/skilling/types'; import { assert } from '../../src/lib/util/logError'; import { mahojiUsersSettingsFetch } from '../../src/mahoji/mahojiSettings'; @@ -88,16 +87,15 @@ describe('MUser', () => { }); test('Should add XP', async () => { - const userId = '123456789'; - const user = await mUserFetch(userId); + const user = await createTestUser(); expect(user.skillsAsLevels.agility).toEqual(1); const result = await user.addXP({ skillName: SkillsEnum.Agility, amount: 1000 }); expect(user.skillsAsLevels.agility).toEqual(9); expect(result).toEqual(`You received 1,000 <:agility:630911040355565568> XP **Congratulations! Your Agility level is now 9** 🎉`); - const xpAdded = await prisma.xPGain.findMany({ + const xpAdded = await global.prisma!.xPGain.findMany({ where: { - user_id: BigInt(userId), + user_id: BigInt(user.id), skill: 'agility', xp: 1000 } diff --git a/tests/integration/commands/gearPresets.test.ts b/tests/integration/commands/gearPresets.test.ts index 4d514ae44e..a7cb6fd33e 100644 --- a/tests/integration/commands/gearPresets.test.ts +++ b/tests/integration/commands/gearPresets.test.ts @@ -1,7 +1,6 @@ import { randInt } from 'e'; import { describe, expect, test, vi } from 'vitest'; -import { prisma } from '../../../src/lib/settings/prisma'; import itemID from '../../../src/lib/util/itemID'; import { gearPresetsCommand } from '../../../src/mahoji/commands/gearpresets'; import { createTestUser } from '../util'; @@ -29,7 +28,7 @@ describe('Gear Presets Command', async () => { } }); - const gpResult = await prisma.gearPreset.findFirst({ where: { user_id: user.id, name: 'test2h' } }); + const gpResult = await global.prisma!.gearPreset.findFirst({ where: { user_id: user.id, name: 'test2h' } }); // Verify row exists: expect(gpResult).toBeTruthy(); if (!gpResult) return false; @@ -54,7 +53,7 @@ describe('Gear Presets Command', async () => { } }); - const gpResult = await prisma.gearPreset.findFirst({ where: { user_id: user.id, name: 'testedit' } }); + const gpResult = await global.prisma!.gearPreset.findFirst({ where: { user_id: user.id, name: 'testedit' } }); // Verify row exists: expect(gpResult).toBeTruthy(); if (!gpResult) return false; @@ -63,7 +62,9 @@ describe('Gear Presets Command', async () => { edit: { gear_preset: 'TestEdit', weapon: 'Ghrazi rapier', feet: 'None' } }); - const gpEditResult = await prisma.gearPreset.findFirst({ where: { user_id: user.id, name: 'testedit' } }); + const gpEditResult = await global.prisma!.gearPreset.findFirst({ + where: { user_id: user.id, name: 'testedit' } + }); // Verify row found: expect(gpEditResult).toBeTruthy(); diff --git a/tests/integration/commands/ironman.test.ts b/tests/integration/commands/ironman.test.ts index 2fc71241f1..4ebac861fa 100644 --- a/tests/integration/commands/ironman.test.ts +++ b/tests/integration/commands/ironman.test.ts @@ -1,19 +1,19 @@ -import { miniID, randomSnowflake } from '@oldschoolgg/toolkit'; +import { miniID } from '@oldschoolgg/toolkit'; import { Prisma } from '@prisma/client'; import { Time } from 'e'; import { Bank } from 'oldschooljs'; import { describe, expect, test } from 'vitest'; -import { prisma } from '../../../src/lib/settings/prisma'; import { ironmanCommand } from '../../../src/mahoji/lib/abstracted_commands/ironmanCommand'; +import { mockedId } from '../util'; describe('Ironman Command', () => { async function createUserWithEverything(userId: string, userData: Partial = {}) { - await prisma.user.create({ + await global.prisma!.user.create({ data: { id: userId, skills_agility: 100_000_000, skills_attack: 100_000_000, ...userData } }); - await prisma.newUser.create({ data: { id: userId } }); - const activity = await prisma.activity.create({ + await global.prisma!.newUser.create({ data: { id: userId } }); + const activity = await global.prisma!.activity.create({ data: { user_id: BigInt(userId), start_date: new Date(), @@ -27,11 +27,11 @@ describe('Ironman Command', () => { } }); await Promise.all([ - prisma.botItemSell.create({ data: { user_id: userId, item_id: 1, quantity: 1, gp_received: 1 } }), - prisma.pinnedTrip.create({ + global.prisma!.botItemSell.create({ data: { user_id: userId, item_id: 1, quantity: 1, gp_received: 1 } }), + global.prisma!.pinnedTrip.create({ data: { user_id: userId, id: miniID(10), activity_id: activity.id, activity_type: 'Mining' } }), - prisma.farmedCrop.create({ + global.prisma!.farmedCrop.create({ data: { user_id: userId, date_planted: new Date(), @@ -41,7 +41,7 @@ describe('Ironman Command', () => { paid_for_protection: false } }), - prisma.slayerTask.create({ + global.prisma!.slayerTask.create({ data: { user_id: userId, monster_id: 1, @@ -51,12 +51,12 @@ describe('Ironman Command', () => { skipped: false } }), - prisma.playerOwnedHouse.create({ data: { user_id: userId } }), - prisma.minigame.create({ data: { user_id: userId } }), - prisma.xPGain.create({ data: { user_id: BigInt(userId), skill: 'agility', xp: 1 } }), - prisma.stashUnit.create({ data: { user_id: BigInt(userId), stash_id: 1, has_built: false } }), - prisma.userStats.create({ data: { user_id: BigInt(userId) } }), - prisma.historicalData.create({ + global.prisma!.playerOwnedHouse.create({ data: { user_id: userId } }), + global.prisma!.minigame.create({ data: { user_id: userId } }), + global.prisma!.xPGain.create({ data: { user_id: BigInt(userId), skill: 'agility', xp: 1 } }), + global.prisma!.stashUnit.create({ data: { user_id: BigInt(userId), stash_id: 1, has_built: false } }), + global.prisma!.userStats.create({ data: { user_id: BigInt(userId) } }), + global.prisma!.historicalData.create({ data: { user_id: userId, GP: 100_000, @@ -70,7 +70,7 @@ describe('Ironman Command', () => { } test('Should reset everything', async () => { - const userId = randomSnowflake(); + const userId = mockedId(); await createUserWithEverything(userId); const result = await ironmanCommand(await mUserFetch(userId), null, false); @@ -83,23 +83,23 @@ describe('Ironman Command', () => { expect(user.bank.equals(new Bank())).toEqual(true); expect(user.cl.equals(new Bank())).toEqual(true); - expect(await prisma.activity.count({ where: { user_id: BigInt(userId) } })).toEqual(0); - expect(await prisma.botItemSell.count({ where: { user_id: userId } })).toEqual(0); - expect(await prisma.pinnedTrip.count({ where: { user_id: userId } })).toEqual(0); - expect(await prisma.farmedCrop.count({ where: { user_id: userId } })).toEqual(0); - expect(await prisma.slayerTask.count({ where: { user_id: userId } })).toEqual(0); - expect(await prisma.playerOwnedHouse.count({ where: { user_id: userId } })).toEqual(0); - expect(await prisma.minigame.count({ where: { user_id: userId } })).toEqual(0); - expect(await prisma.xPGain.count({ where: { user_id: BigInt(userId) } })).toEqual(0); - expect(await prisma.stashUnit.count({ where: { user_id: BigInt(userId) } })).toEqual(0); - expect(await prisma.historicalData.count({ where: { user_id: userId } })).toEqual(0); - const userStats = await prisma.userStats.findFirst({ where: { user_id: BigInt(userId) } }); + expect(await global.prisma!.activity.count({ where: { user_id: BigInt(userId) } })).toEqual(0); + expect(await global.prisma!.botItemSell.count({ where: { user_id: userId } })).toEqual(0); + expect(await global.prisma!.pinnedTrip.count({ where: { user_id: userId } })).toEqual(0); + expect(await global.prisma!.farmedCrop.count({ where: { user_id: userId } })).toEqual(0); + expect(await global.prisma!.slayerTask.count({ where: { user_id: userId } })).toEqual(0); + expect(await global.prisma!.playerOwnedHouse.count({ where: { user_id: userId } })).toEqual(0); + expect(await global.prisma!.minigame.count({ where: { user_id: userId } })).toEqual(0); + expect(await global.prisma!.xPGain.count({ where: { user_id: BigInt(userId) } })).toEqual(0); + expect(await global.prisma!.stashUnit.count({ where: { user_id: BigInt(userId) } })).toEqual(0); + expect(await global.prisma!.historicalData.count({ where: { user_id: userId } })).toEqual(0); + const userStats = await global.prisma!.userStats.findFirst({ where: { user_id: BigInt(userId) } }); expect(userStats?.cl_array).toEqual(undefined); expect(userStats?.cl_array_length).toEqual(undefined); }); test('Should de-iron', async () => { - const userId = randomSnowflake(); + const userId = mockedId(); await createUserWithEverything(userId, { minion_ironman: true }); const initialUser = await mUserFetch(userId); expect(initialUser.isIronman).toEqual(true); diff --git a/tests/integration/grandExchange.test.ts b/tests/integration/grandExchange.test.ts index 4ce4b3f56d..3a64a6d6ea 100644 --- a/tests/integration/grandExchange.test.ts +++ b/tests/integration/grandExchange.test.ts @@ -1,10 +1,12 @@ -import { calcPercentOfNum, randArrItem, randInt, Time } from 'e'; +import 'source-map-support/register'; + +import { calcPercentOfNum, randArrItem, randInt, shuffleArr, Time } from 'e'; import { Bank } from 'oldschooljs'; +import PQueue from 'p-queue'; import { describe, expect, test } from 'vitest'; import { usernameCache } from '../../src/lib/constants'; import { GrandExchange } from '../../src/lib/grandExchange'; -import { prisma } from '../../src/lib/settings/prisma'; import { assert } from '../../src/lib/util'; import resolveItems from '../../src/lib/util/resolveItems'; import { geCommand } from '../../src/mahoji/commands/ge'; @@ -37,7 +39,7 @@ const sampleBank = new Bank() async function cancelAllListings(user: TestUser) { const results: string[] = []; - const activeListings = await prisma.gEListing.findMany({ + const activeListings = await global.prisma!.gEListing.findMany({ where: { user_id: user.id } @@ -58,19 +60,19 @@ async function cancelAllListings(user: TestUser) { describe('Grand Exchange', async () => { const itemPool = resolveItems(['Egg', 'Trout', 'Coal']); GrandExchange.calculateSlotsOfUser = async () => ({ slots: 500 } as any); + await mockClient(); test( 'Fuzz', async () => { assert(randInt(1, 100_000) !== randInt(1, 100_000)); - await mockClient(); await GrandExchange.totalReset(); await GrandExchange.init(); const currentOwnedBank = await GrandExchange.fetchOwnedBank(); expect(currentOwnedBank.toString()).toEqual(new Bank().toString()); - let amountOfUsers = randInt(300, 400); + let amountOfUsers = randInt(433, 533); const totalExpectedBank = sampleBank.clone().multiply(amountOfUsers); let users: TestUser[] = []; @@ -80,22 +82,31 @@ describe('Grand Exchange', async () => { await user.addItemsToBank({ items: sampleBank }); users.push(user); } - - for (let i = 0; i < users.length; i++) { - for (const item of itemPool) { - const method = randArrItem(['buy', 'sell']); - let quantity = randArrItem(quantities); - let price = randArrItem(prices); - users[i].runCommand(geCommand, { - [method]: { - item, - quantity, - price - } - }); - } + console.log(`Finished initializing ${amountOfUsers} users`); + + const commandPromises = new PQueue({ concurrency: 10 }); + for (const user of shuffleArr(users)) { + const method = randArrItem(['buy', 'sell']); + let quantity = randArrItem(quantities); + let price = randArrItem(prices); + commandPromises.add(async () => { + for (const item of itemPool) { + await user.runCommand(geCommand, { + [method]: { + item, + quantity, + price + } + }); + } + }); } + await commandPromises.onEmpty(); + await GrandExchange.queue.onEmpty(); + + console.log('Finished running all commands'); + for (let i = 0; i < 100; i++) { await GrandExchange.tick(); await Promise.all([ @@ -103,6 +114,7 @@ describe('Grand Exchange', async () => { GrandExchange.extensiveVerification() ]); } + console.log('Finished ticking 100 times'); const testBank = new Bank(); const cancelPromises = []; @@ -111,6 +123,8 @@ describe('Grand Exchange', async () => { } await Promise.all(cancelPromises); + console.log('Finished cancelling'); + await Promise.all(users.map(u => u.sync())); for (const user of users) { @@ -125,7 +139,7 @@ describe('Grand Exchange', async () => { expect(data.taxBank).toBeGreaterThan(0); expect(data.totalTax).toBeGreaterThan(0); - const totalTaxed = await prisma.gETransaction.aggregate({ + const totalTaxed = await global.prisma!.gETransaction.aggregate({ _sum: { total_tax_paid: true } @@ -141,7 +155,7 @@ describe('Grand Exchange', async () => { assert(GrandExchange.queue.size === 0, 'Queue should be empty'); }, { - repeats: 2, + repeats: 1, timeout: Time.Minute * 5 } ); diff --git a/tests/integration/migrateUser.test.ts b/tests/integration/migrateUser.test.ts index bc4395a53d..0cb2754def 100644 --- a/tests/integration/migrateUser.test.ts +++ b/tests/integration/migrateUser.test.ts @@ -1,4 +1,3 @@ -import { randomSnowflake } from '@oldschoolgg/toolkit'; import { Activity, activity_type_enum, @@ -32,7 +31,6 @@ import { GearSetupType, UserFullGearSetup } from '../../src/lib/gear/types'; import { GrandExchange } from '../../src/lib/grandExchange'; import { trackLoot } from '../../src/lib/lootTrack'; import { incrementMinigameScore, MinigameName } from '../../src/lib/settings/minigames'; -import { prisma } from '../../src/lib/settings/prisma'; import { SkillsEnum } from '../../src/lib/skilling/types'; import { slayerMasters } from '../../src/lib/slayer/slayerMasters'; import { assignNewSlayerTask } from '../../src/lib/slayer/slayerUtil'; @@ -59,7 +57,7 @@ import { syncNewUserUsername } from '../../src/mahoji/lib/preCommand'; import { OSBMahojiCommand } from '../../src/mahoji/lib/util'; import { updateClientGPTrackSetting, userStatsUpdate } from '../../src/mahoji/mahojiSettings'; import { calculateResultOfLMSGames, getUsersLMSStats } from '../../src/tasks/minions/minigames/lmsActivity'; -import { createTestUser, mockClient, TestUser } from './util'; +import { createTestUser, mockClient, mockedId, TestUser } from './util'; import { BotItemSell, GEListing, StashUnit } from '.prisma/client'; interface TestCommand { @@ -119,7 +117,7 @@ class UserData { } else { await this.mUser.sync(); } - const newUser = await prisma.newUser.findFirst({ where: { id: this.id }, select: { username: true } }); + const newUser = await global.prisma!.newUser.findFirst({ where: { id: this.id }, select: { username: true } }); if (newUser) this.username = newUser.username; this.bank = new Bank(this.mUser.bank); @@ -133,113 +131,122 @@ class UserData { }); if (robochimpUser) this.githubId = robochimpUser.github_id; - const stashUnits = await prisma.stashUnit.findMany({ + const stashUnits = await global.prisma!.stashUnit.findMany({ where: { user_id: BigInt(this.id) }, orderBy: { stash_id: 'asc' } }); if (stashUnits.length > 0) this.stashUnits = stashUnits; - const gearPresets = await prisma.gearPreset.findMany({ + const gearPresets = await global.prisma!.gearPreset.findMany({ where: { user_id: this.id }, orderBy: { name: 'asc' } }); if (gearPresets.length > 0) this.gearPresets = gearPresets; - const activities = await prisma.activity.findMany({ + const activities = await global.prisma!.activity.findMany({ where: { user_id: BigInt(this.id) }, orderBy: { start_date: 'asc' } }); if (activities.length > 0) this.activities = activities; - const slayerTasks = await prisma.slayerTask.findMany({ where: { user_id: this.id }, orderBy: { id: 'asc' } }); + const slayerTasks = await global.prisma!.slayerTask.findMany({ + where: { user_id: this.id }, + orderBy: { id: 'asc' } + }); if (slayerTasks.length > 0) this.slayerTasks = slayerTasks; - const poh = await prisma.playerOwnedHouse.findFirst({ where: { user_id: this.id } }); + const poh = await global.prisma!.playerOwnedHouse.findFirst({ where: { user_id: this.id } }); if (poh) this.poh = poh; - const giveaways = await prisma.giveaway.findMany({ where: { user_id: this.id }, orderBy: { id: 'asc' } }); + const giveaways = await global.prisma!.giveaway.findMany({ + where: { user_id: this.id }, + orderBy: { id: 'asc' } + }); if (giveaways.length > 0) this.giveaways = giveaways; - const farmedCrops = await prisma.farmedCrop.findMany({ where: { user_id: this.id }, orderBy: { id: 'asc' } }); + const farmedCrops = await global.prisma!.farmedCrop.findMany({ + where: { user_id: this.id }, + orderBy: { id: 'asc' } + }); if (farmedCrops.length > 0) this.farmedCrops = farmedCrops; - const minigames = await prisma.minigame.findFirst({ where: { user_id: this.id } }); + const minigames = await global.prisma!.minigame.findFirst({ where: { user_id: this.id } }); if (minigames) this.minigames = minigames; - const pinnedTrips = await prisma.pinnedTrip.findMany({ + const pinnedTrips = await global.prisma!.pinnedTrip.findMany({ where: { user_id: this.id }, orderBy: { activity_id: 'asc' } }); if (pinnedTrips.length > 0) this.pinnedTrips = pinnedTrips; - const lms = await prisma.lastManStandingGame.findMany({ + const lms = await global.prisma!.lastManStandingGame.findMany({ where: { user_id: BigInt(this.id) }, orderBy: { id: 'asc' } }); if (lms.length > 0) this.lms = lms; - const lootTrack = await prisma.lootTrack.findMany({ + const lootTrack = await global.prisma!.lootTrack.findMany({ where: { user_id: BigInt(this.id) }, orderBy: { id: 'asc' } }); if (lootTrack.length > 0) this.lootTrack = lootTrack; - const botItemSell = await prisma.botItemSell.findMany({ + const botItemSell = await global.prisma!.botItemSell.findMany({ where: { user_id: this.id }, orderBy: { item_id: 'asc' } }); if (botItemSell.length > 0) this.botItemSell = botItemSell; - const buyCommandTx = await prisma.buyCommandTransaction.findMany({ + const buyCommandTx = await global.prisma!.buyCommandTransaction.findMany({ where: { user_id: BigInt(this.id) }, orderBy: { id: 'asc' } }); if (buyCommandTx.length > 0) this.buyCommandTx = buyCommandTx; - const reclaimableItems = await prisma.reclaimableItem.findMany({ + const reclaimableItems = await global.prisma!.reclaimableItem.findMany({ where: { user_id: this.id }, orderBy: { key: 'asc' } }); if (reclaimableItems.length > 0) this.reclaimableItems = reclaimableItems; - const xpGains = await prisma.xPGain.findMany({ + const xpGains = await global.prisma!.xPGain.findMany({ where: { user_id: BigInt(this.id) }, orderBy: { id: 'asc' } }); if (xpGains.length > 0) this.xpGains = xpGains; - const economyTx = await prisma.economyTransaction.findMany({ + const economyTx = await global.prisma!.economyTransaction.findMany({ where: { OR: [{ sender: BigInt(this.id) }, { recipient: BigInt(this.id) }] }, orderBy: { date: 'asc' } }); if (economyTx.length > 0) this.economyTx = economyTx; - const bingoParticipant = await prisma.bingoParticipant.findMany({ + const bingoParticipant = await global.prisma!.bingoParticipant.findMany({ where: { user_id: this.id }, orderBy: { bingo_id: 'asc' } }); if (bingoParticipant.length > 0) this.bingoParticipant = bingoParticipant; - const userStats = await prisma.userStats.findFirst({ where: { user_id: BigInt(this.id) } }); + const userStats = await global.prisma!.userStats.findFirst({ where: { user_id: BigInt(this.id) } }); if (userStats) this.userStats = userStats; - const bingos = await prisma.bingo.findMany({ where: { creator_id: this.id }, orderBy: { id: 'asc' } }); + const bingos = await global.prisma!.bingo.findMany({ where: { creator_id: this.id }, orderBy: { id: 'asc' } }); if (bingos.length > 0) this.bingos = bingos; - const historicalData = await prisma.historicalData.findMany({ + const historicalData = await global.prisma!.historicalData.findMany({ where: { user_id: this.id }, orderBy: { date: 'asc' } }); if (historicalData.length > 0) this.historicalData = historicalData; - const commandUsage = await prisma.commandUsage.findMany({ + const commandUsage = await global.prisma!.commandUsage.findMany({ where: { user_id: BigInt(this.id) }, orderBy: { date: 'asc' } }); if (commandUsage.length > 0) this.commandUsage = commandUsage; - const geListings = await prisma.gEListing.findMany({ + const geListings = await global.prisma!.gEListing.findMany({ where: { user_id: this.id }, orderBy: { id: 'asc' } }); @@ -630,14 +637,14 @@ const allTableCommands: TestCommand[] = [ channel_id: 11_111_111_111n, duration }; - await prisma.activity.create({ data }); + await global.prisma!.activity.create({ data }); } } }, { name: 'Group Activity', cmd: async user => { - const users = shuffleArr([user.id, randomSnowflake(), randomSnowflake()]); + const users = shuffleArr([user.id, mockedId(), mockedId()]); const data = { leader: user.id, users, @@ -649,7 +656,7 @@ const allTableCommands: TestCommand[] = [ const duration = 30 * 60 * 1000; const start_date = new Date(); const finish_date = new Date(start_date.getTime() + duration); - await prisma.activity.create({ + await global.prisma!.activity.create({ data: { type: 'TombsOfAmascut', user_id: BigInt(user.id), @@ -695,7 +702,7 @@ const allTableCommands: TestCommand[] = [ 'Fishing bait' ]; const lootBank = new Bank().add(randArrItem(randomBuyItems), randInt(10, 999)); - await prisma.buyCommandTransaction.create({ + await global.prisma!.buyCommandTransaction.create({ data: { user_id: BigInt(user.id), cost_gp: randInt(10_000, 10_000_000), @@ -710,7 +717,7 @@ const allTableCommands: TestCommand[] = [ cmd: async user => { const randomItems = ['Cannonball', 'Blood rune', 'Twisted bow', 'Kodai wand', 'Bandos tassets']; const recvBank = new Bank().add(randArrItem(randomItems), randInt(10, 99)).add(randArrItem(randomItems)); - const partner = await createTestUser(randomSnowflake(), recvBank); + const partner = await createTestUser(recvBank); await tradePlayerItems(user, partner, undefined, recvBank); } }, @@ -719,7 +726,7 @@ const allTableCommands: TestCommand[] = [ cmd: async user => { const randomItems = ['Feather', 'Soul rune', 'Dragon claws', 'Ghrazi rapier', 'Bandos boots']; const recvBank = new Bank().add(randArrItem(randomItems), randInt(10, 99)).add(randArrItem(randomItems)); - const partner = await createTestUser(randomSnowflake(), recvBank); + const partner = await createTestUser(recvBank); await tradePlayerItems(partner, user, recvBank, undefined); } }, @@ -768,7 +775,7 @@ const allTableCommands: TestCommand[] = [ { name: 'Create giveaway', cmd: async user => { - await prisma.giveaway.create({ + await global.prisma!.giveaway.create({ data: { id: randInt(1_000_000, 9_999_999), channel_id: '1111111111111', @@ -794,7 +801,7 @@ const allTableCommands: TestCommand[] = [ name: 'Farmed crop', cmd: async user => { const plant = findPlant('Potato')!; - await prisma.farmedCrop.create({ + await global.prisma!.farmedCrop.create({ data: { user_id: user.id, date_planted: new Date(), @@ -824,7 +831,7 @@ const allTableCommands: TestCommand[] = [ { name: 'Pin Trip', cmd: async user => { - const result = await prisma.activity.findFirst({ + const result = await global.prisma!.activity.findFirst({ where: { user_id: BigInt(user.id) }, select: { id: true } }); @@ -841,7 +848,7 @@ const allTableCommands: TestCommand[] = [ const result = calculateResultOfLMSGames(quantity, lmsStats); - await prisma.lastManStandingGame.createMany({ + await global.prisma!.lastManStandingGame.createMany({ data: result.map(i => ({ ...i, user_id: BigInt(user.id), points: undefined })) }); const points = sumArr(result.map(i => i.points)); @@ -943,7 +950,7 @@ const allTableCommands: TestCommand[] = [ }), {} ), - prisma.botItemSell.createMany({ data: botItemSellData }) + global.prisma!.botItemSell.createMany({ data: botItemSellData }) ]); } }, @@ -978,21 +985,21 @@ const allTableCommands: TestCommand[] = [ creator_id: user.id, guild_id: '342983479501389826' }; - await prisma.bingo.create({ data: createOptions }); + await global.prisma!.bingo.create({ data: createOptions }); } }, { name: 'Bingo Participant', cmd: async user => { - const activeBingos = await prisma.bingo.findMany({ select: { id: true } }); + const activeBingos = await global.prisma!.bingo.findMany({ select: { id: true } }); if (activeBingos.length === 0) return; const myBingo = randArrItem(activeBingos).id; // Check if we're in this bingo already: - const existingTeam = await prisma.bingoParticipant.findFirst({ + const existingTeam = await global.prisma!.bingoParticipant.findFirst({ where: { user_id: user.id, bingo_id: myBingo } }); if (existingTeam) return; - await prisma.bingoTeam.create({ + await global.prisma!.bingoTeam.create({ data: { bingo_id: myBingo, users: { @@ -1029,7 +1036,7 @@ const allTableCommands: TestCommand[] = [ { name: 'Historical data', cmd: async user => { - await prisma.historicalData.create({ + await global.prisma!.historicalData.create({ data: { user_id: user.id, GP: 100_000, @@ -1045,7 +1052,7 @@ const allTableCommands: TestCommand[] = [ name: 'Command usage', cmd: async user => { const randCommands = ['minion', 'runecraft', 'chop', 'mine', 'buy']; - await prisma.commandUsage.create({ + await global.prisma!.commandUsage.create({ data: { user_id: BigInt(user.id), channel_id: 1_111_111_111n, @@ -1071,7 +1078,7 @@ const allTableCommands: TestCommand[] = [ } const itemId = randInt(10_000, 25_000); key += `${itemId}`; - await prisma.reclaimableItem.create({ + await global.prisma!.reclaimableItem.create({ data: { user_id: user.id, key, @@ -1154,6 +1161,7 @@ async function buildBaseUser(userId: string) { .add('Ghrazi rapier'); const userData: Partial = { + id: userId, skills_runecraft: 13_034_431, skills_woodcutting: 13_034_431, skills_mining: 13_034_431, @@ -1168,7 +1176,7 @@ async function buildBaseUser(userId: string) { kourend_favour: { Hosidius: 100, Arceuus: 0, Shayzien: 0, Lovakengj: 0 }, GP: 100_000_000 }; - const user = await createTestUser(userId, startBank, userData); + const user = await createTestUser(startBank, userData); return user; } describe('migrate user test', async () => { @@ -1208,10 +1216,10 @@ describe('migrate user test', async () => { await GrandExchange.init(); test('test migrating existing user to target with no records', async () => { - const sourceUser = await buildBaseUser(randomSnowflake()); + const sourceUser = await buildBaseUser(mockedId()); await runAllTestCommandsOnUser(sourceUser); - const destUserId = randomSnowflake(); + const destUserId = mockedId(); const sourceData = new UserData(sourceUser); await sourceData.sync(); @@ -1229,8 +1237,8 @@ describe('migrate user test', async () => { }); test('test migrating full user on top of full profile', async () => { - const sourceUser = await buildBaseUser(randomSnowflake()); - const destUser = await buildBaseUser(randomSnowflake()); + const sourceUser = await buildBaseUser(mockedId()); + const destUser = await buildBaseUser(mockedId()); await runAllTestCommandsOnUser(sourceUser); await runAllTestCommandsOnUser(destUser); @@ -1271,8 +1279,8 @@ describe('migrate user test', async () => { test( 'test migrating random user on top of empty profile', async () => { - const sourceUser = await buildBaseUser(randomSnowflake()); - const destUserId = randomSnowflake(); + const sourceUser = await buildBaseUser(mockedId()); + const destUserId = mockedId(); const sourceRolls = randInt(6, 11); const cmdHistory = await runRandomTestCommandsOnUser(sourceUser, sourceRolls); @@ -1293,14 +1301,14 @@ describe('migrate user test', async () => { expect(compareResult.result).toBe(true); }, - { repeats: 2 } + { repeats: 1 } ); test( 'test migrating random user on top of random profile', async () => { - const sourceUser = await buildBaseUser(randomSnowflake()); - const destUser = await buildBaseUser(randomSnowflake()); + const sourceUser = await buildBaseUser(mockedId()); + const destUser = await buildBaseUser(mockedId()); const sourceRolls = randInt(5, 12); const destRolls = randInt(5, 12); @@ -1322,14 +1330,14 @@ describe('migrate user test', async () => { expect(compareResult.result).toBe(true); }, - { repeats: 2 } + { repeats: 1 } ); test( 'test migrating random user on top of full profile', async () => { - const sourceUser = await buildBaseUser(randomSnowflake()); - const destUser = await buildBaseUser(randomSnowflake()); + const sourceUser = await buildBaseUser(mockedId()); + const destUser = await buildBaseUser(mockedId()); const cmdHistory = await runRandomTestCommandsOnUser(sourceUser); await runAllTestCommandsOnUser(destUser); @@ -1348,6 +1356,6 @@ describe('migrate user test', async () => { expect(compareResult.result).toBe(true); }, - { repeats: 2 } + { repeats: 1 } ); }); diff --git a/tests/integration/misc.test.ts b/tests/integration/misc.test.ts index d28e8cd3c3..0b33f7f21c 100644 --- a/tests/integration/misc.test.ts +++ b/tests/integration/misc.test.ts @@ -1,7 +1,6 @@ import { describe, expect, test } from 'vitest'; import { analyticsTick } from '../../src/lib/analytics'; -import { prisma } from '../../src/lib/settings/prisma'; import { minionStatsEmbed } from '../../src/lib/util/minionStatsEmbed'; import { mockClient } from './util'; @@ -12,6 +11,6 @@ describe('Integration Misc', () => { test('Analytics', async () => { await mockClient(); await analyticsTick(); - expect(await prisma.analytic.count()).toBeGreaterThanOrEqual(1); + expect(await global.prisma!.analytic.count()).toBeGreaterThanOrEqual(1); }); }); diff --git a/tests/integration/monsterKilling.test.ts b/tests/integration/monsterKilling.test.ts index e745e88660..41e2d8d929 100644 --- a/tests/integration/monsterKilling.test.ts +++ b/tests/integration/monsterKilling.test.ts @@ -1,7 +1,6 @@ import { Bank } from 'oldschooljs'; import { expect, test } from 'vitest'; -import { prisma } from '../../src/lib/settings/prisma'; import { MonsterActivityTaskOptions } from '../../src/lib/types/minions'; import { killCommand } from '../../src/mahoji/commands/k'; import { createTestUser, mockClient } from './util'; @@ -22,7 +21,7 @@ test('Killing Men', async () => { expect(user.bank.amount('Shark')).toBeLessThan(1_000_000); expect( - await prisma.xPGain.count({ + await global.prisma!.xPGain.count({ where: { user_id: BigInt(user.id) } diff --git a/tests/integration/paymentConflict.test.ts b/tests/integration/paymentConflict.test.ts index fb0c1c0ba3..d44d5ba93e 100644 --- a/tests/integration/paymentConflict.test.ts +++ b/tests/integration/paymentConflict.test.ts @@ -1,4 +1,3 @@ -import { randomSnowflake } from '@oldschoolgg/toolkit'; import { randArrItem, randInt, roll, Time } from 'e'; import { Bank } from 'oldschooljs'; import { describe, expect, test } from 'vitest'; @@ -10,7 +9,7 @@ describe('Payment conflicts', async () => { const payerCount = 50; const iterations = 100; const addChance = 3; - const repeats = 5; + const repeats = 1; const bigBank = new Bank().add('Cannonball', 4).add('Bones', 10_000); @@ -20,7 +19,7 @@ describe('Payment conflicts', async () => { await mockClient(); // Payee is currently the primary target of the test. - const userPayee = await createTestUser(randomSnowflake(), new Bank(bigBank), { GP: 1_000_000_000 }); + const userPayee = await createTestUser(new Bank(bigBank), { GP: 1_000_000_000 }); const payeeTarget = await globalClient.fetchUser(userPayee.id); @@ -28,7 +27,7 @@ describe('Payment conflicts', async () => { const payers: TestUser[] = []; for (let i = 0; i < payerCount; i++) { - payers.push(await createTestUser(randomSnowflake(), new Bank(), { GP: 1_000_000_000 })); + payers.push(await createTestUser(new Bank(), { GP: 1_000_000_000 })); } const promisePay = async () => { @@ -79,13 +78,13 @@ describe('Payment conflicts', async () => { async () => { await mockClient(); // May as well test for the Payer also, even though so far we're solid here. - const userPayer = await createTestUser(randomSnowflake(), new Bank(bigBank), { GP: 1_000_000_000 }); + const userPayer = await createTestUser(new Bank(bigBank), { GP: 1_000_000_000 }); const startingBallCount = userPayer.bank.amount('Cannonball'); const payees: TestUser[] = []; for (let i = 0; i < payerCount; i++) { - payees.push(await createTestUser(randomSnowflake(), new Bank(), { GP: 1_000_000_000 })); + payees.push(await createTestUser(new Bank(), { GP: 1_000_000_000 })); } const promisePay = async () => { diff --git a/tests/integration/rolesTask.test.ts b/tests/integration/rolesTask.test.ts index 931c17dde1..5ba57e19b2 100644 --- a/tests/integration/rolesTask.test.ts +++ b/tests/integration/rolesTask.test.ts @@ -1,14 +1,12 @@ -import { randomSnowflake } from '@oldschoolgg/toolkit'; import { Time } from 'e'; import { Bank } from 'oldschooljs'; import { describe, expect, test } from 'vitest'; import { runRolesTask } from '../../src/lib/rolesTask'; import { MinigameName, Minigames } from '../../src/lib/settings/minigames'; -import { prisma } from '../../src/lib/settings/prisma'; import { cryptoRand } from '../../src/lib/util'; import { userStatsBankUpdate } from '../../src/mahoji/mahojiSettings'; -import { createTestUser } from './util'; +import { createTestUser, mockedId } from './util'; describe('Roles Task', async () => { test('Should not throw', async () => { @@ -24,23 +22,23 @@ describe('Roles Task', async () => { for (const minigame of minigames) { minigameUpdate[minigame] = 1000; } - await prisma.minigame.upsert({ + await global.prisma!.minigame.upsert({ where: { user_id: ironUser.id }, update: minigameUpdate, create: { user_id: ironUser.id, ...minigameUpdate } }); - await prisma.giveaway.create({ + await global.prisma!.giveaway.create({ data: { user_id: user.id, loot: { 995: 10_000 }, start_date: new Date(), finish_date: new Date(Date.now() + Time.Hour), channel_id: '792691343284764693', - message_id: randomSnowflake(), - reaction_id: randomSnowflake(), + message_id: mockedId(), + reaction_id: mockedId(), users_entered: [], - id: cryptoRand(1, 100), + id: cryptoRand(1, 10_000_000), completed: false, duration: 10_000 } diff --git a/tests/integration/setup.ts b/tests/integration/setup.ts index 8617aef368..baf9a63b96 100644 --- a/tests/integration/setup.ts +++ b/tests/integration/setup.ts @@ -1,6 +1,8 @@ import '../globalSetup'; -import { vi } from 'vitest'; +import { afterEach, beforeEach, vi } from 'vitest'; + +import { prisma } from '../../src/lib/settings/prisma'; vi.mock('../../src/lib/util/handleMahojiConfirmation', () => ({ handleMahojiConfirmation: vi.fn() @@ -26,3 +28,12 @@ globalClient.fetchUser = async (id: string | bigint) => ({ id: typeof id === 'string' ? id : String(id), send: async () => {} }); + +beforeEach(async () => { + await prisma.$connect(); + console.log(await prisma.$queryRawUnsafe('select count(*) from pg_stat_activity;')); +}); + +afterEach(async () => { + await prisma.$disconnect(); +}); diff --git a/tests/integration/stats.test.ts b/tests/integration/stats.test.ts index 87df8e3319..336435ae15 100644 --- a/tests/integration/stats.test.ts +++ b/tests/integration/stats.test.ts @@ -1,6 +1,5 @@ import { describe, test } from 'vitest'; -import { prisma } from '../../src/lib/settings/prisma'; import { dataPoints } from '../../src/mahoji/lib/abstracted_commands/statCommand'; import { createTestUser, mockClient } from './util'; @@ -9,7 +8,7 @@ describe('Datapoints', async () => { test('Data points', async () => { const user = await createTestUser(); - const stats = await prisma.userStats.upsert({ + const stats = await global.prisma!.userStats.upsert({ where: { user_id: BigInt(user.id) }, create: { user_id: BigInt(user.id) }, update: {} diff --git a/tests/integration/tradeTransaction.test.ts b/tests/integration/tradeTransaction.test.ts index 1d514d7a84..8a0b34b76e 100644 --- a/tests/integration/tradeTransaction.test.ts +++ b/tests/integration/tradeTransaction.test.ts @@ -1,20 +1,19 @@ import 'source-map-support/register'; -import { randomSnowflake } from '@oldschoolgg/toolkit'; import { Prisma } from '@prisma/client'; import { Bank } from 'oldschooljs'; import { describe, expect, test } from 'vitest'; -import { prisma } from '../../src/lib/settings/prisma'; import { tradePlayerItems } from '../../src/lib/util/tradePlayerItems'; +import { mockedId } from './util'; describe('Transactionalized Trade Test', async () => { async function createUserWithBank(bank: Bank, userData: Partial = {}) { - const userId = randomSnowflake(); + const userId = mockedId(); const GP = bank.amount('Coins'); delete bank.bank[995]; - await prisma.user.create({ + await global.prisma!.user.create({ data: { id: userId, GP, bank: bank.bank, ...userData } }); diff --git a/tests/integration/trading.test.ts b/tests/integration/trading.test.ts index 8c6cdfad83..25d3194ad1 100644 --- a/tests/integration/trading.test.ts +++ b/tests/integration/trading.test.ts @@ -2,7 +2,6 @@ import { randArrItem, shuffleArr } from 'e'; import { Bank } from 'oldschooljs'; import { expect, test } from 'vitest'; -import { prisma } from '../../src/lib/settings/prisma'; import { tradeCommand } from '../../src/mahoji/commands/trade'; import { createTestUser, mockClient, TestUser } from './util'; @@ -14,7 +13,7 @@ test('Trade consistency', async () => { const users: TestUser[] = []; for (let i = 0; i < NUMBER_OF_USERS; i++) { - users.push(await createTestUser(undefined, bank)); + users.push(await createTestUser(bank)); } function checkMatch() { @@ -70,7 +69,7 @@ test('Trade consistency', async () => { await Promise.all(promises); checkMatch(); expect( - await prisma.economyTransaction.count({ + await global.prisma!.economyTransaction.count({ where: { sender: { in: users.map(u => BigInt(u.id)) diff --git a/tests/integration/userStats.test.ts b/tests/integration/userStats.test.ts index 8579410fa1..f6815ebaba 100644 --- a/tests/integration/userStats.test.ts +++ b/tests/integration/userStats.test.ts @@ -1,4 +1,3 @@ -import { randomSnowflake } from '@oldschoolgg/toolkit'; import { describe, expect, test } from 'vitest'; import { userStatsUpdate } from '../../src/mahoji/mahojiSettings'; @@ -6,11 +5,11 @@ import { createTestUser, mockClient } from './util'; describe('User Stats', async () => { await mockClient(); - const userID = randomSnowflake(); test('Should return nothing', async () => { - await createTestUser(userID); - const user = await mUserFetch(userID); + const user = await createTestUser(); + const userID = user.id; + expect(await user.fetchStats({})).toEqual({ user_id: BigInt(userID) }); const result = await userStatsUpdate( userID, diff --git a/tests/integration/util.ts b/tests/integration/util.ts index 9bfd9e4273..e1b18d1ef9 100644 --- a/tests/integration/util.ts +++ b/tests/integration/util.ts @@ -1,4 +1,3 @@ -import { randomSnowflake } from '@oldschoolgg/toolkit'; import { Prisma } from '@prisma/client'; import { randInt, shuffleArr, uniqueArr } from 'e'; import { CommandRunOptions } from 'mahoji'; @@ -6,10 +5,10 @@ import { Bank } from 'oldschooljs'; import { globalConfig } from '../../src/lib/constants'; import { MUserClass } from '../../src/lib/MUser'; -import { convertStoredActivityToFlatActivity, prisma } from '../../src/lib/settings/prisma'; +import { convertStoredActivityToFlatActivity } from '../../src/lib/settings/prisma'; import { processPendingActivities } from '../../src/lib/Task'; import { ItemBank } from '../../src/lib/types'; -import { assert, cryptoRand } from '../../src/lib/util'; +import { cryptoRand } from '../../src/lib/util'; import { giveMaxStats } from '../../src/mahoji/commands/testpotato'; import { ironmanCommand } from '../../src/mahoji/lib/abstracted_commands/ironmanCommand'; import { OSBMahojiCommand } from '../../src/mahoji/lib/util'; @@ -63,9 +62,9 @@ export class TestUser extends MUserClass { if (res !== 'You are now an ironman.') { throw new Error(`Failed to reset: ${res}`); } - await prisma.userStats.deleteMany({ where: { user_id: BigInt(this.id) } }); - await prisma.user.delete({ where: { id: this.id } }); - const user = await prisma.user.create({ data: { id: this.id } }); + await global.prisma!.userStats.deleteMany({ where: { user_id: BigInt(this.id) } }); + await global.prisma!.user.delete({ where: { id: this.id } }); + const user = await global.prisma!.user.create({ data: { id: this.id } }); this.user = user; } @@ -124,20 +123,21 @@ export class TestUser extends MUserClass { } } -export async function createTestUser( - id = cryptoRand(1_000_000_000, 5_000_000_000).toString(), - bank?: Bank, - userData: Partial = {} -) { - const user = await prisma.user.upsert({ +export function mockedId() { + return cryptoRand(1_000_000_000, 5_000_000_000_000).toString(); +} + +export async function createTestUser(bank?: Bank, userData: Partial = {}) { + const id = userData?.id ?? mockedId(); + const user = await global.prisma!.user.upsert({ create: { id, - bank: bank?.bank, - ...userData + ...userData, + bank: bank?.bank }, update: { - bank: bank?.bank, - ...userData + ...userData, + bank: bank?.bank }, where: { id @@ -145,14 +145,14 @@ export async function createTestUser( }); try { - await prisma.userStats.create({ + await global.prisma!.userStats.create({ data: { user_id: BigInt(user.id) } }); } catch (err) { console.error(`Failed to make userStats for ${user.id}`); - throw new Error(`Failed to make userStats for ${user.id}`); + throw new Error(err as any); } return new TestUser(user); @@ -165,12 +165,12 @@ class TestClient { } async reset() { - await prisma.clientStorage.delete({ where: { id: this.data.id } }); - this.data = (await prisma.clientStorage.create({ data: { id: this.data.id } }))!; + await global.prisma!.clientStorage.delete({ where: { id: this.data.id } }); + this.data = (await global.prisma!.clientStorage.create({ data: { id: this.data.id } }))!; } async sync() { - this.data = (await prisma.clientStorage.findFirst({ where: { id: this.data.id } }))!; + this.data = (await global.prisma!.clientStorage.findFirst({ where: { id: this.data.id } }))!; } async expectValueMatch(key: keyof ClientStorage, value: any) { @@ -182,8 +182,8 @@ class TestClient { } export async function mockClient() { - const clientId = randomSnowflake(); - const client = await prisma.clientStorage.create({ + const clientId = mockedId(); + const client = await global.prisma!.clientStorage.create({ data: { id: clientId } @@ -193,4 +193,6 @@ export async function mockClient() { return new TestClient(client); } -assert(uniqueArr([randomSnowflake(), randomSnowflake(), randomSnowflake()]).length === 3); +if (uniqueArr([mockedId(), mockedId(), mockedId()]).length !== 3) { + throw new Error('mockedId is broken'); +} diff --git a/vitest.integration.config.ts b/vitest.integration.config.ts index bfc41a49f3..871ff59afb 100644 --- a/vitest.integration.config.ts +++ b/vitest.integration.config.ts @@ -11,6 +11,10 @@ export default defineConfig({ include: ['src/lib/MUser.ts'] }, testTimeout: 30_000, - bail: 1 + bail: 1, + threads: true, + maxConcurrency: 1, + minThreads: 1, + maxThreads: 3 } }); From 25aa03ade1806fb09802312b7e00156e518da9d5 Mon Sep 17 00:00:00 2001 From: GC <30398469+gc@users.noreply.github.com> Date: Sun, 25 Feb 2024 23:25:52 +1100 Subject: [PATCH 08/15] Remove kourend favour (#5720) --- prisma/schema.prisma | 1 - src/lib/MUser.ts | 10 +- src/lib/Task.ts | 5 +- src/lib/data/buyables/buyables.ts | 5 +- src/lib/data/creatables/gracefulOutfits.ts | 176 +++++++----------- src/lib/data/createables.ts | 2 - src/lib/minions/data/kourendFavour.ts | 136 -------------- src/lib/minions/functions/darkAltarCommand.ts | 6 +- src/lib/musicCape.ts | 14 -- src/lib/skilling/functions/calcsFarming.ts | 11 +- src/lib/structures/Requirements.ts | 24 --- src/lib/util/repeatStoredTrip.ts | 9 +- src/mahoji/commands/activities.ts | 26 --- src/mahoji/commands/buy.ts | 8 - src/mahoji/commands/chop.ts | 10 +- src/mahoji/commands/cook.ts | 7 +- src/mahoji/commands/create.ts | 16 -- src/mahoji/commands/fish.ts | 5 - src/mahoji/commands/steal.ts | 6 - src/mahoji/commands/testpotato.ts | 10 +- .../lib/abstracted_commands/farmingCommand.ts | 12 +- .../farmingContractCommand.ts | 6 - .../lib/abstracted_commands/favourCommand.ts | 87 --------- .../lib/abstracted_commands/minionKill.ts | 15 +- .../lib/abstracted_commands/pohCommand.ts | 7 - .../abstracted_commands/puroPuroCommand.ts | 5 - .../lib/abstracted_commands/sawmillCommand.ts | 4 +- .../abstracted_commands/titheFarmCommand.ts | 5 - src/tasks/minions/cookingActivity.ts | 5 +- src/tasks/minions/kourendFavourActivity.ts | 75 -------- tests/integration/migrateUser.test.ts | 1 - tests/integration/setup.ts | 1 - .../unit/snapshots/banksnapshots.test.ts.snap | 71 ------- tests/unit/utils.ts | 7 - 34 files changed, 92 insertions(+), 696 deletions(-) delete mode 100644 src/lib/minions/data/kourendFavour.ts delete mode 100644 src/mahoji/lib/abstracted_commands/favourCommand.ts delete mode 100644 src/tasks/minions/kourendFavourActivity.ts diff --git a/prisma/schema.prisma b/prisma/schema.prisma index f32d78aa42..607b0288bb 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -428,7 +428,6 @@ model User { farmingPatches_flower Json? @map("farmingPatches.flower") @db.Json farmingPatches_mushroom Json? @map("farmingPatches.mushroom") @db.Json farmingPatches_belladonna Json? @map("farmingPatches.belladonna") @db.Json - kourend_favour Json? @map("kourend_favour") @db.Json geListings GEListing[] bingo_participant BingoParticipant[] diff --git a/src/lib/MUser.ts b/src/lib/MUser.ts index 81044ab1ce..5423a68728 100644 --- a/src/lib/MUser.ts +++ b/src/lib/MUser.ts @@ -19,7 +19,6 @@ import { GearSetup, UserFullGearSetup } from './gear/types'; import { handleNewCLItems } from './handleNewCLItems'; import backgroundImages from './minions/data/bankBackgrounds'; import { CombatOptionsEnum } from './minions/data/combatConstants'; -import { baseUserKourendFavour, UserKourendFavour } from './minions/data/kourendFavour'; import { defaultFarmingContract } from './minions/farming'; import { FarmingContract } from './minions/farming/types'; import { AttackStyles } from './minions/functions'; @@ -35,7 +34,7 @@ import { SkillsEnum } from './skilling/types'; import { BankSortMethod } from './sorts'; import { defaultGear, Gear } from './structures/Gear'; import { ItemBank, Skills } from './types'; -import { addItemToBank, assert, convertXPtoLVL, itemNameFromID, percentChance } from './util'; +import { addItemToBank, convertXPtoLVL, itemNameFromID, percentChance } from './util'; import { determineRunes } from './util/determineRunes'; import { getKCByName } from './util/getKCByName'; import getOSItem, { getItem } from './util/getOSItem'; @@ -163,13 +162,6 @@ export class MUserClass { }); } - get kourendFavour() { - const favour = this.user.kourend_favour as any as UserKourendFavour | null; - if (favour === null) return { ...baseUserKourendFavour }; - assert(typeof favour.Arceuus === 'number', `kourendFavour should return valid data for ${this.id}`); - return favour; - } - get isBusy() { return userIsBusy(this.id); } diff --git a/src/lib/Task.ts b/src/lib/Task.ts index 4fe1ff296d..a6cbefcc1c 100644 --- a/src/lib/Task.ts +++ b/src/lib/Task.ts @@ -28,7 +28,6 @@ import { aerialFishingTask } from '../tasks/minions/HunterActivity/aerialFishing import { birdHouseTask } from '../tasks/minions/HunterActivity/birdhouseActivity'; import { driftNetTask } from '../tasks/minions/HunterActivity/driftNetActivity'; import { hunterTask } from '../tasks/minions/HunterActivity/hunterActivity'; -import { kourendTask } from '../tasks/minions/kourendFavourActivity'; import { mageArenaTwoTask } from '../tasks/minions/mageArena2Activity'; import { mageArenaTask } from '../tasks/minions/mageArenaActivity'; import { agilityArenaTask } from '../tasks/minions/minigames/agilityArenaActivity'; @@ -161,7 +160,6 @@ export const tasks: MinionTask[] = [ pickpocketTask, questingTask, monsterTask, - kourendTask, vmTask, templeTrekkingTask, mageTrainingTask, @@ -277,7 +275,8 @@ const ignored: activity_type_enum[] = [ activity_type_enum.BlastFurnace, activity_type_enum.Easter, activity_type_enum.HalloweenEvent, - activity_type_enum.Revenants + activity_type_enum.Revenants, + activity_type_enum.KourendFavour ]; for (const a of Object.values(activity_type_enum)) { if (ignored.includes(a)) { diff --git a/src/lib/data/buyables/buyables.ts b/src/lib/data/buyables/buyables.ts index eff647fe62..80b894a886 100644 --- a/src/lib/data/buyables/buyables.ts +++ b/src/lib/data/buyables/buyables.ts @@ -3,7 +3,6 @@ import { Bank } from 'oldschooljs'; import { QuestID } from '../../../mahoji/lib/abstracted_commands/questCommand'; import { chompyHats } from '../../constants'; import { CombatCannonItemBank } from '../../minions/data/combatConstants'; -import { Favours } from '../../minions/data/kourendFavour'; import { MinigameName } from '../../settings/settings'; import { soteSkillRequirements } from '../../skilling/functions/questRequirements'; import { MUserStats } from '../../structures/MUserStats'; @@ -35,7 +34,6 @@ export interface Buyable { itemCost?: Bank; aliases?: string[]; skillsNeeded?: Skills; - requiredFavour?: Favours; restockTime?: number; minigameScoreReq?: [MinigameName, number]; ironmanPrice?: number; @@ -203,8 +201,7 @@ const constructionBuyables: Buyable[] = [ }, { name: 'Arceuus signet', - gpCost: 100_000, - requiredFavour: Favours.Arceuus + gpCost: 100_000 }, { name: 'Ancient signet', diff --git a/src/lib/data/creatables/gracefulOutfits.ts b/src/lib/data/creatables/gracefulOutfits.ts index 8674dc1a8e..2bd4f63874 100644 --- a/src/lib/data/creatables/gracefulOutfits.ts +++ b/src/lib/data/creatables/gracefulOutfits.ts @@ -1,6 +1,5 @@ import { Bank } from 'oldschooljs'; -import { Favours } from '../../minions/data/kourendFavour'; import itemID from '../../util/itemID'; import { Createable } from '../createables'; @@ -242,8 +241,7 @@ export const gracefulOutfitCreatables: Createable[] = [ [itemID('Arceuus graceful gloves')]: 1, [itemID('Arceuus graceful boots')]: 1, [itemID('Arceuus graceful cape')]: 1 - }, - requiredFavour: Favours.Arceuus + } }, { name: 'Arceuus graceful hood', @@ -253,8 +251,7 @@ export const gracefulOutfitCreatables: Createable[] = [ }, outputItems: { [itemID('Arceuus graceful hood')]: 1 - }, - requiredFavour: Favours.Arceuus + } }, { name: 'Arceuus graceful top', @@ -264,8 +261,7 @@ export const gracefulOutfitCreatables: Createable[] = [ }, outputItems: { [itemID('Arceuus graceful top')]: 1 - }, - requiredFavour: Favours.Arceuus + } }, { name: 'Arceuus graceful legs', @@ -275,8 +271,7 @@ export const gracefulOutfitCreatables: Createable[] = [ }, outputItems: { [itemID('Arceuus graceful legs')]: 1 - }, - requiredFavour: Favours.Arceuus + } }, { name: 'Arceuus graceful gloves', @@ -286,8 +281,7 @@ export const gracefulOutfitCreatables: Createable[] = [ }, outputItems: { [itemID('Arceuus graceful gloves')]: 1 - }, - requiredFavour: Favours.Arceuus + } }, { name: 'Arceuus graceful boots', @@ -297,8 +291,7 @@ export const gracefulOutfitCreatables: Createable[] = [ }, outputItems: { [itemID('Arceuus graceful boots')]: 1 - }, - requiredFavour: Favours.Arceuus + } }, { name: 'Arceuus graceful cape', @@ -308,8 +301,7 @@ export const gracefulOutfitCreatables: Createable[] = [ }, outputItems: { [itemID('Arceuus graceful cape')]: 1 - }, - requiredFavour: Favours.Arceuus + } }, { name: 'Revert arceuus graceful', @@ -329,7 +321,7 @@ export const gracefulOutfitCreatables: Createable[] = [ [itemID('Graceful boots')]: 1, [itemID('Graceful cape')]: 1 }, - requiredFavour: Favours.Arceuus, + noCl: true }, { @@ -340,7 +332,7 @@ export const gracefulOutfitCreatables: Createable[] = [ outputItems: { [itemID('Graceful hood')]: 1 }, - requiredFavour: Favours.Arceuus, + noCl: true }, { @@ -351,7 +343,7 @@ export const gracefulOutfitCreatables: Createable[] = [ outputItems: { [itemID('Graceful top')]: 1 }, - requiredFavour: Favours.Arceuus, + noCl: true }, { @@ -362,7 +354,7 @@ export const gracefulOutfitCreatables: Createable[] = [ outputItems: { [itemID('Graceful legs')]: 1 }, - requiredFavour: Favours.Arceuus, + noCl: true }, { @@ -373,7 +365,7 @@ export const gracefulOutfitCreatables: Createable[] = [ outputItems: { [itemID('Graceful gloves')]: 1 }, - requiredFavour: Favours.Arceuus, + noCl: true }, { @@ -384,7 +376,7 @@ export const gracefulOutfitCreatables: Createable[] = [ outputItems: { [itemID('Graceful boots')]: 1 }, - requiredFavour: Favours.Arceuus, + noCl: true }, { @@ -395,7 +387,7 @@ export const gracefulOutfitCreatables: Createable[] = [ outputItems: { [itemID('Graceful cape')]: 1 }, - requiredFavour: Favours.Arceuus, + noCl: true }, // Piscarilius @@ -417,8 +409,7 @@ export const gracefulOutfitCreatables: Createable[] = [ [itemID('Piscarilius graceful gloves')]: 1, [itemID('Piscarilius graceful boots')]: 1, [itemID('Piscarilius graceful cape')]: 1 - }, - requiredFavour: Favours.Piscarilius + } }, { name: 'Piscarilius graceful hood', @@ -428,8 +419,7 @@ export const gracefulOutfitCreatables: Createable[] = [ }, outputItems: { [itemID('Piscarilius graceful hood')]: 1 - }, - requiredFavour: Favours.Piscarilius + } }, { name: 'Piscarilius graceful top', @@ -439,8 +429,7 @@ export const gracefulOutfitCreatables: Createable[] = [ }, outputItems: { [itemID('Piscarilius graceful top')]: 1 - }, - requiredFavour: Favours.Piscarilius + } }, { name: 'Piscarilius graceful legs', @@ -450,8 +439,7 @@ export const gracefulOutfitCreatables: Createable[] = [ }, outputItems: { [itemID('Piscarilius graceful legs')]: 1 - }, - requiredFavour: Favours.Piscarilius + } }, { name: 'Piscarilius graceful gloves', @@ -461,8 +449,7 @@ export const gracefulOutfitCreatables: Createable[] = [ }, outputItems: { [itemID('Piscarilius graceful gloves')]: 1 - }, - requiredFavour: Favours.Piscarilius + } }, { name: 'Piscarilius graceful boots', @@ -472,8 +459,7 @@ export const gracefulOutfitCreatables: Createable[] = [ }, outputItems: { [itemID('Piscarilius graceful boots')]: 1 - }, - requiredFavour: Favours.Piscarilius + } }, { name: 'Piscarilius graceful cape', @@ -483,8 +469,7 @@ export const gracefulOutfitCreatables: Createable[] = [ }, outputItems: { [itemID('Piscarilius graceful cape')]: 1 - }, - requiredFavour: Favours.Piscarilius + } }, { name: 'Revert Piscarilius graceful', @@ -504,7 +489,7 @@ export const gracefulOutfitCreatables: Createable[] = [ [itemID('Graceful boots')]: 1, [itemID('Graceful cape')]: 1 }, - requiredFavour: Favours.Piscarilius, + noCl: true }, { @@ -515,7 +500,7 @@ export const gracefulOutfitCreatables: Createable[] = [ outputItems: { [itemID('Graceful hood')]: 1 }, - requiredFavour: Favours.Piscarilius, + noCl: true }, { @@ -526,7 +511,7 @@ export const gracefulOutfitCreatables: Createable[] = [ outputItems: { [itemID('Graceful top')]: 1 }, - requiredFavour: Favours.Piscarilius, + noCl: true }, { @@ -537,7 +522,7 @@ export const gracefulOutfitCreatables: Createable[] = [ outputItems: { [itemID('Graceful legs')]: 1 }, - requiredFavour: Favours.Piscarilius, + noCl: true }, { @@ -548,7 +533,7 @@ export const gracefulOutfitCreatables: Createable[] = [ outputItems: { [itemID('Graceful gloves')]: 1 }, - requiredFavour: Favours.Piscarilius, + noCl: true }, { @@ -559,7 +544,7 @@ export const gracefulOutfitCreatables: Createable[] = [ outputItems: { [itemID('Graceful boots')]: 1 }, - requiredFavour: Favours.Piscarilius, + noCl: true }, { @@ -570,7 +555,7 @@ export const gracefulOutfitCreatables: Createable[] = [ outputItems: { [itemID('Graceful cape')]: 1 }, - requiredFavour: Favours.Piscarilius, + noCl: true }, // Lovakengj @@ -592,8 +577,7 @@ export const gracefulOutfitCreatables: Createable[] = [ [itemID('Lovakengj graceful gloves')]: 1, [itemID('Lovakengj graceful boots')]: 1, [itemID('Lovakengj graceful cape')]: 1 - }, - requiredFavour: Favours.Lovakengj + } }, { name: 'Lovakengj graceful hood', @@ -603,8 +587,7 @@ export const gracefulOutfitCreatables: Createable[] = [ }, outputItems: { [itemID('Lovakengj graceful hood')]: 1 - }, - requiredFavour: Favours.Lovakengj + } }, { name: 'Lovakengj graceful top', @@ -614,8 +597,7 @@ export const gracefulOutfitCreatables: Createable[] = [ }, outputItems: { [itemID('Lovakengj graceful top')]: 1 - }, - requiredFavour: Favours.Lovakengj + } }, { name: 'Lovakengj graceful legs', @@ -625,8 +607,7 @@ export const gracefulOutfitCreatables: Createable[] = [ }, outputItems: { [itemID('Lovakengj graceful legs')]: 1 - }, - requiredFavour: Favours.Lovakengj + } }, { name: 'Lovakengj graceful gloves', @@ -636,8 +617,7 @@ export const gracefulOutfitCreatables: Createable[] = [ }, outputItems: { [itemID('Lovakengj graceful gloves')]: 1 - }, - requiredFavour: Favours.Lovakengj + } }, { name: 'Lovakengj graceful boots', @@ -647,8 +627,7 @@ export const gracefulOutfitCreatables: Createable[] = [ }, outputItems: { [itemID('Lovakengj graceful boots')]: 1 - }, - requiredFavour: Favours.Lovakengj + } }, { name: 'Lovakengj graceful cape', @@ -658,8 +637,7 @@ export const gracefulOutfitCreatables: Createable[] = [ }, outputItems: { [itemID('Lovakengj graceful cape')]: 1 - }, - requiredFavour: Favours.Lovakengj + } }, { name: 'Revert Lovakengj graceful', @@ -679,7 +657,7 @@ export const gracefulOutfitCreatables: Createable[] = [ [itemID('Graceful boots')]: 1, [itemID('Graceful cape')]: 1 }, - requiredFavour: Favours.Lovakengj, + noCl: true }, { @@ -690,7 +668,7 @@ export const gracefulOutfitCreatables: Createable[] = [ outputItems: { [itemID('Graceful hood')]: 1 }, - requiredFavour: Favours.Lovakengj, + noCl: true }, { @@ -701,7 +679,7 @@ export const gracefulOutfitCreatables: Createable[] = [ outputItems: { [itemID('Graceful top')]: 1 }, - requiredFavour: Favours.Lovakengj, + noCl: true }, { @@ -712,7 +690,7 @@ export const gracefulOutfitCreatables: Createable[] = [ outputItems: { [itemID('Graceful legs')]: 1 }, - requiredFavour: Favours.Lovakengj, + noCl: true }, { @@ -723,7 +701,7 @@ export const gracefulOutfitCreatables: Createable[] = [ outputItems: { [itemID('Graceful gloves')]: 1 }, - requiredFavour: Favours.Lovakengj, + noCl: true }, { @@ -734,7 +712,7 @@ export const gracefulOutfitCreatables: Createable[] = [ outputItems: { [itemID('Graceful boots')]: 1 }, - requiredFavour: Favours.Lovakengj, + noCl: true }, { @@ -745,7 +723,7 @@ export const gracefulOutfitCreatables: Createable[] = [ outputItems: { [itemID('Graceful cape')]: 1 }, - requiredFavour: Favours.Lovakengj, + noCl: true }, // Shayzien @@ -767,8 +745,7 @@ export const gracefulOutfitCreatables: Createable[] = [ [itemID('Shayzien graceful gloves')]: 1, [itemID('Shayzien graceful boots')]: 1, [itemID('Shayzien graceful cape')]: 1 - }, - requiredFavour: Favours.Shayzien + } }, { name: 'Shayzien graceful hood', @@ -778,8 +755,7 @@ export const gracefulOutfitCreatables: Createable[] = [ }, outputItems: { [itemID('Shayzien graceful hood')]: 1 - }, - requiredFavour: Favours.Shayzien + } }, { name: 'Shayzien graceful top', @@ -789,8 +765,7 @@ export const gracefulOutfitCreatables: Createable[] = [ }, outputItems: { [itemID('Shayzien graceful top')]: 1 - }, - requiredFavour: Favours.Shayzien + } }, { name: 'Shayzien graceful legs', @@ -800,8 +775,7 @@ export const gracefulOutfitCreatables: Createable[] = [ }, outputItems: { [itemID('Shayzien graceful legs')]: 1 - }, - requiredFavour: Favours.Shayzien + } }, { name: 'Shayzien graceful gloves', @@ -811,8 +785,7 @@ export const gracefulOutfitCreatables: Createable[] = [ }, outputItems: { [itemID('Shayzien graceful gloves')]: 1 - }, - requiredFavour: Favours.Shayzien + } }, { name: 'Shayzien graceful boots', @@ -822,8 +795,7 @@ export const gracefulOutfitCreatables: Createable[] = [ }, outputItems: { [itemID('Shayzien graceful boots')]: 1 - }, - requiredFavour: Favours.Shayzien + } }, { name: 'Shayzien graceful cape', @@ -833,8 +805,7 @@ export const gracefulOutfitCreatables: Createable[] = [ }, outputItems: { [itemID('Shayzien graceful cape')]: 1 - }, - requiredFavour: Favours.Shayzien + } }, { name: 'Revert Shayzien graceful', @@ -854,7 +825,7 @@ export const gracefulOutfitCreatables: Createable[] = [ [itemID('Graceful boots')]: 1, [itemID('Graceful cape')]: 1 }, - requiredFavour: Favours.Shayzien, + noCl: true }, { @@ -865,7 +836,7 @@ export const gracefulOutfitCreatables: Createable[] = [ outputItems: { [itemID('Graceful hood')]: 1 }, - requiredFavour: Favours.Shayzien, + noCl: true }, { @@ -876,7 +847,7 @@ export const gracefulOutfitCreatables: Createable[] = [ outputItems: { [itemID('Graceful top')]: 1 }, - requiredFavour: Favours.Shayzien, + noCl: true }, { @@ -887,7 +858,7 @@ export const gracefulOutfitCreatables: Createable[] = [ outputItems: { [itemID('Graceful legs')]: 1 }, - requiredFavour: Favours.Shayzien, + noCl: true }, { @@ -898,7 +869,7 @@ export const gracefulOutfitCreatables: Createable[] = [ outputItems: { [itemID('Graceful gloves')]: 1 }, - requiredFavour: Favours.Shayzien, + noCl: true }, { @@ -909,7 +880,7 @@ export const gracefulOutfitCreatables: Createable[] = [ outputItems: { [itemID('Graceful boots')]: 1 }, - requiredFavour: Favours.Shayzien, + noCl: true }, { @@ -920,7 +891,7 @@ export const gracefulOutfitCreatables: Createable[] = [ outputItems: { [itemID('Graceful cape')]: 1 }, - requiredFavour: Favours.Shayzien, + noCl: true }, // Hosidius @@ -942,8 +913,7 @@ export const gracefulOutfitCreatables: Createable[] = [ [itemID('Hosidius graceful gloves')]: 1, [itemID('Hosidius graceful boots')]: 1, [itemID('Hosidius graceful cape')]: 1 - }, - requiredFavour: Favours.Hosidius + } }, { name: 'Hosidius graceful hood', @@ -953,8 +923,7 @@ export const gracefulOutfitCreatables: Createable[] = [ }, outputItems: { [itemID('Hosidius graceful hood')]: 1 - }, - requiredFavour: Favours.Hosidius + } }, { name: 'Hosidius graceful top', @@ -964,8 +933,7 @@ export const gracefulOutfitCreatables: Createable[] = [ }, outputItems: { [itemID('Hosidius graceful top')]: 1 - }, - requiredFavour: Favours.Hosidius + } }, { name: 'Hosidius graceful legs', @@ -975,8 +943,7 @@ export const gracefulOutfitCreatables: Createable[] = [ }, outputItems: { [itemID('Hosidius graceful legs')]: 1 - }, - requiredFavour: Favours.Hosidius + } }, { name: 'Hosidius graceful gloves', @@ -986,8 +953,7 @@ export const gracefulOutfitCreatables: Createable[] = [ }, outputItems: { [itemID('Hosidius graceful gloves')]: 1 - }, - requiredFavour: Favours.Hosidius + } }, { name: 'Hosidius graceful boots', @@ -997,8 +963,7 @@ export const gracefulOutfitCreatables: Createable[] = [ }, outputItems: { [itemID('Hosidius graceful boots')]: 1 - }, - requiredFavour: Favours.Hosidius + } }, { name: 'Hosidius graceful cape', @@ -1008,8 +973,7 @@ export const gracefulOutfitCreatables: Createable[] = [ }, outputItems: { [itemID('Hosidius graceful cape')]: 1 - }, - requiredFavour: Favours.Hosidius + } }, { name: 'Revert Hosidius graceful', @@ -1029,7 +993,7 @@ export const gracefulOutfitCreatables: Createable[] = [ [itemID('Graceful boots')]: 1, [itemID('Graceful cape')]: 1 }, - requiredFavour: Favours.Hosidius, + noCl: true }, { @@ -1040,7 +1004,7 @@ export const gracefulOutfitCreatables: Createable[] = [ outputItems: { [itemID('Graceful hood')]: 1 }, - requiredFavour: Favours.Hosidius, + noCl: true }, { @@ -1051,7 +1015,7 @@ export const gracefulOutfitCreatables: Createable[] = [ outputItems: { [itemID('Graceful top')]: 1 }, - requiredFavour: Favours.Hosidius, + noCl: true }, { @@ -1062,7 +1026,7 @@ export const gracefulOutfitCreatables: Createable[] = [ outputItems: { [itemID('Graceful legs')]: 1 }, - requiredFavour: Favours.Hosidius, + noCl: true }, { @@ -1073,7 +1037,7 @@ export const gracefulOutfitCreatables: Createable[] = [ outputItems: { [itemID('Graceful gloves')]: 1 }, - requiredFavour: Favours.Hosidius, + noCl: true }, { @@ -1084,7 +1048,7 @@ export const gracefulOutfitCreatables: Createable[] = [ outputItems: { [itemID('Graceful boots')]: 1 }, - requiredFavour: Favours.Hosidius, + noCl: true }, { @@ -1095,7 +1059,7 @@ export const gracefulOutfitCreatables: Createable[] = [ outputItems: { [itemID('Graceful cape')]: 1 }, - requiredFavour: Favours.Hosidius, + noCl: true }, // Great Kourend diff --git a/src/lib/data/createables.ts b/src/lib/data/createables.ts index cd44634b45..7b43682d1b 100644 --- a/src/lib/data/createables.ts +++ b/src/lib/data/createables.ts @@ -1,7 +1,6 @@ import { Bank } from 'oldschooljs'; import { BitField } from '../constants'; -import { Favours } from '../minions/data/kourendFavour'; import { blisterwoodRequirements, ivandisRequirements } from '../minions/data/templeTrekking'; import { SlayerTaskUnlocksEnum } from '../slayer/slayerUnlocks'; import { ItemBank, Skills } from '../types'; @@ -40,7 +39,6 @@ export interface Createable { GPCost?: number; cantBeInCL?: boolean; requiredSlayerUnlocks?: SlayerTaskUnlocksEnum[]; - requiredFavour?: Favours; maxCanOwn?: number; onCreate?: (qty: number, user: MUser) => Promise<{ result: boolean; message: string }>; type?: 'pack' | 'unpack'; diff --git a/src/lib/minions/data/kourendFavour.ts b/src/lib/minions/data/kourendFavour.ts deleted file mode 100644 index c37add31b4..0000000000 --- a/src/lib/minions/data/kourendFavour.ts +++ /dev/null @@ -1,136 +0,0 @@ -import { Time } from 'e'; -import { Bank } from 'oldschooljs'; - -import { stringMatches } from '../../util'; -import { Skills } from './../../types/index'; - -export interface UserKourendFavour { - Arceuus: number; - Hosidius: number; - Lovakengj: number; - Piscarilius: number; - Shayzien: number; -} - -export const baseUserKourendFavour: UserKourendFavour = Object.freeze({ - Arceuus: 0, - Hosidius: 0, - Lovakengj: 0, - Piscarilius: 0, - Shayzien: 0 -}); - -interface KourendFavour { - name: string; - alias: string[]; - duration: number; - pointsGain: number; - skillReqs?: Skills; - xp?: number; - itemCost?: Bank; - itemsReceived: Bank | null; - qpRequired?: number; -} - -export enum Favours { - Arceuus = 'arceuus', - Hosidius = 'hosidius', - Lovakengj = 'lovakengj', - Piscarilius = 'piscarilius', - Shayzien = 'shayzien' -} - -export const KourendFavours: KourendFavour[] = [ - { - name: 'Arceuus', - alias: ['arce', 'arceu', 'arceuu', 'arceuus'], - duration: 30 * Time.Minute, - pointsGain: 50, - itemCost: new Bank({ - 'Stamina potion(4)': 2 - }), - itemsReceived: new Bank({ - 'Book of arcane knowledge': 13 - }) - }, - { - name: 'Hosidius', - alias: ['hosi', 'hosid', 'hosidi', 'hosidius'], - duration: 20 * Time.Minute, - pointsGain: 50, - itemCost: new Bank({ - Compost: 475, - Saltpetre: 475 - }), - itemsReceived: null - }, - { - name: 'Lovakengj', - alias: ['lova', 'lovak', 'lovake', 'lovakengj'], - duration: 2 * Time.Minute, - pointsGain: 1, - skillReqs: { - mining: 65, - smithing: 73 - }, - itemsReceived: new Bank({ - 'Volcanic sulphur': 9 - }) - }, - { - name: 'Piscarilius', - alias: ['pisc', 'pisca', 'piscar', 'piscarilius'], - duration: 30 * Time.Minute, - pointsGain: 25, - skillReqs: { - crafting: 30, - hunter: 15 - }, - itemCost: new Bank({ - Plank: 45, - 'Steel bar': 25 - }), - itemsReceived: null - }, - { - name: 'Shayzien', - alias: ['shay', 'shayz', 'shayzi', 'shayzien'], - duration: 30 * Time.Minute, - pointsGain: 50, - skillReqs: { - attack: 50, - strength: 50, - defence: 50, - hitpoints: 50, - prayer: 43 - }, - itemCost: new Bank({ - 'Stamina potion(4)': 2, - 'Prayer potion(4)': 2 - }), - itemsReceived: new Bank({ - 'Training manual': 3 - }) - } -]; - -export function findFavour(favourName: string): KourendFavour | undefined { - return KourendFavours.find( - item => - stringMatches(favourName, item.name) || - (item.alias && item.alias.some(alias => stringMatches(alias, favourName))) - ); -} - -export function gotFavour(user: MUser, favour: Favours | undefined, neededPoints: number): [boolean, number] { - const currentUserFavour = user.kourendFavour; - let gotEnoughPoints = false; - if (!favour || !currentUserFavour) return [gotEnoughPoints, neededPoints]; - for (const [key, value] of Object.entries(currentUserFavour) as [keyof UserKourendFavour, number][]) { - if (key.toLowerCase() === favour.toString().toLowerCase()) { - if (value >= neededPoints) gotEnoughPoints = true; - break; - } - } - return [gotEnoughPoints, neededPoints]; -} diff --git a/src/lib/minions/functions/darkAltarCommand.ts b/src/lib/minions/functions/darkAltarCommand.ts index d5b0af3802..355e1dfd3f 100644 --- a/src/lib/minions/functions/darkAltarCommand.ts +++ b/src/lib/minions/functions/darkAltarCommand.ts @@ -8,7 +8,6 @@ import { formatDuration, hasSkillReqs } from '../../util'; import addSubTaskToActivityTask from '../../util/addSubTaskToActivityTask'; import { calcMaxTripLength } from '../../util/calcMaxTripLength'; import getOSItem from '../../util/getOSItem'; -import { Favours, gotFavour } from '../data/kourendFavour'; export const darkAltarRunes = { soul: { @@ -41,10 +40,7 @@ export async function darkAltarCommand({ user, channelID, name }: { user: MUser; if (!hasReqs) { return `You can't craft Blood runes at the Dark Altar, because you don't have these required stats: ${neededReqs}.`; } - const [hasFavour, requiredPoints] = gotFavour(user, Favours.Arceuus, 100); - if (!hasFavour) { - return `Crafting Blood/Soul runes at the Dark Altar requires ${requiredPoints}% Arceuus Favour.`; - } + const rune = name.toLowerCase().includes('soul') ? 'soul' : 'blood'; const runeData = darkAltarRunes[rune]; diff --git a/src/lib/musicCape.ts b/src/lib/musicCape.ts index 1f9210985b..35ef6b33fc 100644 --- a/src/lib/musicCape.ts +++ b/src/lib/musicCape.ts @@ -236,20 +236,6 @@ AND data->>'runeID' IS NOT NULL;`; return [{ reason: 'You need to build something in your POH' }]; } }) - .add({ - name: 'Must have atleast 25% in each house favour', - has: async ({ user }) => { - const results: RequirementFailure[] = []; - const favour = user.kourendFavour; - - const notDoneFavours = Object.entries(favour).filter(([_, value]) => value < 25); - - if (notDoneFavours.length > 0) { - results.push({ reason: `You need atleast 25% favour in ${notDoneFavours.map(i => i[0]).join(', ')}.` }); - } - return results; - } - }) .add({ name: 'Champions Challenge', has: async ({ user }) => { diff --git a/src/lib/skilling/functions/calcsFarming.ts b/src/lib/skilling/functions/calcsFarming.ts index 7729737442..9a5fea0bb3 100644 --- a/src/lib/skilling/functions/calcsFarming.ts +++ b/src/lib/skilling/functions/calcsFarming.ts @@ -1,9 +1,8 @@ import { randInt } from 'e'; -import { Favours, gotFavour } from '../../minions/data/kourendFavour'; import { Plant, SkillsEnum } from '../types'; -export function calcNumOfPatches(plant: Plant, user: MUser, qp: number): [number, string | undefined] { +export function calcNumOfPatches(plant: Plant, user: MUser, qp: number): [number] { let numOfPatches = plant.defaultNumOfPatches; const farmingLevel = user.skillLevel(SkillsEnum.Farming); const questPoints = qp; @@ -14,13 +13,7 @@ export function calcNumOfPatches(plant: Plant, user: MUser, qp: number): [number break; } } - let errorMessage: string | undefined = undefined; for (let i = plant.additionalPatchesByFarmGuildAndLvl.length; i > 0; i--) { - const [hasFavour, requiredPoints] = gotFavour(user, Favours.Hosidius, 60); - if (!hasFavour) { - errorMessage = `${user.minionName} needs ${requiredPoints}% Hosidius Favour to use Farming guild patches.`; - break; - } const [farmingLevelReq, additionalPatches] = plant.additionalPatchesByFarmGuildAndLvl[i - 1]; if (farmingLevel >= farmingLevelReq) { numOfPatches += additionalPatches; @@ -34,7 +27,7 @@ export function calcNumOfPatches(plant: Plant, user: MUser, qp: number): [number break; } } - return [numOfPatches, errorMessage]; + return [numOfPatches]; } export function calcVariableYield( diff --git a/src/lib/structures/Requirements.ts b/src/lib/structures/Requirements.ts index 951a585c1e..5e6862bf26 100644 --- a/src/lib/structures/Requirements.ts +++ b/src/lib/structures/Requirements.ts @@ -7,7 +7,6 @@ import { ClueTier } from '../clues/clueTiers'; import { BitField, BitFieldData, BOT_TYPE } from '../constants'; import { diariesObject, DiaryTierName, userhasDiaryTier } from '../diaries'; import { effectiveMonsters } from '../minions/data/killableMonsters'; -import { UserKourendFavour } from '../minions/data/kourendFavour'; import { ClueBank } from '../minions/types'; import type { RobochimpUser } from '../roboChimp'; import { MinigameName } from '../settings/minigames'; @@ -51,7 +50,6 @@ type Requirement = { | { qpRequirement: number } | { lapsRequirement: Record } | { sacrificedItemsRequirement: Bank } - | { favour: Partial } | { OR: Requirement[] } | { minigames: Partial> } | { bitfieldRequirement: BitField } @@ -110,14 +108,6 @@ export class Requirements { requirementParts.push(`Sacrificed Items Requirement: ${req.sacrificedItemsRequirement.toString()}`); } - if ('favour' in req) { - requirementParts.push( - `Kourend Favour Requirement: ${Object.entries(req.favour) - .map(([k, v]) => `${v}% favour in ${k}`) - .join(', ')}.` - ); - } - if ('minigames' in req) { requirementParts.push( `Minigame Requirements: ${Object.entries(req.minigames) @@ -262,20 +252,6 @@ export class Requirements { } } - if ('favour' in requirement) { - const insufficientFavour = []; - for (const [house, favour] of objectEntries(requirement.favour)) { - if (user.kourendFavour[house] < favour!) { - insufficientFavour.push(`${favour}% favour in ${house}`); - } - } - if (insufficientFavour.length > 0) { - results.push({ - reason: `You need these favour: ${insufficientFavour.join(', ')}.` - }); - } - } - if ('minigames' in requirement) { const insufficientMinigames = []; for (const [minigame, score] of objectEntries(requirement.minigames)) { diff --git a/src/lib/util/repeatStoredTrip.ts b/src/lib/util/repeatStoredTrip.ts index e2ac988e49..d9d8aa6eb3 100644 --- a/src/lib/util/repeatStoredTrip.ts +++ b/src/lib/util/repeatStoredTrip.ts @@ -34,7 +34,6 @@ import { GuardiansOfTheRiftActivityTaskOptions, HerbloreActivityTaskOptions, HunterActivityTaskOptions, - KourendFavourActivityTaskOptions, MahoganyHomesActivityTaskOptions, MiningActivityTaskOptions, MonsterActivityTaskOptions, @@ -131,6 +130,10 @@ export const tripHandlers = { commandName: 'm', args: () => ({}) }, + [activity_type_enum.KourendFavour]: { + commandName: 'm', + args: () => ({}) + }, [activity_type_enum.AerialFishing]: { commandName: 'activities', args: () => ({ aerial_fishing: {} }) @@ -348,10 +351,6 @@ export const tripHandlers = { commandName: 'activities', args: () => ({ inferno: { action: 'start' } }) }, - [activity_type_enum.KourendFavour]: { - commandName: 'activities', - args: (data: KourendFavourActivityTaskOptions) => ({ favour: { name: data.favour } }) - }, [activity_type_enum.LastManStanding]: { commandName: 'minigames', args: () => ({ lms: { start: {} } }) diff --git a/src/mahoji/commands/activities.ts b/src/mahoji/commands/activities.ts index 14ca68192a..7c883469cd 100644 --- a/src/mahoji/commands/activities.ts +++ b/src/mahoji/commands/activities.ts @@ -4,7 +4,6 @@ import { UNDERWATER_AGILITY_THIEVING_TRAINING_SKILL, UnderwaterAgilityThievingTrainingSkill } from '../../lib/constants'; -import { KourendFavours } from '../../lib/minions/data/kourendFavour'; import { Planks } from '../../lib/minions/data/planks'; import Potions from '../../lib/minions/data/potions'; import birdhouses from '../../lib/skilling/skills/hunter/birdHouseTrapping'; @@ -26,7 +25,6 @@ import { collectables, collectCommand } from '../lib/abstracted_commands/collect import { decantCommand } from '../lib/abstracted_commands/decantCommand'; import { driftNetCommand } from '../lib/abstracted_commands/driftNetCommand'; import { enchantCommand } from '../lib/abstracted_commands/enchantCommand'; -import { favourCommand } from '../lib/abstracted_commands/favourCommand'; import { fightCavesCommand } from '../lib/abstracted_commands/fightCavesCommand'; import { infernoStartCommand, infernoStatsCommand } from '../lib/abstracted_commands/infernoCommand'; import { otherActivities, otherActivitiesCommand } from '../lib/abstracted_commands/otherActivitiesCommand'; @@ -180,26 +178,6 @@ export const activitiesCommand: OSBMahojiCommand = { } ] }, - { - type: ApplicationCommandOptionType.Subcommand, - name: 'favour', - description: 'Allows you to get Kourend Favour.', - options: [ - { - type: ApplicationCommandOptionType.String, - name: 'name', - description: 'The Kourend house.', - choices: KourendFavours.map(i => ({ name: i.name, value: i.name })), - required: false - }, - { - type: ApplicationCommandOptionType.Boolean, - name: 'no_stams', - description: "Don't use stamina potions when getting favour.", - required: false - } - ] - }, { type: ApplicationCommandOptionType.Subcommand, name: 'decant', @@ -528,7 +506,6 @@ export const activitiesCommand: OSBMahojiCommand = { quest?: { name?: string; }; - favour?: { name?: string; no_stams?: boolean }; decant?: { potion_name: string; dose?: number }; charge?: { item: string; quantity?: number }; fight_caves?: {}; @@ -611,9 +588,6 @@ export const activitiesCommand: OSBMahojiCommand = { if (options.quest) { return questCommand(user, channelID, options.quest.name); } - if (options.favour) { - return favourCommand(user, options.favour.name, channelID, options.favour.no_stams); - } if (options.charge?.item === 'glory') { return chargeGloriesCommand(user, channelID, options.charge.quantity); } diff --git a/src/mahoji/commands/buy.ts b/src/mahoji/commands/buy.ts index ce96d17ba2..b65d2c6a8c 100644 --- a/src/mahoji/commands/buy.ts +++ b/src/mahoji/commands/buy.ts @@ -4,7 +4,6 @@ import { Bank } from 'oldschooljs'; import { ItemBank } from 'oldschooljs/dist/meta/types'; import Buyables from '../../lib/data/buyables/buyables'; -import { gotFavour } from '../../lib/minions/data/kourendFavour'; import { getMinigameScore, Minigames } from '../../lib/settings/minigames'; import { prisma } from '../../lib/settings/prisma'; import { MUserStats } from '../../lib/structures/MUserStats'; @@ -103,13 +102,6 @@ export const buyCommand: OSBMahojiCommand = { )}.`; } - if (buyable.requiredFavour) { - const [success, points] = gotFavour(user, buyable.requiredFavour, 100); - if (!success) { - return `You don't have the required amount of Favour to buy this item.\n\nRequired: ${points}% ${buyable.requiredFavour.toString()} Favour.`; - } - } - if (buyable.minigameScoreReq) { const [key, req] = buyable.minigameScoreReq; let kc = await getMinigameScore(user.id, key); diff --git a/src/mahoji/commands/chop.ts b/src/mahoji/commands/chop.ts index 08f04f4617..d987b692d3 100644 --- a/src/mahoji/commands/chop.ts +++ b/src/mahoji/commands/chop.ts @@ -1,7 +1,6 @@ import { increaseNumByPercent, reduceNumByPercent } from 'e'; import { ApplicationCommandOptionType, CommandRunOptions } from 'mahoji'; -import { Favours, gotFavour } from '../../lib/minions/data/kourendFavour'; import { determineWoodcuttingTime } from '../../lib/skilling/functions/determineWoodcuttingTime'; import Woodcutting from '../../lib/skilling/skills/woodcutting'; import { WoodcuttingActivityTaskOptions } from '../../lib/types/minions'; @@ -129,19 +128,12 @@ export const chopCommand: OSBMahojiCommand = { return `${user.minionName} needs ${log.qpRequired} QP to cut ${log.name}.`; } - const [hasFavour, requiredPoints] = gotFavour(user, Favours.Hosidius, 75); - if (!hasFavour && log.name === 'Redwood Logs') { - return `${minionName( - user - )} needs ${requiredPoints}% Hosidius Favour to chop Redwood at the Woodcutting Guild!`; - } - const boosts = []; let wcLvl = skills.woodcutting; // Invisible wc boost for woodcutting guild - if (skills.woodcutting >= 60 && log.wcGuild && hasFavour) { + if (skills.woodcutting >= 60 && log.wcGuild) { boosts.push('+7 invisible WC lvls at the Woodcutting guild'); wcLvl += 7; } diff --git a/src/mahoji/commands/cook.ts b/src/mahoji/commands/cook.ts index 8e85654456..c7afc9a0b7 100644 --- a/src/mahoji/commands/cook.ts +++ b/src/mahoji/commands/cook.ts @@ -3,7 +3,6 @@ import { ApplicationCommandOptionType, CommandRunOptions } from 'mahoji'; import { Bank } from 'oldschooljs'; import { KourendKebosDiary, userhasDiaryTier } from '../../lib/diaries'; -import { Favours, gotFavour } from '../../lib/minions/data/kourendFavour'; import Cooking, { Cookables } from '../../lib/skilling/skills/cooking/cooking'; import LeapingFish from '../../lib/skilling/skills/cooking/leapingFish'; import { CookingActivityTaskOptions } from '../../lib/types/minions'; @@ -77,10 +76,10 @@ export const cookCommand: OSBMahojiCommand = { // These are just for notifying the user, they only take effect in the Activity. const boosts = []; + const [hasEasyDiary] = await userhasDiaryTier(user, KourendKebosDiary.easy); const [hasEliteDiary] = await userhasDiaryTier(user, KourendKebosDiary.elite); - const [hasFavour] = gotFavour(user, Favours.Hosidius, 100); - if (hasFavour) boosts.push('Using Hosidius Range'); - if (hasFavour && hasEliteDiary) boosts.push('Kourend Elite Diary'); + if (hasEasyDiary) boosts.push('Using Hosidius Range'); + if (hasEasyDiary && hasEliteDiary) boosts.push('Kourend Elite Diary'); const hasGaunts = user.hasEquipped('Cooking gauntlets'); if (hasGaunts) boosts.push('Cooking gauntlets equipped'); diff --git a/src/mahoji/commands/create.ts b/src/mahoji/commands/create.ts index 49bc5b7ee6..a33427a203 100644 --- a/src/mahoji/commands/create.ts +++ b/src/mahoji/commands/create.ts @@ -3,7 +3,6 @@ import { ApplicationCommandOptionType, CommandRunOptions } from 'mahoji'; import { Bank } from 'oldschooljs'; import Createables from '../../lib/data/createables'; -import { gotFavour } from '../../lib/minions/data/kourendFavour'; import { SkillsEnum } from '../../lib/skilling/types'; import { SlayerTaskUnlocksEnum } from '../../lib/slayer/slayerUnlocks'; import { hasSlayerUnlock } from '../../lib/slayer/slayerUtil'; @@ -103,21 +102,6 @@ export const createCommand: OSBMahojiCommand = { return `You don't have the required Slayer Unlocks to ${action} this item.\n\nRequired: ${errors}`; } } - if (createableItem.requiredFavour) { - const [success, points] = gotFavour(user, createableItem.requiredFavour, 100); - if (!success) { - return `You don't have the required amount of Favour to ${action} this item.\n\nRequired: ${points}% ${createableItem.requiredFavour.toString()} Favour.`; - } - } - - if (createableItem.name.toLowerCase().includes('kourend')) { - const currentUserFavour = user.kourendFavour; - for (const [key, value] of Object.entries(currentUserFavour)) { - if (value < 100) { - return `You don't have the required amount of Favour to ${action} this item.\n\nRequired: 100% ${key} Favour.`; - } - } - } if (createableItem.GPCost && user.GP < createableItem.GPCost * quantity) { return `You need ${createableItem.GPCost.toLocaleString()} coins to ${action} this item.`; diff --git a/src/mahoji/commands/fish.ts b/src/mahoji/commands/fish.ts index 8abc343bb5..cfcc40caa1 100644 --- a/src/mahoji/commands/fish.ts +++ b/src/mahoji/commands/fish.ts @@ -4,7 +4,6 @@ import { ApplicationCommandOptionType, CommandRunOptions } from 'mahoji'; import { Bank } from 'oldschooljs'; import TzTokJad from 'oldschooljs/dist/simulation/monsters/special/TzTokJad'; -import { Favours, gotFavour } from '../../lib/minions/data/kourendFavour'; import Fishing from '../../lib/skilling/skills/fishing'; import { SkillsEnum } from '../../lib/skilling/types'; import { FishingActivityTaskOptions } from '../../lib/types/minions'; @@ -63,10 +62,6 @@ export const fishCommand: OSBMahojiCommand = { return `You need ${fish.qpRequired} qp to catch those!`; } } - const [hasFavour, requiredPoints] = gotFavour(user, Favours.Piscarilius, 100); - if (!hasFavour && fish.name === 'Anglerfish') { - return `${user.minionName} needs ${requiredPoints}% Piscarilius Favour to fish Anglerfish!`; - } if ( fish.name === 'Barbarian fishing' && diff --git a/src/mahoji/commands/steal.ts b/src/mahoji/commands/steal.ts index 1d253a3756..7af63b93b3 100644 --- a/src/mahoji/commands/steal.ts +++ b/src/mahoji/commands/steal.ts @@ -4,7 +4,6 @@ import { randInt } from 'e'; import { ApplicationCommandOptionType, CommandRunOptions } from 'mahoji'; import { ArdougneDiary, userhasDiaryTier } from '../../lib/diaries'; -import { Favours, gotFavour } from '../../lib/minions/data/kourendFavour'; import removeFoodFromUser from '../../lib/minions/functions/removeFoodFromUser'; import { Stealable, stealables } from '../../lib/skilling/skills/thieving/stealables'; import { SkillsEnum } from '../../lib/skilling/types'; @@ -88,11 +87,6 @@ export const stealCommand: OSBMahojiCommand = { } a ${stealable.name}.`; } - const [hasFavour, requiredPoints] = gotFavour(user, Favours.Hosidius, 15); - if (!hasFavour && stealable.name === 'Fruit stall') { - return `${user.minionName} needs ${requiredPoints}% Hosidius Favour to steal fruit from the Fruit stalls!`; - } - const timeToTheft = stealable.type === 'pickpockable' ? (stealable.customTickRate ?? 2) * 600 : stealable.respawnTime; diff --git a/src/mahoji/commands/testpotato.ts b/src/mahoji/commands/testpotato.ts index 3006ae867a..eb10ce82a8 100644 --- a/src/mahoji/commands/testpotato.ts +++ b/src/mahoji/commands/testpotato.ts @@ -14,7 +14,6 @@ import { leaguesCreatables } from '../../lib/data/creatables/leagueCreatables'; import { Eatables } from '../../lib/data/eatables'; import { TOBMaxMageGear, TOBMaxMeleeGear, TOBMaxRangeGear } from '../../lib/data/tob'; import killableMonsters, { effectiveMonsters } from '../../lib/minions/data/killableMonsters'; -import { UserKourendFavour } from '../../lib/minions/data/kourendFavour'; import potions from '../../lib/minions/data/potions'; import { mahojiUserSettingsUpdate } from '../../lib/MUser'; import { allOpenables } from '../../lib/openables'; @@ -54,14 +53,7 @@ export async function giveMaxStats(user: MUser) { } await user.update({ QP: MAX_QP, - ...updates, - kourend_favour: { - Arceuus: 100, - Hosidius: 100, - Lovakengj: 100, - Piscarilius: 100, - Shayzien: 100 - } as UserKourendFavour as any + ...updates }); } diff --git a/src/mahoji/lib/abstracted_commands/farmingCommand.ts b/src/mahoji/lib/abstracted_commands/farmingCommand.ts index a2e839d892..cfb471853d 100644 --- a/src/mahoji/lib/abstracted_commands/farmingCommand.ts +++ b/src/mahoji/lib/abstracted_commands/farmingCommand.ts @@ -5,7 +5,6 @@ import { Bank } from 'oldschooljs'; import { superCompostables } from '../../../lib/data/filterables'; import { ArdougneDiary, userhasDiaryTier } from '../../../lib/diaries'; -import { Favours, gotFavour } from '../../../lib/minions/data/kourendFavour'; import { prisma } from '../../../lib/settings/prisma'; import { calcNumOfPatches } from '../../../lib/skilling/functions/calcsFarming'; import { getFarmingInfo } from '../../../lib/skilling/functions/getFarmingInfo'; @@ -165,11 +164,6 @@ export async function farmingPlantCommand({ return `${user.minionName} needs ${plant.level} Farming to plant ${plant.name}.`; } - const [hasFavour, requiredPoints] = gotFavour(user, Favours.Hosidius, 65); - if (!hasFavour && plant.name === 'Grape') { - return `${user.minionName} needs ${requiredPoints}% Hosidius Favour to plant Grapes.`; - } - const { patchesDetailed } = await getFarmingInfo(user.id); const patchType = patchesDetailed.find(i => i.patchName === plant.seedType)!; @@ -186,9 +180,9 @@ export async function farmingPlantCommand({ const treeStr = !planted ? null : treeCheck(planted, currentWoodcuttingLevel, GP, patchType.lastQuantity); if (treeStr) return treeStr; - const [numOfPatches, noFarmGuild] = calcNumOfPatches(plant, user, questPoints); + const [numOfPatches] = calcNumOfPatches(plant, user, questPoints); if (numOfPatches === 0) { - return 'There are no available patches to you. Note: 60% Hosidius favour is required for farming guild.'; + return 'There are no available patches to you.'; } const maxTripLength = calcMaxTripLength(user, 'Farming'); @@ -292,8 +286,6 @@ export async function farmingPlantCommand({ ); } - if (noFarmGuild) boostStr.push(noFarmGuild); - const inserted = await prisma.farmedCrop.create({ data: { user_id: user.id, diff --git a/src/mahoji/lib/abstracted_commands/farmingContractCommand.ts b/src/mahoji/lib/abstracted_commands/farmingContractCommand.ts index 5865c11848..51f2df322e 100644 --- a/src/mahoji/lib/abstracted_commands/farmingContractCommand.ts +++ b/src/mahoji/lib/abstracted_commands/farmingContractCommand.ts @@ -1,6 +1,5 @@ import { CommandResponse } from 'mahoji/dist/lib/structures/ICommand'; -import { Favours, gotFavour } from '../../../lib/minions/data/kourendFavour'; import { defaultFarmingContract } from '../../../lib/minions/farming'; import { ContractOption, FarmingContract, FarmingContractDifficultyLevel } from '../../../lib/minions/farming/types'; import { getPlantToGrow } from '../../../lib/skilling/functions/calcFarmingContracts'; @@ -45,11 +44,6 @@ export async function farmingContractCommand(userID: string, input?: ContractOpt return janeImage("You currently don't have a contract, so you can't ask for something easier!"); } - const [hasFavour, requiredPoints] = gotFavour(user, Favours.Hosidius, 60); - if (!hasFavour) { - return `${user.minionName} needs ${requiredPoints}% Hosidius Favour to enter the Farming Guild!`; - } - if (input !== 'easier' && farmingLevel < contractToFarmingLevel[input]) { return janeImage( `You need ${contractToFarmingLevel[input]} farming to receive a contract of ${input} difficulty!` diff --git a/src/mahoji/lib/abstracted_commands/favourCommand.ts b/src/mahoji/lib/abstracted_commands/favourCommand.ts deleted file mode 100644 index 364c49c939..0000000000 --- a/src/mahoji/lib/abstracted_commands/favourCommand.ts +++ /dev/null @@ -1,87 +0,0 @@ -import { Bank } from 'oldschooljs'; - -import { findFavour, KourendFavours } from '../../../lib/minions/data/kourendFavour'; -import { SkillsEnum } from '../../../lib/skilling/types'; -import { KourendFavourActivityTaskOptions } from '../../../lib/types/minions'; -import { formatDuration } from '../../../lib/util'; -import addSubTaskToActivityTask from '../../../lib/util/addSubTaskToActivityTask'; -import { calcMaxTripLength } from '../../../lib/util/calcMaxTripLength'; -import { minionIsBusy } from '../../../lib/util/minionIsBusy'; - -export async function favourCommand( - user: MUser, - favourName: string | undefined, - channelID: string, - noStams: boolean | undefined -) { - const currentUserFavour = user.kourendFavour; - if (!favourName || minionIsBusy(user.id)) { - let allFavourString: string = 'Your current Kourend Favour:'; - for (const [key, value] of Object.entries(currentUserFavour)) { - allFavourString += `\n**${key}**: ${value}%`; - } - return allFavourString; - } - const favour = findFavour(favourName); - if (!favour) { - return `Cannot find matching Kourend Favour. Possible Favours are: ${KourendFavours.map(i => i.name).join( - ', ' - )}.`; - } - const maxTripLength = calcMaxTripLength(user, 'KourendFavour'); - let currentPoints = 0; - for (const [key, value] of Object.entries(currentUserFavour)) { - if (key.toLowerCase() === favour.name.toLowerCase()) { - if (value >= 100) return `You already have the maximum amount of ${key} Favour ${value}%.`; - currentPoints = value; - break; - } - } - let quantity = Math.floor(maxTripLength / favour.duration); - if (quantity * favour.pointsGain + currentPoints > 100) { - quantity = Math.ceil((100 - currentPoints) / favour.pointsGain); - } - let duration = quantity * favour.duration; - - if (favour.qpRequired && user.QP < favour.qpRequired) { - return `You need ${favour.qpRequired} QP to do ${favour.name} Favour.`; - } - - if (favour.skillReqs) { - for (const [skillName, lvl] of Object.entries(favour.skillReqs)) { - if (user.skillLevel(skillName as SkillsEnum) < lvl) { - return `You need ${lvl} ${skillName} to do ${favour.name} Favour.`; - } - } - } - let cost: Bank = new Bank(); - let ns = false; - if (favour.itemCost) { - cost = favour.itemCost.clone().multiply(quantity); - if (cost.has('Stamina potion(4)') && noStams) { - // 50% longer trip time for not using stamina potion(4) - ns = true; - duration *= 1.5; - cost.remove('Stamina potion(4)', cost.amount('Stamina potion (4)')); - } - if (!user.owns(cost)) { - return `You don't have the items needed for this trip, you need: ${cost}.`; - } - await user.removeItemsFromBank(cost); - } - - await addSubTaskToActivityTask({ - favour: favour.name, - userID: user.id, - channelID: channelID.toString(), - quantity, - duration, - type: 'KourendFavour' - }); - - return `${user.minionName} is now completing ${favour.name} Favour tasks, it'll take around ${formatDuration( - duration - )} to finish.${cost.toString().length > 0 ? ` Removed ${cost} from your bank.` : ''}${ - ns ? '\n50% longer trip due to not using Stamina potions.' : '' - }`; -} diff --git a/src/mahoji/lib/abstracted_commands/minionKill.ts b/src/mahoji/lib/abstracted_commands/minionKill.ts index 12b1068142..a7166489b3 100644 --- a/src/mahoji/lib/abstracted_commands/minionKill.ts +++ b/src/mahoji/lib/abstracted_commands/minionKill.ts @@ -36,7 +36,6 @@ import { SlayerActivityConstants } from '../../../lib/minions/data/combatConstants'; import { revenantMonsters } from '../../../lib/minions/data/killableMonsters/revs'; -import { Favours, gotFavour } from '../../../lib/minions/data/kourendFavour'; import { AttackStyles, calculateMonsterFood, @@ -205,11 +204,6 @@ export async function minionKillCommand( const [hasReqs, reason] = hasMonsterRequirements(user, monster); if (!hasReqs) return reason ?? "You don't have the requirements to fight this monster"; - const [hasFavour, requiredPoints] = gotFavour(user, Favours.Shayzien, 100); - if (!hasFavour && monster.id === Monsters.LizardmanShaman.id) { - return `${user.minionName} needs ${requiredPoints}% Shayzien Favour to kill Lizardman shamans.`; - } - if (monster.diaryRequirement) { const [diary, tier]: [Diary, DiaryTier] = monster.diaryRequirement; const [hasDiary] = await userhasDiaryTier(user, tier); @@ -969,14 +963,7 @@ export async function monsterInfo(user: MUser, name: string): Promise 0) { itemRequirements.push(`**Items Required:** ${formatItemReqs(monster.itemsRequired)}\n`); diff --git a/src/mahoji/lib/abstracted_commands/pohCommand.ts b/src/mahoji/lib/abstracted_commands/pohCommand.ts index d115176440..24b479eaf0 100644 --- a/src/mahoji/lib/abstracted_commands/pohCommand.ts +++ b/src/mahoji/lib/abstracted_commands/pohCommand.ts @@ -3,7 +3,6 @@ import { ChatInputCommandInteraction } from 'discord.js'; import { Bank } from 'oldschooljs'; import { BitField } from '../../../lib/constants'; -import { Favours, gotFavour } from '../../../lib/minions/data/kourendFavour'; import { getPOHObject, GroupedPohObjects, itemsNotRefundable, PoHObjects } from '../../../lib/poh'; import { pohImageGenerator } from '../../../lib/pohImage'; import { prisma } from '../../../lib/settings/prisma'; @@ -98,12 +97,6 @@ export async function pohBuildCommand(interaction: ChatInputCommandInteraction, return `You need level ${formatSkillRequirements(obj.level)} to build a ${obj.name} in your house.`; } - if (obj.id === 29_149 || obj.id === 31_858) { - const [hasFavour, requiredPoints] = gotFavour(user, Favours.Arceuus, 100); - if (!hasFavour) { - return `Build Dark Altar/Occult altar requires ${requiredPoints}% Arceuus Favour.`; - } - } const inPlace = poh[obj.slot]; if (obj.slot === 'mounted_item' && inPlace !== null) { return 'You already have a item mount built.'; diff --git a/src/mahoji/lib/abstracted_commands/puroPuroCommand.ts b/src/mahoji/lib/abstracted_commands/puroPuroCommand.ts index 214424ed4a..4c5b892889 100644 --- a/src/mahoji/lib/abstracted_commands/puroPuroCommand.ts +++ b/src/mahoji/lib/abstracted_commands/puroPuroCommand.ts @@ -73,11 +73,6 @@ export async function puroPuroStartCommand( if (darkLure) { if (user.QP < 9) return 'To use Dark Lure, you need 9 QP.'; if (!hasDarkLureSkillReqs) return `To use Dark Lure, you need: ${lureReason}.`; - const currentUserFavour = user.kourendFavour; - for (const [key, value] of Object.entries(currentUserFavour)) { - if (value < 100) - return `You don't have the required amount of Favour to cast Dark Lure.\n\nRequired: 100% ${key} Favour.`; - } const { bank } = user; const natureRuneID = itemID('Nature rune'); const deathRuneID = itemID('Death rune'); diff --git a/src/mahoji/lib/abstracted_commands/sawmillCommand.ts b/src/mahoji/lib/abstracted_commands/sawmillCommand.ts index c764f892ee..6fbd0406ca 100644 --- a/src/mahoji/lib/abstracted_commands/sawmillCommand.ts +++ b/src/mahoji/lib/abstracted_commands/sawmillCommand.ts @@ -1,7 +1,6 @@ import { clamp, Time } from 'e'; import { Bank } from 'oldschooljs'; -import { Favours, gotFavour } from '../../../lib/minions/data/kourendFavour'; import { Planks } from '../../../lib/minions/data/planks'; import { SawmillActivityTaskOptions } from '../../../lib/types/minions'; import { formatDuration, itemNameFromID, stringMatches, toKMB } from '../../../lib/util'; @@ -34,9 +33,8 @@ export async function sawmillCommand( timePerPlank *= 0.9; boosts.push('10% for Graceful'); } - const [hasFavour] = gotFavour(user, Favours.Hosidius, 75); const skills = user.skillsAsLevels; - if (skills.woodcutting >= 60 && user.QP >= 50 && hasFavour) { + if (skills.woodcutting >= 60 && user.QP >= 50) { timePerPlank *= 0.9; boosts.push('10% for Woodcutting Guild unlocked'); } diff --git a/src/mahoji/lib/abstracted_commands/titheFarmCommand.ts b/src/mahoji/lib/abstracted_commands/titheFarmCommand.ts index 0ba0099180..aa4a71b818 100644 --- a/src/mahoji/lib/abstracted_commands/titheFarmCommand.ts +++ b/src/mahoji/lib/abstracted_commands/titheFarmCommand.ts @@ -4,7 +4,6 @@ import { Bank } from 'oldschooljs'; import { Emoji } from '../../../lib/constants'; import TitheFarmBuyables from '../../../lib/data/buyables/titheFarmBuyables'; -import { Favours, gotFavour } from '../../../lib/minions/data/kourendFavour'; import { TitheFarmActivityTaskOptions } from '../../../lib/types/minions'; import { formatDuration, stringMatches } from '../../../lib/util'; import addSubTaskToActivityTask from '../../../lib/util/addSubTaskToActivityTask'; @@ -45,10 +44,6 @@ export async function titheFarmCommand(user: MUser, channelID: string) { if (skills.farming < 34) { return `${user} needs 34 Farming to use the Tithe Farm!`; } - const [hasFavour, requiredPoints] = gotFavour(user, Favours.Hosidius, 100); - if (!hasFavour) { - return `${user.minionName} needs ${requiredPoints}% Hosidius Favour to use the Tithe Farm!`; - } const [duration, boostStr] = await determineDuration(user); diff --git a/src/tasks/minions/cookingActivity.ts b/src/tasks/minions/cookingActivity.ts index c625f74bfc..f6c9bc4b4b 100644 --- a/src/tasks/minions/cookingActivity.ts +++ b/src/tasks/minions/cookingActivity.ts @@ -1,7 +1,6 @@ import { Bank } from 'oldschooljs'; import { KourendKebosDiary, userhasDiaryTier } from '../../lib/diaries'; -import { Favours, gotFavour } from '../../lib/minions/data/kourendFavour'; import calcBurntCookables from '../../lib/skilling/functions/calcBurntCookables'; import Cooking from '../../lib/skilling/skills/cooking/cooking'; import { SkillsEnum } from '../../lib/skilling/types'; @@ -19,11 +18,11 @@ export const cookingTask: MinionTask = { let burnedAmount = 0; let stopBurningLvl = 0; + const [hasEasyDiary] = await userhasDiaryTier(user, KourendKebosDiary.easy); const [hasEliteDiary] = await userhasDiaryTier(user, KourendKebosDiary.elite); - const [hasFavour] = gotFavour(user, Favours.Hosidius, 100); const hasGaunts = user.hasEquipped('Cooking gauntlets'); - if (hasFavour && cookable.burnKourendBonus) { + if (hasEasyDiary && cookable.burnKourendBonus) { stopBurningLvl = cookable.burnKourendBonus[(hasEliteDiary ? 1 : 0) * 2 + (hasGaunts ? 1 : 0)]; } else if (cookable.stopBurnAtCG && hasGaunts) { stopBurningLvl = cookable.stopBurnAtCG; diff --git a/src/tasks/minions/kourendFavourActivity.ts b/src/tasks/minions/kourendFavourActivity.ts deleted file mode 100644 index 73adaf2446..0000000000 --- a/src/tasks/minions/kourendFavourActivity.ts +++ /dev/null @@ -1,75 +0,0 @@ -import { Bank } from 'oldschooljs'; - -import { KourendFavourActivityTaskOptions } from '../../lib/types/minions'; -import { handleTripFinish } from '../../lib/util/handleTripFinish'; -import { KourendFavours, UserKourendFavour } from './../../lib/minions/data/kourendFavour'; - -export const kourendTask: MinionTask = { - type: 'KourendFavour', - async run(data: KourendFavourActivityTaskOptions) { - let { quantity, userID, channelID } = data; - const favour = KourendFavours.find(i => i.name === data.favour)!; - const user = await mUserFetch(userID); - const favourPoints = favour.pointsGain * quantity; - let shayzienDone = false; - let totalPoints: number | undefined = undefined; - const currentUserFavour = user.kourendFavour; - for (const [key, value] of Object.entries(currentUserFavour) as [keyof UserKourendFavour, number][]) { - if (key.toLowerCase() === favour.name.toLowerCase()) { - totalPoints = Math.min(Number(value) + favourPoints, 100); - currentUserFavour[key] = totalPoints; - await user.update({ - kourend_favour: currentUserFavour as any - }); - if (key === 'Shayzien' && totalPoints === 100) shayzienDone = true; - break; - } - } - const confirmedFavour = KourendFavours.find(i => i.name === favour.name)!; - const loot = confirmedFavour.itemsReceived?.clone().multiply(quantity); - if (shayzienDone && loot) { - loot.add( - new Bank({ - 'Shayzien boots (1)': 5, - 'Shayzien gloves (1)': 5, - 'Shayzien greaves (1)': 5, - 'Shayzien helm (1)': 5, - 'Shayzien platebody (1)': 5, - 'Shayzien boots (2)': 5, - 'Shayzien gloves (2)': 5, - 'Shayzien greaves (2)': 5, - 'Shayzien helm (2)': 5, - 'Shayzien platebody (2)': 5, - 'Shayzien boots (3)': 5, - 'Shayzien gloves (3)': 5, - 'Shayzien greaves (3)': 5, - 'Shayzien helm (3)': 5, - 'Shayzien platebody (3)': 5, - 'Shayzien boots (4)': 5, - 'Shayzien gloves (4)': 5, - 'Shayzien greaves (4)': 5, - 'Shayzien helm (4)': 5, - 'Shayzien platebody (4)': 5, - 'Shayzien boots (5)': 5, - 'Shayzien gloves (5)': 5, - 'Shayzien greaves (5)': 5, - 'Shayzien helm (5)': 5, - 'Shayzien body (5)': 5 - }) - ); - } - if (loot) { - await transactItems({ - userID: user.id, - collectionLog: true, - itemsToAdd: loot - }); - } - - let str = `${user}, ${user.minionName} finished gaining ${favour.name} Favour, adding ${favourPoints}%.${ - totalPoints ? ` You now have a total of ${totalPoints}%.` : '' - }${loot ? ` You also received ${loot}.` : ''}`; - - handleTripFinish(user, channelID, str, undefined, data, loot ?? null); - } -}; diff --git a/tests/integration/migrateUser.test.ts b/tests/integration/migrateUser.test.ts index 0cb2754def..a6d0775af8 100644 --- a/tests/integration/migrateUser.test.ts +++ b/tests/integration/migrateUser.test.ts @@ -1173,7 +1173,6 @@ async function buildBaseUser(userId: string) { skills_strength: 13_034_431, skills_agility: randInt(1_000_000, 5_000_000), bitfield: [BitField.HasHosidiusWallkit], - kourend_favour: { Hosidius: 100, Arceuus: 0, Shayzien: 0, Lovakengj: 0 }, GP: 100_000_000 }; const user = await createTestUser(startBank, userData); diff --git a/tests/integration/setup.ts b/tests/integration/setup.ts index baf9a63b96..043df84e3f 100644 --- a/tests/integration/setup.ts +++ b/tests/integration/setup.ts @@ -31,7 +31,6 @@ globalClient.fetchUser = async (id: string | bigint) => ({ beforeEach(async () => { await prisma.$connect(); - console.log(await prisma.$queryRawUnsafe('select count(*) from pg_stat_activity;')); }); afterEach(async () => { diff --git a/tests/unit/snapshots/banksnapshots.test.ts.snap b/tests/unit/snapshots/banksnapshots.test.ts.snap index 4452333099..4762a26d93 100644 --- a/tests/unit/snapshots/banksnapshots.test.ts.snap +++ b/tests/unit/snapshots/banksnapshots.test.ts.snap @@ -1111,7 +1111,6 @@ exports[`OSB Buyables 1`] = ` }, "name": "Arceuus signet", "outputItems": undefined, - "requiredFavour": "arceuus", }, { "gpCost": 100000, @@ -17824,7 +17823,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "arceuus", }, { "cantHaveItems": undefined, @@ -17842,7 +17840,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "arceuus", }, { "cantHaveItems": undefined, @@ -17860,7 +17857,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "arceuus", }, { "cantHaveItems": undefined, @@ -17878,7 +17874,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "arceuus", }, { "cantHaveItems": undefined, @@ -17896,7 +17891,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "arceuus", }, { "cantHaveItems": undefined, @@ -17914,7 +17908,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "arceuus", }, { "cantHaveItems": undefined, @@ -17932,7 +17925,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "arceuus", }, { "cantHaveItems": undefined, @@ -17960,7 +17952,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "arceuus", }, { "cantHaveItems": undefined, @@ -17978,7 +17969,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "arceuus", }, { "cantHaveItems": undefined, @@ -17996,7 +17986,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "arceuus", }, { "cantHaveItems": undefined, @@ -18014,7 +18003,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "arceuus", }, { "cantHaveItems": undefined, @@ -18032,7 +18020,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "arceuus", }, { "cantHaveItems": undefined, @@ -18050,7 +18037,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "arceuus", }, { "cantHaveItems": undefined, @@ -18068,7 +18054,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "arceuus", }, { "cantHaveItems": undefined, @@ -18096,7 +18081,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "piscarilius", }, { "cantHaveItems": undefined, @@ -18114,7 +18098,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "piscarilius", }, { "cantHaveItems": undefined, @@ -18132,7 +18115,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "piscarilius", }, { "cantHaveItems": undefined, @@ -18150,7 +18132,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "piscarilius", }, { "cantHaveItems": undefined, @@ -18168,7 +18149,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "piscarilius", }, { "cantHaveItems": undefined, @@ -18186,7 +18166,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "piscarilius", }, { "cantHaveItems": undefined, @@ -18204,7 +18183,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "piscarilius", }, { "cantHaveItems": undefined, @@ -18232,7 +18210,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "piscarilius", }, { "cantHaveItems": undefined, @@ -18250,7 +18227,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "piscarilius", }, { "cantHaveItems": undefined, @@ -18268,7 +18244,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "piscarilius", }, { "cantHaveItems": undefined, @@ -18286,7 +18261,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "piscarilius", }, { "cantHaveItems": undefined, @@ -18304,7 +18278,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "piscarilius", }, { "cantHaveItems": undefined, @@ -18322,7 +18295,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "piscarilius", }, { "cantHaveItems": undefined, @@ -18340,7 +18312,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "piscarilius", }, { "cantHaveItems": undefined, @@ -18368,7 +18339,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "lovakengj", }, { "cantHaveItems": undefined, @@ -18386,7 +18356,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "lovakengj", }, { "cantHaveItems": undefined, @@ -18404,7 +18373,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "lovakengj", }, { "cantHaveItems": undefined, @@ -18422,7 +18390,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "lovakengj", }, { "cantHaveItems": undefined, @@ -18440,7 +18407,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "lovakengj", }, { "cantHaveItems": undefined, @@ -18458,7 +18424,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "lovakengj", }, { "cantHaveItems": undefined, @@ -18476,7 +18441,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "lovakengj", }, { "cantHaveItems": undefined, @@ -18504,7 +18468,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "lovakengj", }, { "cantHaveItems": undefined, @@ -18522,7 +18485,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "lovakengj", }, { "cantHaveItems": undefined, @@ -18540,7 +18502,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "lovakengj", }, { "cantHaveItems": undefined, @@ -18558,7 +18519,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "lovakengj", }, { "cantHaveItems": undefined, @@ -18576,7 +18536,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "lovakengj", }, { "cantHaveItems": undefined, @@ -18594,7 +18553,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "lovakengj", }, { "cantHaveItems": undefined, @@ -18612,7 +18570,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "lovakengj", }, { "cantHaveItems": undefined, @@ -18640,7 +18597,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "shayzien", }, { "cantHaveItems": undefined, @@ -18658,7 +18614,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "shayzien", }, { "cantHaveItems": undefined, @@ -18676,7 +18631,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "shayzien", }, { "cantHaveItems": undefined, @@ -18694,7 +18648,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "shayzien", }, { "cantHaveItems": undefined, @@ -18712,7 +18665,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "shayzien", }, { "cantHaveItems": undefined, @@ -18730,7 +18682,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "shayzien", }, { "cantHaveItems": undefined, @@ -18748,7 +18699,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "shayzien", }, { "cantHaveItems": undefined, @@ -18776,7 +18726,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "shayzien", }, { "cantHaveItems": undefined, @@ -18794,7 +18743,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "shayzien", }, { "cantHaveItems": undefined, @@ -18812,7 +18760,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "shayzien", }, { "cantHaveItems": undefined, @@ -18830,7 +18777,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "shayzien", }, { "cantHaveItems": undefined, @@ -18848,7 +18794,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "shayzien", }, { "cantHaveItems": undefined, @@ -18866,7 +18811,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "shayzien", }, { "cantHaveItems": undefined, @@ -18884,7 +18828,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "shayzien", }, { "cantHaveItems": undefined, @@ -18912,7 +18855,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "hosidius", }, { "cantHaveItems": undefined, @@ -18930,7 +18872,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "hosidius", }, { "cantHaveItems": undefined, @@ -18948,7 +18889,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "hosidius", }, { "cantHaveItems": undefined, @@ -18966,7 +18906,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "hosidius", }, { "cantHaveItems": undefined, @@ -18984,7 +18923,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "hosidius", }, { "cantHaveItems": undefined, @@ -19002,7 +18940,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "hosidius", }, { "cantHaveItems": undefined, @@ -19020,7 +18957,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "hosidius", }, { "cantHaveItems": undefined, @@ -19048,7 +18984,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "hosidius", }, { "cantHaveItems": undefined, @@ -19066,7 +19001,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "hosidius", }, { "cantHaveItems": undefined, @@ -19084,7 +19018,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "hosidius", }, { "cantHaveItems": undefined, @@ -19102,7 +19035,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "hosidius", }, { "cantHaveItems": undefined, @@ -19120,7 +19052,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "hosidius", }, { "cantHaveItems": undefined, @@ -19138,7 +19069,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "hosidius", }, { "cantHaveItems": undefined, @@ -19156,7 +19086,6 @@ exports[`OSB Creatables 1`] = ` }, "frozen": false, }, - "requiredFavour": "hosidius", }, { "cantHaveItems": undefined, diff --git a/tests/unit/utils.ts b/tests/unit/utils.ts index b02814e0b1..02ec2008e9 100644 --- a/tests/unit/utils.ts +++ b/tests/unit/utils.ts @@ -77,13 +77,6 @@ export const mockUser = (overrides?: MockUserArgs): User => { bitfield: overrides?.bitfield ?? [], username: 'Magnaboy', QP: overrides?.QP ?? 0, - kourend_favour: { - Arceuus: 0, - Hosidius: 0, - Lovakengj: 0, - Piscarilius: 0, - Shayzien: 0 - }, sacrificedValue: 0, id: overrides?.id ?? '', monsterScores: {} From 4712b2ff11befb4b49d387de9ef2a8702c68ba95 Mon Sep 17 00:00:00 2001 From: GC <30398469+gc@users.noreply.github.com> Date: Mon, 26 Feb 2024 00:01:31 +1100 Subject: [PATCH 09/15] Test fix (maybe) (#5721) --- .env.test | 2 +- tests/integration/grandExchange.test.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.env.test b/.env.test index bca1e62bd3..42706042aa 100644 --- a/.env.test +++ b/.env.test @@ -6,4 +6,4 @@ PATREON_TOKEN=asdfasdfasdf PATREON_WEBHOOK_SECRET=asdfasdfasdf HTTP_PORT=7373 CLIENT_ID=111398433321891634 -PRISMA_CLIENT_ENGINE_TYPE=binary \ No newline at end of file +# PRISMA_CLIENT_ENGINE_TYPE=binary \ No newline at end of file diff --git a/tests/integration/grandExchange.test.ts b/tests/integration/grandExchange.test.ts index 3a64a6d6ea..3d22e59088 100644 --- a/tests/integration/grandExchange.test.ts +++ b/tests/integration/grandExchange.test.ts @@ -123,6 +123,7 @@ describe('Grand Exchange', async () => { } await Promise.all(cancelPromises); + await GrandExchange.queue.onEmpty(); console.log('Finished cancelling'); await Promise.all(users.map(u => u.sync())); From 98cba2d8aca39070d26d8efe1d5876d07da85520 Mon Sep 17 00:00:00 2001 From: GC <30398469+gc@users.noreply.github.com> Date: Mon, 26 Feb 2024 22:59:39 +1100 Subject: [PATCH 10/15] Test improvements/fixes (#5722) --- .github/workflows/integration_tests.yml | 1 + .github/workflows/unit_tests.yml | 1 + package.json | 4 +- prisma/schema.prisma | 4 +- src/lib/grandExchange.ts | 43 +- src/lib/util/smallUtils.ts | 2 +- src/scripts/integration-tests.ts | 8 +- tests/integration/grandExchange.test.ts | 74 +- tests/integration/util.ts | 6 + vitest.integration.config.ts | 8 +- vitest.unit.config.ts | 5 +- yarn.lock | 915 +++++++++++++----------- 12 files changed, 582 insertions(+), 489 deletions(-) diff --git a/.github/workflows/integration_tests.yml b/.github/workflows/integration_tests.yml index 117c536840..79e9bfaf6d 100644 --- a/.github/workflows/integration_tests.yml +++ b/.github/workflows/integration_tests.yml @@ -11,6 +11,7 @@ jobs: test: name: Node v${{ matrix.node_version }} - ${{ matrix.os }} runs-on: ${{ matrix.os }} + timeout-minutes: 5 strategy: matrix: node_version: [18.12.0, 20] diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 9bb15e4a59..675ebb2847 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -11,6 +11,7 @@ jobs: test: name: Node v${{ matrix.node_version }} - ${{ matrix.os }} runs-on: ${{ matrix.os }} + timeout-minutes: 5 strategy: matrix: node_version: [18.12.0, 20] diff --git a/package.json b/package.json index 31f2864901..2e28c085c8 100644 --- a/package.json +++ b/package.json @@ -70,7 +70,7 @@ "@types/node-fetch": "^2.6.1", "@typescript-eslint/eslint-plugin": "^5.41.0", "@typescript-eslint/parser": "^5.41.0", - "@vitest/coverage-c8": "^0.31.0", + "@vitest/coverage-v8": "^1.3.1", "concurrently": "^7.6.0", "dotenv-cli": "^7.3.0", "esbuild": "^0.19.5", @@ -87,7 +87,7 @@ "rimraf": "^4.4.0", "source-map-support": "^0.5.21", "typescript": "5.0.2", - "vitest": "^0.31.0" + "vitest": "^1.3.1" }, "engines": { "node": ">=18.12.0" diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 607b0288bb..fafeb0c934 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -1012,10 +1012,10 @@ model GETransaction { total_tax_paid BigInt - buy_listing GEListing @relation("buy_transactions", fields: [buy_listing_id], references: [id]) + buy_listing GEListing @relation("buy_transactions", fields: [buy_listing_id], references: [id], onDelete: Cascade) buy_listing_id Int - sell_listing GEListing @relation("sell_transactions", fields: [sell_listing_id], references: [id]) + sell_listing GEListing @relation("sell_transactions", fields: [sell_listing_id], references: [id], onDelete: Cascade) sell_listing_id Int @@index([sell_listing_id]) diff --git a/src/lib/grandExchange.ts b/src/lib/grandExchange.ts index 418df03f1e..2a0bb4cee4 100644 --- a/src/lib/grandExchange.ts +++ b/src/lib/grandExchange.ts @@ -529,7 +529,7 @@ ${type} ${toKMB(quantity)} ${item.name} for ${toKMB(price)} each, for a total of } debugLog( - `Completing a transaction, removing ${bankToRemoveFromGeBank} from the GE bank, ${totalTaxPaid} in taxed gp. The current GE bank is ${geBank.toString()}.`, + `Completing a transaction, removing ${bankToRemoveFromGeBank} from the GE bank, ${totalTaxPaid} in taxed gp. The current GE bank is ${geBank.toString()}. ${debug}`, { totalPriceAfterTax, totalTaxPaid, @@ -766,9 +766,18 @@ ${type} ${toKMB(quantity)} ${item.name} for ${toKMB(price)} each, for a total of debugLog(`Expected G.E Bank: ${shouldHave}`); if (!currentBank.equals(shouldHave)) { - throw new Error( - `GE either has extra or insufficient items. Difference: ${shouldHave.difference(currentBank)}` - ); + if (!currentBank.has(shouldHave)) { + throw new Error( + `GE is MISSING items to cover the ${[...buyListings, ...sellListings].length}x active listings. +G.E Bank Has: ${currentBank} +G.E Bank Should Have: ${shouldHave} +Difference: ${shouldHave.difference(currentBank)}` + ); + } + throw new Error(`GE has EXTRA items. +G.E Bank Has: ${currentBank} +G.E Bank Should Have: ${shouldHave} +Difference: ${shouldHave.difference(currentBank)}`); } else { debugLog( `GE has ${currentBank}, which is enough to cover the ${ @@ -780,21 +789,17 @@ ${type} ${toKMB(quantity)} ${item.name} for ${toKMB(price)} each, for a total of } async tick() { - return new Promise((resolve, reject) => { - this.queue.add(async () => { - if (this.isTicking) return reject(new Error('Already ticking.')); - this.isTicking = true; - try { - await this._tick(); - } catch (err: any) { - logError(err.message); - debugLog(err.message); - return reject(err); - } finally { - this.isTicking = false; - resolve(); - } - }); + await this.queue.add(async () => { + if (this.isTicking) throw new Error('Already ticking.'); + try { + await this._tick(); + } catch (err: any) { + logError(err.message); + debugLog(err.message); + throw err; + } finally { + this.isTicking = false; + } }); } diff --git a/src/lib/util/smallUtils.ts b/src/lib/util/smallUtils.ts index f0cc081665..fef9d06d72 100644 --- a/src/lib/util/smallUtils.ts +++ b/src/lib/util/smallUtils.ts @@ -170,7 +170,7 @@ export function makeAutoFarmButton() { export const SQL_sumOfAllCLItems = (clItems: number[]) => `NULLIF(${clItems.map(i => `COALESCE(("collectionLogBank"->>'${i}')::int, 0)`).join(' + ')}, 0)`; -export const generateGrandExchangeID = () => miniID(5).toLowerCase(); +export const generateGrandExchangeID = () => miniID(6).toLowerCase(); export function tailFile(fileName: string, numLines: number): Promise { return new Promise((resolve, reject) => { diff --git a/src/scripts/integration-tests.ts b/src/scripts/integration-tests.ts index 6a114b8ef7..f24fb5853b 100644 --- a/src/scripts/integration-tests.ts +++ b/src/scripts/integration-tests.ts @@ -8,14 +8,18 @@ async function main() { console.log('Waiting...'); await sleep(2000); - console.log('Starting...'); + console.log('Getting ready...'); execSync('dotenv -e .env.test -- prisma db push --schema="./prisma/schema.prisma"', { stdio: 'inherit' }); execSync('dotenv -e .env.test -- prisma db push --schema="./prisma/robochimp.prisma"', { stdio: 'inherit' }); + + console.log('Building...'); execSync('yarn prebuild:scripts', { stdio: 'inherit' }); execSync('yarn build:esbuild', { stdio: 'inherit' }); + console.log('Starting tests...'); let runs = 1; for (let i = 0; i < runs; i++) { + console.log(`Starting run ${i + 1}/${runs}`); execSync('vitest run --config vitest.integration.config.ts', { stdio: 'inherit', encoding: 'utf-8' @@ -23,9 +27,9 @@ async function main() { console.log(`Finished run ${i + 1}/${runs}`); } } catch (err) { + console.error(err); throw new Error(err as any); } finally { - await sleep(5000); console.log('Shutting down containers...'); execSync('docker-compose down', { stdio: 'inherit' }); } diff --git a/tests/integration/grandExchange.test.ts b/tests/integration/grandExchange.test.ts index 3d22e59088..d4b730dbd4 100644 --- a/tests/integration/grandExchange.test.ts +++ b/tests/integration/grandExchange.test.ts @@ -38,23 +38,25 @@ const sampleBank = new Bank() .freeze(); async function cancelAllListings(user: TestUser) { - const results: string[] = []; const activeListings = await global.prisma!.gEListing.findMany({ where: { user_id: user.id } }); for (const listing of activeListings) { - results.push( - (await user.runCommand(geCommand, { - cancel: { - listing: listing.userfacing_id - } - })) as string - ); - } + const result = (await user.runCommand(geCommand, { + cancel: { + listing: listing.userfacing_id + } + })) as string; - return results.join('\n'); + if ( + result !== 'You cannot cancel a listing that has already been fulfilled.' && + !result.startsWith('Successfully cancelled your listing,') + ) { + throw new Error(`Unexpected result from cancelling listing: ${result}`); + } + } } describe('Grand Exchange', async () => { @@ -62,6 +64,11 @@ describe('Grand Exchange', async () => { GrandExchange.calculateSlotsOfUser = async () => ({ slots: 500 } as any); await mockClient(); + async function waitForGEToBeEmpty() { + await GrandExchange.queue.onEmpty(); + assert(!GrandExchange.locked, 'G.E should not be locked'); + } + test( 'Fuzz', async () => { @@ -72,7 +79,7 @@ describe('Grand Exchange', async () => { const currentOwnedBank = await GrandExchange.fetchOwnedBank(); expect(currentOwnedBank.toString()).toEqual(new Bank().toString()); - let amountOfUsers = randInt(433, 533); + let amountOfUsers = randInt(100, 200); const totalExpectedBank = sampleBank.clone().multiply(amountOfUsers); let users: TestUser[] = []; @@ -84,6 +91,7 @@ describe('Grand Exchange', async () => { } console.log(`Finished initializing ${amountOfUsers} users`); + // Run a bunch of commands to buy/sell const commandPromises = new PQueue({ concurrency: 10 }); for (const user of shuffleArr(users)) { const method = randArrItem(['buy', 'sell']); @@ -101,33 +109,42 @@ describe('Grand Exchange', async () => { } }); } - await commandPromises.onEmpty(); - await GrandExchange.queue.onEmpty(); - + await waitForGEToBeEmpty(); console.log('Finished running all commands'); + // Tick the g.e to make some transactions for (let i = 0; i < 100; i++) { await GrandExchange.tick(); + await waitForGEToBeEmpty(); await Promise.all([ GrandExchange.checkGECanFullFilAllListings(), GrandExchange.extensiveVerification() ]); } + await waitForGEToBeEmpty(); console.log('Finished ticking 100 times'); - const testBank = new Bank(); + // Cancel all remaining listings const cancelPromises = []; for (const user of users) { cancelPromises.push(cancelAllListings(user)); } - await Promise.all(cancelPromises); - await GrandExchange.queue.onEmpty(); + await waitForGEToBeEmpty(); + const { buyListings, sellListings } = await GrandExchange.fetchActiveListings(); + if (buyListings.length > 0 || sellListings.length > 0) { + throw new Error('There should be no active listings!'); + } + const newCurrentOwnedBank = await GrandExchange.fetchOwnedBank(); + if (newCurrentOwnedBank.length !== 0) { + throw new Error('There should be no items in the G.E bank!'); + } console.log('Finished cancelling'); await Promise.all(users.map(u => u.sync())); + const testBank = new Bank(); for (const user of users) { testBank.add(user.bankWithGP); } @@ -137,8 +154,8 @@ describe('Grand Exchange', async () => { const data = await GrandExchange.fetchData(); expect(data.isLocked).toEqual(false); - expect(data.taxBank).toBeGreaterThan(0); - expect(data.totalTax).toBeGreaterThan(0); + expect(data.taxBank, '1MS').toBeGreaterThan(0); + expect(data.totalTax, 'L1M').toBeGreaterThan(0); const totalTaxed = await global.prisma!.gETransaction.aggregate({ _sum: { @@ -146,14 +163,19 @@ describe('Grand Exchange', async () => { } }); const totalTaxGP = Number(totalTaxed._sum.total_tax_paid!); - expect(totalTaxGP).toEqual(data.taxBank); - expect(totalTaxGP).toEqual(data.totalTax); - expect(testBank.amount('Coins')).toBeLessThanOrEqual(totalExpectedBank.amount('Coins')); - expect(testBank.amount('Coins') + totalTaxGP).toEqual(totalExpectedBank.amount('Coins')); - expect(testBank.toString()).toEqual(totalExpectedBank.clone().remove('Coins', totalTaxGP).toString()); + const taxDebugStr = `Based on transactions, received ${totalTaxGP} tax +Based on G.E data, we should have received ${data.totalTax} tax`; + expect(totalTaxGP, taxDebugStr).toEqual(data.taxBank); + expect(totalTaxGP, taxDebugStr).toEqual(data.totalTax); + expect(testBank.amount('Coins'), 'A5D').toBeLessThanOrEqual(totalExpectedBank.amount('Coins')); + expect(testBank.amount('Coins') + totalTaxGP, 'M3S').toEqual(totalExpectedBank.amount('Coins')); + expect(testBank.toString(), '9N3').toEqual( + totalExpectedBank.clone().remove('Coins', totalTaxGP).toString() + ); await GrandExchange.queue.onEmpty(); assert(GrandExchange.queue.size === 0, 'Queue should be empty'); + const geBank = await GrandExchange.fetchOwnedBank(); }, { repeats: 1, @@ -237,7 +259,7 @@ describe('Grand Exchange', async () => { expect(bank.length).toEqual(0); const data = await GrandExchange.fetchData(); - expect(data.taxBank).toEqual(totalTax); - expect(data.totalTax).toEqual(totalTax); + expect(data.taxBank, 'LZ9').toEqual(totalTax); + expect(data.totalTax, 'M39').toEqual(totalTax); }); }); diff --git a/tests/integration/util.ts b/tests/integration/util.ts index e1b18d1ef9..f090e79f0c 100644 --- a/tests/integration/util.ts +++ b/tests/integration/util.ts @@ -123,12 +123,18 @@ export class TestUser extends MUserClass { } } +const idsUsed = new Set(); + export function mockedId() { return cryptoRand(1_000_000_000, 5_000_000_000_000).toString(); } export async function createTestUser(bank?: Bank, userData: Partial = {}) { const id = userData?.id ?? mockedId(); + if (idsUsed.has(id)) { + throw new Error(`ID ${id} has already been used`); + } + idsUsed.add(id); const user = await global.prisma!.user.upsert({ create: { id, diff --git a/vitest.integration.config.ts b/vitest.integration.config.ts index 871ff59afb..adb3616b99 100644 --- a/vitest.integration.config.ts +++ b/vitest.integration.config.ts @@ -6,15 +6,15 @@ export default defineConfig({ include: ['tests/integration/**/*.test.ts'], setupFiles: 'tests/integration/setup.ts', coverage: { - provider: 'c8', + provider: 'v8', reporter: 'text', include: ['src/lib/MUser.ts'] }, testTimeout: 30_000, bail: 1, - threads: true, maxConcurrency: 1, - minThreads: 1, - maxThreads: 3 + maxWorkers: 1, + minWorkers: 1, + pool: 'forks' } }); diff --git a/vitest.unit.config.ts b/vitest.unit.config.ts index 4ee325fa5c..cb2406e53f 100644 --- a/vitest.unit.config.ts +++ b/vitest.unit.config.ts @@ -7,13 +7,12 @@ export default defineConfig({ name: 'Old School Bot - Unit', include: ['tests/unit/**/*.test.ts'], coverage: { - provider: 'c8', + provider: 'v8', reporter: 'html', include: ['src/lib/structures/Gear.ts', 'src/lib/util/parseStringBank.ts', 'src/lib/util/equipMulti.ts'] }, setupFiles: 'tests/unit/setup.ts', resolveSnapshotPath: (testPath, extension) => - join(join(dirname(testPath), 'snapshots'), `${basename(testPath)}${extension}`), - threads: false + join(join(dirname(testPath), 'snapshots'), `${basename(testPath)}${extension}`) } }); diff --git a/yarn.lock b/yarn.lock index 70a939dea0..6c5fe69ffa 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,7 +2,7 @@ # yarn lockfile v1 -"@ampproject/remapping@^2.2.0": +"@ampproject/remapping@^2.2.1": version "2.2.1" resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.2.1.tgz#99e8e11851128b8702cd57c33684f1d0f260b630" integrity sha512-lFMjJTrFL3j7L9yBxwYfCq2k6qqwHyzuUl/XBnif78PWTJYyL/dfowQHWE3sp6U6ZzqWiiIZnpTMO96zhkjwtg== @@ -24,11 +24,21 @@ dependencies: "@babel/highlight" "^7.22.5" +"@babel/helper-string-parser@^7.23.4": + version "7.23.4" + resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.23.4.tgz#9478c707febcbbe1ddb38a3d91a2e054ae622d83" + integrity sha512-803gmbQdqwdf4olxrX4AJyFBV/RTr3rSmOj0rKwesmzlfhYNDEs+/iOcznzpNWlJlIlTJC2QfPFcHB6DlzdVLQ== + "@babel/helper-validator-identifier@^7.18.6", "@babel/helper-validator-identifier@^7.19.1": version "7.19.1" resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz#7eea834cf32901ffdc1a7ee555e2f9c27e249ca2" integrity sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w== +"@babel/helper-validator-identifier@^7.22.20": + version "7.22.20" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz#c4ae002c61d2879e724581d96665583dbc1dc0e0" + integrity sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A== + "@babel/helper-validator-identifier@^7.22.5": version "7.22.5" resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.5.tgz#9544ef6a33999343c8740fa51350f30eeaaaf193" @@ -57,6 +67,11 @@ resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.20.13.tgz#ddf1eb5a813588d2fb1692b70c6fce75b945c088" integrity sha512-gFDLKMfpiXCsjt4za2JA9oTMn70CeseCehb11kRZgvd7+F67Hih3OHOK24cRrWECJ/ljfPGac6ygXAs/C8kIvw== +"@babel/parser@^7.23.6": + version "7.23.9" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.23.9.tgz#7b903b6149b0f8fa7ad564af646c4c38a77fc44b" + integrity sha512-9tcKgqKbs3xGJ+NtKF2ndOBBLVwPjl1SHxPQkd36r3Dlirw3xWUeGaTbqr7uGZcTaxkVNwc+03SVP7aCdWrTlA== + "@babel/runtime@^7.21.0": version "7.23.9" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.23.9.tgz#47791a15e4603bb5f905bc0753801cf21d6345f7" @@ -64,6 +79,15 @@ dependencies: regenerator-runtime "^0.14.0" +"@babel/types@^7.23.6": + version "7.23.9" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.23.9.tgz#1dd7b59a9a2b5c87f8b41e52770b5ecbf492e002" + integrity sha512-dQjSq/7HaSjRM43FFGnv5keM2HsxpmyV1PfaSVm0nzzjwwTmjOe6J4bC8e3+pTEIgHaHj+1ZlLThRJ2auc/w1Q== + dependencies: + "@babel/helper-string-parser" "^7.23.4" + "@babel/helper-validator-identifier" "^7.22.20" + to-fast-properties "^2.0.0" + "@bcoe/v8-coverage@^0.2.3": version "0.2.3" resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" @@ -159,221 +183,111 @@ resolved "https://registry.yarnpkg.com/@esbuild/aix-ppc64/-/aix-ppc64-0.19.12.tgz#d1bc06aedb6936b3b6d313bf809a5a40387d2b7f" integrity sha512-bmoCYyWdEL3wDQIVbcyzRyeKLgk2WtWLTWz1ZIAZF/EGbNOwSA6ew3PftJ1PqMiOOGu0OyFMzG53L0zqIpPeNA== -"@esbuild/android-arm64@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.18.20.tgz#984b4f9c8d0377443cc2dfcef266d02244593622" - integrity sha512-Nz4rJcchGDtENV0eMKUNa6L12zz2zBDXuhj/Vjh18zGqB44Bi7MBMSXjgunJgjRhCmKOjnPuZp4Mb6OKqtMHLQ== - "@esbuild/android-arm64@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.19.12.tgz#7ad65a36cfdb7e0d429c353e00f680d737c2aed4" integrity sha512-P0UVNGIienjZv3f5zq0DP3Nt2IE/3plFzuaS96vihvD0Hd6H/q4WXUGpCxD/E8YrSXfNyRPbpTq+T8ZQioSuPA== -"@esbuild/android-arm@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.18.20.tgz#fedb265bc3a589c84cc11f810804f234947c3682" - integrity sha512-fyi7TDI/ijKKNZTUJAQqiG5T7YjJXgnzkURqmGj13C6dCqckZBLdl4h7bkhHt/t0WP+zO9/zwroDvANaOqO5Sw== - "@esbuild/android-arm@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.19.12.tgz#b0c26536f37776162ca8bde25e42040c203f2824" integrity sha512-qg/Lj1mu3CdQlDEEiWrlC4eaPZ1KztwGJ9B6J+/6G+/4ewxJg7gqj8eVYWvao1bXrqGiW2rsBZFSX3q2lcW05w== -"@esbuild/android-x64@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.18.20.tgz#35cf419c4cfc8babe8893d296cd990e9e9f756f2" - integrity sha512-8GDdlePJA8D6zlZYJV/jnrRAi6rOiNaCC/JclcXpB+KIuvfBN4owLtgzY2bsxnx666XjJx2kDPUmnTtR8qKQUg== - "@esbuild/android-x64@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.19.12.tgz#cb13e2211282012194d89bf3bfe7721273473b3d" integrity sha512-3k7ZoUW6Q6YqhdhIaq/WZ7HwBpnFBlW905Fa4s4qWJyiNOgT1dOqDiVAQFwBH7gBRZr17gLrlFCRzF6jFh7Kew== -"@esbuild/darwin-arm64@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.18.20.tgz#08172cbeccf95fbc383399a7f39cfbddaeb0d7c1" - integrity sha512-bxRHW5kHU38zS2lPTPOyuyTm+S+eobPUnTNkdJEfAddYgEcll4xkT8DB9d2008DtTbl7uJag2HuE5NZAZgnNEA== - "@esbuild/darwin-arm64@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.19.12.tgz#cbee41e988020d4b516e9d9e44dd29200996275e" integrity sha512-B6IeSgZgtEzGC42jsI+YYu9Z3HKRxp8ZT3cqhvliEHovq8HSX2YX8lNocDn79gCKJXOSaEot9MVYky7AKjCs8g== -"@esbuild/darwin-x64@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.18.20.tgz#d70d5790d8bf475556b67d0f8b7c5bdff053d85d" - integrity sha512-pc5gxlMDxzm513qPGbCbDukOdsGtKhfxD1zJKXjCCcU7ju50O7MeAZ8c4krSJcOIJGFR+qx21yMMVYwiQvyTyQ== - "@esbuild/darwin-x64@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.19.12.tgz#e37d9633246d52aecf491ee916ece709f9d5f4cd" integrity sha512-hKoVkKzFiToTgn+41qGhsUJXFlIjxI/jSYeZf3ugemDYZldIXIxhvwN6erJGlX4t5h417iFuheZ7l+YVn05N3A== -"@esbuild/freebsd-arm64@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.18.20.tgz#98755cd12707f93f210e2494d6a4b51b96977f54" - integrity sha512-yqDQHy4QHevpMAaxhhIwYPMv1NECwOvIpGCZkECn8w2WFHXjEwrBn3CeNIYsibZ/iZEUemj++M26W3cNR5h+Tw== - "@esbuild/freebsd-arm64@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.12.tgz#1ee4d8b682ed363b08af74d1ea2b2b4dbba76487" integrity sha512-4aRvFIXmwAcDBw9AueDQ2YnGmz5L6obe5kmPT8Vd+/+x/JMVKCgdcRwH6APrbpNXsPz+K653Qg8HB/oXvXVukA== -"@esbuild/freebsd-x64@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.18.20.tgz#c1eb2bff03915f87c29cece4c1a7fa1f423b066e" - integrity sha512-tgWRPPuQsd3RmBZwarGVHZQvtzfEBOreNuxEMKFcd5DaDn2PbBxfwLcj4+aenoh7ctXcbXmOQIn8HI6mCSw5MQ== - "@esbuild/freebsd-x64@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.19.12.tgz#37a693553d42ff77cd7126764b535fb6cc28a11c" integrity sha512-EYoXZ4d8xtBoVN7CEwWY2IN4ho76xjYXqSXMNccFSx2lgqOG/1TBPW0yPx1bJZk94qu3tX0fycJeeQsKovA8gg== -"@esbuild/linux-arm64@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.18.20.tgz#bad4238bd8f4fc25b5a021280c770ab5fc3a02a0" - integrity sha512-2YbscF+UL7SQAVIpnWvYwM+3LskyDmPhe31pE7/aoTMFKKzIc9lLbyGUpmmb8a8AixOL61sQ/mFh3jEjHYFvdA== - "@esbuild/linux-arm64@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.19.12.tgz#be9b145985ec6c57470e0e051d887b09dddb2d4b" integrity sha512-EoTjyYyLuVPfdPLsGVVVC8a0p1BFFvtpQDB/YLEhaXyf/5bczaGeN15QkR+O4S5LeJ92Tqotve7i1jn35qwvdA== -"@esbuild/linux-arm@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.18.20.tgz#3e617c61f33508a27150ee417543c8ab5acc73b0" - integrity sha512-/5bHkMWnq1EgKr1V+Ybz3s1hWXok7mDFUMQ4cG10AfW3wL02PSZi5kFpYKrptDsgb2WAJIvRcDm+qIvXf/apvg== - "@esbuild/linux-arm@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.19.12.tgz#207ecd982a8db95f7b5279207d0ff2331acf5eef" integrity sha512-J5jPms//KhSNv+LO1S1TX1UWp1ucM6N6XuL6ITdKWElCu8wXP72l9MM0zDTzzeikVyqFE6U8YAV9/tFyj0ti+w== -"@esbuild/linux-ia32@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.18.20.tgz#699391cccba9aee6019b7f9892eb99219f1570a7" - integrity sha512-P4etWwq6IsReT0E1KHU40bOnzMHoH73aXp96Fs8TIT6z9Hu8G6+0SHSw9i2isWrD2nbx2qo5yUqACgdfVGx7TA== - "@esbuild/linux-ia32@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.19.12.tgz#d0d86b5ca1562523dc284a6723293a52d5860601" integrity sha512-Thsa42rrP1+UIGaWz47uydHSBOgTUnwBwNq59khgIwktK6x60Hivfbux9iNR0eHCHzOLjLMLfUMLCypBkZXMHA== -"@esbuild/linux-loong64@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.18.20.tgz#e6fccb7aac178dd2ffb9860465ac89d7f23b977d" - integrity sha512-nXW8nqBTrOpDLPgPY9uV+/1DjxoQ7DoB2N8eocyq8I9XuqJ7BiAMDMf9n1xZM9TgW0J8zrquIb/A7s3BJv7rjg== - "@esbuild/linux-loong64@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.19.12.tgz#9a37f87fec4b8408e682b528391fa22afd952299" integrity sha512-LiXdXA0s3IqRRjm6rV6XaWATScKAXjI4R4LoDlvO7+yQqFdlr1Bax62sRwkVvRIrwXxvtYEHHI4dm50jAXkuAA== -"@esbuild/linux-mips64el@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.18.20.tgz#eeff3a937de9c2310de30622a957ad1bd9183231" - integrity sha512-d5NeaXZcHp8PzYy5VnXV3VSd2D328Zb+9dEq5HE6bw6+N86JVPExrA6O68OPwobntbNJ0pzCpUFZTo3w0GyetQ== - "@esbuild/linux-mips64el@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.19.12.tgz#4ddebd4e6eeba20b509d8e74c8e30d8ace0b89ec" integrity sha512-fEnAuj5VGTanfJ07ff0gOA6IPsvrVHLVb6Lyd1g2/ed67oU1eFzL0r9WL7ZzscD+/N6i3dWumGE1Un4f7Amf+w== -"@esbuild/linux-ppc64@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.18.20.tgz#2f7156bde20b01527993e6881435ad79ba9599fb" - integrity sha512-WHPyeScRNcmANnLQkq6AfyXRFr5D6N2sKgkFo2FqguP44Nw2eyDlbTdZwd9GYk98DZG9QItIiTlFLHJHjxP3FA== - "@esbuild/linux-ppc64@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.19.12.tgz#adb67dadb73656849f63cd522f5ecb351dd8dee8" integrity sha512-nYJA2/QPimDQOh1rKWedNOe3Gfc8PabU7HT3iXWtNUbRzXS9+vgB0Fjaqr//XNbd82mCxHzik2qotuI89cfixg== -"@esbuild/linux-riscv64@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.18.20.tgz#6628389f210123d8b4743045af8caa7d4ddfc7a6" - integrity sha512-WSxo6h5ecI5XH34KC7w5veNnKkju3zBRLEQNY7mv5mtBmrP/MjNBCAlsM2u5hDBlS3NGcTQpoBvRzqBcRtpq1A== - "@esbuild/linux-riscv64@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.19.12.tgz#11bc0698bf0a2abf8727f1c7ace2112612c15adf" integrity sha512-2MueBrlPQCw5dVJJpQdUYgeqIzDQgw3QtiAHUC4RBz9FXPrskyyU3VI1hw7C0BSKB9OduwSJ79FTCqtGMWqJHg== -"@esbuild/linux-s390x@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.18.20.tgz#255e81fb289b101026131858ab99fba63dcf0071" - integrity sha512-+8231GMs3mAEth6Ja1iK0a1sQ3ohfcpzpRLH8uuc5/KVDFneH6jtAJLFGafpzpMRO6DzJ6AvXKze9LfFMrIHVQ== - "@esbuild/linux-s390x@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.19.12.tgz#e86fb8ffba7c5c92ba91fc3b27ed5a70196c3cc8" integrity sha512-+Pil1Nv3Umes4m3AZKqA2anfhJiVmNCYkPchwFJNEJN5QxmTs1uzyy4TvmDrCRNT2ApwSari7ZIgrPeUx4UZDg== -"@esbuild/linux-x64@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.18.20.tgz#c7690b3417af318a9b6f96df3031a8865176d338" - integrity sha512-UYqiqemphJcNsFEskc73jQ7B9jgwjWrSayxawS6UVFZGWrAAtkzjxSqnoclCXxWtfwLdzU+vTpcNYhpn43uP1w== - "@esbuild/linux-x64@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.19.12.tgz#5f37cfdc705aea687dfe5dfbec086a05acfe9c78" integrity sha512-B71g1QpxfwBvNrfyJdVDexenDIt1CiDN1TIXLbhOw0KhJzE78KIFGX6OJ9MrtC0oOqMWf+0xop4qEU8JrJTwCg== -"@esbuild/netbsd-x64@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.18.20.tgz#30e8cd8a3dded63975e2df2438ca109601ebe0d1" - integrity sha512-iO1c++VP6xUBUmltHZoMtCUdPlnPGdBom6IrO4gyKPFFVBKioIImVooR5I83nTew5UOYrk3gIJhbZh8X44y06A== - "@esbuild/netbsd-x64@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.19.12.tgz#29da566a75324e0d0dd7e47519ba2f7ef168657b" integrity sha512-3ltjQ7n1owJgFbuC61Oj++XhtzmymoCihNFgT84UAmJnxJfm4sYCiSLTXZtE00VWYpPMYc+ZQmB6xbSdVh0JWA== -"@esbuild/openbsd-x64@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.18.20.tgz#7812af31b205055874c8082ea9cf9ab0da6217ae" - integrity sha512-e5e4YSsuQfX4cxcygw/UCPIEP6wbIL+se3sxPdCiMbFLBWu0eiZOJ7WoD+ptCLrmjZBK1Wk7I6D/I3NglUGOxg== - "@esbuild/openbsd-x64@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.19.12.tgz#306c0acbdb5a99c95be98bdd1d47c916e7dc3ff0" integrity sha512-RbrfTB9SWsr0kWmb9srfF+L933uMDdu9BIzdA7os2t0TXhCRjrQyCeOt6wVxr79CKD4c+p+YhCj31HBkYcXebw== -"@esbuild/sunos-x64@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.18.20.tgz#d5c275c3b4e73c9b0ecd38d1ca62c020f887ab9d" - integrity sha512-kDbFRFp0YpTQVVrqUd5FTYmWo45zGaXe0X8E1G/LKFC0v8x0vWrhOWSLITcCn63lmZIxfOMXtCfti/RxN/0wnQ== - "@esbuild/sunos-x64@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.19.12.tgz#0933eaab9af8b9b2c930236f62aae3fc593faf30" integrity sha512-HKjJwRrW8uWtCQnQOz9qcU3mUZhTUQvi56Q8DPTLLB+DawoiQdjsYq+j+D3s9I8VFtDr+F9CjgXKKC4ss89IeA== -"@esbuild/win32-arm64@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.18.20.tgz#73bc7f5a9f8a77805f357fab97f290d0e4820ac9" - integrity sha512-ddYFR6ItYgoaq4v4JmQQaAI5s7npztfV4Ag6NrhiaW0RrnOXqBkgwZLofVTlq1daVTQNhtI5oieTvkRPfZrePg== - "@esbuild/win32-arm64@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.19.12.tgz#773bdbaa1971b36db2f6560088639ccd1e6773ae" integrity sha512-URgtR1dJnmGvX864pn1B2YUYNzjmXkuJOIqG2HdU62MVS4EHpU2946OZoTMnRUHklGtJdJZ33QfzdjGACXhn1A== -"@esbuild/win32-ia32@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.18.20.tgz#ec93cbf0ef1085cc12e71e0d661d20569ff42102" - integrity sha512-Wv7QBi3ID/rROT08SABTS7eV4hX26sVduqDOTe1MvGMjNd3EjOz4b7zeexIR62GTIEKrfJXKL9LFxTYgkyeu7g== - "@esbuild/win32-ia32@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.19.12.tgz#000516cad06354cc84a73f0943a4aa690ef6fd67" integrity sha512-+ZOE6pUkMOJfmxmBZElNOx72NKpIa/HFOMGzu8fqzQJ5kgf6aTGrcJaFsNiVMH4JKpMipyK+7k0n2UXN7a8YKQ== -"@esbuild/win32-x64@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.18.20.tgz#786c5f41f043b07afb1af37683d7c33668858f6d" - integrity sha512-kTdfRcSiDfQca/y9QIkng02avJ+NCaQvrMejlsB3RRv5sE9rRoeBPISaZpKxHELzRxZyLvNts1P27W3wV+8geQ== - "@esbuild/win32-x64@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.19.12.tgz#c57c8afbb4054a3ab8317591a0b7320360b444ae" @@ -509,7 +423,7 @@ resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz#b520529ec21d8e5945a1851dfd1c32e94e39ff45" integrity sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA== -"@istanbuljs/schema@^0.1.2", "@istanbuljs/schema@^0.1.3": +"@istanbuljs/schema@^0.1.2": version "0.1.3" resolved "https://registry.yarnpkg.com/@istanbuljs/schema/-/schema-0.1.3.tgz#e45e384e4b8ec16bce2fd903af78450f6bf7ec98" integrity sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA== @@ -528,6 +442,13 @@ dependencies: "@sinclair/typebox" "^0.27.8" +"@jest/schemas@^29.6.3": + version "29.6.3" + resolved "https://registry.yarnpkg.com/@jest/schemas/-/schemas-29.6.3.tgz#430b5ce8a4e0044a7e3819663305a7b3091c8e03" + integrity sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA== + dependencies: + "@sinclair/typebox" "^0.27.8" + "@jest/types@^29.6.1": version "29.6.1" resolved "https://registry.yarnpkg.com/@jest/types/-/types-29.6.1.tgz#ae79080278acff0a6af5eb49d063385aaa897bf2" @@ -564,7 +485,7 @@ resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz#add4c98d341472a289190b424efbdb096991bb24" integrity sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw== -"@jridgewell/sourcemap-codec@^1.4.13": +"@jridgewell/sourcemap-codec@^1.4.15": version "1.4.15" resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz#d7c6e6755c78567a951e04ab52ef0fd26de59f32" integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg== @@ -788,6 +709,71 @@ dependencies: "@prisma/debug" "5.10.2" +"@rollup/rollup-android-arm-eabi@4.12.0": + version "4.12.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.12.0.tgz#38c3abd1955a3c21d492af6b1a1dca4bb1d894d6" + integrity sha512-+ac02NL/2TCKRrJu2wffk1kZ+RyqxVUlbjSagNgPm94frxtr+XDL12E5Ll1enWskLrtrZ2r8L3wED1orIibV/w== + +"@rollup/rollup-android-arm64@4.12.0": + version "4.12.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.12.0.tgz#3822e929f415627609e53b11cec9a4be806de0e2" + integrity sha512-OBqcX2BMe6nvjQ0Nyp7cC90cnumt8PXmO7Dp3gfAju/6YwG0Tj74z1vKrfRz7qAv23nBcYM8BCbhrsWqO7PzQQ== + +"@rollup/rollup-darwin-arm64@4.12.0": + version "4.12.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.12.0.tgz#6c082de71f481f57df6cfa3701ab2a7afde96f69" + integrity sha512-X64tZd8dRE/QTrBIEs63kaOBG0b5GVEd3ccoLtyf6IdXtHdh8h+I56C2yC3PtC9Ucnv0CpNFJLqKFVgCYe0lOQ== + +"@rollup/rollup-darwin-x64@4.12.0": + version "4.12.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.12.0.tgz#c34ca0d31f3c46a22c9afa0e944403eea0edcfd8" + integrity sha512-cc71KUZoVbUJmGP2cOuiZ9HSOP14AzBAThn3OU+9LcA1+IUqswJyR1cAJj3Mg55HbjZP6OLAIscbQsQLrpgTOg== + +"@rollup/rollup-linux-arm-gnueabihf@4.12.0": + version "4.12.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.12.0.tgz#48e899c1e438629c072889b824a98787a7c2362d" + integrity sha512-a6w/Y3hyyO6GlpKL2xJ4IOh/7d+APaqLYdMf86xnczU3nurFTaVN9s9jOXQg97BE4nYm/7Ga51rjec5nfRdrvA== + +"@rollup/rollup-linux-arm64-gnu@4.12.0": + version "4.12.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.12.0.tgz#788c2698a119dc229062d40da6ada8a090a73a68" + integrity sha512-0fZBq27b+D7Ar5CQMofVN8sggOVhEtzFUwOwPppQt0k+VR+7UHMZZY4y+64WJ06XOhBTKXtQB/Sv0NwQMXyNAA== + +"@rollup/rollup-linux-arm64-musl@4.12.0": + version "4.12.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.12.0.tgz#3882a4e3a564af9e55804beeb67076857b035ab7" + integrity sha512-eTvzUS3hhhlgeAv6bfigekzWZjaEX9xP9HhxB0Dvrdbkk5w/b+1Sxct2ZuDxNJKzsRStSq1EaEkVSEe7A7ipgQ== + +"@rollup/rollup-linux-riscv64-gnu@4.12.0": + version "4.12.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.12.0.tgz#0c6ad792e1195c12bfae634425a3d2aa0fe93ab7" + integrity sha512-ix+qAB9qmrCRiaO71VFfY8rkiAZJL8zQRXveS27HS+pKdjwUfEhqo2+YF2oI+H/22Xsiski+qqwIBxVewLK7sw== + +"@rollup/rollup-linux-x64-gnu@4.12.0": + version "4.12.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.12.0.tgz#9d62485ea0f18d8674033b57aa14fb758f6ec6e3" + integrity sha512-TenQhZVOtw/3qKOPa7d+QgkeM6xY0LtwzR8OplmyL5LrgTWIXpTQg2Q2ycBf8jm+SFW2Wt/DTn1gf7nFp3ssVA== + +"@rollup/rollup-linux-x64-musl@4.12.0": + version "4.12.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.12.0.tgz#50e8167e28b33c977c1f813def2b2074d1435e05" + integrity sha512-LfFdRhNnW0zdMvdCb5FNuWlls2WbbSridJvxOvYWgSBOYZtgBfW9UGNJG//rwMqTX1xQE9BAodvMH9tAusKDUw== + +"@rollup/rollup-win32-arm64-msvc@4.12.0": + version "4.12.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.12.0.tgz#68d233272a2004429124494121a42c4aebdc5b8e" + integrity sha512-JPDxovheWNp6d7AHCgsUlkuCKvtu3RB55iNEkaQcf0ttsDU/JZF+iQnYcQJSk/7PtT4mjjVG8N1kpwnI9SLYaw== + +"@rollup/rollup-win32-ia32-msvc@4.12.0": + version "4.12.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.12.0.tgz#366ca62221d1689e3b55a03f4ae12ae9ba595d40" + integrity sha512-fjtuvMWRGJn1oZacG8IPnzIV6GF2/XG+h71FKn76OYFqySXInJtseAqdprVTDTyqPxQOG9Exak5/E9Z3+EJ8ZA== + +"@rollup/rollup-win32-x64-msvc@4.12.0": + version "4.12.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.12.0.tgz#9ffdf9ed133a7464f4ae187eb9e1294413fab235" + integrity sha512-ZYmr5mS2wd4Dew/JjT0Fqi2NPB/ZhZ2VvPp7SmvPZb4Y1CG/LRcS6tcRo2cYU7zLK5A7cdbhWnnWmUjoI4qapg== + "@sapphire/async-queue@^1.5.0": version "1.5.0" resolved "https://registry.yarnpkg.com/@sapphire/async-queue/-/async-queue-1.5.0.tgz#2f255a3f186635c4fb5a2381e375d3dfbc5312d8" @@ -882,23 +868,16 @@ resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-2.0.0.tgz#f544a148d3ab35801c1f633a7441fd87c2e484bf" integrity sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A== -"@types/chai-subset@^1.3.3": - version "1.3.3" - resolved "https://registry.yarnpkg.com/@types/chai-subset/-/chai-subset-1.3.3.tgz#97893814e92abd2c534de422cb377e0e0bdaac94" - integrity sha512-frBecisrNGz+F4T6bcc+NLeolfiojh5FxW2klu669+8BARtyQv2C/GkNW6FUodVe4BroGMP/wER/YDGc7rEllw== - dependencies: - "@types/chai" "*" - -"@types/chai@*", "@types/chai@^4.3.4": - version "4.3.4" - resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.3.4.tgz#e913e8175db8307d78b4e8fa690408ba6b65dee4" - integrity sha512-KnRanxnpfpjUTqTCXslZSEdLfXExwgNxYPdiO2WGUj8+HDjFi8R3k5RVKPeSCzLjCcshCAtVO2QBbVuAV4kTnw== - "@types/deep-equal@^1.0.3": version "1.0.4" resolved "https://registry.yarnpkg.com/@types/deep-equal/-/deep-equal-1.0.4.tgz#c0a854be62d6b9fae665137a6639aab53389a147" integrity sha512-tqdiS4otQP4KmY0PR3u6KbZ5EWvhNdUoS/jc93UuK23C220lOZ/9TvjfxdPcKvqwwDVtmtSCrnr0p/2dirAxkA== +"@types/estree@1.0.5", "@types/estree@^1.0.0": + version "1.0.5" + resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.5.tgz#a6ce3e556e00fd9895dd872dd172ad0d4bd687f4" + integrity sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw== + "@types/he@^1.1.2": version "1.1.2" resolved "https://registry.yarnpkg.com/@types/he/-/he-1.1.2.tgz#0c8b275f36d2b8b651104638e4d45693349c3953" @@ -1162,60 +1141,68 @@ "@typescript-eslint/types" "5.54.1" eslint-visitor-keys "^3.3.0" -"@vitest/coverage-c8@^0.31.0": - version "0.31.0" - resolved "https://registry.yarnpkg.com/@vitest/coverage-c8/-/coverage-c8-0.31.0.tgz#67c80f0f9a2eed9b71f593ab54164f9a71af7eca" - integrity sha512-h72qN1D962AO7UefQVulm9JFP5ACS7OfhCdBHioXU8f7ohH/+NTZCgAqmgcfRNHHO/8wLFxx+93YVxhodkEJVA== +"@vitest/coverage-v8@^1.3.1": + version "1.3.1" + resolved "https://registry.yarnpkg.com/@vitest/coverage-v8/-/coverage-v8-1.3.1.tgz#cf5ed8eb5bff6658cea126d0f8fcd2872de0b59f" + integrity sha512-UuBnkSJUNE9rdHjDCPyJ4fYuMkoMtnghes1XohYa4At0MS3OQSAo97FrbwSLRshYsXThMZy1+ybD/byK5llyIg== dependencies: - "@ampproject/remapping" "^2.2.0" - c8 "^7.13.0" - magic-string "^0.30.0" + "@ampproject/remapping" "^2.2.1" + "@bcoe/v8-coverage" "^0.2.3" + debug "^4.3.4" + istanbul-lib-coverage "^3.2.2" + istanbul-lib-report "^3.0.1" + istanbul-lib-source-maps "^4.0.1" + istanbul-reports "^3.1.6" + magic-string "^0.30.5" + magicast "^0.3.3" picocolors "^1.0.0" - std-env "^3.3.2" + std-env "^3.5.0" + test-exclude "^6.0.0" + v8-to-istanbul "^9.2.0" -"@vitest/expect@0.31.0": - version "0.31.0" - resolved "https://registry.yarnpkg.com/@vitest/expect/-/expect-0.31.0.tgz#37ab35d4f75c12826c204f2a0290e0c2e5ef1192" - integrity sha512-Jlm8ZTyp6vMY9iz9Ny9a0BHnCG4fqBa8neCF6Pk/c/6vkUk49Ls6UBlgGAU82QnzzoaUs9E/mUhq/eq9uMOv/g== +"@vitest/expect@1.3.1": + version "1.3.1" + resolved "https://registry.yarnpkg.com/@vitest/expect/-/expect-1.3.1.tgz#d4c14b89c43a25fd400a6b941f51ba27fe0cb918" + integrity sha512-xofQFwIzfdmLLlHa6ag0dPV8YsnKOCP1KdAeVVh34vSjN2dcUiXYCD9htu/9eM7t8Xln4v03U9HLxLpPlsXdZw== dependencies: - "@vitest/spy" "0.31.0" - "@vitest/utils" "0.31.0" - chai "^4.3.7" + "@vitest/spy" "1.3.1" + "@vitest/utils" "1.3.1" + chai "^4.3.10" -"@vitest/runner@0.31.0": - version "0.31.0" - resolved "https://registry.yarnpkg.com/@vitest/runner/-/runner-0.31.0.tgz#ca830405ae4c2744ae5fb7fbe85df81b56430ebc" - integrity sha512-H1OE+Ly7JFeBwnpHTrKyCNm/oZgr+16N4qIlzzqSG/YRQDATBYmJb/KUn3GrZaiQQyL7GwpNHVZxSQd6juLCgw== +"@vitest/runner@1.3.1": + version "1.3.1" + resolved "https://registry.yarnpkg.com/@vitest/runner/-/runner-1.3.1.tgz#e7f96cdf74842934782bfd310eef4b8695bbfa30" + integrity sha512-5FzF9c3jG/z5bgCnjr8j9LNq/9OxV2uEBAITOXfoe3rdZJTdO7jzThth7FXv/6b+kdY65tpRQB7WaKhNZwX+Kg== dependencies: - "@vitest/utils" "0.31.0" - concordance "^5.0.4" - p-limit "^4.0.0" - pathe "^1.1.0" + "@vitest/utils" "1.3.1" + p-limit "^5.0.0" + pathe "^1.1.1" -"@vitest/snapshot@0.31.0": - version "0.31.0" - resolved "https://registry.yarnpkg.com/@vitest/snapshot/-/snapshot-0.31.0.tgz#f59c4bcf0d03f1f494ee09286965e60a1e0cab64" - integrity sha512-5dTXhbHnyUMTMOujZPB0wjFjQ6q5x9c8TvAsSPUNKjp1tVU7i9pbqcKPqntyu2oXtmVxKbuHCqrOd+Ft60r4tg== +"@vitest/snapshot@1.3.1": + version "1.3.1" + resolved "https://registry.yarnpkg.com/@vitest/snapshot/-/snapshot-1.3.1.tgz#193a5d7febf6ec5d22b3f8c5a093f9e4322e7a88" + integrity sha512-EF++BZbt6RZmOlE3SuTPu/NfwBF6q4ABS37HHXzs2LUVPBLx2QoY/K0fKpRChSo8eLiuxcbCVfqKgx/dplCDuQ== dependencies: - magic-string "^0.30.0" - pathe "^1.1.0" - pretty-format "^27.5.1" + magic-string "^0.30.5" + pathe "^1.1.1" + pretty-format "^29.7.0" -"@vitest/spy@0.31.0": - version "0.31.0" - resolved "https://registry.yarnpkg.com/@vitest/spy/-/spy-0.31.0.tgz#98cb19046c0bd2673a73d6c90ee1533d1be82136" - integrity sha512-IzCEQ85RN26GqjQNkYahgVLLkULOxOm5H/t364LG0JYb3Apg0PsYCHLBYGA006+SVRMWhQvHlBBCyuByAMFmkg== +"@vitest/spy@1.3.1": + version "1.3.1" + resolved "https://registry.yarnpkg.com/@vitest/spy/-/spy-1.3.1.tgz#814245d46d011b99edd1c7528f5725c64e85a88b" + integrity sha512-xAcW+S099ylC9VLU7eZfdT9myV67Nor9w9zhf0mGCYJSO+zM2839tOeROTdikOi/8Qeusffvxb/MyBSOja1Uig== dependencies: - tinyspy "^2.1.0" + tinyspy "^2.2.0" -"@vitest/utils@0.31.0": - version "0.31.0" - resolved "https://registry.yarnpkg.com/@vitest/utils/-/utils-0.31.0.tgz#d0aae17150b95ebf7afdf4e5db8952ac21610ffa" - integrity sha512-kahaRyLX7GS1urekRXN2752X4gIgOGVX4Wo8eDUGUkTWlGpXzf5ZS6N9RUUS+Re3XEE8nVGqNyxkSxF5HXlGhQ== +"@vitest/utils@1.3.1": + version "1.3.1" + resolved "https://registry.yarnpkg.com/@vitest/utils/-/utils-1.3.1.tgz#7b05838654557544f694a372de767fcc9594d61a" + integrity sha512-d3Waie/299qqRyHTm2DjADeTaNdNSVsnwHPWrs20JMpjh6eiVq7ggggweO8rc4arhf6rRkWuHKwvxGvejUXZZQ== dependencies: - concordance "^5.0.4" - loupe "^2.3.6" - pretty-format "^27.5.1" + diff-sequences "^29.6.3" + estree-walker "^3.0.3" + loupe "^2.3.7" + pretty-format "^29.7.0" "@vladfrangu/async_event_emitter@^2.2.2": version "2.2.2" @@ -1252,16 +1239,26 @@ acorn-jsx@^5.3.2: resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ== -acorn-walk@^8.0.2, acorn-walk@^8.2.0: +acorn-walk@^8.0.2: version "8.2.0" resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.2.0.tgz#741210f2e2426454508853a2f44d0ab83b7f69c1" integrity sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA== +acorn-walk@^8.3.2: + version "8.3.2" + resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.3.2.tgz#7703af9415f1b6db9315d6895503862e231d34aa" + integrity sha512-cjkyv4OtNCIeqhHrfS81QWXoCBPExR/J62oyEqepVw8WaQeSqpW2uhuLPh1m9eWhDuOo/jUXVTlifvesOWp/4A== + acorn@^8.1.0, acorn@^8.8.0, acorn@^8.8.2: version "8.8.2" resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.8.2.tgz#1b2f25db02af965399b9776b0c2c391276d37c4a" integrity sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw== +acorn@^8.11.3: + version "8.11.3" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.11.3.tgz#71e0b14e13a4ec160724b38fb7b0f233b1b81d7a" + integrity sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg== + agent-base@6: version "6.0.2" resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-6.0.2.tgz#49fff58577cfee3f37176feab4c22e00f86d7f77" @@ -1454,11 +1451,6 @@ bl@^4.1.0: inherits "^2.0.4" readable-stream "^3.4.0" -blueimp-md5@^2.10.0: - version "2.19.0" - resolved "https://registry.yarnpkg.com/blueimp-md5/-/blueimp-md5-2.19.0.tgz#b53feea5498dcb53dc6ec4b823adb84b729c4af0" - integrity sha512-DRQrD6gJyy8FbiE4s+bDoXS9hiW3Vbx5uCdwvcCf3zLHL+Iv7LtGHLpr+GZV8rHG8tK766FGYBwRbu8pELTt+w== - brace-expansion@^1.1.7: version "1.1.11" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" @@ -1526,24 +1518,6 @@ bytes@3.1.2: resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.2.tgz#8b0beeb98605adf1b128fa4386403c009e0221a5" integrity sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg== -c8@^7.13.0: - version "7.13.0" - resolved "https://registry.yarnpkg.com/c8/-/c8-7.13.0.tgz#a2a70a851278709df5a9247d62d7f3d4bcb5f2e4" - integrity sha512-/NL4hQTv1gBL6J6ei80zu3IiTrmePDKXKXOTLpHvcIWZTVYQlDhVWjjWvkhICylE8EwwnMVzDZugCvdx0/DIIA== - dependencies: - "@bcoe/v8-coverage" "^0.2.3" - "@istanbuljs/schema" "^0.1.3" - find-up "^5.0.0" - foreground-child "^2.0.0" - istanbul-lib-coverage "^3.2.0" - istanbul-lib-report "^3.0.0" - istanbul-reports "^3.1.4" - rimraf "^3.0.2" - test-exclude "^6.0.0" - v8-to-istanbul "^9.0.0" - yargs "^16.2.0" - yargs-parser "^20.2.9" - cac@^6.7.14: version "6.7.14" resolved "https://registry.yarnpkg.com/cac/-/cac-6.7.14.tgz#804e1e6f506ee363cb0e3ccbb09cad5dd9870959" @@ -1573,18 +1547,18 @@ callsites@^3.0.0: resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== -chai@^4.3.7: - version "4.3.7" - resolved "https://registry.yarnpkg.com/chai/-/chai-4.3.7.tgz#ec63f6df01829088e8bf55fca839bcd464a8ec51" - integrity sha512-HLnAzZ2iupm25PlN0xFreAlBA5zaBSv3og0DdeGA4Ar6h6rJ3A0rolRUKJhSF2V10GZKDgWF/VmAEsNWjCRB+A== +chai@^4.3.10: + version "4.4.1" + resolved "https://registry.yarnpkg.com/chai/-/chai-4.4.1.tgz#3603fa6eba35425b0f2ac91a009fe924106e50d1" + integrity sha512-13sOfMv2+DWduEU+/xbun3LScLoqN17nBeTLUsmDfKdoiC1fr0n9PU4guu4AhRcOVFk/sW8LyZWHuhWtQZiF+g== dependencies: assertion-error "^1.1.0" - check-error "^1.0.2" - deep-eql "^4.1.2" - get-func-name "^2.0.0" - loupe "^2.3.1" + check-error "^1.0.3" + deep-eql "^4.1.3" + get-func-name "^2.0.2" + loupe "^2.3.6" pathval "^1.1.1" - type-detect "^4.0.5" + type-detect "^4.0.8" chalk@^2.0.0: version "2.4.2" @@ -1619,10 +1593,12 @@ chartjs-plugin-datalabels@^2.0.0: resolved "https://registry.yarnpkg.com/chartjs-plugin-datalabels/-/chartjs-plugin-datalabels-2.2.0.tgz#369578e131d743c2e34b5fbe2d3f9335f6639b8f" integrity sha512-14ZU30lH7n89oq+A4bWaJPnAG8a7ZTk7dKf48YAzMvJjQtjrgg5Dpk9f+LbjCF6bpx3RAGTeL13IXpKQYyRvlw== -check-error@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/check-error/-/check-error-1.0.2.tgz#574d312edd88bb5dd8912e9286dd6c0aed4aac82" - integrity sha512-BrgHpW9NURQgzoNyjfq0Wu6VFO6D7IZEmJNdtgNqpzGG8RuNFHt2jQxWlAs4HMe119chBnv+34syEZtc6IhLtA== +check-error@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/check-error/-/check-error-1.0.3.tgz#a6502e4312a7ee969f646e83bb3ddd56281bd694" + integrity sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg== + dependencies: + get-func-name "^2.0.2" ci-info@^3.2.0: version "3.8.0" @@ -1653,15 +1629,6 @@ cli-spinners@^2.5.0: resolved "https://registry.yarnpkg.com/cli-spinners/-/cli-spinners-2.7.0.tgz#f815fd30b5f9eaac02db604c7a231ed7cb2f797a" integrity sha512-qu3pN8Y3qHNgE2AFweciB1IfMnmZ/fsNTEE+NOFjmGB2F/7rLhnhzppvpCnN4FovtP26k8lHyy9ptEbNwWFLzw== -cliui@^7.0.2: - version "7.0.4" - resolved "https://registry.yarnpkg.com/cliui/-/cliui-7.0.4.tgz#a0265ee655476fc807aea9df3df8df7783808b4f" - integrity sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ== - dependencies: - string-width "^4.2.0" - strip-ansi "^6.0.0" - wrap-ansi "^7.0.0" - cliui@^8.0.1: version "8.0.1" resolved "https://registry.yarnpkg.com/cliui/-/cliui-8.0.1.tgz#0c04b075db02cbfe60dc8e6cf2f5486b1a3608aa" @@ -1732,20 +1699,6 @@ concat-map@0.0.1: resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg== -concordance@^5.0.4: - version "5.0.4" - resolved "https://registry.yarnpkg.com/concordance/-/concordance-5.0.4.tgz#9896073261adced72f88d60e4d56f8efc4bbbbd2" - integrity sha512-OAcsnTEYu1ARJqWVGwf4zh4JDfHZEaSNlNccFmt8YjB2l/n19/PF2viLINHc57vO4FKIAFl2FWASIGZZWZ2Kxw== - dependencies: - date-time "^3.1.0" - esutils "^2.0.3" - fast-diff "^1.2.0" - js-string-escape "^1.0.1" - lodash "^4.17.15" - md5-hex "^3.0.1" - semver "^7.3.2" - well-known-symbols "^2.0.0" - concurrently@^7.6.0: version "7.6.0" resolved "https://registry.yarnpkg.com/concurrently/-/concurrently-7.6.0.tgz#531a6f5f30cf616f355a4afb8f8fcb2bba65a49a" @@ -1761,17 +1714,17 @@ concurrently@^7.6.0: tree-kill "^1.2.2" yargs "^17.3.1" -convert-source-map@^1.6.0: - version "1.9.0" - resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.9.0.tgz#7faae62353fb4213366d0ca98358d22e8368b05f" - integrity sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A== +convert-source-map@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-2.0.0.tgz#4b560f649fc4e918dd0ab75cf4961e8bc882d82a" + integrity sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg== cookie@^0.5.0: version "0.5.0" resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.5.0.tgz#d1f5d71adec6558c58f389987c366aa47e994f8b" integrity sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw== -cross-spawn@^7.0.0, cross-spawn@^7.0.2, cross-spawn@^7.0.3: +cross-spawn@^7.0.2, cross-spawn@^7.0.3: version "7.0.3" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== @@ -1803,13 +1756,6 @@ date-fns@^2.29.1: dependencies: "@babel/runtime" "^7.21.0" -date-time@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/date-time/-/date-time-3.1.0.tgz#0d1e934d170579f481ed8df1e2b8ff70ee845e1e" - integrity sha512-uqCUKXE5q1PNBXjPqvwhwJf9SwMoAHBgWJ6DcrnS5o+W2JOiIILl0JEdVD8SGujrNS02GGxgwAg2PN2zONgtjg== - dependencies: - time-zone "^1.0.0" - debug@4, debug@^4.0.0, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2, debug@^4.3.3, debug@^4.3.4: version "4.3.4" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" @@ -1829,7 +1775,7 @@ decimal.js@^10.4.3: resolved "https://registry.yarnpkg.com/decimal.js/-/decimal.js-10.4.3.tgz#1044092884d245d1b7f65725fa4ad4c6f781cc23" integrity sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA== -deep-eql@^4.1.2: +deep-eql@^4.1.3: version "4.1.3" resolved "https://registry.yarnpkg.com/deep-eql/-/deep-eql-4.1.3.tgz#7c7775513092f7df98d8df9996dd085eb668cc6d" integrity sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw== @@ -2088,6 +2034,11 @@ diff-sequences@^29.4.3: resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-29.4.3.tgz#9314bc1fabe09267ffeca9cbafc457d8499a13f2" integrity sha512-ofrBgwpPhCD85kMKtE9RYFFq6OC1A89oW2vvgWZNCwxrUpRUILopY7lsYyMDSjc8g6U6aiO0Qubg6r4Wgt5ZnA== +diff-sequences@^29.6.3: + version "29.6.3" + resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-29.6.3.tgz#4deaf894d11407c51efc8418012f9e70b84ea921" + integrity sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q== + dir-glob@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-3.0.1.tgz#56dbf73d992a4a93ba1584f4534063fd2e41717f" @@ -2302,35 +2253,7 @@ es-to-primitive@^1.2.1: is-date-object "^1.0.1" is-symbol "^1.0.2" -esbuild@^0.18.10: - version "0.18.20" - resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.18.20.tgz#4709f5a34801b43b799ab7d6d82f7284a9b7a7a6" - integrity sha512-ceqxoedUrcayh7Y7ZX6NdbbDzGROiyVBgC4PriJThBKSVPWnnFHZAkfI1lJT8QFkOwH4qOS2SJkS4wvpGl8BpA== - optionalDependencies: - "@esbuild/android-arm" "0.18.20" - "@esbuild/android-arm64" "0.18.20" - "@esbuild/android-x64" "0.18.20" - "@esbuild/darwin-arm64" "0.18.20" - "@esbuild/darwin-x64" "0.18.20" - "@esbuild/freebsd-arm64" "0.18.20" - "@esbuild/freebsd-x64" "0.18.20" - "@esbuild/linux-arm" "0.18.20" - "@esbuild/linux-arm64" "0.18.20" - "@esbuild/linux-ia32" "0.18.20" - "@esbuild/linux-loong64" "0.18.20" - "@esbuild/linux-mips64el" "0.18.20" - "@esbuild/linux-ppc64" "0.18.20" - "@esbuild/linux-riscv64" "0.18.20" - "@esbuild/linux-s390x" "0.18.20" - "@esbuild/linux-x64" "0.18.20" - "@esbuild/netbsd-x64" "0.18.20" - "@esbuild/openbsd-x64" "0.18.20" - "@esbuild/sunos-x64" "0.18.20" - "@esbuild/win32-arm64" "0.18.20" - "@esbuild/win32-ia32" "0.18.20" - "@esbuild/win32-x64" "0.18.20" - -esbuild@^0.19.5, esbuild@~0.19.10: +esbuild@^0.19.3, esbuild@^0.19.5, esbuild@~0.19.10: version "0.19.12" resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.19.12.tgz#dc82ee5dc79e82f5a5c3b4323a2a641827db3e04" integrity sha512-aARqgq8roFBj054KvQr5f1sFu0D65G+miZRCuJyJ0G13Zwx7vRar5Zhn2tkQNzIXcBrNVsv/8stehpj+GAjgbg== @@ -2643,7 +2566,14 @@ estraverse@^5.1.0, estraverse@^5.2.0: resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.2.0.tgz#307df42547e6cc7324d3cf03c155d5cdb8c53880" integrity sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ== -esutils@^2.0.2, esutils@^2.0.3: +estree-walker@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-3.0.3.tgz#67c3e549ec402a487b4fc193d1953a524752340d" + integrity sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g== + dependencies: + "@types/estree" "^1.0.0" + +esutils@^2.0.2: version "2.0.3" resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== @@ -2663,6 +2593,21 @@ events@^3.3.0: resolved "https://registry.yarnpkg.com/events/-/events-3.3.0.tgz#31a95ad0a924e2d2c419a813aeb2c4e878ea7400" integrity sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q== +execa@^8.0.1: + version "8.0.1" + resolved "https://registry.yarnpkg.com/execa/-/execa-8.0.1.tgz#51f6a5943b580f963c3ca9c6321796db8cc39b8c" + integrity sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg== + dependencies: + cross-spawn "^7.0.3" + get-stream "^8.0.1" + human-signals "^5.0.0" + is-stream "^3.0.0" + merge-stream "^2.0.0" + npm-run-path "^5.1.0" + onetime "^6.0.0" + signal-exit "^4.1.0" + strip-final-newline "^3.0.0" + expect@^29.0.0: version "29.6.2" resolved "https://registry.yarnpkg.com/expect/-/expect-29.6.2.tgz#7b08e83eba18ddc4a2cf62b5f2d1918f5cd84521" @@ -2690,7 +2635,7 @@ fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== -fast-diff@^1.1.2, fast-diff@^1.2.0: +fast-diff@^1.1.2: version "1.2.0" resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.2.0.tgz#73ee11982d86caaf7959828d519cfe927fac5f03" integrity sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w== @@ -2870,14 +2815,6 @@ for-each@^0.3.3: dependencies: is-callable "^1.1.3" -foreground-child@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/foreground-child/-/foreground-child-2.0.0.tgz#71b32800c9f15aa8f2f83f4a6bd9bff35d861a53" - integrity sha512-dCIq9FpEcyQyXKCkyzmlPTFNgrCzPudOe+mhvJU5zAtlBnGVy2yKxtfsxK2tQBThwq225jcvBjpw1Gr40uzZCA== - dependencies: - cross-spawn "^7.0.0" - signal-exit "^3.0.2" - form-data@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/form-data/-/form-data-3.0.1.tgz#ebd53791b78356a99af9a300d4282c4d5eb9755f" @@ -2962,7 +2899,7 @@ 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-func-name@^2.0.0: +get-func-name@^2.0.0, get-func-name@^2.0.1, get-func-name@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/get-func-name/-/get-func-name-2.0.2.tgz#0d7cf20cd13fda808669ffa88f4ffc7a3943fc41" integrity sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ== @@ -3007,6 +2944,11 @@ get-stdin@^5.0.1: resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-5.0.1.tgz#122e161591e21ff4c52530305693f20e6393a398" integrity sha512-jZV7n6jGE3Gt7fgSTJoz91Ak5MuTLwMwkoYdjxuJ/AmjIsE1UC03y/IWkZCQGEvVNS9qoRNwy5BCqxImv0FVeA== +get-stream@^8.0.1: + version "8.0.1" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-8.0.1.tgz#def9dfd71742cd7754a7761ed43749a27d02eca2" + integrity sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA== + get-symbol-description@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/get-symbol-description/-/get-symbol-description-1.0.0.tgz#7fdb81c900101fbd564dd5f1a30af5aadc1e58d6" @@ -3240,6 +3182,11 @@ https-proxy-agent@^5.0.1: agent-base "6" debug "4" +human-signals@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-5.0.0.tgz#42665a284f9ae0dade3ba41ebc37eb4b852f3a28" + integrity sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ== + iconv-lite@0.4.24: version "0.4.24" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" @@ -3485,6 +3432,11 @@ is-shared-array-buffer@^1.0.2: dependencies: call-bind "^1.0.2" +is-stream@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-3.0.0.tgz#e6bfd7aa6bef69f4f472ce9bb681e3e57b4319ac" + integrity sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA== + is-string@^1.0.5, is-string@^1.0.7: version "1.0.7" resolved "https://registry.yarnpkg.com/is-string/-/is-string-1.0.7.tgz#0dd12bf2006f255bb58f695110eff7491eebc0fd" @@ -3555,11 +3507,16 @@ isexe@^2.0.0: resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA= -istanbul-lib-coverage@^3.0.0, istanbul-lib-coverage@^3.2.0: +istanbul-lib-coverage@^3.0.0: version "3.2.0" resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz#189e7909d0a39fa5a3dfad5b03f71947770191d3" integrity sha512-eOeJ5BHCmHYvQK7xt9GkdHuzuCGS1Y6g9Gvnx3Ym33fz/HpLRYxiS0wHNr+m/MBC8B647Xt608vCDEvhl9c6Mw== +istanbul-lib-coverage@^3.2.2: + version "3.2.2" + resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz#2d166c4b0644d43a39f04bf6c2edd1e585f31756" + integrity sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg== + istanbul-lib-report@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz#7518fe52ea44de372f460a76b5ecda9ffb73d8a6" @@ -3569,10 +3526,28 @@ istanbul-lib-report@^3.0.0: make-dir "^3.0.0" supports-color "^7.1.0" -istanbul-reports@^3.1.4: - version "3.1.5" - resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-3.1.5.tgz#cc9a6ab25cb25659810e4785ed9d9fb742578bae" - integrity sha512-nUsEMa9pBt/NOHqbcbeJEgqIlY/K7rVWUX6Lql2orY5e9roQOthbR3vtY4zzf2orPELg80fnxxk9zUyPlgwD1w== +istanbul-lib-report@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz#908305bac9a5bd175ac6a74489eafd0fc2445a7d" + integrity sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw== + dependencies: + istanbul-lib-coverage "^3.0.0" + make-dir "^4.0.0" + supports-color "^7.1.0" + +istanbul-lib-source-maps@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz#895f3a709fcfba34c6de5a42939022f3e4358551" + integrity sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw== + dependencies: + debug "^4.1.1" + istanbul-lib-coverage "^3.0.0" + source-map "^0.6.1" + +istanbul-reports@^3.1.6: + version "3.1.7" + resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-3.1.7.tgz#daed12b9e1dca518e15c056e1e537e741280fa0b" + integrity sha512-BewmUXImeuRk2YY0PVbxgKAysvhRPUQE0h5QRM++nVWyubKGV0l8qQ5op8+B2DOmwSe63Jivj0BjkPQVf8fP5g== dependencies: html-escaper "^2.0.0" istanbul-lib-report "^3.0.0" @@ -3648,16 +3623,16 @@ js-sdsl@^4.1.4: resolved "https://registry.yarnpkg.com/js-sdsl/-/js-sdsl-4.3.0.tgz#aeefe32a451f7af88425b11fdb5f58c90ae1d711" integrity sha512-mifzlm2+5nZ+lEcLJMoBK0/IH/bDg8XnJfd/Wq6IP+xoCjLZsTOnV2QpxlVbX9bMnkl5PdEjNtBJ9Cj1NjifhQ== -js-string-escape@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/js-string-escape/-/js-string-escape-1.0.1.tgz#e2625badbc0d67c7533e9edc1068c587ae4137ef" - integrity sha512-Smw4xcfIQ5LVjAOuJCvN/zIodzA/BBSsluuoSykP+lUvScIi4U6RJLfwHet5cxFnCswUjISV8oAXaqaJDY3chg== - js-tokens@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== +js-tokens@^8.0.2: + version "8.0.3" + resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-8.0.3.tgz#1c407ec905643603b38b6be6977300406ec48775" + integrity sha512-UfJMcSJc+SEXEl9lH/VLHSZbThQyLpw1vLO1Lb+j4RWDvG3N2f7yj3PVQA3cmkTBNldJ9eFnM+xEXxHIXrYiJw== + js-yaml@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602" @@ -3759,10 +3734,13 @@ lines-and-columns@^1.1.6: resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.1.6.tgz#1c00c743b433cd0a4e80758f7b64a57440d9ff00" integrity sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA= -local-pkg@^0.4.3: - version "0.4.3" - resolved "https://registry.yarnpkg.com/local-pkg/-/local-pkg-0.4.3.tgz#0ff361ab3ae7f1c19113d9bb97b98b905dbc4963" - integrity sha512-SFppqq5p42fe2qcZQqqEOiVRXl+WCP1MdT6k7BDEW1j++sp5fIY+/fdRQitvKgB5BrBcmrs5m/L0v2FrU5MY1g== +local-pkg@^0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/local-pkg/-/local-pkg-0.5.0.tgz#093d25a346bae59a99f80e75f6e9d36d7e8c925c" + integrity sha512-ok6z3qlYyCDS4ZEU27HaU6x/xZa9Whf8jD4ptH5UZTQYZVYeb9bnZ3ojVhiJNLiXK1Hfc0GNbLXcmZ5plLDDBg== + dependencies: + mlly "^1.4.2" + pkg-types "^1.0.3" locate-path@^5.0.0: version "5.0.0" @@ -3793,7 +3771,7 @@ lodash.truncate@^4.4.2: resolved "https://registry.yarnpkg.com/lodash.truncate/-/lodash.truncate-4.4.2.tgz#5a350da0b1113b837ecfffd5812cbe58d6eae193" integrity sha1-WjUNoLERO4N+z//VgSy+WNbq4ZM= -lodash@^4.17.15, lodash@^4.17.21, lodash@^4.17.4: +lodash@^4.17.21, lodash@^4.17.4: version "4.17.21" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== @@ -3806,13 +3784,20 @@ log-symbols@^4.1.0: chalk "^4.1.0" is-unicode-supported "^0.1.0" -loupe@^2.3.1, loupe@^2.3.6: +loupe@^2.3.6: version "2.3.6" resolved "https://registry.yarnpkg.com/loupe/-/loupe-2.3.6.tgz#76e4af498103c532d1ecc9be102036a21f787b53" integrity sha512-RaPMZKiMy8/JruncMU5Bt6na1eftNoo++R4Y+N2FrxkDVTrGvcyzFTsaGif4QTeKESheMGegbhw6iUAq+5A8zA== dependencies: get-func-name "^2.0.0" +loupe@^2.3.7: + version "2.3.7" + resolved "https://registry.yarnpkg.com/loupe/-/loupe-2.3.7.tgz#6e69b7d4db7d3ab436328013d37d1c8c3540c697" + integrity sha512-zSMINGVYkdpYSOBmLi0D1Uo7JU9nVdQKrHxC8eYlV+9YKK9WePqAlL7lSlorG/U2Fw1w0hTBmaa/jrQ3UbPHtA== + dependencies: + get-func-name "^2.0.1" + lru-cache@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94" @@ -3864,12 +3849,21 @@ magic-bytes.js@^1.0.15: resolved "https://registry.yarnpkg.com/magic-bytes.js/-/magic-bytes.js-1.0.17.tgz#6265d568df98c02b523c0defdd18b86cb2cae883" integrity sha512-PEDpPzHpKe5AxkVmQrNPHFRvPN2ELkkj3eIg4IZO9JdhBiAY3aU53lgYXs9j8B7lpza+QiW0UA4QHCH7EskSeg== -magic-string@^0.30.0: - version "0.30.0" - resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.30.0.tgz#fd58a4748c5c4547338a424e90fa5dd17f4de529" - integrity sha512-LA+31JYDJLs82r2ScLrlz1GjSgu66ZV518eyWT+S8VhyQn/JL0u9MeBOvQMGYiPk1DBiSN9DDMOcXvigJZaViQ== +magic-string@^0.30.5: + version "0.30.7" + resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.30.7.tgz#0cecd0527d473298679da95a2d7aeb8c64048505" + integrity sha512-8vBuFF/I/+OSLRmdf2wwFCJCz+nSn0m6DPvGH1fS/KiQoSaR+sETbov0eIk9KhEKy8CYqIkIAnbohxT/4H0kuA== dependencies: - "@jridgewell/sourcemap-codec" "^1.4.13" + "@jridgewell/sourcemap-codec" "^1.4.15" + +magicast@^0.3.3: + version "0.3.3" + resolved "https://registry.yarnpkg.com/magicast/-/magicast-0.3.3.tgz#a15760f982deec9dabc5f314e318d7c6bddcb27b" + integrity sha512-ZbrP1Qxnpoes8sz47AM0z08U+jW6TyRgZzcWy3Ma3vDhJttwMwAFDMMQFobwdBxByBD46JYmxRzeF7w2+wJEuw== + dependencies: + "@babel/parser" "^7.23.6" + "@babel/types" "^7.23.6" + source-map-js "^1.0.2" mahoji@^0.0.7: version "0.0.7" @@ -3883,23 +3877,28 @@ make-dir@^3.0.0: dependencies: semver "^6.0.0" +make-dir@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-4.0.0.tgz#c3c2307a771277cd9638305f915c29ae741b614e" + integrity sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw== + dependencies: + semver "^7.5.3" + math-expression-evaluator@^1.3.14: version "1.3.14" resolved "https://registry.yarnpkg.com/math-expression-evaluator/-/math-expression-evaluator-1.3.14.tgz#0ebeaccf65fea0f6f5a626f88df41814e5fcd9bf" integrity sha512-M6AMrvq9bO8uL42KvQHPA2/SbAobA0R7gviUmPrcTcGfdwpaLitz4q2Euzx2lP9Oy88vxK3HOrsISgSwKsYS4A== -md5-hex@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/md5-hex/-/md5-hex-3.0.1.tgz#be3741b510591434b2784d79e556eefc2c9a8e5c" - integrity sha512-BUiRtTtV39LIJwinWBjqVsU9xhdnz7/i889V859IBFpuqGAj6LuOvHv5XLbgZ2R7ptJoJaEcxkv88/h25T7Ciw== - dependencies: - blueimp-md5 "^2.10.0" - media-typer@0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748" integrity sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g= +merge-stream@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" + integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== + merge2@^1.3.0, merge2@^1.4.1: version "1.4.1" resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" @@ -3930,6 +3929,11 @@ mimic-fn@^2.1.0: resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== +mimic-fn@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-4.0.0.tgz#60a90550d5cb0b239cca65d893b1a53b29871ecc" + integrity sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw== + min-indent@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/min-indent/-/min-indent-1.0.1.tgz#a63f681673b30571fbe8bc25686ae746eefa9869" @@ -3974,6 +3978,16 @@ mlly@^1.2.0: pkg-types "^1.0.3" ufo "^1.1.2" +mlly@^1.4.2: + version "1.6.1" + resolved "https://registry.yarnpkg.com/mlly/-/mlly-1.6.1.tgz#0983067dc3366d6314fc5e12712884e6978d028f" + integrity sha512-vLgaHvaeunuOXHSmEbZ9izxPx3USsk8KCQ8iC+aTlp5sKRSoZvwhHh5L9VbKSaVC6sJDqbyohIS76E2VmHIPAA== + dependencies: + acorn "^8.11.3" + pathe "^1.1.2" + pkg-types "^1.0.3" + ufo "^1.3.2" + mnemonist@0.39.5: version "0.39.5" resolved "https://registry.yarnpkg.com/mnemonist/-/mnemonist-0.39.5.tgz#5850d9b30d1b2bc57cc8787e5caa40f6c3420477" @@ -4033,6 +4047,11 @@ nanoid@^3.3.6: resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.6.tgz#443380c856d6e9f9824267d960b4236ad583ea4c" integrity sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA== +nanoid@^3.3.7: + version "3.3.7" + resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.7.tgz#d0c301a691bc8d54efa0a2226ccf3fe2fd656bd8" + integrity sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g== + natural-compare-lite@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/natural-compare-lite/-/natural-compare-lite-1.4.0.tgz#17b09581988979fddafe0201e931ba933c96cbb4" @@ -4099,6 +4118,13 @@ normalize-package-data@^2.5.0: semver "2 || 3 || 4 || 5" validate-npm-package-license "^3.0.1" +npm-run-path@^5.1.0: + version "5.3.0" + resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-5.3.0.tgz#e23353d0ebb9317f174e93417e4a4d82d0249e9f" + integrity sha512-ppwTtiJZq0O/ai0z7yfudtBpWIoxM8yE6nHi1X47eFR2EWORqfbu6CnPlNsjeN683eT0qG6H/Pyf9fCcvjnnnQ== + dependencies: + path-key "^4.0.0" + nwsapi@^2.2.2: version "2.2.2" resolved "https://registry.yarnpkg.com/nwsapi/-/nwsapi-2.2.2.tgz#e5418863e7905df67d51ec95938d67bf801f0bb0" @@ -4175,6 +4201,13 @@ onetime@^5.1.0: dependencies: mimic-fn "^2.1.0" +onetime@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/onetime/-/onetime-6.0.0.tgz#7c24c18ed1fd2e9bca4bd26806a33613c77d34b4" + integrity sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ== + dependencies: + mimic-fn "^4.0.0" + optionator@^0.8.1: version "0.8.3" resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.3.tgz#84fa1d036fe9d3c7e21d99884b601167ec8fb495" @@ -4233,10 +4266,10 @@ p-limit@^3.0.2: dependencies: yocto-queue "^0.1.0" -p-limit@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-4.0.0.tgz#914af6544ed32bfa54670b061cafcbd04984b644" - integrity sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ== +p-limit@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-5.0.0.tgz#6946d5b7140b649b7a33a027d89b4c625b3a5985" + integrity sha512-/Eaoq+QyLSiXQ4lyYV23f14mZRQcXnxfHrN0vCai+ak9G0pp9iEQukIIZq5NccEvwRB8PUnZT0KsOoDCINS1qQ== dependencies: yocto-queue "^1.0.0" @@ -4318,6 +4351,11 @@ path-key@^3.1.0: resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== +path-key@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/path-key/-/path-key-4.0.0.tgz#295588dc3aee64154f877adb9d780b81c554bf18" + integrity sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ== + path-parse@^1.0.7: version "1.0.7" resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" @@ -4341,6 +4379,11 @@ pathe@^1.1.0: resolved "https://registry.yarnpkg.com/pathe/-/pathe-1.1.0.tgz#e2e13f6c62b31a3289af4ba19886c230f295ec03" integrity sha512-ODbEPR0KKHqECXW1GoxdDb+AZvULmXjVPy4rt+pGo2+TnjJTIPJQSVS6N63n8T2Ip+syHhbn52OewKicV0373w== +pathe@^1.1.1, pathe@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/pathe/-/pathe-1.1.2.tgz#6c4cb47a945692e48a1ddd6e4094d170516437ec" + integrity sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ== + pathval@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/pathval/-/pathval-1.1.1.tgz#8534e77a77ce7ac5a2512ea21e0fdb8fcf6c3d8d" @@ -4447,7 +4490,7 @@ postcss-values-parser@^6.0.2: is-url-superb "^4.0.0" quote-unquote "^1.0.0" -postcss@^8.1.7, postcss@^8.4.12, postcss@^8.4.27: +postcss@^8.1.7, postcss@^8.4.12: version "8.4.31" resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.31.tgz#92b451050a9f914da6755af352bdc0192508656d" integrity sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ== @@ -4456,6 +4499,15 @@ postcss@^8.1.7, postcss@^8.4.12, postcss@^8.4.27: picocolors "^1.0.0" source-map-js "^1.0.2" +postcss@^8.4.35: + version "8.4.35" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.35.tgz#60997775689ce09011edf083a549cea44aabe2f7" + integrity sha512-u5U8qYpBCpN13BsiEB0CbR1Hhh4Gc0zLFuedrHJKMctHCHAGrMdG0PRM/KErzAL3CU6/eckEtmHNB3x6e3c0vA== + dependencies: + nanoid "^3.3.7" + picocolors "^1.0.0" + source-map-js "^1.0.2" + precinct@^8.1.0: version "8.3.1" resolved "https://registry.yarnpkg.com/precinct/-/precinct-8.3.1.tgz#94b99b623df144eed1ce40e0801c86078466f0dc" @@ -4515,15 +4567,6 @@ prettier@^2.7.1: resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.3.tgz#ab697b1d3dd46fb4626fbe2f543afe0cc98d8632" integrity sha512-tJ/oJ4amDihPoufT5sM0Z1SKEuKay8LfVAMlbbhnnkvt6BUserZylqo2PN+p9KeljLr0OHa2rXHU1T8reeoTrw== -pretty-format@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-27.5.1.tgz#2181879fdea51a7a5851fb39d920faa63f01d88e" - integrity sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ== - dependencies: - ansi-regex "^5.0.1" - ansi-styles "^5.0.0" - react-is "^17.0.1" - pretty-format@^29.0.0, pretty-format@^29.6.2: version "29.6.2" resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-29.6.2.tgz#3d5829261a8a4d89d8b9769064b29c50ed486a47" @@ -4533,6 +4576,15 @@ pretty-format@^29.0.0, pretty-format@^29.6.2: ansi-styles "^5.0.0" react-is "^18.0.0" +pretty-format@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-29.7.0.tgz#ca42c758310f365bfa71a0bda0a807160b776812" + integrity sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ== + dependencies: + "@jest/schemas" "^29.6.3" + ansi-styles "^5.0.0" + react-is "^18.0.0" + pretty-ms@^7.0.1: version "7.0.1" resolved "https://registry.yarnpkg.com/pretty-ms/-/pretty-ms-7.0.1.tgz#7d903eaab281f7d8e03c66f867e239dc32fb73e8" @@ -4620,11 +4672,6 @@ rc@^1.2.7: minimist "^1.2.0" strip-json-comments "~2.0.1" -react-is@^17.0.1: - version "17.0.2" - resolved "https://registry.yarnpkg.com/react-is/-/react-is-17.0.2.tgz#e691d4a8e9c789365655539ab372762b0efb54f0" - integrity sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w== - react-is@^18.0.0: version "18.2.0" resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.2.0.tgz#199431eeaaa2e09f86427efbb4f1473edb47609b" @@ -4803,11 +4850,26 @@ rimraf@^4.4.0: dependencies: glob "^9.2.0" -rollup@^3.27.1: - version "3.29.4" - resolved "https://registry.yarnpkg.com/rollup/-/rollup-3.29.4.tgz#4d70c0f9834146df8705bfb69a9a19c9e1109981" - integrity sha512-oWzmBZwvYrU0iJHtDmhsm662rC15FRXmcjCk1xD771dFDx5jJ02ufAQQTn0etB2emNk4J9EZg/yWKpsn9BWGRw== +rollup@^4.2.0: + version "4.12.0" + resolved "https://registry.yarnpkg.com/rollup/-/rollup-4.12.0.tgz#0b6d1e5f3d46bbcf244deec41a7421dc54cc45b5" + integrity sha512-wz66wn4t1OHIJw3+XU7mJJQV/2NAfw5OAk6G6Hoo3zcvz/XOfQ52Vgi+AN4Uxoxi0KBBwk2g8zPrTDA4btSB/Q== + dependencies: + "@types/estree" "1.0.5" optionalDependencies: + "@rollup/rollup-android-arm-eabi" "4.12.0" + "@rollup/rollup-android-arm64" "4.12.0" + "@rollup/rollup-darwin-arm64" "4.12.0" + "@rollup/rollup-darwin-x64" "4.12.0" + "@rollup/rollup-linux-arm-gnueabihf" "4.12.0" + "@rollup/rollup-linux-arm64-gnu" "4.12.0" + "@rollup/rollup-linux-arm64-musl" "4.12.0" + "@rollup/rollup-linux-riscv64-gnu" "4.12.0" + "@rollup/rollup-linux-x64-gnu" "4.12.0" + "@rollup/rollup-linux-x64-musl" "4.12.0" + "@rollup/rollup-win32-arm64-msvc" "4.12.0" + "@rollup/rollup-win32-ia32-msvc" "4.12.0" + "@rollup/rollup-win32-x64-msvc" "4.12.0" fsevents "~2.3.2" rrweb-cssom@^0.6.0: @@ -4896,13 +4958,20 @@ semver@^6.0.0, semver@^6.3.0: resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== -semver@^7.3.2, semver@^7.3.5, semver@^7.3.7: +semver@^7.3.5, semver@^7.3.7: version "7.5.4" resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e" integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA== dependencies: lru-cache "^6.0.0" +semver@^7.5.3: + version "7.6.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.0.tgz#1a46a4db4bffcccd97b743b5005c8325f23d4e2d" + integrity sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg== + dependencies: + lru-cache "^6.0.0" + set-cookie-parser@^2.4.1: version "2.4.8" resolved "https://registry.yarnpkg.com/set-cookie-parser/-/set-cookie-parser-2.4.8.tgz#d0da0ed388bc8f24e706a391f9c9e252a13c58b2" @@ -4971,6 +5040,11 @@ signal-exit@^3.0.2: resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== +signal-exit@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-4.1.0.tgz#952188c1cbd546070e2dd20d0f41c0ae0530cb04" + integrity sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw== + simple-statistics@^7.8.3: version "7.8.3" resolved "https://registry.yarnpkg.com/simple-statistics/-/simple-statistics-7.8.3.tgz#62998dd7786ba14fa27b07f4f3cd498466f7961a" @@ -5017,7 +5091,7 @@ source-map-support@^0.5.21: buffer-from "^1.0.0" source-map "^0.6.0" -source-map@^0.6.0, source-map@~0.6.1: +source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== @@ -5080,10 +5154,10 @@ statuses@2.0.1: resolved "https://registry.yarnpkg.com/statuses/-/statuses-2.0.1.tgz#55cb000ccf1d48728bd23c685a063998cf1a1b63" integrity sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ== -std-env@^3.3.2: - version "3.3.3" - resolved "https://registry.yarnpkg.com/std-env/-/std-env-3.3.3.tgz#a54f06eb245fdcfef53d56f3c0251f1d5c3d01fe" - integrity sha512-Rz6yejtVyWnVjC1RFvNmYL10kgjC49EOghxWn0RFqlCHGFpQx+Xe7yW3I4ceK1SGrWIGMjD5Kbue8W/udkbMJg== +std-env@^3.5.0: + version "3.7.0" + resolved "https://registry.yarnpkg.com/std-env/-/std-env-3.7.0.tgz#c9f7386ced6ecf13360b6c6c55b8aaa4ef7481d2" + integrity sha512-JPbdCEQLj1w5GilpiHAx3qJvFndqybBysA3qUOnznweH4QbNYUsW/ea8QzSrnh0vNsezMMw5bcVool8lM0gwzg== stop-iteration-iterator@^1.0.0: version "1.0.0" @@ -5159,6 +5233,11 @@ strip-bom@^3.0.0: resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" integrity sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM= +strip-final-newline@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-3.0.0.tgz#52894c313fbff318835280aed60ff71ebf12b8fd" + integrity sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw== + strip-indent@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/strip-indent/-/strip-indent-3.0.0.tgz#c32e1cee940b6b3432c771bc2c54bcce73cd3001" @@ -5176,12 +5255,12 @@ strip-json-comments@~2.0.1: resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" integrity sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ== -strip-literal@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/strip-literal/-/strip-literal-1.0.1.tgz#0115a332710c849b4e46497891fb8d585e404bd2" - integrity sha512-QZTsipNpa2Ppr6v1AmJHESqJ3Uz247MUS0OjrnnZjFAvEoWqxuyFuXn2xLgMtRnijJShAa1HL0gtJyUs7u7n3Q== +strip-literal@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/strip-literal/-/strip-literal-2.0.0.tgz#5d063580933e4e03ebb669b12db64d2200687527" + integrity sha512-f9vHgsCWBq2ugHAkGMiiYY+AYG0D/cbloKKg0nhaaaSNsujdGIpVXCNsrJpCKr5M0f4aI31mr13UjY6GAuXCKA== dependencies: - acorn "^8.8.2" + js-tokens "^8.0.2" stylus-lookup@^3.0.1: version "3.0.2" @@ -5259,30 +5338,30 @@ thread-stream@^2.0.0: dependencies: real-require "^0.2.0" -time-zone@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/time-zone/-/time-zone-1.0.0.tgz#99c5bf55958966af6d06d83bdf3800dc82faec5d" - integrity sha512-TIsDdtKo6+XrPtiTm1ssmMngN1sAhyKnTO2kunQWqNPWIVvCm15Wmw4SWInwTVgJ5u/Tr04+8Ei9TNcw4x4ONA== - tiny-lru@^10.0.0: version "10.0.1" resolved "https://registry.yarnpkg.com/tiny-lru/-/tiny-lru-10.0.1.tgz#aaf5d22207e641ed1b176ac2e616d6cc2fc9ef66" integrity sha512-Vst+6kEsWvb17Zpz14sRJV/f8bUWKhqm6Dc+v08iShmIJ/WxqWytHzCTd6m88pS33rE2zpX34TRmOpAJPloNCA== -tinybench@^2.4.0: - version "2.5.0" - resolved "https://registry.yarnpkg.com/tinybench/-/tinybench-2.5.0.tgz#4711c99bbf6f3e986f67eb722fed9cddb3a68ba5" - integrity sha512-kRwSG8Zx4tjF9ZiyH4bhaebu+EDz1BOx9hOigYHlUW4xxI/wKIUQUqo018UlU4ar6ATPBsaMrdbKZ+tmPdohFA== +tinybench@^2.5.1: + version "2.6.0" + resolved "https://registry.yarnpkg.com/tinybench/-/tinybench-2.6.0.tgz#1423284ee22de07c91b3752c048d2764714b341b" + integrity sha512-N8hW3PG/3aOoZAN5V/NSAEDz0ZixDSSt5b/a05iqtpgfLWMSVuCo7w0k2vVvEjdrIoeGqZzweX2WlyioNIHchA== -tinypool@^0.5.0: - version "0.5.0" - resolved "https://registry.yarnpkg.com/tinypool/-/tinypool-0.5.0.tgz#3861c3069bf71e4f1f5aa2d2e6b3aaacc278961e" - integrity sha512-paHQtnrlS1QZYKF/GnLoOM/DN9fqaGOFbCbxzAhwniySnzl9Ebk8w73/dd34DAhe/obUbPAOldTyYXQZxnPBPQ== +tinypool@^0.8.2: + version "0.8.2" + resolved "https://registry.yarnpkg.com/tinypool/-/tinypool-0.8.2.tgz#84013b03dc69dacb322563a475d4c0a9be00f82a" + integrity sha512-SUszKYe5wgsxnNOVlBYO6IC+8VGWdVGZWAqUxp3UErNBtptZvWbwyUOyzNL59zigz2rCA92QiL3wvG+JDSdJdQ== -tinyspy@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/tinyspy/-/tinyspy-2.1.0.tgz#bd6875098f988728e6456cfd5ab8cc06498ecdeb" - integrity sha512-7eORpyqImoOvkQJCSkL0d0mB4NHHIFAy4b1u8PHdDa7SjGS2njzl6/lyGoZLm+eyYEtlUmFGE0rFj66SWxZgQQ== +tinyspy@^2.2.0: + version "2.2.1" + resolved "https://registry.yarnpkg.com/tinyspy/-/tinyspy-2.2.1.tgz#117b2342f1f38a0dbdcc73a50a454883adf861d1" + integrity sha512-KYad6Vy5VDWV4GH3fjpseMQ/XU2BhIYP7Vzd0LG44qRWm/Yt2WCOTicFdvmgo6gWaqooMQCawTtILVQJupKu7A== + +to-fast-properties@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e" + integrity sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog== to-regex-range@^5.0.1: version "5.0.1" @@ -5389,7 +5468,7 @@ type-check@~0.3.2: dependencies: prelude-ls "~1.1.2" -type-detect@^4.0.0, type-detect@^4.0.5: +type-detect@^4.0.0, type-detect@^4.0.8: version "4.0.8" resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c" integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g== @@ -5446,6 +5525,11 @@ ufo@^1.1.2: resolved "https://registry.yarnpkg.com/ufo/-/ufo-1.1.2.tgz#d0d9e0fa09dece0c31ffd57bd363f030a35cfe76" integrity sha512-TrY6DsjTQQgyS3E3dBaOXf0TpPD8u9FVrVYmKVegJuFw51n/YB9XPt+U6ydzFG5ZIN7+DIjPbNmXoBj9esYhgQ== +ufo@^1.3.2: + version "1.4.0" + resolved "https://registry.yarnpkg.com/ufo/-/ufo-1.4.0.tgz#39845b31be81b4f319ab1d99fd20c56cac528d32" + integrity sha512-Hhy+BhRBleFjpJ2vchUNN40qgkh0366FWJGqVLYBHev0vpHTrXSA0ryT+74UiW6KWsldNurQMKGqCm1M2zBciQ== + unbox-primitive@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/unbox-primitive/-/unbox-primitive-1.0.2.tgz#29032021057d5e6cdbd08c5129c226dff8ed6f9e" @@ -5508,14 +5592,14 @@ uuid@8.3.2: resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2" integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg== -v8-to-istanbul@^9.0.0: - version "9.0.1" - resolved "https://registry.yarnpkg.com/v8-to-istanbul/-/v8-to-istanbul-9.0.1.tgz#b6f994b0b5d4ef255e17a0d17dc444a9f5132fa4" - integrity sha512-74Y4LqY74kLE6IFyIjPtkSTWzUZmj8tdHT9Ii/26dvQ6K9Dl2NbEfj0XgU2sHCtKgt5VupqhlO/5aWuqS+IY1w== +v8-to-istanbul@^9.2.0: + version "9.2.0" + resolved "https://registry.yarnpkg.com/v8-to-istanbul/-/v8-to-istanbul-9.2.0.tgz#2ed7644a245cddd83d4e087b9b33b3e62dfd10ad" + integrity sha512-/EH/sDgxU2eGxajKdwLCDmQ4FWq+kpi3uCmBGpw1xJtnAxEjlD8j8PEiGWpCIMIs3ciNAgH0d3TTJiUkYzyZjA== dependencies: "@jridgewell/trace-mapping" "^0.3.12" "@types/istanbul-lib-coverage" "^2.0.1" - convert-source-map "^1.6.0" + convert-source-map "^2.0.0" validate-npm-package-license@^3.0.1: version "3.0.4" @@ -5530,58 +5614,52 @@ vary@^1.1.2: resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc" integrity sha1-IpnwLG3tMNSllhsLn3RSShj2NPw= -vite-node@0.31.0: - version "0.31.0" - resolved "https://registry.yarnpkg.com/vite-node/-/vite-node-0.31.0.tgz#8794a98f21b0cf2394bfd2aaa5fc85d2c42be084" - integrity sha512-8x1x1LNuPvE2vIvkSB7c1mApX5oqlgsxzHQesYF7l5n1gKrEmrClIiZuOFbFDQcjLsmcWSwwmrWrcGWm9Fxc/g== +vite-node@1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/vite-node/-/vite-node-1.3.1.tgz#a93f7372212f5d5df38e945046b945ac3f4855d2" + integrity sha512-azbRrqRxlWTJEVbzInZCTchx0X69M/XPTCz4H+TLvlTcR/xH/3hkRqhOakT41fMJCMzXTu4UvegkZiEoJAWvng== dependencies: cac "^6.7.14" debug "^4.3.4" - mlly "^1.2.0" - pathe "^1.1.0" + pathe "^1.1.1" picocolors "^1.0.0" - vite "^3.0.0 || ^4.0.0" + vite "^5.0.0" -"vite@^3.0.0 || ^4.0.0": - version "4.5.2" - resolved "https://registry.yarnpkg.com/vite/-/vite-4.5.2.tgz#d6ea8610e099851dad8c7371599969e0f8b97e82" - integrity sha512-tBCZBNSBbHQkaGyhGCDUGqeo2ph8Fstyp6FMSvTtsXeZSPpSMGlviAOav2hxVTqFcx8Hj/twtWKsMJXNY0xI8w== +vite@^5.0.0: + version "5.1.4" + resolved "https://registry.yarnpkg.com/vite/-/vite-5.1.4.tgz#14e9d3e7a6e488f36284ef13cebe149f060bcfb6" + integrity sha512-n+MPqzq+d9nMVTKyewqw6kSt+R3CkvF9QAKY8obiQn8g1fwTscKxyfaYnC632HtBXAQGc1Yjomphwn1dtwGAHg== dependencies: - esbuild "^0.18.10" - postcss "^8.4.27" - rollup "^3.27.1" + esbuild "^0.19.3" + postcss "^8.4.35" + rollup "^4.2.0" optionalDependencies: - fsevents "~2.3.2" + fsevents "~2.3.3" -vitest@^0.31.0: - version "0.31.0" - resolved "https://registry.yarnpkg.com/vitest/-/vitest-0.31.0.tgz#133e98f779aa81afbc7ee1fcb385a0c458b8c2c8" - integrity sha512-JwWJS9p3GU9GxkG7eBSmr4Q4x4bvVBSswaCFf1PBNHiPx00obfhHRJfgHcnI0ffn+NMlIh9QGvG75FlaIBdKGA== - dependencies: - "@types/chai" "^4.3.4" - "@types/chai-subset" "^1.3.3" - "@types/node" "*" - "@vitest/expect" "0.31.0" - "@vitest/runner" "0.31.0" - "@vitest/snapshot" "0.31.0" - "@vitest/spy" "0.31.0" - "@vitest/utils" "0.31.0" - acorn "^8.8.2" - acorn-walk "^8.2.0" - cac "^6.7.14" - chai "^4.3.7" - concordance "^5.0.4" +vitest@^1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/vitest/-/vitest-1.3.1.tgz#2d7e9861f030d88a4669392a4aecb40569d90937" + integrity sha512-/1QJqXs8YbCrfv/GPQ05wAZf2eakUPLPa18vkJAKE7RXOKfVHqMZZ1WlTjiwl6Gcn65M5vpNUB6EFLnEdRdEXQ== + dependencies: + "@vitest/expect" "1.3.1" + "@vitest/runner" "1.3.1" + "@vitest/snapshot" "1.3.1" + "@vitest/spy" "1.3.1" + "@vitest/utils" "1.3.1" + acorn-walk "^8.3.2" + chai "^4.3.10" debug "^4.3.4" - local-pkg "^0.4.3" - magic-string "^0.30.0" - pathe "^1.1.0" + execa "^8.0.1" + local-pkg "^0.5.0" + magic-string "^0.30.5" + pathe "^1.1.1" picocolors "^1.0.0" - std-env "^3.3.2" - strip-literal "^1.0.1" - tinybench "^2.4.0" - tinypool "^0.5.0" - vite "^3.0.0 || ^4.0.0" - vite-node "0.31.0" + std-env "^3.5.0" + strip-literal "^2.0.0" + tinybench "^2.5.1" + tinypool "^0.8.2" + vite "^5.0.0" + vite-node "1.3.1" why-is-node-running "^2.2.2" w3c-xmlserializer@^4.0.0: @@ -5613,11 +5691,6 @@ webidl-conversions@^7.0.0: resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-7.0.0.tgz#256b4e1882be7debbf01d05f0aa2039778ea080a" integrity sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g== -well-known-symbols@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/well-known-symbols/-/well-known-symbols-2.0.0.tgz#e9c7c07dbd132b7b84212c8174391ec1f9871ba5" - integrity sha512-ZMjC3ho+KXo0BfJb7JgtQ5IBuvnShdlACNkKkdsqBmYw3bPAaJfPeYUo6tLUaT5tG/Gkh7xkpBhKRQ9e7pyg9Q== - whatwg-encoding@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/whatwg-encoding/-/whatwg-encoding-2.0.0.tgz#e7635f597fd87020858626805a2729fa7698ac53" @@ -5749,29 +5822,11 @@ yallist@^4.0.0: resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== -yargs-parser@^20.2.2, yargs-parser@^20.2.9: - version "20.2.9" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.9.tgz#2eb7dc3b0289718fc295f362753845c41a0c94ee" - integrity sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w== - yargs-parser@^21.1.1: version "21.1.1" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35" integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw== -yargs@^16.2.0: - version "16.2.0" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-16.2.0.tgz#1c82bf0f6b6a66eafce7ef30e376f49a12477f66" - integrity sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw== - dependencies: - cliui "^7.0.2" - escalade "^3.1.1" - get-caller-file "^2.0.5" - require-directory "^2.1.1" - string-width "^4.2.0" - y18n "^5.0.5" - yargs-parser "^20.2.2" - yargs@^17.3.1: version "17.7.2" resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.7.2.tgz#991df39aca675a192b816e1e0363f9d75d2aa269" From 7537866f5386f1e6e3c4f1e84ecb2c105a92d5be Mon Sep 17 00:00:00 2001 From: gc <30398469+gc@users.noreply.github.com> Date: Tue, 27 Feb 2024 01:45:47 +1100 Subject: [PATCH 11/15] Fix bigint bug and add test --- src/lib/MUser.ts | 2 +- tests/integration/MUser.test.ts | 33 ++++++++++++++++++++++++++++++++- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/src/lib/MUser.ts b/src/lib/MUser.ts index 5423a68728..6c2809d65c 100644 --- a/src/lib/MUser.ts +++ b/src/lib/MUser.ts @@ -269,7 +269,7 @@ export class MUserClass { async calcActualClues() { const result: { id: number; qty: number }[] = - await prisma.$queryRawUnsafe(`SELECT (data->>'clueID')::int AS id, SUM((data->>'quantity')::int) AS qty + await prisma.$queryRawUnsafe(`SELECT (data->>'clueID')::int AS id, SUM((data->>'quantity')::int)::int AS qty FROM activity WHERE type = 'ClueCompletion' AND user_id = '${this.id}'::bigint diff --git a/tests/integration/MUser.test.ts b/tests/integration/MUser.test.ts index c5cf9afc1c..0a221c877b 100644 --- a/tests/integration/MUser.test.ts +++ b/tests/integration/MUser.test.ts @@ -1,9 +1,12 @@ -import { objectEntries } from 'e'; +import { activity_type_enum } from '@prisma/client'; +import { objectEntries, randArrItem, randInt, Time } from 'e'; import { Bank } from 'oldschooljs'; import { ItemBank } from 'oldschooljs/dist/meta/types'; import { convertLVLtoXP } from 'oldschooljs/dist/util'; import { describe, expect, test } from 'vitest'; +import { ClueTiers } from '../../src/lib/clues/clueTiers'; +import { prisma } from '../../src/lib/settings/prisma'; import { SkillsEnum } from '../../src/lib/skilling/types'; import { assert } from '../../src/lib/util/logError'; import { mahojiUsersSettingsFetch } from '../../src/mahoji/mahojiSettings'; @@ -140,4 +143,32 @@ describe('MUser', () => { expect(itemsAdded).toEqual(loot); } }); + + test('calcActualClues', async () => { + const user = await createTestUser(); + const clues = []; + for (let i = 0; i < 100; i++) { + const tier = randArrItem(ClueTiers); + clues.push({ + id: randInt(1, 100_000_000), + user_id: BigInt(user.id), + start_date: new Date(Date.now() - Time.Hour), + duration: Time.Hour, + finish_date: new Date(), + completed: true, + type: activity_type_enum.ClueCompletion, + channel_id: BigInt(1), + group_activity: false, + data: { + userID: user.id, + clueID: tier.id, + quantity: randInt(1, 10) + } + }); + } + await prisma.activity.createMany({ + data: clues + }); + await user.calcActualClues(); + }); }); From 894281dc30a208db077878c2830da7e4358a5daf Mon Sep 17 00:00:00 2001 From: GC <30398469+gc@users.noreply.github.com> Date: Tue, 27 Feb 2024 02:02:07 +1100 Subject: [PATCH 12/15] BigInt fixes (#5726) --- .github/workflows/integration_tests.yml | 2 +- .github/workflows/unit_tests.yml | 2 +- src/lib/addXP.ts | 6 +-- src/lib/analytics.ts | 8 ++-- src/lib/roboChimp.ts | 2 +- src/lib/rolesTask.ts | 12 +++--- src/lib/settings/prisma.ts | 2 +- src/lib/slayer/slayerUtil.ts | 2 +- src/mahoji/commands/admin.ts | 16 +++---- src/mahoji/commands/ge.ts | 2 +- src/mahoji/commands/leaderboard.ts | 2 +- src/mahoji/commands/tools.ts | 2 +- .../lib/abstracted_commands/infernoCommand.ts | 2 +- .../lib/abstracted_commands/statCommand.ts | 42 +++++++++---------- 14 files changed, 52 insertions(+), 50 deletions(-) diff --git a/.github/workflows/integration_tests.yml b/.github/workflows/integration_tests.yml index 79e9bfaf6d..5671a71eac 100644 --- a/.github/workflows/integration_tests.yml +++ b/.github/workflows/integration_tests.yml @@ -11,7 +11,7 @@ jobs: test: name: Node v${{ matrix.node_version }} - ${{ matrix.os }} runs-on: ${{ matrix.os }} - timeout-minutes: 5 + timeout-minutes: 10 strategy: matrix: node_version: [18.12.0, 20] diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 675ebb2847..168e1a2245 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -11,7 +11,7 @@ jobs: test: name: Node v${{ matrix.node_version }} - ${{ matrix.os }} runs-on: ${{ matrix.os }} - timeout-minutes: 5 + timeout-minutes: 10 strategy: matrix: node_version: [18.12.0, 20] diff --git a/src/lib/addXP.ts b/src/lib/addXP.ts index d9be2b3028..774257260d 100644 --- a/src/lib/addXP.ts +++ b/src/lib/addXP.ts @@ -12,7 +12,7 @@ import { sendToChannelID } from './util/webhook'; const skillsVals = Object.values(Skills); const maxFilter = skillsVals.map(s => `"skills.${s.id}" >= ${LEVEL_99_XP}`).join(' AND '); -const makeQuery = (ironman: boolean) => `SELECT count(id) +const makeQuery = (ironman: boolean) => `SELECT count(id)::int FROM users WHERE ${maxFilter} ${ironman ? 'AND "minion.ironman" = true' : ''};`; @@ -111,7 +111,7 @@ export async function addXP(user: MUser, params: AddXpParams): Promise { { count: string; }[] - >(`SELECT COUNT(*) FROM users WHERE "skills.${params.skillName}" >= ${LEVEL_99_XP};`); + >(`SELECT COUNT(*)::int FROM users WHERE "skills.${params.skillName}" >= ${LEVEL_99_XP};`); let str = `${skill.emoji} **${user.badgedUsername}'s** minion, ${ user.minionName @@ -125,7 +125,7 @@ export async function addXP(user: MUser, params: AddXpParams): Promise { count: string; }[] >( - `SELECT COUNT(*) FROM users WHERE "minion.ironman" = true AND "skills.${params.skillName}" >= ${LEVEL_99_XP};` + `SELECT COUNT(*)::int FROM users WHERE "minion.ironman" = true AND "skills.${params.skillName}" >= ${LEVEL_99_XP};` ); str += ` They are the ${formatOrdinal(parseInt(ironmenWith.count) + 1)} Ironman to get 99.`; } diff --git a/src/lib/analytics.ts b/src/lib/analytics.ts index f2689b8908..1d60da2474 100644 --- a/src/lib/analytics.ts +++ b/src/lib/analytics.ts @@ -39,10 +39,10 @@ export async function analyticsTick() { const [numberOfMinions, totalSacrificed, numberOfIronmen, totalGP] = ( await Promise.all( [ - 'SELECT COUNT(*) FROM users WHERE "minion.hasBought" = true;', - 'SELECT SUM ("sacrificedValue") AS count FROM users;', - 'SELECT COUNT(*) FROM users WHERE "minion.ironman" = true;', - 'SELECT SUM ("GP") AS count FROM users;' + 'SELECT COUNT(*)::int FROM users WHERE "minion.hasBought" = true;', + 'SELECT SUM("sacrificedValue")::int AS count FROM users;', + 'SELECT COUNT(*)::int FROM users WHERE "minion.ironman" = true;', + 'SELECT SUM("GP") AS count FROM users;' ].map(query => prisma.$queryRawUnsafe(query)) ) ).map((result: any) => parseInt(result[0].count)) as number[]; diff --git a/src/lib/roboChimp.ts b/src/lib/roboChimp.ts index 8373f16b7f..7b32294dcc 100644 --- a/src/lib/roboChimp.ts +++ b/src/lib/roboChimp.ts @@ -83,7 +83,7 @@ export async function roboChimpUserFetch(userID: string) { export async function calculateOwnCLRanking(userID: string) { const clPercentRank = ( - await roboChimpClient.$queryRaw<{ count: number }[]>`SELECT COUNT(*) + await roboChimpClient.$queryRaw<{ count: number }[]>`SELECT COUNT(*)::int FROM public.user WHERE osb_cl_percent >= (SELECT osb_cl_percent FROM public.user WHERE id = ${BigInt(userID)});` )[0].count; diff --git a/src/lib/rolesTask.ts b/src/lib/rolesTask.ts index 51656b8806..7008b9756a 100644 --- a/src/lib/rolesTask.ts +++ b/src/lib/rolesTask.ts @@ -44,7 +44,7 @@ LIMIT 1;`; const mostSlayerTasksDoneQuery = `SELECT user_id::text as id, 'Most Tasks' as desc FROM slayer_tasks GROUP BY user_id -ORDER BY count(user_id) DESC +ORDER BY count(user_id)::int DESC LIMIT 1;`; async function addRoles({ @@ -287,12 +287,12 @@ SELECT id, (cardinality(u.cl_keys) - u.inverse_length) as qty addToUserMap(userMap, mostValueIronman[0].id, 'Rank 1 Ironman Sacrificed Value'); const mostUniques = await q(`SELECT u.id, u.sacbanklength FROM ( - SELECT (SELECT COUNT(*) FROM JSONB_OBJECT_KEYS("sacrificed_bank")) sacbanklength, user_id::text as id FROM user_stats + SELECT (SELECT COUNT(*)::int FROM JSONB_OBJECT_KEYS("sacrificed_bank")) sacbanklength, user_id::text as id FROM user_stats ) u ORDER BY u.sacbanklength DESC LIMIT 1;`); const mostUniquesIron = await q(`SELECT u.id, u.sacbanklength FROM ( - SELECT (SELECT COUNT(*) FROM JSONB_OBJECT_KEYS("sacrificed_bank")) sacbanklength, user_id::text as id FROM user_stats + SELECT (SELECT COUNT(*)::int FROM JSONB_OBJECT_KEYS("sacrificed_bank")) sacbanklength, user_id::text as id FROM user_stats INNER JOIN users ON "user_stats"."user_id"::text = "users"."id" WHERE "users"."minion.ironman" = true ) u @@ -388,7 +388,7 @@ LIMIT 2;`, FROM activity WHERE type = 'Farming' GROUP BY user_id -ORDER BY count(user_id) DESC +ORDER BY count(user_id)::int DESC LIMIT 2;`, `SELECT user_id::text as id, 'Top 2 Tithe Farm' as desc FROM user_stats @@ -445,7 +445,9 @@ LIMIT 2;` '982989775399174184', '346304390858145792' ]; - const res = await prisma.$queryRaw<{ user_id: string; qty: number }[]>`SELECT user_id, COUNT(user_id) AS qty + const res = await prisma.$queryRaw< + { user_id: string; qty: number }[] + >`SELECT user_id, COUNT(user_id)::int AS qty FROM giveaway WHERE channel_id IN (${Prisma.join(GIVEAWAY_CHANNELS)}) AND user_id NOT IN ('157797566833098752') diff --git a/src/lib/settings/prisma.ts b/src/lib/settings/prisma.ts index b36b777d15..e8c6096614 100644 --- a/src/lib/settings/prisma.ts +++ b/src/lib/settings/prisma.ts @@ -59,7 +59,7 @@ export function convertStoredActivityToFlatActivity(activity: Activity): Activit * ⚠️ Uses queryRawUnsafe */ export async function countUsersWithItemInCl(itemID: number, ironmenOnly: boolean) { - const query = `SELECT COUNT(id) + const query = `SELECT COUNT(id)::int FROM users WHERE ("collectionLogBank"->>'${itemID}') IS NOT NULL AND ("collectionLogBank"->>'${itemID}')::int >= 1 diff --git a/src/lib/slayer/slayerUtil.ts b/src/lib/slayer/slayerUtil.ts index b2b4248edc..d18c50a9d9 100644 --- a/src/lib/slayer/slayerUtil.ts +++ b/src/lib/slayer/slayerUtil.ts @@ -453,7 +453,7 @@ export function filterLootReplace(myBank: Bank, myLoot: Bank) { export async function getSlayerTaskStats(userID: string) { const result: { monster_id: number; total_quantity: number; qty: number }[] = - await prisma.$queryRaw`SELECT monster_id, SUM(quantity) AS total_quantity, COUNT(monster_id) AS qty + await prisma.$queryRaw`SELECT monster_id, SUM(quantity)::int AS total_quantity, COUNT(monster_id)::int AS qty FROM slayer_tasks WHERE user_id = ${userID} AND quantity_remaining = 0 diff --git a/src/mahoji/commands/admin.ts b/src/mahoji/commands/admin.ts index 3b279fa17f..097731b97c 100644 --- a/src/mahoji/commands/admin.ts +++ b/src/mahoji/commands/admin.ts @@ -131,7 +131,7 @@ async function unsafeEval({ userID, code }: { userID: string; code: string }) { async function allEquippedPets() { const pets = await prisma.$queryRawUnsafe< { pet: number; qty: number }[] - >(`SELECT "minion.equippedPet" AS pet, COUNT("minion.equippedPet") AS qty + >(`SELECT "minion.equippedPet" AS pet, COUNT("minion.equippedPet")::int AS qty FROM users WHERE "minion.equippedPet" IS NOT NULL GROUP BY "minion.equippedPet" @@ -289,7 +289,7 @@ AND ("gear.melee" IS NOT NULL OR >(`SELECT (blowpipe->>'scales')::int AS scales, (blowpipe->>'dartID')::int AS dart, (blowpipe->>'dartQuantity')::int AS qty FROM users WHERE blowpipe iS NOT NULL and (blowpipe->>'dartQuantity')::int != 0;`), - prisma.$queryRawUnsafe<{ sum: number }[]>('SELECT SUM("GP") FROM users;'), + prisma.$queryRawUnsafe<{ sum: number }[]>('SELECT SUM("GP")::int FROM users;'), prisma.$queryRawUnsafe<{ banks: ItemBank }[]>(`SELECT json_object_agg(itemID, itemQTY)::jsonb as banks from ( @@ -329,7 +329,7 @@ WHERE blowpipe iS NOT NULL and (blowpipe->>'dartQuantity')::int != 0;`), name: 'Most Active', run: async () => { const res = await prisma.$queryRawUnsafe<{ num: number; username: string }[]>(` -SELECT sum(duration) as num, "new_user"."username", user_id +SELECT sum(duration)::int as num, "new_user"."username", user_id FROM activity INNER JOIN "new_users" "new_user" on "new_user"."id" = "activity"."user_id"::text WHERE start_date > now() - interval '2 days' @@ -409,11 +409,11 @@ The next buy limit reset is at: ${buyLimitInterval.nextResetStr}, it resets ever run: async () => { const result = await prisma.$queryRawUnsafe<{ item_id: string; total_gp_spent: number }[]>(`SELECT key AS item_id, - sum((cost_gp / total_items) * value::integer) AS total_gp_spent + sum((cost_gp / total_items) * value::integer)::int AS total_gp_spent FROM buy_command_transaction, json_each_text(loot_bank), - (SELECT id, sum(value::integer) as total_items FROM buy_command_transaction, json_each_text(loot_bank) GROUP BY id) subquery + (SELECT id, sum(value::integer)::int as total_items FROM buy_command_transaction, json_each_text(loot_bank) GROUP BY id) subquery WHERE buy_command_transaction.id = subquery.id GROUP BY @@ -441,7 +441,7 @@ LIMIT run: async () => { const result = await prisma.$queryRawUnsafe< { item_id: number; gp: number }[] - >(`select item_id, sum(gp_received) as gp + >(`select item_id, sum(gp_received)::int as gp from bot_item_sell group by item_id order by gp desc @@ -450,7 +450,7 @@ limit 80; const totalGPGivenOut = await prisma.$queryRawUnsafe< { total_gp_given_out: number }[] - >(`select sum(gp_received) as total_gp_given_out + >(`select sum(gp_received)::int as total_gp_given_out from bot_item_sell;`); return { @@ -479,7 +479,7 @@ from bot_item_sell;`); name: 'Max G.E Slot users', run: async () => { const res = await prisma.$queryRawUnsafe<{ user_id: string; slots_used: number }[]>(` -SELECT user_id, COUNT(*) AS slots_used +SELECT user_id, COUNT(*)::int AS slots_used FROM ge_listing WHERE cancelled_at IS NULL AND fulfilled_at IS NULL GROUP BY user_id diff --git a/src/mahoji/commands/ge.ts b/src/mahoji/commands/ge.ts index d4ec891f94..fc6e6f7726 100644 --- a/src/mahoji/commands/ge.ts +++ b/src/mahoji/commands/ge.ts @@ -396,7 +396,7 @@ The next buy limit reset is at: ${GrandExchange.getInterval().nextResetStr}, it >(`SELECT DATE_TRUNC('week', sellTransactions.created_at) AS week, AVG(sellTransactions.price_per_item_before_tax) AS average_price_per_item_before_tax, - SUM(sellTransactions.quantity_bought) AS total_quantity_bought + SUM(sellTransactions.quantity_bought)::int AS total_quantity_bought FROM ge_listing INNER JOIN diff --git a/src/mahoji/commands/leaderboard.ts b/src/mahoji/commands/leaderboard.ts index cafadd7934..f6d3cc2ac3 100644 --- a/src/mahoji/commands/leaderboard.ts +++ b/src/mahoji/commands/leaderboard.ts @@ -186,7 +186,7 @@ async function sacrificeLb( const mostUniques: { id: string; sacbanklength: number }[] = await prisma.$queryRawUnsafe( `SELECT u.user_id::text AS id, u.sacbanklength FROM ( - SELECT (SELECT COUNT(*) FROM JSONB_OBJECT_KEYS(sacrificed_bank)) sacbanklength, user_id FROM user_stats + SELECT (SELECT COUNT(*)::int FROM JSONB_OBJECT_KEYS(sacrificed_bank)) sacbanklength, user_id FROM user_stats ${ironmanOnly ? 'INNER JOIN users ON users.id::bigint = user_stats.user_id WHERE "minion.ironman" = true' : ''} ) u ORDER BY u.sacbanklength DESC LIMIT 10; diff --git a/src/mahoji/commands/tools.ts b/src/mahoji/commands/tools.ts index a054d3d8cc..65aaf20731 100644 --- a/src/mahoji/commands/tools.ts +++ b/src/mahoji/commands/tools.ts @@ -103,7 +103,7 @@ GROUP BY type ORDER BY qty DESC LIMIT 15;`), prisma.$queryRawUnsafe(` -SELECT sum(duration) +SELECT sum(duration)::int FROM activity WHERE user_id = ${id} ${whereInMassClause(id)};`) diff --git a/src/mahoji/lib/abstracted_commands/infernoCommand.ts b/src/mahoji/lib/abstracted_commands/infernoCommand.ts index de277b5a63..bef958eb09 100644 --- a/src/mahoji/lib/abstracted_commands/infernoCommand.ts +++ b/src/mahoji/lib/abstracted_commands/infernoCommand.ts @@ -118,7 +118,7 @@ function baseDuration(_attempts: number) { async function timesMadeToZuk(userID: string) { const timesMadeToZuk = Number( ( - await prisma.$queryRawUnsafe(`SELECT COUNT(*) + await prisma.$queryRawUnsafe(`SELECT COUNT(*)::int FROM activity WHERE type = 'Inferno' AND user_id = ${userID} diff --git a/src/mahoji/lib/abstracted_commands/statCommand.ts b/src/mahoji/lib/abstracted_commands/statCommand.ts index 2cb942e481..bb339a7ee4 100644 --- a/src/mahoji/lib/abstracted_commands/statCommand.ts +++ b/src/mahoji/lib/abstracted_commands/statCommand.ts @@ -118,7 +118,7 @@ WHERE export async function personalConstructionStats(user: MUser) { const result: { id: number; qty: number }[] = - await prisma.$queryRawUnsafe(`SELECT (data->>'objectID')::int AS id, SUM((data->>'quantity')::int) AS qty + await prisma.$queryRawUnsafe(`SELECT (data->>'objectID')::int AS id, SUM((data->>'quantity')::int)::int AS qty FROM activity WHERE type = 'Construction' AND user_id = '${user.id}'::bigint @@ -136,7 +136,7 @@ GROUP BY data->>'objectID';`); export async function personalFiremakingStats(user: MUser) { const result: { id: number; qty: number }[] = - await prisma.$queryRawUnsafe(`SELECT (data->>'burnableID')::int AS id, SUM((data->>'quantity')::int) AS qty + await prisma.$queryRawUnsafe(`SELECT (data->>'burnableID')::int AS id, SUM((data->>'quantity')::int)::int AS qty FROM activity WHERE type = 'Firemaking' AND user_id = '${user.id}'::bigint @@ -154,7 +154,7 @@ GROUP BY data->>'burnableID';`); export async function personalWoodcuttingStats(user: MUser) { const result: { id: number; qty: number }[] = - await prisma.$queryRawUnsafe(`SELECT (data->>'logID')::int AS id, SUM((data->>'quantity')::int) AS qty + await prisma.$queryRawUnsafe(`SELECT (data->>'logID')::int AS id, SUM((data->>'quantity')::int)::int AS qty FROM activity WHERE type = 'Woodcutting' AND user_id = '${user.id}'::bigint @@ -172,7 +172,7 @@ GROUP BY data->>'logID';`); export async function personalMiningStats(user: MUser) { const result: { id: number; qty: number }[] = - await prisma.$queryRawUnsafe(`SELECT (data->>'oreID')::int AS id, SUM((data->>'quantity')::int) AS qty + await prisma.$queryRawUnsafe(`SELECT (data->>'oreID')::int AS id, SUM((data->>'quantity')::int)::int AS qty FROM activity WHERE type = 'Mining' AND user_id = '${user.id}'::bigint @@ -190,7 +190,7 @@ GROUP BY data->>'oreID';`); export async function personalHerbloreStats(user: MUser, stats: UserStats) { const result: { id: number; qty: number }[] = - await prisma.$queryRawUnsafe(`SELECT (data->>'mixableID')::int AS id, SUM((data->>'quantity')::int) AS qty + await prisma.$queryRawUnsafe(`SELECT (data->>'mixableID')::int AS id, SUM((data->>'quantity')::int)::int AS qty FROM activity WHERE type = 'Herblore' AND user_id = '${user.id}'::bigint @@ -208,7 +208,7 @@ GROUP BY data->>'mixableID';`); } export async function personalAlchingStats(user: MUser, includeAgilityAlching = true) { const result: { id: number; qty: number }[] = - await prisma.$queryRawUnsafe(`SELECT (data->>'itemID')::int AS id, SUM((data->>'quantity')::int) AS qty + await prisma.$queryRawUnsafe(`SELECT (data->>'itemID')::int AS id, SUM((data->>'quantity')::int)::int AS qty FROM activity WHERE type = 'Alching' AND user_id = '${user.id}'::bigint @@ -216,7 +216,7 @@ AND data->>'itemID' IS NOT NULL AND completed = true GROUP BY data->>'itemID';`); const agilityAlchRes: { id: number; qty: number }[] = - await prisma.$queryRawUnsafe(`SELECT (((data->>'alch')::json)->>'itemID')::int AS id, SUM((((data->>'alch')::json)->>'quantity')::int) AS qty + await prisma.$queryRawUnsafe(`SELECT (((data->>'alch')::json)->>'itemID')::int AS id, SUM((((data->>'alch')::json)->>'quantity')::int)::int AS qty FROM activity WHERE type = 'Agility' AND user_id = '${user.id}'::bigint @@ -234,7 +234,7 @@ GROUP BY ((data->>'alch')::json)->>'itemID';`); } export async function personalSmithingStats(user: MUser) { const result: { id: number; qty: number }[] = - await prisma.$queryRawUnsafe(`SELECT (data->>'smithedBarID')::int AS id, SUM((data->>'quantity')::int) AS qty + await prisma.$queryRawUnsafe(`SELECT (data->>'smithedBarID')::int AS id, SUM((data->>'quantity')::int)::int AS qty FROM activity WHERE type = 'Smithing' AND user_id = '${user.id}'::bigint @@ -251,7 +251,7 @@ GROUP BY data->>'smithedBarID';`); } export async function personalSmeltingStats(user: MUser) { const result: { id: number; qty: number }[] = - await prisma.$queryRawUnsafe(`SELECT (data->>'barID')::int AS id, SUM((data->>'quantity')::int) AS qty + await prisma.$queryRawUnsafe(`SELECT (data->>'barID')::int AS id, SUM((data->>'quantity')::int)::int AS qty FROM activity WHERE type = 'Smelting' AND user_id = '${user.id}'::bigint @@ -268,7 +268,7 @@ GROUP BY data->>'barID';`); } export async function personalSpellCastStats(user: MUser) { const result: { id: number; qty: number }[] = - await prisma.$queryRawUnsafe(`SELECT (data->>'spellID')::int AS id, SUM((data->>'quantity')::int) AS qty + await prisma.$queryRawUnsafe(`SELECT (data->>'spellID')::int AS id, SUM((data->>'quantity')::int)::int AS qty FROM activity WHERE type = 'Casting' AND user_id = '${user.id}'::bigint @@ -279,7 +279,7 @@ GROUP BY data->>'spellID';`); } export async function personalCollectingStats(user: MUser) { const result: { id: number; qty: number }[] = - await prisma.$queryRawUnsafe(`SELECT (data->>'collectableID')::int AS id, SUM((data->>'quantity')::int) AS qty + await prisma.$queryRawUnsafe(`SELECT (data->>'collectableID')::int AS id, SUM((data->>'quantity')::int)::int AS qty FROM activity WHERE type = 'Collecting' AND user_id = '${user.id}'::bigint @@ -323,7 +323,7 @@ export const dataPoints: readonly DataPiece[] = [ perkTierNeeded: PerkTier.Four, run: async (user: MUser) => { const result: { type: activity_type_enum; qty: number }[] = - await prisma.$queryRawUnsafe(`SELECT type, count(type) AS qty + await prisma.$queryRawUnsafe(`SELECT type, count(type)::int AS qty FROM activity WHERE completed = true AND user_id = ${BigInt(user.id)} @@ -418,7 +418,7 @@ GROUP BY data->>'monsterID';`); perkTierNeeded: PerkTier.Four, run: async () => { const result: { mins: number; count: number }[] = - await prisma.$queryRaw`SELECT mins, COUNT(mins) FROM (SELECT ((data->>'deathTime')::int / 1000 / 60) as mins + await prisma.$queryRaw`SELECT mins, COUNT(mins)::int FROM (SELECT ((data->>'deathTime')::int / 1000 / 60) as mins FROM activity WHERE type = 'Inferno' AND completed = true @@ -438,7 +438,7 @@ GROUP BY mins;`; perkTierNeeded: PerkTier.Four, run: async (user: MUser) => { const result: { mins: number; count: number }[] = - await prisma.$queryRawUnsafe(`SELECT mins, COUNT(mins) FROM (SELECT ((data->>'deathTime')::int / 1000 / 60) as mins + await prisma.$queryRawUnsafe(`SELECT mins, COUNT(mins)::int FROM (SELECT ((data->>'deathTime')::int / 1000 / 60) as mins FROM activity WHERE type = 'Inferno' AND user_id = ${BigInt(user.id)} @@ -561,7 +561,7 @@ WHERE "skills.${skillName}" = 200000000::int;`) as Promise<{ qty: number; skill_ perkTierNeeded: PerkTier.Four, run: async (user: MUser) => { const result: { plant: string; qty: number }[] = - await prisma.$queryRawUnsafe(`SELECT data->>'plantsName' as plant, COUNT(data->>'plantsName') AS qty + await prisma.$queryRawUnsafe(`SELECT data->>'plantsName' as plant, COUNT(data->>'plantsName')::int AS qty FROM activity WHERE type = 'Farming' AND data->>'plantsName' IS NOT NULL @@ -581,7 +581,7 @@ GROUP BY data->>'plantsName'`); perkTierNeeded: PerkTier.Four, run: async () => { const result: { plant: string; qty: number }[] = - await prisma.$queryRaw`SELECT data->>'plantsName' as plant, COUNT(data->>'plantsName') AS qty + await prisma.$queryRaw`SELECT data->>'plantsName' as plant, COUNT(data->>'plantsName')::int AS qty FROM activity WHERE type = 'Farming' AND data->>'plantsName' IS NOT NULL @@ -783,7 +783,7 @@ ${result perkTierNeeded: PerkTier.Four, run: async () => { const result = await prisma.$queryRawUnsafe( - 'SELECT COUNT(*) FROM users WHERE "minion.hasBought" = true;' + 'SELECT COUNT(*)::int FROM users WHERE "minion.hasBought" = true;' ); return `There are ${result[0].count.toLocaleString()} minions!`; } @@ -793,7 +793,7 @@ ${result perkTierNeeded: PerkTier.Four, run: async () => { const result = await prisma.$queryRawUnsafe( - 'SELECT COUNT(*) FROM users WHERE "minion.ironman" = true;' + 'SELECT COUNT(*)::int FROM users WHERE "minion.ironman" = true;' ); return `There are ${parseInt(result[0].count).toLocaleString()} ironman minions!`; } @@ -803,7 +803,7 @@ ${result perkTierNeeded: PerkTier.Four, run: async () => { const result: { icon: string | null; qty: number }[] = await prisma.$queryRawUnsafe( - 'SELECT "minion.icon" as icon, COUNT(*) as qty FROM users WHERE "minion.icon" is not null group by "minion.icon" order by qty asc;' + 'SELECT "minion.icon" as icon, COUNT(*)::int as qty FROM users WHERE "minion.icon" is not null group by "minion.icon" order by qty asc;' ); return `**Current minion tiers and their number of users:**\n${Object.values(result) .map(row => `${row.icon ?? '<:minion:763743627092164658>'} : ${row.qty}`) @@ -814,7 +814,7 @@ ${result name: 'Global Bank Backgrounds', perkTierNeeded: PerkTier.Four, run: async () => { - const result = await prisma.$queryRawUnsafe(`SELECT "bankBackground", COUNT(*) + const result = await prisma.$queryRawUnsafe(`SELECT "bankBackground", COUNT(*)::int FROM users WHERE "bankBackground" <> 1 GROUP BY "bankBackground";`); @@ -959,7 +959,7 @@ GROUP BY "bankBackground";`); run: async (user: MUser) => { const result = await prisma.$queryRawUnsafe( `SELECT skill, - SUM(xp) AS total_xp + SUM(xp)::int AS total_xp FROM xp_gains WHERE source = 'TearsOfGuthix' AND user_id = ${BigInt(user.id)} From 64e4e46f15b8325967d8599213dcee96ee9dda0d Mon Sep 17 00:00:00 2001 From: gc <30398469+gc@users.noreply.github.com> Date: Tue, 27 Feb 2024 16:21:40 +1100 Subject: [PATCH 13/15] Bigint fixes --- src/mahoji/commands/admin.ts | 12 ++++++------ src/mahoji/lib/abstracted_commands/statCommand.ts | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/mahoji/commands/admin.ts b/src/mahoji/commands/admin.ts index 097731b97c..320962f9fc 100644 --- a/src/mahoji/commands/admin.ts +++ b/src/mahoji/commands/admin.ts @@ -289,7 +289,7 @@ AND ("gear.melee" IS NOT NULL OR >(`SELECT (blowpipe->>'scales')::int AS scales, (blowpipe->>'dartID')::int AS dart, (blowpipe->>'dartQuantity')::int AS qty FROM users WHERE blowpipe iS NOT NULL and (blowpipe->>'dartQuantity')::int != 0;`), - prisma.$queryRawUnsafe<{ sum: number }[]>('SELECT SUM("GP")::int FROM users;'), + prisma.$queryRawUnsafe<{ sum: number }[]>('SELECT SUM("GP") FROM users;'), prisma.$queryRawUnsafe<{ banks: ItemBank }[]>(`SELECT json_object_agg(itemID, itemQTY)::jsonb as banks from ( @@ -407,13 +407,13 @@ The next buy limit reset is at: ${buyLimitInterval.nextResetStr}, it resets ever { name: 'Buy GP Sinks', run: async () => { - const result = await prisma.$queryRawUnsafe<{ item_id: string; total_gp_spent: number }[]>(`SELECT + const result = await prisma.$queryRawUnsafe<{ item_id: string; total_gp_spent: bigint }[]>(`SELECT key AS item_id, - sum((cost_gp / total_items) * value::integer)::int AS total_gp_spent + sum((cost_gp / total_items) * value::integer) AS total_gp_spent FROM buy_command_transaction, json_each_text(loot_bank), - (SELECT id, sum(value::integer)::int as total_items FROM buy_command_transaction, json_each_text(loot_bank) GROUP BY id) subquery + (SELECT id, sum(value::integer) as total_items FROM buy_command_transaction, json_each_text(loot_bank) GROUP BY id) subquery WHERE buy_command_transaction.id = subquery.id GROUP BY @@ -441,7 +441,7 @@ LIMIT run: async () => { const result = await prisma.$queryRawUnsafe< { item_id: number; gp: number }[] - >(`select item_id, sum(gp_received)::int as gp + >(`select item_id, sum(gp_received) as gp from bot_item_sell group by item_id order by gp desc @@ -450,7 +450,7 @@ limit 80; const totalGPGivenOut = await prisma.$queryRawUnsafe< { total_gp_given_out: number }[] - >(`select sum(gp_received)::int as total_gp_given_out + >(`select sum(gp_received) as total_gp_given_out from bot_item_sell;`); return { diff --git a/src/mahoji/lib/abstracted_commands/statCommand.ts b/src/mahoji/lib/abstracted_commands/statCommand.ts index bb339a7ee4..ecca38d52a 100644 --- a/src/mahoji/lib/abstracted_commands/statCommand.ts +++ b/src/mahoji/lib/abstracted_commands/statCommand.ts @@ -338,7 +338,7 @@ GROUP BY type;`); perkTierNeeded: PerkTier.Four, run: async (user: MUser) => { const result: { type: activity_type_enum; hours: number }[] = - await prisma.$queryRawUnsafe(`SELECT type, sum(duration) / ${Time.Hour} AS hours + await prisma.$queryRawUnsafe(`SELECT type, sum(duration)::int / ${Time.Hour} AS hours FROM activity WHERE completed = true AND user_id = ${BigInt(user.id)} @@ -357,7 +357,7 @@ GROUP BY type;`); perkTierNeeded: PerkTier.Four, run: async (user: MUser) => { const result: { id: number; kc: number }[] = - await prisma.$queryRawUnsafe(`SELECT (data->>'monsterID')::int as id, SUM((data->>'quantity')::int) AS kc + await prisma.$queryRawUnsafe(`SELECT (data->>'monsterID')::int as id, SUM((data->>'quantity')::int)::int AS kc FROM activity WHERE completed = true AND user_id = ${BigInt(user.id)} From b073bbc7187fdb048ba8b948acc41a6f4ae11e62 Mon Sep 17 00:00:00 2001 From: gc <30398469+gc@users.noreply.github.com> Date: Tue, 27 Feb 2024 16:43:05 +1100 Subject: [PATCH 14/15] Undo bso changes to tob --- src/lib/simulation/tob.ts | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/lib/simulation/tob.ts b/src/lib/simulation/tob.ts index 6993e2a0da..47264dc4a3 100644 --- a/src/lib/simulation/tob.ts +++ b/src/lib/simulation/tob.ts @@ -94,9 +94,6 @@ export class TheatreOfBloodClass { return new Bank().add('Cabbage'); } - if (BOT_TYPE === 'BSO') { - NonUniqueTable.tertiary(25, 'Clue scroll (elite)'); - } const loot = new Bank(); for (let i = 0; i < 3; i++) { loot.add(NonUniqueTable.roll()); @@ -111,10 +108,8 @@ export class TheatreOfBloodClass { loot.add(HardModeExtraTable.roll()); } - if (BOT_TYPE === 'OSB') { - if (roll(25)) { - loot.add('Clue scroll (elite)'); - } + if (roll(25)) { + loot.add('Clue scroll (elite)'); } let petChance = isHardMode ? 500 : 650; From 0b0d67cbc0999376eacc5ae16efcbe5dae1c0b9b Mon Sep 17 00:00:00 2001 From: gc <30398469+gc@users.noreply.github.com> Date: Tue, 27 Feb 2024 17:36:28 +1100 Subject: [PATCH 15/15] Update toolkit --- package.json | 2 +- src/lib/simulation/tob.ts | 1 - yarn.lock | 8 ++++---- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 2e28c085c8..226848a0bc 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "@fastify/sensible": "^5.2.0", "@napi-rs/canvas": "0.1.38", "@octokit/graphql": "^4.8.0", - "@oldschoolgg/toolkit": "^0.0.23", + "@oldschoolgg/toolkit": "^0.0.24", "@prisma/client": "^5.10.2", "@sapphire/stopwatch": "^1.4.0", "@sapphire/time-utilities": "^1.6.0", diff --git a/src/lib/simulation/tob.ts b/src/lib/simulation/tob.ts index 47264dc4a3..3148333da4 100644 --- a/src/lib/simulation/tob.ts +++ b/src/lib/simulation/tob.ts @@ -4,7 +4,6 @@ import { Bank, LootTable } from 'oldschooljs'; import { LootBank } from 'oldschooljs/dist/meta/types'; import { convertLootBanksToItemBanks, JSONClone } from 'oldschooljs/dist/util'; -import { BOT_TYPE } from '../constants'; import { TOBRooms } from '../data/tob'; import { assert } from '../util/logError'; diff --git a/yarn.lock b/yarn.lock index 6c5fe69ffa..8879d788cb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -653,10 +653,10 @@ eslint-plugin-unicorn "^44.0.2" prettier "^2.7.1" -"@oldschoolgg/toolkit@^0.0.23": - version "0.0.23" - resolved "https://registry.yarnpkg.com/@oldschoolgg/toolkit/-/toolkit-0.0.23.tgz#6805c7f6321ca0f13c5ad84478ea79051e13e319" - integrity sha512-84RhRCa8McsB5SJ39sJ51XxSapdr008ZCILNz7xVBTvyagBso2BlxM81tMx0+mcn/Xu3IbQnvrv7nKw5eyXZbQ== +"@oldschoolgg/toolkit@^0.0.24": + version "0.0.24" + resolved "https://registry.yarnpkg.com/@oldschoolgg/toolkit/-/toolkit-0.0.24.tgz#86867f126565d278a209d0e95b3cd9ae527b39ac" + integrity sha512-z73pPLvVohlimglhWcgGcX/bF2oadUDaZvrWBpDKKChr4kiNhVXgBlnGyOQ6xJxwZGvQ+QhepSK/ZQTHaQ4ufA== dependencies: deepmerge "^4.3.1" e "^0.2.3"