From e70288335ec8e837b1624ba7e9749921cc6dfad1 Mon Sep 17 00:00:00 2001 From: Lukas Obermann Date: Mon, 9 Feb 2026 14:13:33 +0100 Subject: [PATCH] refactor!: migrate codebase to TSONDB database --- package-lock.json | 2777 +++++++++-------- package.json | 25 +- src/creator.ts | 11 +- src/entities/combatTechnique.ts | 24 +- src/entities/experienceLevel.ts | 2 +- src/entities/focusRule.ts | 16 +- src/entities/liturgicalChant.ts | 346 +- src/entities/optionalRule.ts | 2 +- src/entities/partial/activatableNameChunks.ts | 48 +- .../partial/prerequisites/displayOption.ts | 10 +- src/entities/partial/prerequisites/index.ts | 1055 +++---- src/entities/partial/prerequisites/part.ts | 4 +- .../prerequisites/prerequisiteGroups.ts | 1050 +++---- .../prerequisites/single/activatable.ts | 592 ++-- .../prerequisites/single/animistPower.ts | 8 +- .../prerequisites/single/blessedTradition.ts | 14 +- .../single/commonSuggestedByRCP.ts | 6 +- .../partial/prerequisites/single/culture.ts | 8 +- .../prerequisites/single/enhancement.ts | 102 +- .../partial/prerequisites/single/influence.ts | 2 +- .../prerequisites/single/magicalTradition.ts | 16 +- .../single/noOtherAncestorBloodAdvantage.ts | 1 - .../partial/prerequisites/single/pact.ts | 37 +- .../prerequisites/single/personalityTrait.ts | 47 + .../prerequisites/single/primaryAttribute.ts | 2 +- .../prerequisites/single/publication.ts | 8 +- .../partial/prerequisites/single/race.ts | 8 +- .../partial/prerequisites/single/rated.ts | 90 +- .../single/ratedMinimumNumber.ts | 188 +- .../partial/prerequisites/single/ratedSum.ts | 19 +- .../partial/prerequisites/single/rule.ts | 2 +- .../partial/prerequisites/single/sex.ts | 5 +- .../single/sexualCharacteristic.ts | 8 +- .../prerequisites/single/socialStatus.ts | 13 +- .../partial/prerequisites/single/state.ts | 8 +- .../partial/prerequisites/single/text.ts | 4 +- .../partial/rated/activatable/castingTime.ts | 35 +- .../rated/activatable/checkResultBased.ts | 22 +- .../partial/rated/activatable/cost.ts | 185 +- .../partial/rated/activatable/duration.ts | 71 +- .../partial/rated/activatable/effect.ts | 14 +- .../partial/rated/activatable/index.ts | 38 +- .../rated/activatable/isMinimumMaximum.ts | 8 +- .../rated/activatable/nonModifiableSuffix.ts | 16 +- .../partial/rated/activatable/range.ts | 44 +- .../partial/rated/activatable/speed.ts | 2 +- .../rated/activatable/targetCategory.ts | 50 +- src/entities/partial/rated/improvementCost.ts | 6 +- src/entities/partial/rated/skillCheck.ts | 32 +- src/entities/partial/responsiveText.ts | 7 +- src/entities/partial/units/energy.ts | 14 +- src/entities/partial/units/length.ts | 34 +- src/entities/partial/units/timeSpan.ts | 49 +- src/entities/skill.ts | 106 +- src/entities/spell.ts | 679 ++-- src/helpers/enums.ts | 20 + src/helpers/getTypes.ts | 506 +-- src/helpers/identifiers.ts | 390 ++- src/helpers/translate.ts | 19 +- src/index.ts | 2 +- src/references/index.ts | 108 +- src/references/occurrence.ts | 27 - src/references/page.ts | 30 +- src/references/pageRange.ts | 35 +- test/entities/partial/prerequisites/part.ts | 19 +- .../partial/prerequisites/single/state.ts | 42 +- .../partial/prerequisites/single/text.ts | 11 +- .../rated/activatable/checkResultBased.ts | 13 +- test/helpers/translate.ts | 19 +- test/references/page.ts | 166 +- test/references/pageRange.ts | 33 +- 71 files changed, 4227 insertions(+), 5183 deletions(-) create mode 100644 src/entities/partial/prerequisites/single/personalityTrait.ts create mode 100644 src/helpers/enums.ts delete mode 100644 src/references/occurrence.ts diff --git a/package-lock.json b/package-lock.json index 7047c05..60a4c95 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,19 +9,21 @@ "version": "0.2.1", "license": "MPL-2.0", "dependencies": { - "@optolith/helpers": "^0.2.2" + "@optolith/helpers": "^0.2.2", + "messageformat": "^4.0.0" }, "devDependencies": { "@eslint/js": "^9.17.0", - "@types/node": "^22.10.5", - "commit-and-tag-version": "^12.5.0", - "eslint-config-prettier": "^9.1.0", - "eslint-plugin-jsdoc": "^50.6.1", - "glob": "^11.0.0", - "globals": "^15.14.0", - "tsx": "^4.19.2", - "typescript": "^5.7.2", - "typescript-eslint": "^8.19.0" + "@types/node": "^25.2.1", + "commit-and-tag-version": "^12.6.1", + "eslint-config-prettier": "^10.1.8", + "eslint-plugin-jsdoc": "^62.5.4", + "glob": "^13.0.1", + "globals": "^17.3.0", + "optolith-database-schema": "^0.29.0", + "tsx": "^4.21.0", + "typescript": "^5.9.3", + "typescript-eslint": "^8.54.0" } }, "node_modules/@babel/code-frame": { @@ -64,25 +66,44 @@ "node": ">=6.9.0" } }, + "node_modules/@elyukai/utils": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/@elyukai/utils/-/utils-0.2.1.tgz", + "integrity": "sha512-az6I2MHjZ+QEJNcK7xTe/z7dNucBwyT9mYe3BNGl4iUHQiTc2DuMEbsAYrITLtVNTJT6yO6p48m9bzOiVQJO9w==", + "dev": true, + "license": "MPL-2.0" + }, "node_modules/@es-joy/jsdoccomment": { - "version": "0.49.0", - "resolved": "https://registry.npmjs.org/@es-joy/jsdoccomment/-/jsdoccomment-0.49.0.tgz", - "integrity": "sha512-xjZTSFgECpb9Ohuk5yMX5RhUEbfeQcuOp8IF60e+wyzWEF0M5xeSgqsfLtvPEX8BIyOX9saZqzuGPmZ8oWc+5Q==", + "version": "0.84.0", + "resolved": "https://registry.npmjs.org/@es-joy/jsdoccomment/-/jsdoccomment-0.84.0.tgz", + "integrity": "sha512-0xew1CxOam0gV5OMjh2KjFQZsKL2bByX1+q4j3E73MpYIdyUxcZb/xQct9ccUb+ve5KGUYbCUxyPnYB7RbuP+w==", "dev": true, "license": "MIT", "dependencies": { - "comment-parser": "1.4.1", - "esquery": "^1.6.0", - "jsdoc-type-pratt-parser": "~4.1.0" + "@types/estree": "^1.0.8", + "@typescript-eslint/types": "^8.54.0", + "comment-parser": "1.4.5", + "esquery": "^1.7.0", + "jsdoc-type-pratt-parser": "~7.1.1" }, "engines": { - "node": ">=16" + "node": "^20.19.0 || ^22.13.0 || >=24" + } + }, + "node_modules/@es-joy/resolve.exports": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@es-joy/resolve.exports/-/resolve.exports-1.2.0.tgz", + "integrity": "sha512-Q9hjxWI5xBM+qW2enxfe8wDKdFWMfd0Z29k5ZJnuBqD/CasY5Zryj09aCA6owbGATWz+39p5uIdaHXpopOcG8g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" } }, "node_modules/@esbuild/aix-ppc64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.23.1.tgz", - "integrity": "sha512-6VhYk1diRqrhBAqpJEdjASR/+WVRtfjpqKuNw11cLiaWpAT/Uu+nokB+UJnevzy/P9C/ty6AOe0dwueMrGh/iQ==", + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.0.tgz", + "integrity": "sha512-KuZrd2hRjz01y5JK9mEBSD3Vj3mbCvemhT466rSuJYeE/hjuBrHfjjcjMdTm/sz7au+++sdbJZJmuBwQLuw68A==", "cpu": [ "ppc64" ], @@ -97,9 +118,9 @@ } }, "node_modules/@esbuild/android-arm": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.23.1.tgz", - "integrity": "sha512-uz6/tEy2IFm9RYOyvKl88zdzZfwEfKZmnX9Cj1BHjeSGNuGLuMD1kR8y5bteYmwqKm1tj8m4cb/aKEorr6fHWQ==", + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.27.0.tgz", + "integrity": "sha512-j67aezrPNYWJEOHUNLPj9maeJte7uSMM6gMoxfPC9hOg8N02JuQi/T7ewumf4tNvJadFkvLZMlAq73b9uwdMyQ==", "cpu": [ "arm" ], @@ -114,9 +135,9 @@ } }, "node_modules/@esbuild/android-arm64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.23.1.tgz", - "integrity": "sha512-xw50ipykXcLstLeWH7WRdQuysJqejuAGPd30vd1i5zSyKK3WE+ijzHmLKxdiCMtH1pHz78rOg0BKSYOSB/2Khw==", + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.27.0.tgz", + "integrity": "sha512-CC3vt4+1xZrs97/PKDkl0yN7w8edvU2vZvAFGD16n9F0Cvniy5qvzRXjfO1l94efczkkQE6g1x0i73Qf5uthOQ==", "cpu": [ "arm64" ], @@ -131,9 +152,9 @@ } }, "node_modules/@esbuild/android-x64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.23.1.tgz", - "integrity": "sha512-nlN9B69St9BwUoB+jkyU090bru8L0NA3yFvAd7k8dNsVH8bi9a8cUAUSEcEEgTp2z3dbEDGJGfP6VUnkQnlReg==", + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.27.0.tgz", + "integrity": "sha512-wurMkF1nmQajBO1+0CJmcN17U4BP6GqNSROP8t0X/Jiw2ltYGLHpEksp9MpoBqkrFR3kv2/te6Sha26k3+yZ9Q==", "cpu": [ "x64" ], @@ -148,9 +169,9 @@ } }, "node_modules/@esbuild/darwin-arm64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.23.1.tgz", - "integrity": "sha512-YsS2e3Wtgnw7Wq53XXBLcV6JhRsEq8hkfg91ESVadIrzr9wO6jJDMZnCQbHm1Guc5t/CdDiFSSfWP58FNuvT3Q==", + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.0.tgz", + "integrity": "sha512-uJOQKYCcHhg07DL7i8MzjvS2LaP7W7Pn/7uA0B5S1EnqAirJtbyw4yC5jQ5qcFjHK9l6o/MX9QisBg12kNkdHg==", "cpu": [ "arm64" ], @@ -165,9 +186,9 @@ } }, "node_modules/@esbuild/darwin-x64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.23.1.tgz", - "integrity": "sha512-aClqdgTDVPSEGgoCS8QDG37Gu8yc9lTHNAQlsztQ6ENetKEO//b8y31MMu2ZaPbn4kVsIABzVLXYLhCGekGDqw==", + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.27.0.tgz", + "integrity": "sha512-8mG6arH3yB/4ZXiEnXof5MK72dE6zM9cDvUcPtxhUZsDjESl9JipZYW60C3JGreKCEP+p8P/72r69m4AZGJd5g==", "cpu": [ "x64" ], @@ -182,9 +203,9 @@ } }, "node_modules/@esbuild/freebsd-arm64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.23.1.tgz", - "integrity": "sha512-h1k6yS8/pN/NHlMl5+v4XPfikhJulk4G+tKGFIOwURBSFzE8bixw1ebjluLOjfwtLqY0kewfjLSrO6tN2MgIhA==", + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.27.0.tgz", + "integrity": "sha512-9FHtyO988CwNMMOE3YIeci+UV+x5Zy8fI2qHNpsEtSF83YPBmE8UWmfYAQg6Ux7Gsmd4FejZqnEUZCMGaNQHQw==", "cpu": [ "arm64" ], @@ -199,9 +220,9 @@ } }, "node_modules/@esbuild/freebsd-x64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.23.1.tgz", - "integrity": "sha512-lK1eJeyk1ZX8UklqFd/3A60UuZ/6UVfGT2LuGo3Wp4/z7eRTRYY+0xOu2kpClP+vMTi9wKOfXi2vjUpO1Ro76g==", + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.27.0.tgz", + "integrity": "sha512-zCMeMXI4HS/tXvJz8vWGexpZj2YVtRAihHLk1imZj4efx1BQzN76YFeKqlDr3bUWI26wHwLWPd3rwh6pe4EV7g==", "cpu": [ "x64" ], @@ -216,9 +237,9 @@ } }, "node_modules/@esbuild/linux-arm": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.23.1.tgz", - "integrity": "sha512-CXXkzgn+dXAPs3WBwE+Kvnrf4WECwBdfjfeYHpMeVxWE0EceB6vhWGShs6wi0IYEqMSIzdOF1XjQ/Mkm5d7ZdQ==", + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.27.0.tgz", + "integrity": "sha512-t76XLQDpxgmq2cNXKTVEB7O7YMb42atj2Re2Haf45HkaUpjM2J0UuJZDuaGbPbamzZ7bawyGFUkodL+zcE+jvQ==", "cpu": [ "arm" ], @@ -233,9 +254,9 @@ } }, "node_modules/@esbuild/linux-arm64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.23.1.tgz", - "integrity": "sha512-/93bf2yxencYDnItMYV/v116zff6UyTjo4EtEQjUBeGiVpMmffDNUyD9UN2zV+V3LRV3/on4xdZ26NKzn6754g==", + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.27.0.tgz", + "integrity": "sha512-AS18v0V+vZiLJyi/4LphvBE+OIX682Pu7ZYNsdUHyUKSoRwdnOsMf6FDekwoAFKej14WAkOef3zAORJgAtXnlQ==", "cpu": [ "arm64" ], @@ -250,9 +271,9 @@ } }, "node_modules/@esbuild/linux-ia32": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.23.1.tgz", - "integrity": "sha512-VTN4EuOHwXEkXzX5nTvVY4s7E/Krz7COC8xkftbbKRYAl96vPiUssGkeMELQMOnLOJ8k3BY1+ZY52tttZnHcXQ==", + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.27.0.tgz", + "integrity": "sha512-Mz1jxqm/kfgKkc/KLHC5qIujMvnnarD9ra1cEcrs7qshTUSksPihGrWHVG5+osAIQ68577Zpww7SGapmzSt4Nw==", "cpu": [ "ia32" ], @@ -267,9 +288,9 @@ } }, "node_modules/@esbuild/linux-loong64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.23.1.tgz", - "integrity": "sha512-Vx09LzEoBa5zDnieH8LSMRToj7ir/Jeq0Gu6qJ/1GcBq9GkfoEAoXvLiW1U9J1qE/Y/Oyaq33w5p2ZWrNNHNEw==", + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.27.0.tgz", + "integrity": "sha512-QbEREjdJeIreIAbdG2hLU1yXm1uu+LTdzoq1KCo4G4pFOLlvIspBm36QrQOar9LFduavoWX2msNFAAAY9j4BDg==", "cpu": [ "loong64" ], @@ -284,9 +305,9 @@ } }, "node_modules/@esbuild/linux-mips64el": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.23.1.tgz", - "integrity": "sha512-nrFzzMQ7W4WRLNUOU5dlWAqa6yVeI0P78WKGUo7lg2HShq/yx+UYkeNSE0SSfSure0SqgnsxPvmAUu/vu0E+3Q==", + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.27.0.tgz", + "integrity": "sha512-sJz3zRNe4tO2wxvDpH/HYJilb6+2YJxo/ZNbVdtFiKDufzWq4JmKAiHy9iGoLjAV7r/W32VgaHGkk35cUXlNOg==", "cpu": [ "mips64el" ], @@ -301,9 +322,9 @@ } }, "node_modules/@esbuild/linux-ppc64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.23.1.tgz", - "integrity": "sha512-dKN8fgVqd0vUIjxuJI6P/9SSSe/mB9rvA98CSH2sJnlZ/OCZWO1DJvxj8jvKTfYUdGfcq2dDxoKaC6bHuTlgcw==", + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.27.0.tgz", + "integrity": "sha512-z9N10FBD0DCS2dmSABDBb5TLAyF1/ydVb+N4pi88T45efQ/w4ohr/F/QYCkxDPnkhkp6AIpIcQKQ8F0ANoA2JA==", "cpu": [ "ppc64" ], @@ -318,9 +339,9 @@ } }, "node_modules/@esbuild/linux-riscv64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.23.1.tgz", - "integrity": "sha512-5AV4Pzp80fhHL83JM6LoA6pTQVWgB1HovMBsLQ9OZWLDqVY8MVobBXNSmAJi//Csh6tcY7e7Lny2Hg1tElMjIA==", + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.27.0.tgz", + "integrity": "sha512-pQdyAIZ0BWIC5GyvVFn5awDiO14TkT/19FTmFcPdDec94KJ1uZcmFs21Fo8auMXzD4Tt+diXu1LW1gHus9fhFQ==", "cpu": [ "riscv64" ], @@ -335,9 +356,9 @@ } }, "node_modules/@esbuild/linux-s390x": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.23.1.tgz", - "integrity": "sha512-9ygs73tuFCe6f6m/Tb+9LtYxWR4c9yg7zjt2cYkjDbDpV/xVn+68cQxMXCjUpYwEkze2RcU/rMnfIXNRFmSoDw==", + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.27.0.tgz", + "integrity": "sha512-hPlRWR4eIDDEci953RI1BLZitgi5uqcsjKMxwYfmi4LcwyWo2IcRP+lThVnKjNtk90pLS8nKdroXYOqW+QQH+w==", "cpu": [ "s390x" ], @@ -352,9 +373,9 @@ } }, "node_modules/@esbuild/linux-x64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.23.1.tgz", - "integrity": "sha512-EV6+ovTsEXCPAp58g2dD68LxoP/wK5pRvgy0J/HxPGB009omFPv3Yet0HiaqvrIrgPTBuC6wCH1LTOY91EO5hQ==", + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.27.0.tgz", + "integrity": "sha512-1hBWx4OUJE2cab++aVZ7pObD6s+DK4mPGpemtnAORBvb5l/g5xFGk0vc0PjSkrDs0XaXj9yyob3d14XqvnQ4gw==", "cpu": [ "x64" ], @@ -368,10 +389,27 @@ "node": ">=18" } }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.27.0.tgz", + "integrity": "sha512-6m0sfQfxfQfy1qRuecMkJlf1cIzTOgyaeXaiVaaki8/v+WB+U4hc6ik15ZW6TAllRlg/WuQXxWj1jx6C+dfy3w==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, "node_modules/@esbuild/netbsd-x64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.23.1.tgz", - "integrity": "sha512-aevEkCNu7KlPRpYLjwmdcuNz6bDFiE7Z8XC4CPqExjTvrHugh28QzUXVOZtiYghciKUacNktqxdpymplil1beA==", + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.27.0.tgz", + "integrity": "sha512-xbbOdfn06FtcJ9d0ShxxvSn2iUsGd/lgPIO2V3VZIPDbEaIj1/3nBBe1AwuEZKXVXkMmpr6LUAgMkLD/4D2PPA==", "cpu": [ "x64" ], @@ -386,9 +424,9 @@ } }, "node_modules/@esbuild/openbsd-arm64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.23.1.tgz", - "integrity": "sha512-3x37szhLexNA4bXhLrCC/LImN/YtWis6WXr1VESlfVtVeoFJBRINPJ3f0a/6LV8zpikqoUg4hyXw0sFBt5Cr+Q==", + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.27.0.tgz", + "integrity": "sha512-fWgqR8uNbCQ/GGv0yhzttj6sU/9Z5/Sv/VGU3F5OuXK6J6SlriONKrQ7tNlwBrJZXRYk5jUhuWvF7GYzGguBZQ==", "cpu": [ "arm64" ], @@ -403,9 +441,9 @@ } }, "node_modules/@esbuild/openbsd-x64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.23.1.tgz", - "integrity": "sha512-aY2gMmKmPhxfU+0EdnN+XNtGbjfQgwZj43k8G3fyrDM/UdZww6xrWxmDkuz2eCZchqVeABjV5BpildOrUbBTqA==", + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.27.0.tgz", + "integrity": "sha512-aCwlRdSNMNxkGGqQajMUza6uXzR/U0dIl1QmLjPtRbLOx3Gy3otfFu/VjATy4yQzo9yFDGTxYDo1FfAD9oRD2A==", "cpu": [ "x64" ], @@ -419,10 +457,27 @@ "node": ">=18" } }, + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.27.0.tgz", + "integrity": "sha512-nyvsBccxNAsNYz2jVFYwEGuRRomqZ149A39SHWk4hV0jWxKM0hjBPm3AmdxcbHiFLbBSwG6SbpIcUbXjgyECfA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" + } + }, "node_modules/@esbuild/sunos-x64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.23.1.tgz", - "integrity": "sha512-RBRT2gqEl0IKQABT4XTj78tpk9v7ehp+mazn2HbUeZl1YMdaGAQqhapjGTCe7uw7y0frDi4gS0uHzhvpFuI1sA==", + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.27.0.tgz", + "integrity": "sha512-Q1KY1iJafM+UX6CFEL+F4HRTgygmEW568YMqDA5UV97AuZSm21b7SXIrRJDwXWPzr8MGr75fUZPV67FdtMHlHA==", "cpu": [ "x64" ], @@ -437,9 +492,9 @@ } }, "node_modules/@esbuild/win32-arm64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.23.1.tgz", - "integrity": "sha512-4O+gPR5rEBe2FpKOVyiJ7wNDPA8nGzDuJ6gN4okSA1gEOYZ67N8JPk58tkWtdtPeLz7lBnY6I5L3jdsr3S+A6A==", + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.27.0.tgz", + "integrity": "sha512-W1eyGNi6d+8kOmZIwi/EDjrL9nxQIQ0MiGqe/AWc6+IaHloxHSGoeRgDRKHFISThLmsewZ5nHFvGFWdBYlgKPg==", "cpu": [ "arm64" ], @@ -454,9 +509,9 @@ } }, "node_modules/@esbuild/win32-ia32": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.23.1.tgz", - "integrity": "sha512-BcaL0Vn6QwCwre3Y717nVHZbAa4UBEigzFm6VdsVdT/MbZ38xoj1X9HPkZhbmaBGUD1W8vxAfffbDe8bA6AKnQ==", + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.27.0.tgz", + "integrity": "sha512-30z1aKL9h22kQhilnYkORFYt+3wp7yZsHWus+wSKAJR8JtdfI76LJ4SBdMsCopTR3z/ORqVu5L1vtnHZWVj4cQ==", "cpu": [ "ia32" ], @@ -471,9 +526,9 @@ } }, "node_modules/@esbuild/win32-x64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.23.1.tgz", - "integrity": "sha512-BHpFFeslkWrXWyUPnbKm+xYYVYruCinGcftSBaa8zoF9hZO4BcSCFUvHVTtzpIY6YzUnYtuEhZ+C9iEXjxnasg==", + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.27.0.tgz", + "integrity": "sha512-aIitBcjQeyOhMTImhLZmtxfdOcuNRpwlPNmlFKPcHQYPhEssw75Cl1TSXJXpMkzaua9FUetx/4OQKq7eJul5Cg==", "cpu": [ "x64" ], @@ -488,17 +543,20 @@ } }, "node_modules/@eslint-community/eslint-utils": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", - "integrity": "sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==", + "version": "4.9.1", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.9.1.tgz", + "integrity": "sha512-phrYmNiYppR7znFEdqgfWHXR6NCkZEK7hwWDHZUjit/2/U0r6XvkDl0SYnoM51Hq7FhCGdLDT6zxCCOY1hexsQ==", "dev": true, "license": "MIT", "dependencies": { - "eslint-visitor-keys": "^3.3.0" + "eslint-visitor-keys": "^3.4.3" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, + "funding": { + "url": "https://opencollective.com/eslint" + }, "peerDependencies": { "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" } @@ -517,9 +575,9 @@ } }, "node_modules/@eslint-community/regexpp": { - "version": "4.11.1", - "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.11.1.tgz", - "integrity": "sha512-m4DVN9ZqskZoLU5GlWZadwDnYo3vAEydiUayB9widCl9ffWx2IvPnp6n3on5rJmziJSw9Bv+Z3ChDVdMwXCY8Q==", + "version": "4.12.2", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.2.tgz", + "integrity": "sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew==", "dev": true, "license": "MIT", "engines": { @@ -527,14 +585,14 @@ } }, "node_modules/@eslint/config-array": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.18.0.tgz", - "integrity": "sha512-fTxvnS1sRMu3+JjXwJG0j/i4RT9u4qJ+lqS/yCGap4lH4zZGzQ7tu+xZqQmcMZq5OBZDL4QRxQzRjkWcGt8IVw==", + "version": "0.21.1", + "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.21.1.tgz", + "integrity": "sha512-aw1gNayWpdI/jSYVgzN5pL0cfzU02GT3NBpeT/DXbx1/1x7ZKxFPd9bwrzygx/qiwIQiJ1sw/zD8qY/kRvlGHA==", "dev": true, "license": "Apache-2.0", "peer": true, "dependencies": { - "@eslint/object-schema": "^2.1.4", + "@eslint/object-schema": "^2.1.7", "debug": "^4.3.1", "minimatch": "^3.1.2" }, @@ -542,21 +600,38 @@ "node": "^18.18.0 || ^20.9.0 || >=21.1.0" } }, - "node_modules/@eslint/core": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.6.0.tgz", - "integrity": "sha512-8I2Q8ykA4J0x0o7cg67FPVnehcqWTBehu/lmY+bolPFHGjh49YzGBMXTvpqVgEbBdvNCSxj6iFgiIyHzf03lzg==", + "node_modules/@eslint/config-helpers": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.4.2.tgz", + "integrity": "sha512-gBrxN88gOIf3R7ja5K9slwNayVcZgK6SOUORm2uBzTeIEfeVaIhOpCtTox3P6R7o2jLFwLFTLnC7kU/RGcYEgw==", "dev": true, "license": "Apache-2.0", "peer": true, + "dependencies": { + "@eslint/core": "^0.17.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/core": { + "version": "0.17.0", + "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.17.0.tgz", + "integrity": "sha512-yL/sLrpmtDaFEiUj1osRP4TI2MDz1AddJL+jZ7KSqvBuliN4xqYY54IfdN8qD8Toa6g1iloph1fxQNkjOxrrpQ==", + "dev": true, + "license": "Apache-2.0", + "peer": true, + "dependencies": { + "@types/json-schema": "^7.0.15" + }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" } }, "node_modules/@eslint/eslintrc": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.1.0.tgz", - "integrity": "sha512-4Bfj15dVJdoy3RfZmmo86RK1Fwzn6SstsvK9JS+BaVKqC6QQQQyXekNaC+g+LKNgkQ+2VhGAzm6hO40AhMR3zQ==", + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.3.1.tgz", + "integrity": "sha512-gtF186CXhIl1p4pJNGZw8Yc6RlshoePRvE0X91oPGb3vZ8pM3qOS9W9NGPat9LziaBV7XrJWGylNQXkGcnM3IQ==", "dev": true, "license": "MIT", "peer": true, @@ -578,24 +653,6 @@ "url": "https://opencollective.com/eslint" } }, - "node_modules/@eslint/eslintrc/node_modules/ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", - "dev": true, - "license": "MIT", - "peer": true, - "dependencies": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, "node_modules/@eslint/eslintrc/node_modules/globals": { "version": "14.0.0", "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", @@ -610,28 +667,23 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/@eslint/eslintrc/node_modules/json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true, - "license": "MIT", - "peer": true - }, "node_modules/@eslint/js": { - "version": "9.17.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.17.0.tgz", - "integrity": "sha512-Sxc4hqcs1kTu0iID3kcZDW3JHq2a77HO9P8CP6YEA/FpH3Ll8UXE2r/86Rz9YJLKme39S9vU5OWNjC6Xl0Cr3w==", + "version": "9.39.1", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.39.1.tgz", + "integrity": "sha512-S26Stp4zCy88tH94QbBv3XCuzRQiZ9yXofEILmglYTh/Ug/a9/umqvgFtYBAo3Lp0nsI/5/qH1CCrbdK3AP1Tw==", "dev": true, "license": "MIT", "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://eslint.org/donate" } }, "node_modules/@eslint/object-schema": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.4.tgz", - "integrity": "sha512-BsWiH1yFGjXXS2yvrf5LyuoSIIbPrGUWob917o+BTKuZ7qJdxX8aJLRxs1fS9n6r7vESrq1OUqb68dANcFXuQQ==", + "version": "2.1.7", + "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.7.tgz", + "integrity": "sha512-VtAOaymWVfZcmZbp6E2mympDIHvyjXs/12LqWYjVw6qjrfF+VK+fyG33kChz3nnK+SU5/NeHOqrTEHS8sXO3OA==", "dev": true, "license": "Apache-2.0", "peer": true, @@ -640,13 +692,14 @@ } }, "node_modules/@eslint/plugin-kit": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.2.4.tgz", - "integrity": "sha512-zSkKow6H5Kdm0ZUQUB2kV5JIXqoG0+uH5YADhaEHswm664N9Db8dXSi0nMJpacpMf+MyyglF1vnZohpEg5yUtg==", + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.4.1.tgz", + "integrity": "sha512-43/qtrDUokr7LJqoF2c3+RInu/t4zfrpYdoSDfYyhg52rwLV6TnOvdG4fXm7IkSB3wErkcmJS9iEhjVtOSEjjA==", "dev": true, "license": "Apache-2.0", "peer": true, "dependencies": { + "@eslint/core": "^0.17.0", "levn": "^0.4.1" }, "engines": { @@ -654,9 +707,9 @@ } }, "node_modules/@humanfs/core": { - "version": "0.19.0", - "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.0.tgz", - "integrity": "sha512-2cbWIHbZVEweE853g8jymffCA+NCMiuqeECeBBLm8dg2oFdjuGJhgN4UAbI+6v0CKbbhvtXA4qV8YR5Ji86nmw==", + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz", + "integrity": "sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==", "dev": true, "license": "Apache-2.0", "peer": true, @@ -665,15 +718,15 @@ } }, "node_modules/@humanfs/node": { - "version": "0.16.5", - "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.5.tgz", - "integrity": "sha512-KSPA4umqSG4LHYRodq31VDwKAvaTF4xmVlzM8Aeh4PlU1JQ3IG0wiA8C25d3RQ9nJyM3mBHyI53K06VVL/oFFg==", + "version": "0.16.7", + "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.7.tgz", + "integrity": "sha512-/zUx+yOsIrG4Y43Eh2peDeKCxlRt/gET6aHfaKpuq267qXdYDFViVHfMaLyygZOnl0kGWxFIgsBy8QFuTLUXEQ==", "dev": true, "license": "Apache-2.0", "peer": true, "dependencies": { - "@humanfs/core": "^0.19.0", - "@humanwhocodes/retry": "^0.3.0" + "@humanfs/core": "^0.19.1", + "@humanwhocodes/retry": "^0.4.0" }, "engines": { "node": ">=18.18.0" @@ -695,9 +748,9 @@ } }, "node_modules/@humanwhocodes/retry": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.3.1.tgz", - "integrity": "sha512-JBxkERygn7Bv/GbN5Rv8Ul6LVknS+5Bp6RgDC/O8gEBU/yeH5Ui5C/OlWrTb6qct7LjjfT6Re2NxB0ln0yYybA==", + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.3.tgz", + "integrity": "sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==", "dev": true, "license": "Apache-2.0", "peer": true, @@ -719,173 +772,99 @@ "node": ">=6.9.0" } }, - "node_modules/@isaacs/cliui": { - "version": "8.0.2", - "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", - "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", + "node_modules/@isaacs/balanced-match": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@isaacs/balanced-match/-/balanced-match-4.0.1.tgz", + "integrity": "sha512-yzMTt9lEb8Gv7zRioUilSglI0c0smZ9k5D65677DLWLtWJaXIS3CqcGyUFByYKlnUj6TkjLVs54fBl6+TiGQDQ==", "dev": true, - "license": "ISC", + "license": "MIT", + "engines": { + "node": "20 || >=22" + } + }, + "node_modules/@isaacs/brace-expansion": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/@isaacs/brace-expansion/-/brace-expansion-5.0.1.tgz", + "integrity": "sha512-WMz71T1JS624nWj2n2fnYAuPovhv7EUhk69R6i9dsVyzxt5eM3bjwvgk9L+APE1TRscGysAVMANkB0jh0LQZrQ==", + "dev": true, + "license": "MIT", "dependencies": { - "string-width": "^5.1.2", - "string-width-cjs": "npm:string-width@^4.2.0", - "strip-ansi": "^7.0.1", - "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", - "wrap-ansi": "^8.1.0", - "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" + "@isaacs/balanced-match": "^4.0.1" }, "engines": { - "node": ">=12" + "node": "20 || >=22" } }, - "node_modules/@isaacs/cliui/node_modules/ansi-regex": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz", - "integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==", + "node_modules/@kwsites/file-exists": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@kwsites/file-exists/-/file-exists-1.1.1.tgz", + "integrity": "sha512-m9/5YGR18lIwxSFDwfE3oA7bWuq9kdau6ugN4H2rJeyhFQZcG9AgSHkQtSD15a8WvTgfz9aikZMrKPHvbpqFiw==", "dev": true, "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-regex?sponsor=1" + "dependencies": { + "debug": "^4.1.1" } }, - "node_modules/@isaacs/cliui/node_modules/ansi-styles": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", - "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/@isaacs/cliui/node_modules/emoji-regex": { - "version": "9.2.2", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", - "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "node_modules/@kwsites/promise-deferred": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@kwsites/promise-deferred/-/promise-deferred-1.1.1.tgz", + "integrity": "sha512-GaHYm+c0O9MjZRu0ongGBRbinu8gVAMd2UZjji6jVmqKtZluZnptXGWhz1E8j8D2HJ3f/yMxKAUC0b+57wncIw==", "dev": true, "license": "MIT" }, - "node_modules/@isaacs/cliui/node_modules/string-width": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", - "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", - "dev": true, - "license": "MIT", - "dependencies": { - "eastasianwidth": "^0.2.0", - "emoji-regex": "^9.2.2", - "strip-ansi": "^7.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@isaacs/cliui/node_modules/strip-ansi": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", - "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^6.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/strip-ansi?sponsor=1" - } - }, - "node_modules/@isaacs/cliui/node_modules/wrap-ansi": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", - "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^6.1.0", - "string-width": "^5.0.1", - "strip-ansi": "^7.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, - "node_modules/@nodelib/fs.scandir": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", - "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", - "dev": true, - "license": "MIT", - "dependencies": { - "@nodelib/fs.stat": "2.0.5", - "run-parallel": "^1.1.9" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/@nodelib/fs.stat": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", - "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 8" - } - }, - "node_modules/@nodelib/fs.walk": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", - "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@nodelib/fs.scandir": "2.1.5", - "fastq": "^1.6.0" - }, - "engines": { - "node": ">= 8" - } - }, "node_modules/@optolith/helpers": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/@optolith/helpers/-/helpers-0.2.2.tgz", "integrity": "sha512-XeogxaEbKjQ5wklSwHdf+0TifZIBe42lNlmW2TIH6yWRNl3kW36dwXmwooSqnHoC8IM78vs0lkuKb9YoV14HrQ==", "license": "MPL-2.0" }, - "node_modules/@pkgr/core": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/@pkgr/core/-/core-0.1.1.tgz", - "integrity": "sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA==", + "node_modules/@preact/signals": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/@preact/signals/-/signals-2.7.1.tgz", + "integrity": "sha512-mP2+wMYHqDXVKFGzjqkL6CiHj3okB8eVTTJUZBrSVGozi/XfA+zZRCEALKKZYRoSoqLyT4J6qM4lhwT9155s1Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@preact/signals-core": "^1.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/preact" + }, + "peerDependencies": { + "preact": ">= 10.25.0 || >=11.0.0-0" + } + }, + "node_modules/@preact/signals-core": { + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/@preact/signals-core/-/signals-core-1.13.0.tgz", + "integrity": "sha512-slT6XeTCAbdql61GVLlGU4x7XHI7kCZV5Um5uhE4zLX4ApgiiXc0UYFvVOKq06xcovzp7p+61l68oPi563ARKg==", + "dev": true, + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/preact" + } + }, + "node_modules/@sindresorhus/base62": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/base62/-/base62-1.0.0.tgz", + "integrity": "sha512-TeheYy0ILzBEI/CO55CP6zJCSdSWeRtGnHy8U8dWSUH4I68iqTsy7HkMktR4xakThc9jotkPQUXT4ITdbV7cHA==", "dev": true, "license": "MIT", "engines": { - "node": "^12.20.0 || ^14.18.0 || >=16.0.0" + "node": ">=18" }, "funding": { - "url": "https://opencollective.com/unts" + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/@types/estree": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz", - "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==", + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", + "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", "dev": true, - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/@types/json-schema": { "version": "7.0.15", @@ -903,13 +882,13 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "22.10.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.10.5.tgz", - "integrity": "sha512-F8Q+SeGimwOo86fiovQh8qiXfFEh2/ocYv7tU5pJ3EXMSSxk1Joj5wefpFK2fHTf/N6HKGSxIDBT9f3gCxXPkQ==", + "version": "25.2.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-25.2.1.tgz", + "integrity": "sha512-CPrnr8voK8vC6eEtyRzvMpgp3VyVRhgclonE7qYi6P9sXwYb59ucfrnmFBTaP0yUi8Gk4yZg/LlTJULGxvTNsg==", "dev": true, "license": "MIT", "dependencies": { - "undici-types": "~6.20.0" + "undici-types": "~7.16.0" } }, "node_modules/@types/normalize-package-data": { @@ -920,21 +899,20 @@ "license": "MIT" }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "8.19.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.19.0.tgz", - "integrity": "sha512-NggSaEZCdSrFddbctrVjkVZvFC6KGfKfNK0CU7mNK/iKHGKbzT4Wmgm08dKpcZECBu9f5FypndoMyRHkdqfT1Q==", + "version": "8.54.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.54.0.tgz", + "integrity": "sha512-hAAP5io/7csFStuOmR782YmTthKBJ9ND3WVL60hcOjvtGFb+HJxH4O5huAcmcZ9v9G8P+JETiZ/G1B8MALnWZQ==", "dev": true, "license": "MIT", "dependencies": { - "@eslint-community/regexpp": "^4.10.0", - "@typescript-eslint/scope-manager": "8.19.0", - "@typescript-eslint/type-utils": "8.19.0", - "@typescript-eslint/utils": "8.19.0", - "@typescript-eslint/visitor-keys": "8.19.0", - "graphemer": "^1.4.0", - "ignore": "^5.3.1", + "@eslint-community/regexpp": "^4.12.2", + "@typescript-eslint/scope-manager": "8.54.0", + "@typescript-eslint/type-utils": "8.54.0", + "@typescript-eslint/utils": "8.54.0", + "@typescript-eslint/visitor-keys": "8.54.0", + "ignore": "^7.0.5", "natural-compare": "^1.4.0", - "ts-api-utils": "^1.3.0" + "ts-api-utils": "^2.4.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -944,23 +922,33 @@ "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "@typescript-eslint/parser": "^8.0.0 || ^8.0.0-alpha.0", + "@typescript-eslint/parser": "^8.54.0", "eslint": "^8.57.0 || ^9.0.0", - "typescript": ">=4.8.4 <5.8.0" + "typescript": ">=4.8.4 <6.0.0" + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/ignore": { + "version": "7.0.5", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.5.tgz", + "integrity": "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" } }, "node_modules/@typescript-eslint/parser": { - "version": "8.19.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.19.0.tgz", - "integrity": "sha512-6M8taKyOETY1TKHp0x8ndycipTVgmp4xtg5QpEZzXxDhNvvHOJi5rLRkLr8SK3jTgD5l4fTlvBiRdfsuWydxBw==", + "version": "8.54.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.54.0.tgz", + "integrity": "sha512-BtE0k6cjwjLZoZixN0t5AKP0kSzlGu7FctRXYuPAm//aaiZhmfq1JwdYpYr1brzEspYyFeF+8XF5j2VK6oalrA==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/scope-manager": "8.19.0", - "@typescript-eslint/types": "8.19.0", - "@typescript-eslint/typescript-estree": "8.19.0", - "@typescript-eslint/visitor-keys": "8.19.0", - "debug": "^4.3.4" + "@typescript-eslint/scope-manager": "8.54.0", + "@typescript-eslint/types": "8.54.0", + "@typescript-eslint/typescript-estree": "8.54.0", + "@typescript-eslint/visitor-keys": "8.54.0", + "debug": "^4.4.3" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -971,18 +959,40 @@ }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0", - "typescript": ">=4.8.4 <5.8.0" + "typescript": ">=4.8.4 <6.0.0" + } + }, + "node_modules/@typescript-eslint/project-service": { + "version": "8.54.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.54.0.tgz", + "integrity": "sha512-YPf+rvJ1s7MyiWM4uTRhE4DvBXrEV+d8oC3P9Y2eT7S+HBS0clybdMIPnhiATi9vZOYDc7OQ1L/i6ga6NFYK/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/tsconfig-utils": "^8.54.0", + "@typescript-eslint/types": "^8.54.0", + "debug": "^4.4.3" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <6.0.0" } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "8.19.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.19.0.tgz", - "integrity": "sha512-hkoJiKQS3GQ13TSMEiuNmSCvhz7ujyqD1x3ShbaETATHrck+9RaDdUbt+osXaUuns9OFwrDTTrjtwsU8gJyyRA==", + "version": "8.54.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.54.0.tgz", + "integrity": "sha512-27rYVQku26j/PbHYcVfRPonmOlVI6gihHtXFbTdB5sb6qA0wdAQAbyXFVarQ5t4HRojIz64IV90YtsjQSSGlQg==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.19.0", - "@typescript-eslint/visitor-keys": "8.19.0" + "@typescript-eslint/types": "8.54.0", + "@typescript-eslint/visitor-keys": "8.54.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -992,17 +1002,35 @@ "url": "https://opencollective.com/typescript-eslint" } }, + "node_modules/@typescript-eslint/tsconfig-utils": { + "version": "8.54.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.54.0.tgz", + "integrity": "sha512-dRgOyT2hPk/JwxNMZDsIXDgyl9axdJI3ogZ2XWhBPsnZUv+hPesa5iuhdYt2gzwA9t8RE5ytOJ6xB0moV0Ujvw==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <6.0.0" + } + }, "node_modules/@typescript-eslint/type-utils": { - "version": "8.19.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.19.0.tgz", - "integrity": "sha512-TZs0I0OSbd5Aza4qAMpp1cdCYVnER94IziudE3JU328YUHgWu9gwiwhag+fuLeJ2LkWLXI+F/182TbG+JaBdTg==", + "version": "8.54.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.54.0.tgz", + "integrity": "sha512-hiLguxJWHjjwL6xMBwD903ciAwd7DmK30Y9Axs/etOkftC3ZNN9K44IuRD/EB08amu+Zw6W37x9RecLkOo3pMA==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/typescript-estree": "8.19.0", - "@typescript-eslint/utils": "8.19.0", - "debug": "^4.3.4", - "ts-api-utils": "^1.3.0" + "@typescript-eslint/types": "8.54.0", + "@typescript-eslint/typescript-estree": "8.54.0", + "@typescript-eslint/utils": "8.54.0", + "debug": "^4.4.3", + "ts-api-utils": "^2.4.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1013,13 +1041,13 @@ }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0", - "typescript": ">=4.8.4 <5.8.0" + "typescript": ">=4.8.4 <6.0.0" } }, "node_modules/@typescript-eslint/types": { - "version": "8.19.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.19.0.tgz", - "integrity": "sha512-8XQ4Ss7G9WX8oaYvD4OOLCjIQYgRQxO+qCiR2V2s2GxI9AUpo7riNwo6jDhKtTcaJjT8PY54j2Yb33kWtSJsmA==", + "version": "8.54.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.54.0.tgz", + "integrity": "sha512-PDUI9R1BVjqu7AUDsRBbKMtwmjWcn4J3le+5LpcFgWULN3LvHC5rkc9gCVxbrsrGmO1jfPybN5s6h4Jy+OnkAA==", "dev": true, "license": "MIT", "engines": { @@ -1031,20 +1059,21 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "8.19.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.19.0.tgz", - "integrity": "sha512-WW9PpDaLIFW9LCbucMSdYUuGeFUz1OkWYS/5fwZwTA+l2RwlWFdJvReQqMUMBw4yJWJOfqd7An9uwut2Oj8sLw==", + "version": "8.54.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.54.0.tgz", + "integrity": "sha512-BUwcskRaPvTk6fzVWgDPdUndLjB87KYDrN5EYGetnktoeAvPtO4ONHlAZDnj5VFnUANg0Sjm7j4usBlnoVMHwA==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.19.0", - "@typescript-eslint/visitor-keys": "8.19.0", - "debug": "^4.3.4", - "fast-glob": "^3.3.2", - "is-glob": "^4.0.3", - "minimatch": "^9.0.4", - "semver": "^7.6.0", - "ts-api-utils": "^1.3.0" + "@typescript-eslint/project-service": "8.54.0", + "@typescript-eslint/tsconfig-utils": "8.54.0", + "@typescript-eslint/types": "8.54.0", + "@typescript-eslint/visitor-keys": "8.54.0", + "debug": "^4.4.3", + "minimatch": "^9.0.5", + "semver": "^7.7.3", + "tinyglobby": "^0.2.15", + "ts-api-utils": "^2.4.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1054,13 +1083,13 @@ "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "typescript": ">=4.8.4 <5.8.0" + "typescript": ">=4.8.4 <6.0.0" } }, "node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", "dev": true, "license": "MIT", "dependencies": { @@ -1084,16 +1113,16 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "8.19.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.19.0.tgz", - "integrity": "sha512-PTBG+0oEMPH9jCZlfg07LCB2nYI0I317yyvXGfxnvGvw4SHIOuRnQ3kadyyXY6tGdChusIHIbM5zfIbp4M6tCg==", + "version": "8.54.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.54.0.tgz", + "integrity": "sha512-9Cnda8GS57AQakvRyG0PTejJNlA2xhvyNtEVIMlDWOOeEyBkYWhGPnfrIAnqxLMTSTo6q8g12XVjjev5l1NvMA==", "dev": true, "license": "MIT", "dependencies": { - "@eslint-community/eslint-utils": "^4.4.0", - "@typescript-eslint/scope-manager": "8.19.0", - "@typescript-eslint/types": "8.19.0", - "@typescript-eslint/typescript-estree": "8.19.0" + "@eslint-community/eslint-utils": "^4.9.1", + "@typescript-eslint/scope-manager": "8.54.0", + "@typescript-eslint/types": "8.54.0", + "@typescript-eslint/typescript-estree": "8.54.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1104,18 +1133,18 @@ }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0", - "typescript": ">=4.8.4 <5.8.0" + "typescript": ">=4.8.4 <6.0.0" } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "8.19.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.19.0.tgz", - "integrity": "sha512-mCFtBbFBJDCNCWUl5y6sZSCHXw1DEFEk3c/M3nRK2a4XUB8StGFtmcEMizdjKuBzB6e/smJAAWYug3VrdLMr1w==", + "version": "8.54.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.54.0.tgz", + "integrity": "sha512-VFlhGSl4opC0bprJiItPQ1RfUhGDIBokcPwaFH4yiBCaNPeld/9VeXbiPO1cLyorQi1G1vL+ecBk1x8o1axORA==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.19.0", - "eslint-visitor-keys": "^4.2.0" + "@typescript-eslint/types": "8.54.0", + "eslint-visitor-keys": "^4.2.1" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1125,10 +1154,24 @@ "url": "https://opencollective.com/typescript-eslint" } }, + "node_modules/accepts": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-2.0.0.tgz", + "integrity": "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==", + "dev": true, + "license": "MIT", + "dependencies": { + "mime-types": "^3.0.0", + "negotiator": "^1.0.0" + }, + "engines": { + "node": ">= 0.6" + } + }, "node_modules/acorn": { - "version": "8.12.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz", - "integrity": "sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==", + "version": "8.15.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz", + "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", "dev": true, "license": "MIT", "bin": { @@ -1155,17 +1198,22 @@ "dev": true, "license": "MIT" }, - "node_modules/agent-base": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.1.tgz", - "integrity": "sha512-H0TSyFNDMomMNJQBn8wFV5YC/2eJ+VXECwOadZJT554xP6cODZHPX3H9QMQECxvrgiSOP1pHjy1sMWQVYJOUOA==", + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { - "debug": "^4.3.4" + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" }, - "engines": { - "node": ">= 14" + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" } }, "node_modules/ansi-regex": { @@ -1226,13 +1274,6 @@ "node": ">=0.10.0" } }, - "node_modules/asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", - "dev": true, - "license": "MIT" - }, "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", @@ -1240,10 +1281,35 @@ "dev": true, "license": "MIT" }, + "node_modules/body-parser": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.2.2.tgz", + "integrity": "sha512-oP5VkATKlNwcgvxi0vM0p/D3n2C3EReYVX+DNYs5TjZFn/oQt2j+4sVJtSMr18pdRr8wjTcBl6LoV+FUwzPmNA==", + "dev": true, + "license": "MIT", + "dependencies": { + "bytes": "^3.1.2", + "content-type": "^1.0.5", + "debug": "^4.4.3", + "http-errors": "^2.0.0", + "iconv-lite": "^0.7.0", + "on-finished": "^2.4.1", + "qs": "^6.14.1", + "raw-body": "^3.0.1", + "type-is": "^2.0.1" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, "node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", "dev": true, "license": "MIT", "dependencies": { @@ -1251,19 +1317,6 @@ "concat-map": "0.0.1" } }, - "node_modules/braces": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", - "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", - "dev": true, - "license": "MIT", - "dependencies": { - "fill-range": "^7.1.1" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/buffer-from": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", @@ -1271,6 +1324,47 @@ "dev": true, "license": "MIT" }, + "node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/callsites": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", @@ -1357,23 +1451,10 @@ "dev": true, "license": "MIT" }, - "node_modules/combined-stream": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "dev": true, - "license": "MIT", - "dependencies": { - "delayed-stream": "~1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, "node_modules/comment-parser": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/comment-parser/-/comment-parser-1.4.1.tgz", - "integrity": "sha512-buhp5kePrmda3vhc5B9t7pUQXAb2Tnd0qgpkIhPhkHXxJpiPJ11H0ZEU0oBpJ2QztSbzG/ZxMj/CHsYJqRHmyg==", + "version": "1.4.5", + "resolved": "https://registry.npmjs.org/comment-parser/-/comment-parser-1.4.5.tgz", + "integrity": "sha512-aRDkn3uyIlCFfk5NUA+VdwMmMsh8JGhc4hapfV4yxymHGQ3BVskMQfoXGpCo5IoBuQ9tS5iiVKhCpTcB4pW4qw==", "dev": true, "license": "MIT", "engines": { @@ -1381,9 +1462,9 @@ } }, "node_modules/commit-and-tag-version": { - "version": "12.5.0", - "resolved": "https://registry.npmjs.org/commit-and-tag-version/-/commit-and-tag-version-12.5.0.tgz", - "integrity": "sha512-Ll7rkKntH20iEFOPUT4e503Jf3J0J8jSN+aSeHuvNdtv4xmv9kSLSBg2CWsMVihwF3J2WvMHBEUSCKuDNesiTA==", + "version": "12.6.1", + "resolved": "https://registry.npmjs.org/commit-and-tag-version/-/commit-and-tag-version-12.6.1.tgz", + "integrity": "sha512-QNwgDDrg44oFAiLwXChOGabeGlkuaEvD7lUbLYleWLmOVYqFidek0G6xUE1NbRtitkOrDx8fuFh8w17+nUCOYg==", "dev": true, "license": "ISC", "dependencies": { @@ -1392,16 +1473,15 @@ "conventional-changelog-config-spec": "2.1.0", "conventional-changelog-conventionalcommits": "6.1.0", "conventional-recommended-bump": "7.0.1", - "detect-indent": "^6.0.0", + "detect-indent": "^6.1.0", "detect-newline": "^3.1.0", "dotgitignore": "^2.1.0", - "figures": "^3.1.0", + "fast-xml-parser": "^5.2.5", + "figures": "^3.2.0", "find-up": "^5.0.0", - "git-semver-tags": "^5.0.0", - "jsdom": "^25.0.0", - "semver": "^7.6.3", - "w3c-xmlserializer": "^5.0.0", - "yaml": "^2.4.1", + "git-semver-tags": "^5.0.1", + "semver": "^7.7.2", + "yaml": "^2.6.0", "yargs": "^17.7.2" }, "bin": { @@ -1445,6 +1525,30 @@ "typedarray": "^0.0.6" } }, + "node_modules/content-disposition": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-1.0.1.tgz", + "integrity": "sha512-oIXISMynqSqm241k6kcQ5UwttDILMK4BiurCfGEREw6+X9jkkpEe5T9FZaApyLGGOnFuyMWZpdolTXMtvEJ08Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/content-type": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, "node_modules/conventional-changelog": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/conventional-changelog/-/conventional-changelog-4.0.0.tgz", @@ -1684,6 +1788,26 @@ "node": ">=14" } }, + "node_modules/cookie": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", + "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie-signature": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.2.2.tgz", + "integrity": "sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.6.0" + } + }, "node_modules/core-util-is": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", @@ -1697,6 +1821,7 @@ "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", @@ -1706,19 +1831,6 @@ "node": ">= 8" } }, - "node_modules/cssstyle": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-4.1.0.tgz", - "integrity": "sha512-h66W1URKpBS5YMI/V8PyXvTMFT8SupJ1IzoIV8IeBC/ji8WVmrO8dGlTi+2dh6whmdk6BiKJLD/ZBkhWbcg6nA==", - "dev": true, - "license": "MIT", - "dependencies": { - "rrweb-cssom": "^0.7.1" - }, - "engines": { - "node": ">=18" - } - }, "node_modules/dargs": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/dargs/-/dargs-7.0.0.tgz", @@ -1729,20 +1841,6 @@ "node": ">=8" } }, - "node_modules/data-urls": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-5.0.0.tgz", - "integrity": "sha512-ZYP5VBHshaDAiVZxjbRVcFJpc+4xGgT0bK3vzy1HLN8jTO975HEbuYzZJcHoQEY5K1a0z8YayJkyVETa08eNTg==", - "dev": true, - "license": "MIT", - "dependencies": { - "whatwg-mimetype": "^4.0.0", - "whatwg-url": "^14.0.0" - }, - "engines": { - "node": ">=18" - } - }, "node_modules/dateformat": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-3.0.3.tgz", @@ -1754,9 +1852,9 @@ } }, "node_modules/debug": { - "version": "4.3.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", - "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", "dev": true, "license": "MIT", "dependencies": { @@ -1808,13 +1906,6 @@ "node": ">=0.10.0" } }, - "node_modules/decimal.js": { - "version": "10.4.3", - "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.4.3.tgz", - "integrity": "sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA==", - "dev": true, - "license": "MIT" - }, "node_modules/deep-is": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", @@ -1823,14 +1914,14 @@ "license": "MIT", "peer": true }, - "node_modules/delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", "dev": true, "license": "MIT", "engines": { - "node": ">=0.4.0" + "node": ">= 0.8" } }, "node_modules/detect-indent": { @@ -1946,10 +2037,25 @@ "node": ">=4" } }, - "node_modules/eastasianwidth": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", - "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", "dev": true, "license": "MIT" }, @@ -1960,17 +2066,14 @@ "dev": true, "license": "MIT" }, - "node_modules/entities": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", - "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", + "node_modules/encodeurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", + "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", "dev": true, - "license": "BSD-2-Clause", + "license": "MIT", "engines": { - "node": ">=0.12" - }, - "funding": { - "url": "https://github.com/fb55/entities?sponsor=1" + "node": ">= 0.8" } }, "node_modules/error-ex": { @@ -1983,17 +2086,43 @@ "is-arrayish": "^0.2.1" } }, - "node_modules/es-module-lexer": { - "version": "1.5.4", - "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.5.4.tgz", - "integrity": "sha512-MVNK56NiMrOwitFB7cqDwq0CQutbw+0BvLshJSse0MUNU+y1FC3bUS/AQg7oUng+/wKrrki7JfmwtVHkVfPLlw==", + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", "dev": true, - "license": "MIT" + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-object-atoms": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", + "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } }, "node_modules/esbuild": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.23.1.tgz", - "integrity": "sha512-VVNz/9Sa0bs5SELtn3f7qhJCDPCF5oMEl5cO9/SSinpE9hbPVvxbd572HH5AKiP7WD8INO53GgfDDhRjkylHEg==", + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.0.tgz", + "integrity": "sha512-jd0f4NHbD6cALCyGElNpGAOtWxSq46l9X/sWB0Nzd5er4Kz2YTm+Vl0qKFT9KUJvD8+fiO8AvoHhFvEatfVixA==", "dev": true, "hasInstallScript": true, "license": "MIT", @@ -2004,30 +2133,32 @@ "node": ">=18" }, "optionalDependencies": { - "@esbuild/aix-ppc64": "0.23.1", - "@esbuild/android-arm": "0.23.1", - "@esbuild/android-arm64": "0.23.1", - "@esbuild/android-x64": "0.23.1", - "@esbuild/darwin-arm64": "0.23.1", - "@esbuild/darwin-x64": "0.23.1", - "@esbuild/freebsd-arm64": "0.23.1", - "@esbuild/freebsd-x64": "0.23.1", - "@esbuild/linux-arm": "0.23.1", - "@esbuild/linux-arm64": "0.23.1", - "@esbuild/linux-ia32": "0.23.1", - "@esbuild/linux-loong64": "0.23.1", - "@esbuild/linux-mips64el": "0.23.1", - "@esbuild/linux-ppc64": "0.23.1", - "@esbuild/linux-riscv64": "0.23.1", - "@esbuild/linux-s390x": "0.23.1", - "@esbuild/linux-x64": "0.23.1", - "@esbuild/netbsd-x64": "0.23.1", - "@esbuild/openbsd-arm64": "0.23.1", - "@esbuild/openbsd-x64": "0.23.1", - "@esbuild/sunos-x64": "0.23.1", - "@esbuild/win32-arm64": "0.23.1", - "@esbuild/win32-ia32": "0.23.1", - "@esbuild/win32-x64": "0.23.1" + "@esbuild/aix-ppc64": "0.27.0", + "@esbuild/android-arm": "0.27.0", + "@esbuild/android-arm64": "0.27.0", + "@esbuild/android-x64": "0.27.0", + "@esbuild/darwin-arm64": "0.27.0", + "@esbuild/darwin-x64": "0.27.0", + "@esbuild/freebsd-arm64": "0.27.0", + "@esbuild/freebsd-x64": "0.27.0", + "@esbuild/linux-arm": "0.27.0", + "@esbuild/linux-arm64": "0.27.0", + "@esbuild/linux-ia32": "0.27.0", + "@esbuild/linux-loong64": "0.27.0", + "@esbuild/linux-mips64el": "0.27.0", + "@esbuild/linux-ppc64": "0.27.0", + "@esbuild/linux-riscv64": "0.27.0", + "@esbuild/linux-s390x": "0.27.0", + "@esbuild/linux-x64": "0.27.0", + "@esbuild/netbsd-arm64": "0.27.0", + "@esbuild/netbsd-x64": "0.27.0", + "@esbuild/openbsd-arm64": "0.27.0", + "@esbuild/openbsd-x64": "0.27.0", + "@esbuild/openharmony-arm64": "0.27.0", + "@esbuild/sunos-x64": "0.27.0", + "@esbuild/win32-arm64": "0.27.0", + "@esbuild/win32-ia32": "0.27.0", + "@esbuild/win32-x64": "0.27.0" } }, "node_modules/escalade": { @@ -2040,6 +2171,13 @@ "node": ">=6" } }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", + "dev": true, + "license": "MIT" + }, "node_modules/escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", @@ -2051,33 +2189,33 @@ } }, "node_modules/eslint": { - "version": "9.12.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.12.0.tgz", - "integrity": "sha512-UVIOlTEWxwIopRL1wgSQYdnVDcEvs2wyaO6DGo5mXqe3r16IoCNWkR29iHhyaP4cICWjbgbmFUGAhh0GJRuGZw==", + "version": "9.39.1", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.39.1.tgz", + "integrity": "sha512-BhHmn2yNOFA9H9JmmIVKJmd288g9hrVRDkdoIgRCRuSySRUHH7r/DI6aAXW9T1WwUuY3DFgrcaqB+deURBLR5g==", "dev": true, "license": "MIT", "peer": true, "dependencies": { - "@eslint-community/eslint-utils": "^4.2.0", - "@eslint-community/regexpp": "^4.11.0", - "@eslint/config-array": "^0.18.0", - "@eslint/core": "^0.6.0", - "@eslint/eslintrc": "^3.1.0", - "@eslint/js": "9.12.0", - "@eslint/plugin-kit": "^0.2.0", - "@humanfs/node": "^0.16.5", + "@eslint-community/eslint-utils": "^4.8.0", + "@eslint-community/regexpp": "^4.12.1", + "@eslint/config-array": "^0.21.1", + "@eslint/config-helpers": "^0.4.2", + "@eslint/core": "^0.17.0", + "@eslint/eslintrc": "^3.3.1", + "@eslint/js": "9.39.1", + "@eslint/plugin-kit": "^0.4.1", + "@humanfs/node": "^0.16.6", "@humanwhocodes/module-importer": "^1.0.1", - "@humanwhocodes/retry": "^0.3.1", + "@humanwhocodes/retry": "^0.4.2", "@types/estree": "^1.0.6", - "@types/json-schema": "^7.0.15", "ajv": "^6.12.4", "chalk": "^4.0.0", - "cross-spawn": "^7.0.2", + "cross-spawn": "^7.0.6", "debug": "^4.3.2", "escape-string-regexp": "^4.0.0", - "eslint-scope": "^8.1.0", - "eslint-visitor-keys": "^4.1.0", - "espree": "^10.2.0", + "eslint-scope": "^8.4.0", + "eslint-visitor-keys": "^4.2.1", + "espree": "^10.4.0", "esquery": "^1.5.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", @@ -2091,8 +2229,7 @@ "lodash.merge": "^4.6.2", "minimatch": "^3.1.2", "natural-compare": "^1.4.0", - "optionator": "^0.9.3", - "text-table": "^0.2.0" + "optionator": "^0.9.3" }, "bin": { "eslint": "bin/eslint.js" @@ -2113,39 +2250,45 @@ } }, "node_modules/eslint-config-prettier": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz", - "integrity": "sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==", + "version": "10.1.8", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-10.1.8.tgz", + "integrity": "sha512-82GZUjRS0p/jganf6q1rEO25VSoHH0hKPCTrgillPjdI/3bgBhAE1QzHrHTizjpRvy6pGAvKjDJtk2pF9NDq8w==", "dev": true, "license": "MIT", "bin": { "eslint-config-prettier": "bin/cli.js" }, + "funding": { + "url": "https://opencollective.com/eslint-config-prettier" + }, "peerDependencies": { "eslint": ">=7.0.0" } }, "node_modules/eslint-plugin-jsdoc": { - "version": "50.6.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-50.6.1.tgz", - "integrity": "sha512-UWyaYi6iURdSfdVVqvfOs2vdCVz0J40O/z/HTsv2sFjdjmdlUI/qlKLOTmwbPQ2tAfQnE5F9vqx+B+poF71DBQ==", + "version": "62.5.4", + "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-62.5.4.tgz", + "integrity": "sha512-U+Q5ppErmC17VFQl542eBIaXcuq975BzoIHBXyx7UQx/i4gyHXxPiBkonkuxWyFA98hGLALLUuD+NJcXqSGKxg==", "dev": true, "license": "BSD-3-Clause", "dependencies": { - "@es-joy/jsdoccomment": "~0.49.0", + "@es-joy/jsdoccomment": "~0.84.0", + "@es-joy/resolve.exports": "1.2.0", "are-docs-informative": "^0.0.2", - "comment-parser": "1.4.1", - "debug": "^4.3.6", + "comment-parser": "1.4.5", + "debug": "^4.4.3", "escape-string-regexp": "^4.0.0", - "espree": "^10.1.0", - "esquery": "^1.6.0", - "parse-imports": "^2.1.1", - "semver": "^7.6.3", + "espree": "^11.1.0", + "esquery": "^1.7.0", + "html-entities": "^2.6.0", + "object-deep-merge": "^2.0.0", + "parse-imports-exports": "^0.2.4", + "semver": "^7.7.3", "spdx-expression-parse": "^4.0.0", - "synckit": "^0.9.1" + "to-valid-identifier": "^1.0.0" }, "engines": { - "node": ">=18" + "node": "^20.19.0 || ^22.13.0 || >=24" }, "peerDependencies": { "eslint": "^7.0.0 || ^8.0.0 || ^9.0.0" @@ -2164,6 +2307,37 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/eslint-plugin-jsdoc/node_modules/eslint-visitor-keys": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-5.0.0.tgz", + "integrity": "sha512-A0XeIi7CXU7nPlfHS9loMYEKxUaONu/hTEzHTGba9Huu94Cq1hPivf+DE5erJozZOky0LfvXAyrV/tcswpLI0Q==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-plugin-jsdoc/node_modules/espree": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-11.1.0.tgz", + "integrity": "sha512-WFWYhO1fV4iYkqOOvq8FbqIhr2pYfoDY0kCotMkDeNtGpiGGkZ1iov2u8ydjtgM8yF8rzK7oaTbw2NAzbAbehw==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "acorn": "^8.15.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^5.0.0" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, "node_modules/eslint-plugin-jsdoc/node_modules/spdx-expression-parse": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-4.0.0.tgz", @@ -2176,9 +2350,9 @@ } }, "node_modules/eslint-scope": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.1.0.tgz", - "integrity": "sha512-14dSvlhaVhKKsa9Fx1l8A17s7ah7Ef7wCakJ10LYk6+GYmP9yDti2oq2SEwcyndt6knfcZyhyxwY3i9yL78EQw==", + "version": "8.4.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.4.0.tgz", + "integrity": "sha512-sNXOfKCn74rt8RICKMvJS7XKV/Xk9kA7DyJr8mJik3S7Cwgy3qlkkmyS2uQB3jiJg6VNdZd/pDBJu0nvG2NlTg==", "dev": true, "license": "BSD-2-Clause", "peer": true, @@ -2194,9 +2368,9 @@ } }, "node_modules/eslint-visitor-keys": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.0.tgz", - "integrity": "sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw==", + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.1.tgz", + "integrity": "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==", "dev": true, "license": "Apache-2.0", "engines": { @@ -2206,35 +2380,6 @@ "url": "https://opencollective.com/eslint" } }, - "node_modules/eslint/node_modules/@eslint/js": { - "version": "9.12.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.12.0.tgz", - "integrity": "sha512-eohesHH8WFRUprDNyEREgqP6beG6htMeUYeCpkEgBCieCMme5r9zFWjzAJp//9S+Kub4rqE+jXe9Cp1a7IYIIA==", - "dev": true, - "license": "MIT", - "peer": true, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - } - }, - "node_modules/eslint/node_modules/ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", - "dev": true, - "license": "MIT", - "peer": true, - "dependencies": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, "node_modules/eslint/node_modules/ansi-styles": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", @@ -2317,14 +2462,6 @@ "node": ">=8" } }, - "node_modules/eslint/node_modules/json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true, - "license": "MIT", - "peer": true - }, "node_modules/eslint/node_modules/supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", @@ -2340,15 +2477,16 @@ } }, "node_modules/espree": { - "version": "10.2.0", - "resolved": "https://registry.npmjs.org/espree/-/espree-10.2.0.tgz", - "integrity": "sha512-upbkBJbckcCNBDBDXEbuhjbP68n+scUd3k/U2EkyM9nw+I/jPiL4cLF/Al06CF96wRltFda16sxDFrxsI1v0/g==", + "version": "10.4.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-10.4.0.tgz", + "integrity": "sha512-j6PAQ2uUr79PZhBjP5C5fhl8e39FmRnOjsD5lGnWrFU8i2G776tBK7+nP8KuQUTTyAZUwfQqXAgrVH5MbH9CYQ==", "dev": true, "license": "BSD-2-Clause", + "peer": true, "dependencies": { - "acorn": "^8.12.0", + "acorn": "^8.15.0", "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^4.1.0" + "eslint-visitor-keys": "^4.2.1" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -2358,9 +2496,9 @@ } }, "node_modules/esquery": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.6.0.tgz", - "integrity": "sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==", + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.7.0.tgz", + "integrity": "sha512-Ap6G0WQwcU/LHsvLwON1fAQX9Zp0A2Y6Y/cJBl9r/JbW90Zyg4/zbG6zzKa2OTALELarYHmKu0GhpM5EO+7T0g==", "dev": true, "license": "BSD-3-Clause", "dependencies": { @@ -2405,6 +2543,60 @@ "node": ">=0.10.0" } }, + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/express": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/express/-/express-5.2.1.tgz", + "integrity": "sha512-hIS4idWWai69NezIdRt2xFVofaF4j+6INOpJlVOLDO8zXGpUVEVzIYk12UUi2JzjEzWL3IOAxcTubgz9Po0yXw==", + "dev": true, + "license": "MIT", + "dependencies": { + "accepts": "^2.0.0", + "body-parser": "^2.2.1", + "content-disposition": "^1.0.0", + "content-type": "^1.0.5", + "cookie": "^0.7.1", + "cookie-signature": "^1.2.1", + "debug": "^4.4.0", + "depd": "^2.0.0", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "etag": "^1.8.1", + "finalhandler": "^2.1.0", + "fresh": "^2.0.0", + "http-errors": "^2.0.0", + "merge-descriptors": "^2.0.0", + "mime-types": "^3.0.0", + "on-finished": "^2.4.1", + "once": "^1.4.0", + "parseurl": "^1.3.3", + "proxy-addr": "^2.0.7", + "qs": "^6.14.0", + "range-parser": "^1.2.1", + "router": "^2.2.0", + "send": "^1.1.0", + "serve-static": "^2.2.0", + "statuses": "^2.0.1", + "type-is": "^2.0.1", + "vary": "^1.1.2" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", @@ -2413,36 +2605,6 @@ "license": "MIT", "peer": true }, - "node_modules/fast-glob": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz", - "integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@nodelib/fs.stat": "^2.0.2", - "@nodelib/fs.walk": "^1.2.3", - "glob-parent": "^5.1.2", - "merge2": "^1.3.0", - "micromatch": "^4.0.8" - }, - "engines": { - "node": ">=8.6.0" - } - }, - "node_modules/fast-glob/node_modules/glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, - "license": "ISC", - "dependencies": { - "is-glob": "^4.0.1" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", @@ -2459,14 +2621,41 @@ "license": "MIT", "peer": true }, - "node_modules/fastq": { - "version": "1.18.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.18.0.tgz", - "integrity": "sha512-QKHXPW0hD8g4UET03SdOdunzSouc9N4AuHdsX8XNcTsuz+yYFILVNIX4l9yHABMhiEI9Db0JTTIpu0wB+Y1QQw==", + "node_modules/fast-xml-parser": { + "version": "5.3.4", + "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-5.3.4.tgz", + "integrity": "sha512-EFd6afGmXlCx8H8WTZHhAoDaWaGyuIBoZJ2mknrNxug+aZKjkp0a0dlars9Izl+jF+7Gu1/5f/2h68cQpe0IiA==", "dev": true, - "license": "ISC", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/NaturalIntelligence" + } + ], + "license": "MIT", "dependencies": { - "reusify": "^1.0.4" + "strnum": "^2.1.0" + }, + "bin": { + "fxparser": "src/cli/cli.js" + } + }, + "node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } } }, "node_modules/figures": { @@ -2499,17 +2688,26 @@ "node": ">=16.0.0" } }, - "node_modules/fill-range": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", - "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "node_modules/finalhandler": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-2.1.1.tgz", + "integrity": "sha512-S8KoZgRZN+a5rNwqTxlZZePjT/4cnm0ROV70LedRHZ0p8u9fRID0hJUZQpkKLzro8LfmC8sx23bY6tVNxv8pQA==", "dev": true, "license": "MIT", "dependencies": { - "to-regex-range": "^5.0.1" + "debug": "^4.4.0", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "on-finished": "^2.4.1", + "parseurl": "^1.3.3", + "statuses": "^2.0.1" }, "engines": { - "node": ">=8" + "node": ">= 18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" } }, "node_modules/find-up": { @@ -2552,36 +2750,24 @@ "license": "ISC", "peer": true }, - "node_modules/foreground-child": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.0.tgz", - "integrity": "sha512-Ld2g8rrAyMYFXBhEqMz8ZAHBi4J4uS1i/CxGMDnjyFWddMXLVcDp051DZfu+t7+ab7Wv6SMqpWmyFIj5UbfFvg==", - "dev": true, - "license": "ISC", - "dependencies": { - "cross-spawn": "^7.0.0", - "signal-exit": "^4.0.1" - }, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/form-data": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", - "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "node_modules/forwarded": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", "dev": true, "license": "MIT", - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - }, "engines": { - "node": ">= 6" + "node": ">= 0.6" + } + }, + "node_modules/fresh": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-2.0.0.tgz", + "integrity": "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8" } }, "node_modules/fsevents": { @@ -2619,6 +2805,31 @@ "node": "6.* || 8.* || >= 10.*" } }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/get-pkg-repo": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/get-pkg-repo/-/get-pkg-repo-4.2.1.tgz", @@ -2669,6 +2880,20 @@ "node": ">=10" } }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "dev": true, + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/get-tsconfig": { "version": "4.8.1", "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.8.1.tgz", @@ -2742,22 +2967,16 @@ } }, "node_modules/glob": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-11.0.0.tgz", - "integrity": "sha512-9UiX/Bl6J2yaBbxKoEBRm4Cipxgok8kQYcOPEhScPwebu2I0HoQOuYdIO6S3hLuWoZgpDpwQZMzTFxgpkyT76g==", + "version": "13.0.1", + "resolved": "https://registry.npmjs.org/glob/-/glob-13.0.1.tgz", + "integrity": "sha512-B7U/vJpE3DkJ5WXTgTpTRN63uV42DseiXXKMwG14LQBXmsdeIoHAPbU/MEo6II0k5ED74uc2ZGTC6MwHFQhF6w==", "dev": true, - "license": "ISC", + "license": "BlueOak-1.0.0", "dependencies": { - "foreground-child": "^3.1.0", - "jackspeak": "^4.0.1", - "minimatch": "^10.0.0", + "minimatch": "^10.1.2", "minipass": "^7.1.2", - "package-json-from-dist": "^1.0.0", "path-scurry": "^2.0.0" }, - "bin": { - "glob": "dist/esm/bin.mjs" - }, "engines": { "node": "20 || >=22" }, @@ -2779,24 +2998,14 @@ "node": ">=10.13.0" } }, - "node_modules/glob/node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0" - } - }, "node_modules/glob/node_modules/minimatch": { - "version": "10.0.1", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.0.1.tgz", - "integrity": "sha512-ethXTt3SGGR+95gudmqJ1eNhRO7eGEGIgYA9vnPatK4/etz2MEVDno5GMCibdMTuBMyElzIlgxMna3K94XDIDQ==", + "version": "10.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.1.2.tgz", + "integrity": "sha512-fu656aJ0n2kcXwsnwnv9g24tkU5uSmOlTjd6WyyaKm2Z+h1qmY6bAjrcaIxF/BslFqbZ8UBtbJi7KgQOZD2PTw==", "dev": true, - "license": "ISC", + "license": "BlueOak-1.0.0", "dependencies": { - "brace-expansion": "^2.0.1" + "@isaacs/brace-expansion": "^5.0.1" }, "engines": { "node": "20 || >=22" @@ -2806,9 +3015,9 @@ } }, "node_modules/globals": { - "version": "15.14.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-15.14.0.tgz", - "integrity": "sha512-OkToC372DtlQeje9/zHIo5CT8lRP/FUgEOKBEhU4e0abL7J7CD24fD9ohiLN5hagG/kWCYj4K5oaxxtj2Z0Dig==", + "version": "17.3.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-17.3.0.tgz", + "integrity": "sha512-yMqGUQVVCkD4tqjOJf3TnrvaaHDMYp4VlUSObbkIiuCPe/ofdMBFIAcBbCSRFWOnos6qRiTVStDwqPLUclaxIw==", "dev": true, "license": "MIT", "engines": { @@ -2818,6 +3027,19 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/graceful-fs": { "version": "4.2.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", @@ -2825,13 +3047,6 @@ "dev": true, "license": "ISC" }, - "node_modules/graphemer": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", - "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", - "dev": true, - "license": "MIT" - }, "node_modules/handlebars": { "version": "4.7.8", "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.8.tgz", @@ -2874,6 +3089,19 @@ "node": ">=4" } }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/hasown": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", @@ -2900,51 +3128,48 @@ "node": ">=10" } }, - "node_modules/html-encoding-sniffer": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-4.0.0.tgz", - "integrity": "sha512-Y22oTqIU4uuPgEemfz7NDJz6OeKf12Lsu+QC+s3BVpda64lTiMYCyGwg5ki4vFxkMwQdeZDl2adZoqUgdFuTgQ==", + "node_modules/html-entities": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/html-entities/-/html-entities-2.6.0.tgz", + "integrity": "sha512-kig+rMn/QOVRvr7c86gQ8lWXq+Hkv6CbAH1hLu+RG338StTpE8Z0b44SDVaqVu7HGKf27frdmUYEs9hTUX/cLQ==", "dev": true, - "license": "MIT", - "dependencies": { - "whatwg-encoding": "^3.1.1" - }, - "engines": { - "node": ">=18" - } + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/mdevils" + }, + { + "type": "patreon", + "url": "https://patreon.com/mdevils" + } + ], + "license": "MIT" }, - "node_modules/http-proxy-agent": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz", - "integrity": "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==", + "node_modules/http-errors": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz", + "integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==", "dev": true, "license": "MIT", "dependencies": { - "agent-base": "^7.1.0", - "debug": "^4.3.4" + "depd": "~2.0.0", + "inherits": "~2.0.4", + "setprototypeof": "~1.2.0", + "statuses": "~2.0.2", + "toidentifier": "~1.0.1" }, "engines": { - "node": ">= 14" - } - }, - "node_modules/https-proxy-agent": { - "version": "7.0.5", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.5.tgz", - "integrity": "sha512-1e4Wqeblerz+tMKPIq2EMGiiWW1dIjZOksyHWSUm1rmuvw/how9hBHZ38lAGj5ID4Ik6EdkOw7NmWPy6LAwalw==", - "dev": true, - "license": "MIT", - "dependencies": { - "agent-base": "^7.0.2", - "debug": "4" + "node": ">= 0.8" }, - "engines": { - "node": ">= 14" + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" } }, "node_modules/iconv-lite": { - "version": "0.6.3", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", - "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.2.tgz", + "integrity": "sha512-im9DjEDQ55s9fL4EYzOAv0yMqmMBSZp6G0VvFyTMPKWxiSBHUj9NW/qqLmXUwXrrM7AvqSlTCfvqRb0cM8yYqw==", "dev": true, "license": "MIT", "dependencies": { @@ -2952,6 +3177,10 @@ }, "engines": { "node": ">=0.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" } }, "node_modules/ignore": { @@ -2960,14 +3189,15 @@ "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", "dev": true, "license": "MIT", + "peer": true, "engines": { "node": ">= 4" } }, "node_modules/import-fresh": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", - "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz", + "integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==", "dev": true, "license": "MIT", "peer": true, @@ -3017,6 +3247,16 @@ "dev": true, "license": "ISC" }, + "node_modules/ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.10" + } + }, "node_modules/is-arrayish": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", @@ -3046,6 +3286,7 @@ "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", "dev": true, "license": "MIT", + "peer": true, "engines": { "node": ">=0.10.0" } @@ -3066,6 +3307,7 @@ "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "is-extglob": "^2.1.1" }, @@ -3073,16 +3315,6 @@ "node": ">=0.10.0" } }, - "node_modules/is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.12.0" - } - }, "node_modules/is-obj": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz", @@ -3103,10 +3335,10 @@ "node": ">=0.10.0" } }, - "node_modules/is-potential-custom-element-name": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz", - "integrity": "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==", + "node_modules/is-promise": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-4.0.0.tgz", + "integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==", "dev": true, "license": "MIT" }, @@ -3135,23 +3367,8 @@ "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", "dev": true, - "license": "ISC" - }, - "node_modules/jackspeak": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-4.0.2.tgz", - "integrity": "sha512-bZsjR/iRjl1Nk1UkjGpAzLNfQtzuijhn2g+pbZb98HQ1Gk8vM9hfbxeMBP+M2/UUdwj0RqGG3mlvk2MsAqwvEw==", - "dev": true, - "license": "BlueOak-1.0.0", - "dependencies": { - "@isaacs/cliui": "^8.0.2" - }, - "engines": { - "node": "20 || >=22" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } + "license": "ISC", + "peer": true }, "node_modules/js-tokens": { "version": "4.0.0", @@ -3161,9 +3378,9 @@ "license": "MIT" }, "node_modules/js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz", + "integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==", "dev": true, "license": "MIT", "peer": true, @@ -3175,54 +3392,13 @@ } }, "node_modules/jsdoc-type-pratt-parser": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/jsdoc-type-pratt-parser/-/jsdoc-type-pratt-parser-4.1.0.tgz", - "integrity": "sha512-Hicd6JK5Njt2QB6XYFS7ok9e37O8AYk3jTcppG4YVQnYjOemymvTcmc7OWsmq/Qqj5TdRFO5/x/tIPmBeRtGHg==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/jsdoc-type-pratt-parser/-/jsdoc-type-pratt-parser-7.1.1.tgz", + "integrity": "sha512-/2uqY7x6bsrpi3i9LVU6J89352C0rpMk0as8trXxCtvd4kPk1ke/Eyif6wqfSLvoNJqcDG9Vk4UsXgygzCt2xA==", "dev": true, "license": "MIT", "engines": { - "node": ">=12.0.0" - } - }, - "node_modules/jsdom": { - "version": "25.0.1", - "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-25.0.1.tgz", - "integrity": "sha512-8i7LzZj7BF8uplX+ZyOlIz86V6TAsSs+np6m1kpW9u0JWi4z/1t+FzcK1aek+ybTnAC4KhBL4uXCNT0wcUIeCw==", - "dev": true, - "license": "MIT", - "dependencies": { - "cssstyle": "^4.1.0", - "data-urls": "^5.0.0", - "decimal.js": "^10.4.3", - "form-data": "^4.0.0", - "html-encoding-sniffer": "^4.0.0", - "http-proxy-agent": "^7.0.2", - "https-proxy-agent": "^7.0.5", - "is-potential-custom-element-name": "^1.0.1", - "nwsapi": "^2.2.12", - "parse5": "^7.1.2", - "rrweb-cssom": "^0.7.1", - "saxes": "^6.0.0", - "symbol-tree": "^3.2.4", - "tough-cookie": "^5.0.0", - "w3c-xmlserializer": "^5.0.0", - "webidl-conversions": "^7.0.0", - "whatwg-encoding": "^3.1.1", - "whatwg-mimetype": "^4.0.0", - "whatwg-url": "^14.0.0", - "ws": "^8.18.0", - "xml-name-validator": "^5.0.0" - }, - "engines": { - "node": ">=18" - }, - "peerDependencies": { - "canvas": "^2.11.2" - }, - "peerDependenciesMeta": { - "canvas": { - "optional": true - } + "node": ">=20.0.0" } }, "node_modules/json-buffer": { @@ -3247,6 +3423,14 @@ "dev": true, "license": "MIT" }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true, + "license": "MIT", + "peer": true + }, "node_modules/json-stable-stringify-without-jsonify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", @@ -3415,6 +3599,26 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/media-typer": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-1.1.0.tgz", + "integrity": "sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, "node_modules/meow": { "version": "8.1.2", "resolved": "https://registry.npmjs.org/meow/-/meow-8.1.2.tgz", @@ -3600,34 +3804,32 @@ "semver": "bin/semver" } }, - "node_modules/merge2": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", - "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "node_modules/merge-descriptors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-2.0.0.tgz", + "integrity": "sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==", "dev": true, "license": "MIT", "engines": { - "node": ">= 8" + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/micromatch": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", - "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", - "dev": true, - "license": "MIT", - "dependencies": { - "braces": "^3.0.3", - "picomatch": "^2.3.1" - }, + "node_modules/messageformat": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/messageformat/-/messageformat-4.0.0.tgz", + "integrity": "sha512-XKmJ/ffTWToWOlHJzt85ZChQgVGC0LHzNWuNK8zuYpNySsB0nIEmytOdSAOW9ETKtkajAUJf520m5gFHHnrTYg==", + "license": "Apache-2.0", "engines": { - "node": ">=8.6" + "node": "^20.19 || ^22.12 || >=24" } }, "node_modules/mime-db": { - "version": "1.52.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", - "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "version": "1.54.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz", + "integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==", "dev": true, "license": "MIT", "engines": { @@ -3635,16 +3837,20 @@ } }, "node_modules/mime-types": { - "version": "2.1.35", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", - "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.2.tgz", + "integrity": "sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A==", "dev": true, "license": "MIT", "dependencies": { - "mime-db": "1.52.0" + "mime-db": "^1.54.0" }, "engines": { - "node": ">= 0.6" + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" } }, "node_modules/min-indent": { @@ -3729,6 +3935,16 @@ "dev": true, "license": "MIT" }, + "node_modules/negotiator": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-1.0.0.tgz", + "integrity": "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, "node_modules/neo-async": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", @@ -3752,13 +3968,49 @@ "node": ">=10" } }, - "node_modules/nwsapi": { - "version": "2.2.13", - "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.13.tgz", - "integrity": "sha512-cTGB9ptp9dY9A5VbMSe7fQBcl/tt22Vcqdq8+eN93rblOuE0aCFu4aZ2vMwct/2t+lFnosm8RkQW1I0Omb1UtQ==", + "node_modules/object-deep-merge": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/object-deep-merge/-/object-deep-merge-2.0.0.tgz", + "integrity": "sha512-3DC3UMpeffLTHiuXSy/UG4NOIYTLlY9u3V82+djSCLYClWobZiS4ivYzpIUWrRY/nfsJ8cWsKyG3QfyLePmhvg==", "dev": true, "license": "MIT" }, + "node_modules/object-inspect": { + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "dev": true, + "license": "MIT", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, + "license": "ISC", + "dependencies": { + "wrappy": "1" + } + }, "node_modules/optionator": { "version": "0.9.4", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", @@ -3779,16 +4031,15 @@ } }, "node_modules/optolith-database-schema": { - "version": "0.17.2", - "resolved": "https://registry.npmjs.org/optolith-database-schema/-/optolith-database-schema-0.17.2.tgz", - "integrity": "sha512-Qnna0xtElgGfn+rthR35jtIlAHpQ6mLOuI/jeLVvfp0gsO9JDWdOCpPTbVorD+Z7gjv7wl5lueUt2cW5jkAdaA==", + "version": "0.29.0", + "resolved": "https://registry.npmjs.org/optolith-database-schema/-/optolith-database-schema-0.29.0.tgz", + "integrity": "sha512-uYaKxOsjD4ibh9poT8aYX45xbkDtnLwQl6M/oYE3t7Q5S+i5qlU1Dmk9vPIfmEE9GsLfXIhXw/aVrARCOgahhg==", "dev": true, "license": "MPL-2.0", "dependencies": { - "@optolith/helpers": "^0.2.1", - "ajv": "^8.12.0", - "ajv-formats": "^2.1.1", - "yaml": "^2.3.3" + "@elyukai/utils": "^0.2.0", + "tsondb": "^0.19.8", + "yaml": "^2.8.2" } }, "node_modules/p-limit": { @@ -3833,13 +4084,6 @@ "node": ">=6" } }, - "node_modules/package-json-from-dist": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz", - "integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==", - "dev": true, - "license": "BlueOak-1.0.0" - }, "node_modules/parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", @@ -3854,18 +4098,14 @@ "node": ">=6" } }, - "node_modules/parse-imports": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/parse-imports/-/parse-imports-2.2.1.tgz", - "integrity": "sha512-OL/zLggRp8mFhKL0rNORUTR4yBYujK/uU+xZL+/0Rgm2QE4nLO9v8PzEweSJEbMGKmDRjJE4R3IMJlL2di4JeQ==", + "node_modules/parse-imports-exports": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/parse-imports-exports/-/parse-imports-exports-0.2.4.tgz", + "integrity": "sha512-4s6vd6dx1AotCx/RCI2m7t7GCh5bDRUtGNvRfHSP2wbBQdMi67pPe7mtzmgwcaQ8VKK/6IB7Glfyu3qdZJPybQ==", "dev": true, - "license": "Apache-2.0 AND MIT", + "license": "MIT", "dependencies": { - "es-module-lexer": "^1.5.3", - "slashes": "^3.0.12" - }, - "engines": { - "node": ">= 18" + "parse-statements": "1.0.11" } }, "node_modules/parse-json": { @@ -3882,17 +4122,21 @@ "node": ">=4" } }, - "node_modules/parse5": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.1.2.tgz", - "integrity": "sha512-Czj1WaSVpaoj0wbhMzLmWD69anp2WH7FXMB9n1Sy8/ZFF9jolSQVMu1Ij5WIyGmcBmhk7EOndpO4mIpihVqAXw==", + "node_modules/parse-statements": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/parse-statements/-/parse-statements-1.0.11.tgz", + "integrity": "sha512-HlsyYdMBnbPQ9Jr/VgJ1YF4scnldvJpJxCVx6KgqPL4dxppsWrJHCIIxQXMJrqGnsRkNPATbeMJ8Yxu7JMsYcA==", + "dev": true, + "license": "MIT" + }, + "node_modules/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", "dev": true, "license": "MIT", - "dependencies": { - "entities": "^4.4.0" - }, - "funding": { - "url": "https://github.com/inikulin/parse5?sponsor=1" + "engines": { + "node": ">= 0.8" } }, "node_modules/path-exists": { @@ -3911,6 +4155,7 @@ "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", "dev": true, "license": "MIT", + "peer": true, "engines": { "node": ">=8" } @@ -3949,6 +4194,17 @@ "node": "20 || >=22" } }, + "node_modules/path-to-regexp": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.3.0.tgz", + "integrity": "sha512-7jdwVIRtsP8MYpdXSwOS0YdD0Du+qOoF/AEPIt88PcCFrZCzx41oxku1jD88hZBwbNUIEfpqvuhjFaMAqMTWnA==", + "dev": true, + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, "node_modules/path-type": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", @@ -3980,13 +4236,13 @@ "license": "ISC" }, "node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", + "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", "dev": true, "license": "MIT", "engines": { - "node": ">=8.6" + "node": ">=12" }, "funding": { "url": "https://github.com/sponsors/jonschlinkert" @@ -4002,6 +4258,39 @@ "node": ">=0.10.0" } }, + "node_modules/preact": { + "version": "10.28.3", + "resolved": "https://registry.npmjs.org/preact/-/preact-10.28.3.tgz", + "integrity": "sha512-tCmoRkPQLpBeWzpmbhryairGnhW9tKV6c6gr/w+RhoRoKEJwsjzipwp//1oCpGPOchvSLaAPlpcJi9MwMmoPyA==", + "dev": true, + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/preact" + } + }, + "node_modules/preact-iso": { + "version": "2.11.1", + "resolved": "https://registry.npmjs.org/preact-iso/-/preact-iso-2.11.1.tgz", + "integrity": "sha512-rLy0RmzP/hrDjnFdnEblxFgKtzUj4njkHrpGJBGS7S4QuYw1zv0lA38qsWpeAAB10JAz/hF2CsHrLen9ufCtbw==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "preact": ">=10 || >= 11.0.0-0", + "preact-render-to-string": ">=6.4.0" + } + }, + "node_modules/preact-render-to-string": { + "version": "6.6.5", + "resolved": "https://registry.npmjs.org/preact-render-to-string/-/preact-render-to-string-6.6.5.tgz", + "integrity": "sha512-O6MHzYNIKYaiSX3bOw0gGZfEbOmlIDtDfWwN1JJdc/T3ihzRT6tGGSEWE088dWrEDGa1u7101q+6fzQnO9XCPA==", + "dev": true, + "license": "MIT", + "peer": true, + "peerDependencies": { + "preact": ">=10 || >= 11.0.0-0" + } + }, "node_modules/prelude-ls": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", @@ -4020,36 +4309,46 @@ "dev": true, "license": "MIT" }, + "node_modules/proxy-addr": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", + "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "dev": true, + "license": "MIT", + "dependencies": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + }, + "engines": { + "node": ">= 0.10" + } + }, "node_modules/punycode": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", "dev": true, "license": "MIT", + "peer": true, "engines": { "node": ">=6" } }, - "node_modules/queue-microtask": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", - "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "node_modules/qs": { + "version": "6.14.1", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.14.1.tgz", + "integrity": "sha512-4EK3+xJl8Ts67nLYNwqw/dsFVnCf+qR7RgXSK9jEEm9unao3njwMDdmsdvoKBKHzxd7tCYz5e5M+SnMjdtXGQQ==", "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT" + "license": "BSD-3-Clause", + "dependencies": { + "side-channel": "^1.1.0" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, "node_modules/quick-lru": { "version": "4.0.1", @@ -4061,6 +4360,32 @@ "node": ">=8" } }, + "node_modules/range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/raw-body": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-3.0.2.tgz", + "integrity": "sha512-K5zQjDllxWkf7Z5xJdV0/B0WTNqx6vxG70zJE4N0kBs4LovmEYWJzQGxC9bS9RAKu3bgM40lrd5zoLJ12MQ5BA==", + "dev": true, + "license": "MIT", + "dependencies": { + "bytes": "~3.1.2", + "http-errors": "~2.0.1", + "iconv-lite": "~0.7.0", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.10" + } + }, "node_modules/read-pkg": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz", @@ -4232,6 +4557,19 @@ "node": ">=0.10.0" } }, + "node_modules/reserved-identifiers": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/reserved-identifiers/-/reserved-identifiers-1.2.0.tgz", + "integrity": "sha512-yE7KUfFvaBFzGPs5H3Ops1RevfUEsDc5Iz65rOwWg4lE8HJSYtle77uul3+573457oHvBKuHYDl/xqUkKpEEdw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/resolve": { "version": "1.22.8", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", @@ -4271,46 +4609,21 @@ "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" } }, - "node_modules/reusify": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", - "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "node_modules/router": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/router/-/router-2.2.0.tgz", + "integrity": "sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==", "dev": true, "license": "MIT", - "engines": { - "iojs": ">=1.0.0", - "node": ">=0.10.0" - } - }, - "node_modules/rrweb-cssom": { - "version": "0.7.1", - "resolved": "https://registry.npmjs.org/rrweb-cssom/-/rrweb-cssom-0.7.1.tgz", - "integrity": "sha512-TrEMa7JGdVm0UThDJSx7ddw5nVm3UJS9o9CCIZ72B1vSyEZoziDqBYP3XIoi/12lKrJR8rE3jeFHMok2F/Mnsg==", - "dev": true, - "license": "MIT" - }, - "node_modules/run-parallel": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", - "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT", "dependencies": { - "queue-microtask": "^1.2.2" + "debug": "^4.4.0", + "depd": "^2.0.0", + "is-promise": "^4.0.0", + "parseurl": "^1.3.3", + "path-to-regexp": "^8.0.0" + }, + "engines": { + "node": ">= 18" } }, "node_modules/safe-buffer": { @@ -4341,23 +4654,10 @@ "dev": true, "license": "MIT" }, - "node_modules/saxes": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/saxes/-/saxes-6.0.0.tgz", - "integrity": "sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==", - "dev": true, - "license": "ISC", - "dependencies": { - "xmlchars": "^2.2.0" - }, - "engines": { - "node": ">=v12.22.7" - } - }, "node_modules/semver": { - "version": "7.6.3", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", - "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", + "version": "7.7.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.3.tgz", + "integrity": "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==", "dev": true, "license": "ISC", "bin": { @@ -4367,12 +4667,67 @@ "node": ">=10" } }, + "node_modules/send": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/send/-/send-1.2.1.tgz", + "integrity": "sha512-1gnZf7DFcoIcajTjTwjwuDjzuz4PPcY2StKPlsGAQ1+YH20IRVrBaXSWmdjowTJ6u8Rc01PoYOGHXfP1mYcZNQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "^4.4.3", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "etag": "^1.8.1", + "fresh": "^2.0.0", + "http-errors": "^2.0.1", + "mime-types": "^3.0.2", + "ms": "^2.1.3", + "on-finished": "^2.4.1", + "range-parser": "^1.2.1", + "statuses": "^2.0.2" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/serve-static": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-2.2.1.tgz", + "integrity": "sha512-xRXBn0pPqQTVQiC8wyQrKs2MOlX24zQ0POGaj0kultvoOCstBQM5yvOhAVSUwOMjQtTvsPWoNCHfPGwaaQJhTw==", + "dev": true, + "license": "MIT", + "dependencies": { + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "parseurl": "^1.3.3", + "send": "^1.2.0" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", + "dev": true, + "license": "ISC" + }, "node_modules/shebang-command": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "shebang-regex": "^3.0.0" }, @@ -4386,29 +4741,109 @@ "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", "dev": true, "license": "MIT", + "peer": true, "engines": { "node": ">=8" } }, - "node_modules/signal-exit": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", - "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "node_modules/side-channel": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", + "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==", "dev": true, - "license": "ISC", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3", + "side-channel-list": "^1.0.0", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" + }, "engines": { - "node": ">=14" + "node": ">= 0.4" }, "funding": { - "url": "https://github.com/sponsors/isaacs" + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/slashes": { - "version": "3.0.12", - "resolved": "https://registry.npmjs.org/slashes/-/slashes-3.0.12.tgz", - "integrity": "sha512-Q9VME8WyGkc7pJf6QEkj3wE+2CnvZMI+XJhwdTPR8Z/kWQRXi7boAWLDibRPyHRTUTPx5FaU7MsyrjI3yLB4HA==", + "node_modules/side-channel-list": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz", + "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==", "dev": true, - "license": "ISC" + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-weakmap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/simple-cli-args": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/simple-cli-args/-/simple-cli-args-0.1.3.tgz", + "integrity": "sha512-xDUf0CKojlwwYWtOwE8cr4D40o+LB/L2AN9qrnv763KiUWDE9bLzT0KwvDga5/lUnxKO57cPdm/8t0/RwGQKbA==", + "dev": true, + "license": "MPL-2.0" + }, + "node_modules/simple-git": { + "version": "3.30.0", + "resolved": "https://registry.npmjs.org/simple-git/-/simple-git-3.30.0.tgz", + "integrity": "sha512-q6lxyDsCmEal/MEGhP1aVyQ3oxnagGlBDOVSIB4XUVLl1iZh0Pah6ebC9V4xBap/RfgP2WlI8EKs0WS0rMEJHg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@kwsites/file-exists": "^1.1.1", + "@kwsites/promise-deferred": "^1.1.1", + "debug": "^4.4.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/steveukx/git-js?sponsor=1" + } }, "node_modules/source-map": { "version": "0.6.1", @@ -4479,6 +4914,16 @@ "readable-stream": "^3.0.0" } }, + "node_modules/statuses": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz", + "integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, "node_modules/string_decoder": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", @@ -4504,22 +4949,6 @@ "node": ">=8" } }, - "node_modules/string-width-cjs": { - "name": "string-width", - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "license": "MIT", - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/strip-ansi": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", @@ -4533,20 +4962,6 @@ "node": ">=8" } }, - "node_modules/strip-ansi-cjs": { - "name": "strip-ansi", - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/strip-bom": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", @@ -4584,6 +4999,19 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/strnum": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/strnum/-/strnum-2.1.1.tgz", + "integrity": "sha512-7ZvoFTiCnGxBtDqJ//Cu6fWtZtc7Y3x+QOirG15wztbdngGSkht27o2pyGWrVy0b4WAy3jbKmnoK6g5VlVNUUw==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/NaturalIntelligence" + } + ], + "license": "MIT" + }, "node_modules/supports-color": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", @@ -4610,30 +5038,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/symbol-tree": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz", - "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==", - "dev": true, - "license": "MIT" - }, - "node_modules/synckit": { - "version": "0.9.2", - "resolved": "https://registry.npmjs.org/synckit/-/synckit-0.9.2.tgz", - "integrity": "sha512-vrozgXDQwYO72vHjUb/HnFbQx1exDjoKzqx23aXEg2a9VIg2TSFZ8FmeZpTjUCFMYw7mpX4BE2SFu8wI7asYsw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@pkgr/core": "^0.1.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": "^14.18.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/unts" - } - }, "node_modules/text-extensions": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/text-extensions/-/text-extensions-1.9.0.tgz", @@ -4644,14 +5048,6 @@ "node": ">=0.10" } }, - "node_modules/text-table": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", - "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", - "dev": true, - "license": "MIT", - "peer": true - }, "node_modules/through": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", @@ -4703,63 +5099,48 @@ "safe-buffer": "~5.1.0" } }, - "node_modules/tldts": { - "version": "6.1.50", - "resolved": "https://registry.npmjs.org/tldts/-/tldts-6.1.50.tgz", - "integrity": "sha512-q9GOap6q3KCsLMdOjXhWU5jVZ8/1dIib898JBRLsN+tBhENpBDcAVQbE0epADOjw11FhQQy9AcbqKGBQPUfTQA==", + "node_modules/tinyglobby": { + "version": "0.2.15", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.15.tgz", + "integrity": "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==", "dev": true, "license": "MIT", "dependencies": { - "tldts-core": "^6.1.50" + "fdir": "^6.5.0", + "picomatch": "^4.0.3" }, - "bin": { - "tldts": "bin/cli.js" + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" } }, - "node_modules/tldts-core": { - "version": "6.1.50", - "resolved": "https://registry.npmjs.org/tldts-core/-/tldts-core-6.1.50.tgz", - "integrity": "sha512-na2EcZqmdA2iV9zHV7OHQDxxdciEpxrjbkp+aHmZgnZKHzoElLajP59np5/4+sare9fQBfixgvXKx8ev1d7ytw==", - "dev": true, - "license": "MIT" - }, - "node_modules/to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "node_modules/to-valid-identifier": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/to-valid-identifier/-/to-valid-identifier-1.0.0.tgz", + "integrity": "sha512-41wJyvKep3yT2tyPqX/4blcfybknGB4D+oETKLs7Q76UiPqRpUJK3hr1nxelyYO0PHKVzJwlu0aCeEAsGI6rpw==", "dev": true, "license": "MIT", "dependencies": { - "is-number": "^7.0.0" + "@sindresorhus/base62": "^1.0.0", + "reserved-identifiers": "^1.0.0" }, "engines": { - "node": ">=8.0" - } - }, - "node_modules/tough-cookie": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-5.0.0.tgz", - "integrity": "sha512-FRKsF7cz96xIIeMZ82ehjC3xW2E+O2+v11udrDYewUbszngYhsGa8z6YUMMzO9QJZzzyd0nGGXnML/TReX6W8Q==", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "tldts": "^6.1.32" + "node": ">=20" }, - "engines": { - "node": ">=16" + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/tr46": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-5.0.0.tgz", - "integrity": "sha512-tk2G5R2KRwBd+ZN0zaEXpmzdKyOYksXwywulIX95MBODjSzMIuQnQ3m8JxgbhnL1LeVo7lqQKsYa1O3Htl7K5g==", + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", "dev": true, "license": "MIT", - "dependencies": { - "punycode": "^2.3.1" - }, "engines": { - "node": ">=18" + "node": ">=0.6" } }, "node_modules/trim-newlines": { @@ -4773,33 +5154,50 @@ } }, "node_modules/ts-api-utils": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.4.3.tgz", - "integrity": "sha512-i3eMG77UTMD0hZhgRS562pv83RC6ukSAC2GMNWc+9dieh/+jDM5u5YG+NHX6VNDRHQcHwmsTHctP9LhbC3WxVw==", + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.4.0.tgz", + "integrity": "sha512-3TaVTaAv2gTiMB35i3FiGJaRfwb3Pyn/j3m/bfAvGe8FB7CF6u+LMYqYlDh7reQf7UNvoTvdfAqHGmPGOSsPmA==", "dev": true, "license": "MIT", "engines": { - "node": ">=16" + "node": ">=18.12" }, "peerDependencies": { - "typescript": ">=4.2.0" + "typescript": ">=4.8.4" } }, - "node_modules/tslib": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.7.0.tgz", - "integrity": "sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA==", + "node_modules/tsondb": { + "version": "0.19.8", + "resolved": "https://registry.npmjs.org/tsondb/-/tsondb-0.19.8.tgz", + "integrity": "sha512-1RG6kV+uZvoj9viXTgZqXBnwV3wcizvdqsswai4Ar3aOMczspu73UZAE3p9Xjk/XmQsO5JMoICU8AP+MiRTNqA==", "dev": true, - "license": "0BSD" + "license": "ISC", + "dependencies": { + "@elyukai/utils": "^0.2.1", + "@preact/signals": "^2.7.0", + "debug": "^4.4.3", + "express": "^5.2.1", + "messageformat": "^4.0.0", + "preact": "^10.28.3", + "preact-iso": "^2.11.1", + "simple-cli-args": "^0.1.3", + "simple-git": "^3.30.0" + }, + "bin": { + "tsondb": "dist/src/bin/tsondb.js" + }, + "engines": { + "node": ">=23.6.0" + } }, "node_modules/tsx": { - "version": "4.19.2", - "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.19.2.tgz", - "integrity": "sha512-pOUl6Vo2LUq/bSa8S5q7b91cgNSjctn9ugq/+Mvow99qW6x/UZYwzxy/3NmqoT66eHYfCVvFvACC58UBPFf28g==", + "version": "4.21.0", + "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.21.0.tgz", + "integrity": "sha512-5C1sg4USs1lfG0GFb2RLXsdpXqBSEhAaA/0kPL01wxzpMqLILNxIxIOKiILz+cdg/pLnOUxFYOR5yhHU666wbw==", "dev": true, "license": "MIT", "dependencies": { - "esbuild": "~0.23.0", + "esbuild": "~0.27.0", "get-tsconfig": "^4.7.5" }, "bin": { @@ -4839,6 +5237,21 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/type-is": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-2.0.1.tgz", + "integrity": "sha512-OZs6gsjF4vMp32qrCbiVSkrFmXtG/AZhY3t0iAMrMBiAZyV9oALtXO8hsrHbMXF9x6L3grlFuwW2oAz7cav+Gw==", + "dev": true, + "license": "MIT", + "dependencies": { + "content-type": "^1.0.5", + "media-typer": "^1.1.0", + "mime-types": "^3.0.0" + }, + "engines": { + "node": ">= 0.6" + } + }, "node_modules/typedarray": { "version": "0.0.6", "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", @@ -4847,9 +5260,9 @@ "license": "MIT" }, "node_modules/typescript": { - "version": "5.7.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.2.tgz", - "integrity": "sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==", + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", "dev": true, "license": "Apache-2.0", "bin": { @@ -4861,15 +5274,16 @@ } }, "node_modules/typescript-eslint": { - "version": "8.19.0", - "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.19.0.tgz", - "integrity": "sha512-Ni8sUkVWYK4KAcTtPjQ/UTiRk6jcsuDhPpxULapUDi8A/l8TSBk+t1GtJA1RsCzIJg0q6+J7bf35AwQigENWRQ==", + "version": "8.54.0", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.54.0.tgz", + "integrity": "sha512-CKsJ+g53QpsNPqbzUsfKVgd3Lny4yKZ1pP4qN3jdMOg/sisIDLGyDMezycquXLE5JsEU0wp3dGNdzig0/fmSVQ==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/eslint-plugin": "8.19.0", - "@typescript-eslint/parser": "8.19.0", - "@typescript-eslint/utils": "8.19.0" + "@typescript-eslint/eslint-plugin": "8.54.0", + "@typescript-eslint/parser": "8.54.0", + "@typescript-eslint/typescript-estree": "8.54.0", + "@typescript-eslint/utils": "8.54.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -4880,7 +5294,7 @@ }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0", - "typescript": ">=4.8.4 <5.8.0" + "typescript": ">=4.8.4 <6.0.0" } }, "node_modules/uglify-js": { @@ -4898,12 +5312,22 @@ } }, "node_modules/undici-types": { - "version": "6.20.0", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.20.0.tgz", - "integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==", + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.16.0.tgz", + "integrity": "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==", "dev": true, "license": "MIT" }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, "node_modules/uri-js": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", @@ -4933,64 +5357,14 @@ "spdx-expression-parse": "^3.0.0" } }, - "node_modules/w3c-xmlserializer": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-5.0.0.tgz", - "integrity": "sha512-o8qghlI8NZHU1lLPrpi2+Uq7abh4GGPpYANlalzWxyWteJOCsr/P+oPBA49TOLu5FTZO4d3F9MnWJfiMo4BkmA==", - "dev": true, - "license": "MIT", - "dependencies": { - "xml-name-validator": "^5.0.0" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/webidl-conversions": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", - "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==", - "dev": true, - "license": "BSD-2-Clause", - "engines": { - "node": ">=12" - } - }, - "node_modules/whatwg-encoding": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-3.1.1.tgz", - "integrity": "sha512-6qN4hJdMwfYBtE3YBTTHhoeuUrDBPZmbQaxWAqSALV/MeEnR5z1xd8UKud2RAkFoPkmB+hli1TZSnyi84xz1vQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "iconv-lite": "0.6.3" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/whatwg-mimetype": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-4.0.0.tgz", - "integrity": "sha512-QaKxh0eNIi2mE9p2vEdzfagOKHCcj1pJ56EEHGQOVxp8r9/iszLUUV7v89x9O1p/T+NlTM5W7jW6+cz4Fq1YVg==", + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", "dev": true, "license": "MIT", "engines": { - "node": ">=18" - } - }, - "node_modules/whatwg-url": { - "version": "14.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-14.0.0.tgz", - "integrity": "sha512-1lfMEm2IEr7RIV+f4lUNPOqfFL+pO+Xw3fJSqmjX9AbXcXcYOkCe1P6+9VBZB6n94af16NfZf+sSk0JCBZC9aw==", - "dev": true, - "license": "MIT", - "dependencies": { - "tr46": "^5.0.0", - "webidl-conversions": "^7.0.0" - }, - "engines": { - "node": ">=18" + "node": ">= 0.8" } }, "node_modules/which": { @@ -4999,6 +5373,7 @@ "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", "dev": true, "license": "ISC", + "peer": true, "dependencies": { "isexe": "^2.0.0" }, @@ -5045,61 +5420,6 @@ "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, - "node_modules/wrap-ansi-cjs": { - "name": "wrap-ansi", - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, - "node_modules/wrap-ansi-cjs/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/wrap-ansi-cjs/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/wrap-ansi-cjs/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true, - "license": "MIT" - }, "node_modules/wrap-ansi/node_modules/ansi-styles": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", @@ -5136,44 +5456,12 @@ "dev": true, "license": "MIT" }, - "node_modules/ws": { - "version": "8.18.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz", - "integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==", + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", "dev": true, - "license": "MIT", - "engines": { - "node": ">=10.0.0" - }, - "peerDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": ">=5.0.2" - }, - "peerDependenciesMeta": { - "bufferutil": { - "optional": true - }, - "utf-8-validate": { - "optional": true - } - } - }, - "node_modules/xml-name-validator": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-5.0.0.tgz", - "integrity": "sha512-EvGK8EJ3DhaHfbRlETOWAS5pO9MZITeauHKJyb8wyajUfQUenkIg2MvLDTZ4T/TgIcm3HU0TFBgWWboAZ30UHg==", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": ">=18" - } - }, - "node_modules/xmlchars": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz", - "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==", - "dev": true, - "license": "MIT" + "license": "ISC" }, "node_modules/xtend": { "version": "4.0.2", @@ -5203,16 +5491,19 @@ "license": "ISC" }, "node_modules/yaml": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.5.1.tgz", - "integrity": "sha512-bLQOjaX/ADgQ20isPJRvF0iRUHIxVhYvr53Of7wGcWlO2jvtUlH5m87DsmulFVxRpNLOnI4tB6p/oh8D7kpn9Q==", + "version": "2.8.2", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.2.tgz", + "integrity": "sha512-mplynKqc1C2hTVYxd0PU2xQAc22TI1vShAYGksCCfxbn/dFwnHTNi1bvYsBTkhdUNtGIf5xNOg938rrSSYvS9A==", "dev": true, "license": "ISC", "bin": { "yaml": "bin.mjs" }, "engines": { - "node": ">= 14" + "node": ">= 14.6" + }, + "funding": { + "url": "https://github.com/sponsors/eemeli" } }, "node_modules/yargs": { diff --git a/package.json b/package.json index da78637..578b617 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "build": "tsc -b", "watch": "tsc -b -w", "release": "commit-and-tag-version", - "test": "glob -c \"node --import tsx --test\" \"./test/**/*.ts\"", + "test": "node --import tsx --test", "lint": "eslint" }, "repository": { @@ -30,20 +30,21 @@ }, "homepage": "https://github.com/Optolith/entity-descriptions#readme", "dependencies": { - "@optolith/helpers": "^0.2.2" + "@optolith/helpers": "^0.2.2", + "messageformat": "^4.0.0" }, "devDependencies": { "@eslint/js": "^9.17.0", - "@types/node": "^22.10.5", - "commit-and-tag-version": "^12.5.0", - "eslint-config-prettier": "^9.1.0", - "eslint-plugin-jsdoc": "^50.6.1", - "glob": "^11.0.0", - "globals": "^15.14.0", - "optolith-database-schema": "^0.17.2", - "tsx": "^4.19.2", - "typescript": "^5.7.2", - "typescript-eslint": "^8.19.0" + "@types/node": "^25.2.1", + "commit-and-tag-version": "^12.6.1", + "eslint-config-prettier": "^10.1.8", + "eslint-plugin-jsdoc": "^62.5.4", + "glob": "^13.0.1", + "globals": "^17.3.0", + "optolith-database-schema": "^0.29.0", + "tsx": "^4.21.0", + "typescript": "^5.9.3", + "typescript-eslint": "^8.54.0" }, "type": "module" } diff --git a/src/creator.ts b/src/creator.ts index 2b8c6b8..9f690e8 100644 --- a/src/creator.ts +++ b/src/creator.ts @@ -1,5 +1,5 @@ import { filterNonNullable } from "@optolith/helpers/array" -import { GetById } from "./helpers/getTypes.js" +import type { GetInstanceById } from "./helpers/getTypes.js" import { LocaleEnvironment } from "./helpers/locale.js" import { EntityDescription, RawEntityDescription } from "./index.js" import { getReferencesTranslation } from "./references/index.js" @@ -12,12 +12,12 @@ export const createEntityDescriptionCreator = ( fn: EntityDescriptionCreator, ): EntityDescriptionCreator => - (databaseAccessors, locale, entry) => { + (databaseAccessors, locale, entry, id) => { if (entry === undefined) { return undefined } - const rawEntry = fn(databaseAccessors, locale, entry) + const rawEntry = fn(databaseAccessors, locale, entry, id) if (rawEntry === undefined) { return undefined @@ -30,7 +30,7 @@ export const createEntityDescriptionCreator = rawEntry.references === undefined ? undefined : getReferencesTranslation( - databaseAccessors.getPublicationById, + databaseAccessors.getInstanceById, locale, rawEntry.references, ), @@ -46,7 +46,8 @@ export type EntityDescriptionCreator< A extends object = object, R = EntityDescription, > = ( - databaseAccessors: A & { getPublicationById: GetById.Static.Publication }, + databaseAccessors: A & { getInstanceById: GetInstanceById<"Publication"> }, locale: LocaleEnvironment, entry: T, + id: string, ) => R | undefined diff --git a/src/entities/combatTechnique.ts b/src/entities/combatTechnique.ts index 00a3896..307cee4 100644 --- a/src/entities/combatTechnique.ts +++ b/src/entities/combatTechnique.ts @@ -1,8 +1,10 @@ import { mapNullable } from "@optolith/helpers/nullable" -import { CloseCombatTechnique } from "optolith-database-schema/types/CombatTechnique_Close" -import { RangedCombatTechnique } from "optolith-database-schema/types/CombatTechnique_Ranged" +import { + CloseCombatTechnique, + RangedCombatTechnique, +} from "optolith-database-schema/gen" import { createEntityDescriptionCreator } from "../creator.js" -import { GetById } from "../helpers/getTypes.js" +import type { GetInstanceById } from "../helpers/getTypes.js" import { createImprovementCost } from "./partial/rated/improvementCost.js" /** @@ -12,9 +14,9 @@ export const getCloseCombatTechniqueEntityDescription = createEntityDescriptionCreator< CloseCombatTechnique, { - getAttributeById: GetById.Static.Attribute + getInstanceById: GetInstanceById<"Attribute"> } - >(({ getAttributeById }, { translate, translateMap }, entry) => { + >(({ getInstanceById }, { translate, translateMap }, entry) => { const translation = translateMap(entry.translations) if (translation === undefined) { @@ -33,8 +35,8 @@ export const getCloseCombatTechniqueEntityDescription = label: translate("Primary Attribute"), value: entry.primary_attribute .map( - attr => - translateMap(getAttributeById(attr.id.attribute)?.translations) + attrId => + translateMap(getInstanceById("Attribute", attrId)?.translations) ?.name, ) .join("/"), @@ -52,9 +54,9 @@ export const getRangedCombatTechniqueEntityDescription = createEntityDescriptionCreator< RangedCombatTechnique, { - getAttributeById: GetById.Static.Attribute + getInstanceById: GetInstanceById<"Attribute"> } - >(({ getAttributeById }, { translate, translateMap }, entry) => { + >(({ getInstanceById }, { translate, translateMap }, entry) => { const translation = translateMap(entry.translations) if (translation === undefined) { @@ -73,8 +75,8 @@ export const getRangedCombatTechniqueEntityDescription = label: translate("Primary Attribute"), value: entry.primary_attribute .map( - attr => - translateMap(getAttributeById(attr.id.attribute)?.translations) + attrId => + translateMap(getInstanceById("Attribute", attrId)?.translations) ?.name, ) .join("/"), diff --git a/src/entities/experienceLevel.ts b/src/entities/experienceLevel.ts index 7f4619d..3418bf5 100644 --- a/src/entities/experienceLevel.ts +++ b/src/entities/experienceLevel.ts @@ -1,4 +1,4 @@ -import { ExperienceLevel } from "optolith-database-schema/types/ExperienceLevel" +import { ExperienceLevel } from "optolith-database-schema/gen" import { createEntityDescriptionCreator } from "../creator.js" /** diff --git a/src/entities/focusRule.ts b/src/entities/focusRule.ts index 6f78a55..438c2bf 100644 --- a/src/entities/focusRule.ts +++ b/src/entities/focusRule.ts @@ -1,15 +1,15 @@ import { romanize } from "@optolith/helpers/roman" -import { FocusRule } from "optolith-database-schema/types/rule/FocusRule" +import type { FocusRule } from "optolith-database-schema/gen" import { createEntityDescriptionCreator } from "../creator.js" -import { GetById } from "../helpers/getTypes.js" +import type { GetInstanceById } from "../helpers/getTypes.js" /** * Get a JSON representation of the rules text for a focus rule. */ export const getFocusRuleEntityDescription = createEntityDescriptionCreator< FocusRule, - { getSubjectById: GetById.Static.Subject } ->(({ getSubjectById }, { translateMap }, entry) => { + { getInstanceById: GetInstanceById<"Subject"> } +>(({ getInstanceById }, { translateMap }, entry) => { const translation = translateMap(entry.translations) if (translation === undefined) { @@ -18,9 +18,11 @@ export const getFocusRuleEntityDescription = createEntityDescriptionCreator< return { title: `${translation.name} (${romanize(entry.level)})`, - subtitle: translateMap( - getSubjectById(entry.subject.id.subject)?.translations, - )?.name, + subtitle: + entry.subject !== undefined + ? translateMap(getInstanceById("Subject", entry.subject)?.translations) + ?.name + : undefined, className: "focus-rule", body: [{ value: translation.description }], references: entry.src, diff --git a/src/entities/liturgicalChant.ts b/src/entities/liturgicalChant.ts index 1e3189a..4a9ddb3 100644 --- a/src/entities/liturgicalChant.ts +++ b/src/entities/liturgicalChant.ts @@ -1,14 +1,15 @@ import { Compare } from "@optolith/helpers/compare" import { isNotNullish } from "@optolith/helpers/nullable" import { assertExhaustive } from "@optolith/helpers/typeSafety" -import { Blessing } from "optolith-database-schema/types/Blessing" -import { Ceremony } from "optolith-database-schema/types/Ceremony" -import { DerivedCharacteristic } from "optolith-database-schema/types/DerivedCharacteristic" -import { LiturgicalChant } from "optolith-database-schema/types/LiturgicalChant" -import { SkillTradition } from "optolith-database-schema/types/_Blessed" -import { AspectReference } from "optolith-database-schema/types/_SimpleReferences" +import { + Blessing, + type Ceremony, + type DerivedCharacteristic, + type LiturgicalChant, + type LiturgyTradition, +} from "optolith-database-schema/gen" import { createEntityDescriptionCreator } from "../creator.js" -import { GetById } from "../helpers/getTypes.js" +import type { GetInstanceById } from "../helpers/getTypes.js" import { Translate, TranslateMap } from "../helpers/translate.js" import { EntityDescriptionSection } from "../index.js" import { getDurationTranslationForBlessing } from "./partial/rated/activatable/duration.js" @@ -31,24 +32,23 @@ const getTextForTraditions = ( translate: Translate translateMap: TranslateMap localeCompare: Compare - getBlessedTraditionById: GetById.Static.BlessedTradition - getAspectById: GetById.Static.Aspect + getInstanceById: GetInstanceById<"BlessedTradition" | "Aspect"> }, - values: SkillTradition[], + values: LiturgyTradition[], ): EntityDescriptionSection => { - const getAspectName = (ref: AspectReference) => - deps.translateMap(deps.getAspectById(ref.id.aspect)?.translations)?.name + const getAspectName = (aspectId: string) => + deps.translateMap(deps.getInstanceById("Aspect", aspectId)?.translations) + ?.name const text = values .map(trad => { - switch (trad.tag) { + switch (trad.kind) { case "GeneralAspect": - return getAspectName(trad.general_aspect) + return getAspectName(trad.GeneralAspect) case "Tradition": { const traditionTranslation = deps.translateMap( - deps.getBlessedTraditionById( - trad.tradition.tradition.id.blessed_tradition, - )?.translations, + deps.getInstanceById("BlessedTradition", trad.Tradition.tradition) + ?.translations, ) const name = traditionTranslation?.name_compressed ?? traditionTranslation?.name @@ -58,7 +58,7 @@ const getTextForTraditions = ( } const aspects = - trad.tradition.aspects + trad.Tradition.aspects ?.map(getAspectName) .filter(isNotNullish) .sort(deps.localeCompare) ?? [] @@ -88,9 +88,9 @@ const getTextForTraditions = ( export const getBlessingEntityDescription = createEntityDescriptionCreator< Blessing, { - getTargetCategoryById: GetById.Static.TargetCategory + getInstanceById: GetInstanceById<"TargetCategory"> } ->(({ getTargetCategoryById }, locale, entry) => { +>(({ getInstanceById }, locale, entry) => { const { translate, translateMap } = locale const translation = translateMap(entry.translations) @@ -132,7 +132,7 @@ export const getBlessingEntityDescription = createEntityDescriptionCreator< ? `***${duration}*** (${translation.duration})` : duration, }, - getTargetCategoryTranslation(getTargetCategoryById, locale, entry.target), + getTargetCategoryTranslation(getInstanceById, locale, entry.target), ], references: entry.src, } @@ -145,153 +145,17 @@ export const getLiturgicalChantEntityDescription = createEntityDescriptionCreator< LiturgicalChant, { - getAttributeById: GetById.Static.Attribute + getInstanceById: GetInstanceById< + | "Attribute" + | "SkillModificationLevel" + | "TargetCategory" + | "Aspect" + | "BlessedTradition" + > getSpirit: () => DerivedCharacteristic | undefined getToughness: () => DerivedCharacteristic | undefined - getSkillModificationLevelById: GetById.Static.SkillModificationLevel - getTargetCategoryById: GetById.Static.TargetCategory - getBlessedTraditionById: GetById.Static.BlessedTradition - getAspectById: GetById.Static.Aspect } - >( - ( - { - getAttributeById, - getSpirit, - getToughness, - getSkillModificationLevelById, - getTargetCategoryById, - getBlessedTraditionById, - getAspectById, - }, - locale, - entry, - ) => { - const { translate, translateMap, compare: localeCompare } = locale - const translation = translateMap(entry.translations) - - if (translation === undefined) { - return undefined - } - - const { castingTime, cost, range, duration } = (() => { - switch (entry.parameters.tag) { - case "OneTime": - return getFastOneTimePerformanceParametersTranslations( - getSkillModificationLevelById, - locale, - Entity.LiturgicalChant, - ResponsiveTextSize.Full, - entry.parameters.one_time, - ) - - case "Sustained": - return getFastSustainedPerformanceParametersTranslations( - getSkillModificationLevelById, - locale, - Entity.LiturgicalChant, - ResponsiveTextSize.Full, - entry.parameters.sustained, - ) - - default: - return assertExhaustive(entry.parameters) - } - })() - - return { - title: translation.name, - className: "liturgical-chant", - body: [ - getTextForCheck( - { translate, translateMap, getAttributeById }, - entry.check, - { - value: entry.check_penalty, - responsiveText: ResponsiveTextSize.Full, - getSpirit, - getToughness, - }, - ), - ...getTextForEffect(locale, translation.effect), - { - label: translate("Liturgical Time"), - value: - castingTime !== translation.casting_time.full - ? `***${castingTime}*** (${translation.casting_time.full})` - : castingTime, - }, - { - label: translate("KP Cost"), - value: - cost !== translation.cost.full - ? `***${cost}*** (${translation.cost.full})` - : cost, - }, - { - label: translate("Range"), - value: - range !== translation.range.full - ? `***${range}*** (${translation.range.full})` - : range, - }, - { - label: translate("Duration"), - value: - duration !== translation.duration.full - ? `***${duration}*** (${translation.duration.full})` - : duration, - }, - getTargetCategoryTranslation( - getTargetCategoryById, - locale, - entry.target, - ), - getTextForTraditions( - { - translate, - translateMap, - localeCompare, - getBlessedTraditionById, - getAspectById, - }, - entry.traditions, - ), - createImprovementCost(translate, entry.improvement_cost), - ], - references: entry.src, - } - }, - ) - -/** - * Get a JSON representation of the rules text for a ceremony. - */ -export const getCeremonyEntityDescription = createEntityDescriptionCreator< - Ceremony, - { - getAttributeById: GetById.Static.Attribute - getSpirit: () => DerivedCharacteristic | undefined - getToughness: () => DerivedCharacteristic | undefined - getSkillModificationLevelById: GetById.Static.SkillModificationLevel - getTargetCategoryById: GetById.Static.TargetCategory - getBlessedTraditionById: GetById.Static.BlessedTradition - getAspectById: GetById.Static.Aspect - } ->( - ( - { - getAttributeById, - getSpirit, - getToughness, - getSkillModificationLevelById, - getTargetCategoryById, - getBlessedTraditionById, - getAspectById, - }, - locale, - entry, - ) => { + >(({ getInstanceById, getSpirit, getToughness }, locale, entry) => { const { translate, translateMap, compare: localeCompare } = locale const translation = translateMap(entry.translations) @@ -300,23 +164,23 @@ export const getCeremonyEntityDescription = createEntityDescriptionCreator< } const { castingTime, cost, range, duration } = (() => { - switch (entry.parameters.tag) { + switch (entry.parameters.kind) { case "OneTime": - return getSlowOneTimePerformanceParametersTranslations( - getSkillModificationLevelById, + return getFastOneTimePerformanceParametersTranslations( + getInstanceById, locale, - Entity.Ritual, + Entity.LiturgicalChant, ResponsiveTextSize.Full, - entry.parameters.one_time, + entry.parameters.OneTime, ) case "Sustained": - return getSlowSustainedPerformanceParametersTranslations( - getSkillModificationLevelById, + return getFastSustainedPerformanceParametersTranslations( + getInstanceById, locale, - Entity.Ceremony, + Entity.LiturgicalChant, ResponsiveTextSize.Full, - entry.parameters.sustained, + entry.parameters.Sustained, ) default: @@ -326,10 +190,10 @@ export const getCeremonyEntityDescription = createEntityDescriptionCreator< return { title: translation.name, - className: "ceremony", + className: "liturgical-chant", body: [ getTextForCheck( - { translate, translateMap, getAttributeById }, + { translate, translateMap, getInstanceById }, entry.check, { value: entry.check_penalty, @@ -340,8 +204,9 @@ export const getCeremonyEntityDescription = createEntityDescriptionCreator< ), ...getTextForEffect(locale, translation.effect), { - label: translate("Ceremonial Time"), + label: translate("Liturgical Time"), value: + translation.casting_time && castingTime !== translation.casting_time.full ? `***${castingTime}*** (${translation.casting_time.full})` : castingTime, @@ -349,36 +214,31 @@ export const getCeremonyEntityDescription = createEntityDescriptionCreator< { label: translate("KP Cost"), value: - cost !== translation.cost.full + translation.cost && cost !== translation.cost.full ? `***${cost}*** (${translation.cost.full})` : cost, }, { label: translate("Range"), value: - range !== translation.range.full + translation.range && range !== translation.range.full ? `***${range}*** (${translation.range.full})` : range, }, { label: translate("Duration"), value: - duration !== translation.duration.full + translation.duration && duration !== translation.duration.full ? `***${duration}*** (${translation.duration.full})` : duration, }, - getTargetCategoryTranslation( - getTargetCategoryById, - locale, - entry.target, - ), + getTargetCategoryTranslation(getInstanceById, locale, entry.target), getTextForTraditions( { translate, translateMap, localeCompare, - getBlessedTraditionById, - getAspectById, + getInstanceById, }, entry.traditions, ), @@ -386,5 +246,113 @@ export const getCeremonyEntityDescription = createEntityDescriptionCreator< ], references: entry.src, } - }, -) + }) + +/** + * Get a JSON representation of the rules text for a ceremony. + */ +export const getCeremonyEntityDescription = createEntityDescriptionCreator< + Ceremony, + { + getInstanceById: GetInstanceById< + | "Attribute" + | "SkillModificationLevel" + | "TargetCategory" + | "Aspect" + | "BlessedTradition" + > + getSpirit: () => DerivedCharacteristic | undefined + getToughness: () => DerivedCharacteristic | undefined + } +>(({ getInstanceById, getSpirit, getToughness }, locale, entry) => { + const { translate, translateMap, compare: localeCompare } = locale + const translation = translateMap(entry.translations) + + if (translation === undefined) { + return undefined + } + + const { castingTime, cost, range, duration } = (() => { + switch (entry.parameters.kind) { + case "OneTime": + return getSlowOneTimePerformanceParametersTranslations( + getInstanceById, + locale, + Entity.Ritual, + ResponsiveTextSize.Full, + entry.parameters.OneTime, + ) + + case "Sustained": + return getSlowSustainedPerformanceParametersTranslations( + getInstanceById, + locale, + Entity.Ceremony, + ResponsiveTextSize.Full, + entry.parameters.Sustained, + ) + + default: + return assertExhaustive(entry.parameters) + } + })() + + return { + title: translation.name, + className: "ceremony", + body: [ + getTextForCheck( + { translate, translateMap, getInstanceById }, + entry.check, + { + value: entry.check_penalty, + responsiveText: ResponsiveTextSize.Full, + getSpirit, + getToughness, + }, + ), + ...getTextForEffect(locale, translation.effect), + { + label: translate("Ceremonial Time"), + value: + translation.casting_time && + castingTime !== translation.casting_time.full + ? `***${castingTime}*** (${translation.casting_time.full})` + : castingTime, + }, + { + label: translate("KP Cost"), + value: + translation.cost && cost !== translation.cost.full + ? `***${cost}*** (${translation.cost.full})` + : cost, + }, + { + label: translate("Range"), + value: + translation.range && range !== translation.range.full + ? `***${range}*** (${translation.range.full})` + : range, + }, + { + label: translate("Duration"), + value: + translation.duration && duration !== translation.duration.full + ? `***${duration}*** (${translation.duration.full})` + : duration, + }, + getTargetCategoryTranslation(getInstanceById, locale, entry.target), + getTextForTraditions( + { + translate, + translateMap, + localeCompare, + getInstanceById, + }, + entry.traditions, + ), + createImprovementCost(translate, entry.improvement_cost), + ], + references: entry.src, + } +}) diff --git a/src/entities/optionalRule.ts b/src/entities/optionalRule.ts index 68a0089..7f213cd 100644 --- a/src/entities/optionalRule.ts +++ b/src/entities/optionalRule.ts @@ -1,4 +1,4 @@ -import { OptionalRule } from "optolith-database-schema/types/rule/OptionalRule" +import { OptionalRule } from "optolith-database-schema/gen" import { createEntityDescriptionCreator } from "../creator.js" /** diff --git a/src/entities/partial/activatableNameChunks.ts b/src/entities/partial/activatableNameChunks.ts index cd93634..c2ee145 100644 --- a/src/entities/partial/activatableNameChunks.ts +++ b/src/entities/partial/activatableNameChunks.ts @@ -1,19 +1,19 @@ import { mapObject } from "@optolith/helpers/object" import { romanize } from "@optolith/helpers/roman" import { assertExhaustive } from "@optolith/helpers/typeSafety" -import { ResolvedSelectOption } from "optolith-database-schema/cache/activatableSelectOptions" -import { +import type { ResolvedSelectOption } from "optolith-database-schema/cache" +import type { ActivatableIdentifier, - SelectOptionIdentifier, -} from "optolith-database-schema/types/_IdentifierGroup" -import { LocaleMap } from "optolith-database-schema/types/_LocaleMap" -import { GetById } from "../../helpers/getTypes.js" + RequirableSelectOptionIdentifier, +} from "optolith-database-schema/gen" +import { type GetInstanceById } from "../../helpers/getTypes.js" import { AdvantageIdentifier, DisadvantageIdentifier, KarmaSpecialAbilityIdentifier, } from "../../helpers/identifiers.js" import { LocaleEnvironment } from "../../helpers/locale.js" +import type { LocaleMap } from "../../helpers/translate.js" import { MISSING_VALUE } from "./unknown.js" /** @@ -172,17 +172,17 @@ const combineBaseName = ( } const getEntrySpecificFullName = ( - getAspectById: GetById.Static.Aspect, + getInstanceById: GetInstanceById<"Aspect">, locale: LocaleEnvironment, id: ActivatableIdentifier, base: ActivatableNameChunk, level: number | undefined, - options: SelectOptionIdentifier[] | undefined, + options: RequirableSelectOptionIdentifier[] | undefined, printedOptions: ActivatableNameComponents["options"], ): Pick | undefined => { - switch (id.tag) { + switch (id.kind) { case "Advantage": - switch (id.advantage) { + switch (id.Advantage) { case AdvantageIdentifier.HatredOf: { const [firstOption, ...rest] = printedOptions @@ -205,7 +205,7 @@ const getEntrySpecificFullName = ( return undefined } case "Disadvantage": - switch (id.disadvantage) { + switch (id.Disadvantage) { case DisadvantageIdentifier.PersonalityFlaw: { const [selection, optionalText, ...rest] = printedOptions @@ -239,7 +239,7 @@ const getEntrySpecificFullName = ( case "AdvancedMagicalSpecialAbility": return undefined case "AdvancedSkillSpecialAbility": - switch (id.advanced_skill_special_ability) { + switch (id.AdvancedSkillSpecialAbility) { // case AdvancedSkillSpecialAbilityIdentifier.Fachwissen: { // const [skillId, firstApplicationId, secondApplicationId] = options ?? [] // const aspect = @@ -299,6 +299,7 @@ const getEntrySpecificFullName = ( case "AncestorGlyph": case "ArcaneOrbEnchantment": case "AttireEnchantment": + case "Beutelzauber": case "BlessedTradition": case "BowlEnchantment": case "BrawlingSpecialAbility": @@ -315,7 +316,7 @@ const getEntrySpecificFullName = ( case "FoolsHatEnchantment": return undefined case "GeneralSpecialAbility": - switch (id.general_special_ability) { + switch (id.GeneralSpecialAbility) { // case GeneralSpecialAbilityIdentifier.LanguageSpecialization: { // const [languageId, specializationId] = options ?? [] @@ -374,15 +375,16 @@ const getEntrySpecificFullName = ( default: return undefined } + case "Haubenzauber": case "InstrumentEnchantment": return undefined case "KarmaSpecialAbility": - switch (id.karma_special_ability) { + switch (id.KarmaSpecialAbility) { case KarmaSpecialAbilityIdentifier.MasterOfAspect: { const [aspectId] = options ?? [] const aspect = - aspectId?.tag === "Aspect" - ? getAspectById(aspectId.aspect) + aspectId?.kind === "Aspect" + ? getInstanceById("Aspect", aspectId.Aspect) : undefined const aspectTranslations = locale.translateMap(aspect?.translations) @@ -406,6 +408,7 @@ const getEntrySpecificFullName = ( return undefined } case "Krallenkettenzauber": + case "Kristallkugelzauber": case "LiturgicalStyleSpecialAbility": case "LycantropicGift": case "MagicalSign": @@ -439,15 +442,15 @@ const getEntrySpecificFullName = ( * Gets the name components for an activatable entry. */ export const getNameComponents = ( - getAspectById: GetById.Static.Aspect, + getInstanceById: GetInstanceById<"Aspect">, locale: LocaleEnvironment, id: ActivatableIdentifier, - options: SelectOptionIdentifier[] | undefined, + options: RequirableSelectOptionIdentifier[] | undefined, level: number | undefined, translations: LocaleMap, getBaseName: (translation: T) => string, getSelectOptionById: ( - id: SelectOptionIdentifier, + id: RequirableSelectOptionIdentifier, ) => ResolvedSelectOption | undefined, displayedInProfession: boolean, ): ActivatableNameComponents => { @@ -455,12 +458,13 @@ export const getNameComponents = ( const nameOptions: ActivatableNameComponents["options"] = (() => { const arr = options?.map(optionId => { - const optTranslations = getSelectOptionById(optionId)?.translations + const optTranslations = + getSelectOptionById(optionId)?.content.translations return optTranslations === undefined ? MISSING_VALUE : mapObject(optTranslations, t10n => displayedInProfession - ? t10n.name_in_profession ?? t10n.name + ? (t10n.name_in_profession ?? t10n.name) : t10n.name, ) }) ?? [] @@ -475,7 +479,7 @@ export const getNameComponents = ( return { ...(getEntrySpecificFullName( - getAspectById, + getInstanceById, locale, id, base, diff --git a/src/entities/partial/prerequisites/displayOption.ts b/src/entities/partial/prerequisites/displayOption.ts index 6438579..ea2afd2 100644 --- a/src/entities/partial/prerequisites/displayOption.ts +++ b/src/entities/partial/prerequisites/displayOption.ts @@ -1,5 +1,5 @@ import { assertExhaustive } from "@optolith/helpers/typeSafety" -import { DisplayOption } from "optolith-database-schema/types/prerequisites/DisplayOption" +import { DisplayOption } from "optolith-database-schema/gen" import { LocaleEnvironment } from "../../../helpers/locale.js" import { MISSING_VALUE } from "../unknown.js" import { PrerequisitePart } from "./part.js" @@ -11,15 +11,15 @@ export const printDisplayOption = ( locale: LocaleEnvironment, displayOption: DisplayOption, ): PrerequisitePart | undefined => { - switch (displayOption.tag) { + switch (displayOption.kind) { case "Hide": return undefined case "ReplaceWith": return { value: - locale.translateMap(displayOption.replace_with.translations) ?? - MISSING_VALUE, - sentenceType: displayOption.replace_with.sentence_type, + locale.translateMap(displayOption.ReplaceWith.translations) + ?.replacement ?? MISSING_VALUE, + sentenceType: displayOption.ReplaceWith.sentence_type, isMeta: false, } default: diff --git a/src/entities/partial/prerequisites/index.ts b/src/entities/partial/prerequisites/index.ts index 7f4b5a4..3c36bb0 100644 --- a/src/entities/partial/prerequisites/index.ts +++ b/src/entities/partial/prerequisites/index.ts @@ -1,10 +1,6 @@ import { isNotNullish } from "@optolith/helpers/nullable" import { romanize } from "@optolith/helpers/roman" import { assertExhaustive } from "@optolith/helpers/typeSafety" -import { - SkillWithEnhancementsIdentifier, - SpecialAbilityIdentifier, -} from "optolith-database-schema/types/_IdentifierGroup" import { AdvantageDisadvantagePrerequisites, AnimistPowerPrerequisites, @@ -26,10 +22,11 @@ import { PrerequisitesForLevels, ProfessionPrerequisites, PublicationPrerequisites, + SpecialAbilityIdentifier, SpellworkPrerequisites, -} from "optolith-database-schema/types/_Prerequisite" -import { GeneralPrerequisiteGroup } from "optolith-database-schema/types/prerequisites/PrerequisiteGroups" -import { GetById } from "../../../helpers/getTypes.js" + type GeneralPrerequisiteGroup, +} from "optolith-database-schema/gen" +import type { GetInstanceById } from "../../../helpers/getTypes.js" import { LocaleEnvironment } from "../../../helpers/locale.js" import { MISSING_VALUE } from "../unknown.js" import { printDisplayOption } from "./displayOption.js" @@ -52,13 +49,13 @@ import { } from "./prerequisiteGroups.js" import { GetResolvedSelectOptionById } from "./single/activatable.js" -type Prerequisite = { tag: string } +type Prerequisite = { kind: string } const printPrerequisiteGroup = ( locale: LocaleEnvironment, group: PrerequisiteGroup, ): PrerequisitePart => ({ - value: locale.translateMap(group.translations) ?? MISSING_VALUE, + value: locale.translateMap(group.translations)?.text ?? MISSING_VALUE, sentenceType: undefined, isMeta: false, }) @@ -84,7 +81,7 @@ const printPrerequisitesDisjunction = ( disjunction.list.length < 2 || disjunction.list .slice(1) - .every(part => part.tag === disjunction.list[0]!.tag) + .every(part => part.kind === disjunction.list[0]!.kind) ) { return { label: first.label, @@ -113,17 +110,17 @@ const printPrerequisitesElement = ( locale: LocaleEnvironment, element: PrerequisitesElement, ): PrerequisitePart | undefined => { - switch (element.tag) { + switch (element.kind) { case "Single": - return printPrerequisite(element.single) + return printPrerequisite(element.Single) case "Disjunction": return printPrerequisitesDisjunction( printPrerequisite, locale, - element.disjunction, + element.Disjunction, ) case "Group": - return printPrerequisiteGroup(locale, element.group) + return printPrerequisiteGroup(locale, element.Group) default: return assertExhaustive(element) } @@ -175,8 +172,8 @@ const printPrerequisitesForLevels = ( (_, i) => ({ level: i + 2, prerequisite: { - tag: "Single", - single: printPreviousLevelPrerequisites.createPreerequisite( + kind: "Single", + Single: printPreviousLevelPrerequisites.createPreerequisite( i + 2, ), }, @@ -202,12 +199,14 @@ const printPrerequisitesForLevels = ( ...(hasBasePrerequisites ? [] : [ - `${locale.translate("Level {0}:", romanize(1))} ${locale.translate( - "none", - )}`, + `${locale.translate("Level {$level}:", { + level: romanize(1), + })} ${locale.translate("none")}`, ]), ...sortedByLevel.map(([_, [levelNumber, prerequisites]]) => { - const level = locale.translate("Level {0}:", romanize(levelNumber)) + const level = locale.translate("Level {$level}:", { + level: romanize(levelNumber), + }) const prerequisitesString = joinPrerequisiteParts( locale, prerequisites @@ -241,17 +240,13 @@ export const printDerivedCharacteristicPrerequisites = ( * Print publication prerequisites as a string. */ export const printPublicationPrerequisites = ( - getPublicationById: GetById.Static.Publication, + getInstanceById: GetInstanceById<"Publication">, locale: LocaleEnvironment, value: PublicationPrerequisites, ): string => printPlainPrerequisites( prerequisite => - printPublicationPrerequisiteGroup( - getPublicationById, - locale, - prerequisite, - ), + printPublicationPrerequisiteGroup(getInstanceById, locale, prerequisite), locale, value, ) @@ -260,71 +255,73 @@ export const printPublicationPrerequisites = ( * Print plain general prerequisites as a string. */ export const printPlainGeneralPrerequisites = ( - getRaceById: GetById.Static.Race, - getCultureById: GetById.Static.Culture, - getPactCategoryById: GetById.Static.PactCategory, - getSocialStatusById: GetById.Static.SocialStatus, - getStateById: GetById.Static.State, - getAdvantageById: GetById.Static.Advantage, - getDisadvantageById: GetById.Static.Disadvantage, - getAdvancedCombatSpecialAbilityById: GetById.Static.AdvancedCombatSpecialAbility, - getAdvancedKarmaSpecialAbilityById: GetById.Static.AdvancedKarmaSpecialAbility, - getAdvancedMagicalSpecialAbilityById: GetById.Static.AdvancedMagicalSpecialAbility, - getAdvancedSkillSpecialAbilityById: GetById.Static.AdvancedSkillSpecialAbility, - getAncestorGlyphById: GetById.Static.AncestorGlyph, - getArcaneOrbEnchantmentById: GetById.Static.ArcaneOrbEnchantment, - getAttireEnchantmentById: GetById.Static.AttireEnchantment, - getBlessedTraditionById: GetById.Static.BlessedTradition, - getBowlEnchantmentById: GetById.Static.BowlEnchantment, - getBrawlingSpecialAbilityById: GetById.Static.BrawlingSpecialAbility, - getCauldronEnchantmentById: GetById.Static.CauldronEnchantment, - getCeremonialItemSpecialAbilityById: GetById.Static.CeremonialItemSpecialAbility, - getChronicleEnchantmentById: GetById.Static.ChronicleEnchantment, - getCombatSpecialAbilityById: GetById.Static.CombatSpecialAbility, - getCombatStyleSpecialAbilityById: GetById.Static.CombatStyleSpecialAbility, - getCommandSpecialAbilityById: GetById.Static.CommandSpecialAbility, - getDaggerRitualById: GetById.Static.DaggerRitual, - getFamiliarSpecialAbilityById: GetById.Static.FamiliarSpecialAbility, - getFatePointSexSpecialAbilityById: GetById.Static.FatePointSexSpecialAbility, - getFatePointSpecialAbilityById: GetById.Static.FatePointSpecialAbility, - getFoolsHatEnchantmentById: GetById.Static.FoolsHatEnchantment, - getGeneralSpecialAbilityById: GetById.Static.GeneralSpecialAbility, - getInstrumentEnchantmentById: GetById.Static.InstrumentEnchantment, - getKarmaSpecialAbilityById: GetById.Static.KarmaSpecialAbility, - getKrallenkettenzauberById: GetById.Static.Krallenkettenzauber, - getLiturgicalStyleSpecialAbilityById: GetById.Static.LiturgicalStyleSpecialAbility, - getLycantropicGiftById: GetById.Static.LycantropicGift, - getMagicalSignById: GetById.Static.MagicalSign, - getMagicalSpecialAbilityById: GetById.Static.MagicalSpecialAbility, - getMagicalTraditionById: GetById.Static.MagicalTradition, - getMagicStyleSpecialAbilityById: GetById.Static.MagicStyleSpecialAbility, - getOrbEnchantmentById: GetById.Static.OrbEnchantment, - getPactGiftById: GetById.Static.PactGift, - getProtectiveWardingCircleSpecialAbilityById: GetById.Static.ProtectiveWardingCircleSpecialAbility, - getRingEnchantmentById: GetById.Static.RingEnchantment, - getSermonById: GetById.Static.Sermon, - getSexSpecialAbilityById: GetById.Static.SexSpecialAbility, - getSickleRitualById: GetById.Static.SickleRitual, - getSikaryanDrainSpecialAbilityById: GetById.Static.SikaryanDrainSpecialAbility, - getSkillStyleSpecialAbilityById: GetById.Static.SkillStyleSpecialAbility, - getSpellSwordEnchantmentById: GetById.Static.SpellSwordEnchantment, - getStaffEnchantmentById: GetById.Static.StaffEnchantment, - getToyEnchantmentById: GetById.Static.ToyEnchantment, - getTrinkhornzauberById: GetById.Static.Trinkhornzauber, - getVampiricGiftById: GetById.Static.VampiricGift, - getVisionById: GetById.Static.Vision, - getWandEnchantmentById: GetById.Static.WandEnchantment, - getWeaponEnchantmentById: GetById.Static.WeaponEnchantment, - getAttributeById: GetById.Static.Attribute, - getSkillById: GetById.Static.Skill, - getCloseCombatTechniqueById: GetById.Static.CloseCombatTechnique, - getRangedCombatTechniqueById: GetById.Static.RangedCombatTechnique, - getSpellById: GetById.Static.Spell, - getRitualById: GetById.Static.Ritual, - getLiturgicalChantById: GetById.Static.LiturgicalChant, - getCeremonyById: GetById.Static.Ceremony, - getPropertyById: GetById.Static.Property, - getAspectById: GetById.Static.Aspect, + getInstanceById: GetInstanceById< + | "Race" + | "Culture" + | "PactCategory" + | "SocialStatus" + | "State" + | "Advantage" + | "Disadvantage" + | "AdvancedCombatSpecialAbility" + | "AdvancedKarmaSpecialAbility" + | "AdvancedMagicalSpecialAbility" + | "AdvancedSkillSpecialAbility" + | "AncestorGlyph" + | "ArcaneOrbEnchantment" + | "AttireEnchantment" + | "BlessedTradition" + | "BowlEnchantment" + | "BrawlingSpecialAbility" + | "CauldronEnchantment" + | "CeremonialItemSpecialAbility" + | "ChronicleEnchantment" + | "CombatSpecialAbility" + | "CombatStyleSpecialAbility" + | "CommandSpecialAbility" + | "DaggerRitual" + | "FamiliarSpecialAbility" + | "FatePointSexSpecialAbility" + | "FatePointSpecialAbility" + | "FoolsHatEnchantment" + | "GeneralSpecialAbility" + | "InstrumentEnchantment" + | "KarmaSpecialAbility" + | "Krallenkettenzauber" + | "LiturgicalStyleSpecialAbility" + | "LycantropicGift" + | "MagicalSign" + | "MagicalSpecialAbility" + | "MagicalTradition" + | "MagicStyleSpecialAbility" + | "OrbEnchantment" + | "PactGift" + | "ProtectiveWardingCircleSpecialAbility" + | "RingEnchantment" + | "Sermon" + | "SexSpecialAbility" + | "SickleRitual" + | "SikaryanDrainSpecialAbility" + | "SkillStyleSpecialAbility" + | "SpellSwordEnchantment" + | "StaffEnchantment" + | "ToyEnchantment" + | "Trinkhornzauber" + | "VampiricGift" + | "Vision" + | "WandEnchantment" + | "WeaponEnchantment" + | "Attribute" + | "Skill" + | "CloseCombatTechnique" + | "RangedCombatTechnique" + | "Spell" + | "Ritual" + | "LiturgicalChant" + | "Ceremony" + | "Property" + | "Aspect" + >, getResolvedSelectOptionById: GetResolvedSelectOptionById, locale: LocaleEnvironment, value: PlainGeneralPrerequisites, @@ -332,71 +329,7 @@ export const printPlainGeneralPrerequisites = ( printPlainPrerequisites( prerequisite => printGeneralPrerequisiteGroup( - getRaceById, - getCultureById, - getPactCategoryById, - getSocialStatusById, - getStateById, - getAdvantageById, - getDisadvantageById, - getAdvancedCombatSpecialAbilityById, - getAdvancedKarmaSpecialAbilityById, - getAdvancedMagicalSpecialAbilityById, - getAdvancedSkillSpecialAbilityById, - getAncestorGlyphById, - getArcaneOrbEnchantmentById, - getAttireEnchantmentById, - getBlessedTraditionById, - getBowlEnchantmentById, - getBrawlingSpecialAbilityById, - getCauldronEnchantmentById, - getCeremonialItemSpecialAbilityById, - getChronicleEnchantmentById, - getCombatSpecialAbilityById, - getCombatStyleSpecialAbilityById, - getCommandSpecialAbilityById, - getDaggerRitualById, - getFamiliarSpecialAbilityById, - getFatePointSexSpecialAbilityById, - getFatePointSpecialAbilityById, - getFoolsHatEnchantmentById, - getGeneralSpecialAbilityById, - getInstrumentEnchantmentById, - getKarmaSpecialAbilityById, - getKrallenkettenzauberById, - getLiturgicalStyleSpecialAbilityById, - getLycantropicGiftById, - getMagicalSignById, - getMagicalSpecialAbilityById, - getMagicalTraditionById, - getMagicStyleSpecialAbilityById, - getOrbEnchantmentById, - getPactGiftById, - getProtectiveWardingCircleSpecialAbilityById, - getRingEnchantmentById, - getSermonById, - getSexSpecialAbilityById, - getSickleRitualById, - getSikaryanDrainSpecialAbilityById, - getSkillStyleSpecialAbilityById, - getSpellSwordEnchantmentById, - getStaffEnchantmentById, - getToyEnchantmentById, - getTrinkhornzauberById, - getVampiricGiftById, - getVisionById, - getWandEnchantmentById, - getWeaponEnchantmentById, - getAttributeById, - getSkillById, - getCloseCombatTechniqueById, - getRangedCombatTechniqueById, - getSpellById, - getRitualById, - getLiturgicalChantById, - getCeremonyById, - getPropertyById, - getAspectById, + getInstanceById, getResolvedSelectOptionById, locale, prerequisite, @@ -409,71 +342,73 @@ export const printPlainGeneralPrerequisites = ( * Print general prerequisites as a string. */ export const printGeneralPrerequisites = ( - getRaceById: GetById.Static.Race, - getCultureById: GetById.Static.Culture, - getPactCategoryById: GetById.Static.PactCategory, - getSocialStatusById: GetById.Static.SocialStatus, - getStateById: GetById.Static.State, - getAdvantageById: GetById.Static.Advantage, - getDisadvantageById: GetById.Static.Disadvantage, - getAdvancedCombatSpecialAbilityById: GetById.Static.AdvancedCombatSpecialAbility, - getAdvancedKarmaSpecialAbilityById: GetById.Static.AdvancedKarmaSpecialAbility, - getAdvancedMagicalSpecialAbilityById: GetById.Static.AdvancedMagicalSpecialAbility, - getAdvancedSkillSpecialAbilityById: GetById.Static.AdvancedSkillSpecialAbility, - getAncestorGlyphById: GetById.Static.AncestorGlyph, - getArcaneOrbEnchantmentById: GetById.Static.ArcaneOrbEnchantment, - getAttireEnchantmentById: GetById.Static.AttireEnchantment, - getBlessedTraditionById: GetById.Static.BlessedTradition, - getBowlEnchantmentById: GetById.Static.BowlEnchantment, - getBrawlingSpecialAbilityById: GetById.Static.BrawlingSpecialAbility, - getCauldronEnchantmentById: GetById.Static.CauldronEnchantment, - getCeremonialItemSpecialAbilityById: GetById.Static.CeremonialItemSpecialAbility, - getChronicleEnchantmentById: GetById.Static.ChronicleEnchantment, - getCombatSpecialAbilityById: GetById.Static.CombatSpecialAbility, - getCombatStyleSpecialAbilityById: GetById.Static.CombatStyleSpecialAbility, - getCommandSpecialAbilityById: GetById.Static.CommandSpecialAbility, - getDaggerRitualById: GetById.Static.DaggerRitual, - getFamiliarSpecialAbilityById: GetById.Static.FamiliarSpecialAbility, - getFatePointSexSpecialAbilityById: GetById.Static.FatePointSexSpecialAbility, - getFatePointSpecialAbilityById: GetById.Static.FatePointSpecialAbility, - getFoolsHatEnchantmentById: GetById.Static.FoolsHatEnchantment, - getGeneralSpecialAbilityById: GetById.Static.GeneralSpecialAbility, - getInstrumentEnchantmentById: GetById.Static.InstrumentEnchantment, - getKarmaSpecialAbilityById: GetById.Static.KarmaSpecialAbility, - getKrallenkettenzauberById: GetById.Static.Krallenkettenzauber, - getLiturgicalStyleSpecialAbilityById: GetById.Static.LiturgicalStyleSpecialAbility, - getLycantropicGiftById: GetById.Static.LycantropicGift, - getMagicalSignById: GetById.Static.MagicalSign, - getMagicalSpecialAbilityById: GetById.Static.MagicalSpecialAbility, - getMagicalTraditionById: GetById.Static.MagicalTradition, - getMagicStyleSpecialAbilityById: GetById.Static.MagicStyleSpecialAbility, - getOrbEnchantmentById: GetById.Static.OrbEnchantment, - getPactGiftById: GetById.Static.PactGift, - getProtectiveWardingCircleSpecialAbilityById: GetById.Static.ProtectiveWardingCircleSpecialAbility, - getRingEnchantmentById: GetById.Static.RingEnchantment, - getSermonById: GetById.Static.Sermon, - getSexSpecialAbilityById: GetById.Static.SexSpecialAbility, - getSickleRitualById: GetById.Static.SickleRitual, - getSikaryanDrainSpecialAbilityById: GetById.Static.SikaryanDrainSpecialAbility, - getSkillStyleSpecialAbilityById: GetById.Static.SkillStyleSpecialAbility, - getSpellSwordEnchantmentById: GetById.Static.SpellSwordEnchantment, - getStaffEnchantmentById: GetById.Static.StaffEnchantment, - getToyEnchantmentById: GetById.Static.ToyEnchantment, - getTrinkhornzauberById: GetById.Static.Trinkhornzauber, - getVampiricGiftById: GetById.Static.VampiricGift, - getVisionById: GetById.Static.Vision, - getWandEnchantmentById: GetById.Static.WandEnchantment, - getWeaponEnchantmentById: GetById.Static.WeaponEnchantment, - getAttributeById: GetById.Static.Attribute, - getSkillById: GetById.Static.Skill, - getCloseCombatTechniqueById: GetById.Static.CloseCombatTechnique, - getRangedCombatTechniqueById: GetById.Static.RangedCombatTechnique, - getSpellById: GetById.Static.Spell, - getRitualById: GetById.Static.Ritual, - getLiturgicalChantById: GetById.Static.LiturgicalChant, - getCeremonyById: GetById.Static.Ceremony, - getPropertyById: GetById.Static.Property, - getAspectById: GetById.Static.Aspect, + getInstanceById: GetInstanceById< + | "Race" + | "Culture" + | "PactCategory" + | "SocialStatus" + | "State" + | "Advantage" + | "Disadvantage" + | "AdvancedCombatSpecialAbility" + | "AdvancedKarmaSpecialAbility" + | "AdvancedMagicalSpecialAbility" + | "AdvancedSkillSpecialAbility" + | "AncestorGlyph" + | "ArcaneOrbEnchantment" + | "AttireEnchantment" + | "BlessedTradition" + | "BowlEnchantment" + | "BrawlingSpecialAbility" + | "CauldronEnchantment" + | "CeremonialItemSpecialAbility" + | "ChronicleEnchantment" + | "CombatSpecialAbility" + | "CombatStyleSpecialAbility" + | "CommandSpecialAbility" + | "DaggerRitual" + | "FamiliarSpecialAbility" + | "FatePointSexSpecialAbility" + | "FatePointSpecialAbility" + | "FoolsHatEnchantment" + | "GeneralSpecialAbility" + | "InstrumentEnchantment" + | "KarmaSpecialAbility" + | "Krallenkettenzauber" + | "LiturgicalStyleSpecialAbility" + | "LycantropicGift" + | "MagicalSign" + | "MagicalSpecialAbility" + | "MagicalTradition" + | "MagicStyleSpecialAbility" + | "OrbEnchantment" + | "PactGift" + | "ProtectiveWardingCircleSpecialAbility" + | "RingEnchantment" + | "Sermon" + | "SexSpecialAbility" + | "SickleRitual" + | "SikaryanDrainSpecialAbility" + | "SkillStyleSpecialAbility" + | "SpellSwordEnchantment" + | "StaffEnchantment" + | "ToyEnchantment" + | "Trinkhornzauber" + | "VampiricGift" + | "Vision" + | "WandEnchantment" + | "WeaponEnchantment" + | "Attribute" + | "Skill" + | "CloseCombatTechnique" + | "RangedCombatTechnique" + | "Spell" + | "Ritual" + | "LiturgicalChant" + | "Ceremony" + | "Property" + | "Aspect" + >, getResolvedSelectOptionById: GetResolvedSelectOptionById, locale: LocaleEnvironment, value: GeneralPrerequisites, @@ -485,71 +420,7 @@ export const printGeneralPrerequisites = ( printPrerequisitesForLevels( prerequisite => printGeneralPrerequisiteGroup( - getRaceById, - getCultureById, - getPactCategoryById, - getSocialStatusById, - getStateById, - getAdvantageById, - getDisadvantageById, - getAdvancedCombatSpecialAbilityById, - getAdvancedKarmaSpecialAbilityById, - getAdvancedMagicalSpecialAbilityById, - getAdvancedSkillSpecialAbilityById, - getAncestorGlyphById, - getArcaneOrbEnchantmentById, - getAttireEnchantmentById, - getBlessedTraditionById, - getBowlEnchantmentById, - getBrawlingSpecialAbilityById, - getCauldronEnchantmentById, - getCeremonialItemSpecialAbilityById, - getChronicleEnchantmentById, - getCombatSpecialAbilityById, - getCombatStyleSpecialAbilityById, - getCommandSpecialAbilityById, - getDaggerRitualById, - getFamiliarSpecialAbilityById, - getFatePointSexSpecialAbilityById, - getFatePointSpecialAbilityById, - getFoolsHatEnchantmentById, - getGeneralSpecialAbilityById, - getInstrumentEnchantmentById, - getKarmaSpecialAbilityById, - getKrallenkettenzauberById, - getLiturgicalStyleSpecialAbilityById, - getLycantropicGiftById, - getMagicalSignById, - getMagicalSpecialAbilityById, - getMagicalTraditionById, - getMagicStyleSpecialAbilityById, - getOrbEnchantmentById, - getPactGiftById, - getProtectiveWardingCircleSpecialAbilityById, - getRingEnchantmentById, - getSermonById, - getSexSpecialAbilityById, - getSickleRitualById, - getSikaryanDrainSpecialAbilityById, - getSkillStyleSpecialAbilityById, - getSpellSwordEnchantmentById, - getStaffEnchantmentById, - getToyEnchantmentById, - getTrinkhornzauberById, - getVampiricGiftById, - getVisionById, - getWandEnchantmentById, - getWeaponEnchantmentById, - getAttributeById, - getSkillById, - getCloseCombatTechniqueById, - getRangedCombatTechniqueById, - getSpellById, - getRitualById, - getLiturgicalChantById, - getCeremonyById, - getPropertyById, - getAspectById, + getInstanceById, getResolvedSelectOptionById, locale, prerequisite, @@ -561,8 +432,8 @@ export const printGeneralPrerequisites = ( : { levels: printPreviousLevelPrerequisites.levels, createPreerequisite: (level): GeneralPrerequisiteGroup => ({ - tag: "Activatable", - activatable: { + kind: "Activatable", + Activatable: { id: printPreviousLevelPrerequisites.id, active: true, level, @@ -575,67 +446,69 @@ export const printGeneralPrerequisites = ( * Print profession prerequisites as a string. */ export const printProfessionPrerequisites = ( - getRaceById: GetById.Static.Race, - getCultureById: GetById.Static.Culture, - getAdvantageById: GetById.Static.Advantage, - getDisadvantageById: GetById.Static.Disadvantage, - getAdvancedCombatSpecialAbilityById: GetById.Static.AdvancedCombatSpecialAbility, - getAdvancedKarmaSpecialAbilityById: GetById.Static.AdvancedKarmaSpecialAbility, - getAdvancedMagicalSpecialAbilityById: GetById.Static.AdvancedMagicalSpecialAbility, - getAdvancedSkillSpecialAbilityById: GetById.Static.AdvancedSkillSpecialAbility, - getAncestorGlyphById: GetById.Static.AncestorGlyph, - getArcaneOrbEnchantmentById: GetById.Static.ArcaneOrbEnchantment, - getAttireEnchantmentById: GetById.Static.AttireEnchantment, - getBlessedTraditionById: GetById.Static.BlessedTradition, - getBowlEnchantmentById: GetById.Static.BowlEnchantment, - getBrawlingSpecialAbilityById: GetById.Static.BrawlingSpecialAbility, - getCauldronEnchantmentById: GetById.Static.CauldronEnchantment, - getCeremonialItemSpecialAbilityById: GetById.Static.CeremonialItemSpecialAbility, - getChronicleEnchantmentById: GetById.Static.ChronicleEnchantment, - getCombatSpecialAbilityById: GetById.Static.CombatSpecialAbility, - getCombatStyleSpecialAbilityById: GetById.Static.CombatStyleSpecialAbility, - getCommandSpecialAbilityById: GetById.Static.CommandSpecialAbility, - getDaggerRitualById: GetById.Static.DaggerRitual, - getFamiliarSpecialAbilityById: GetById.Static.FamiliarSpecialAbility, - getFatePointSexSpecialAbilityById: GetById.Static.FatePointSexSpecialAbility, - getFatePointSpecialAbilityById: GetById.Static.FatePointSpecialAbility, - getFoolsHatEnchantmentById: GetById.Static.FoolsHatEnchantment, - getGeneralSpecialAbilityById: GetById.Static.GeneralSpecialAbility, - getInstrumentEnchantmentById: GetById.Static.InstrumentEnchantment, - getKarmaSpecialAbilityById: GetById.Static.KarmaSpecialAbility, - getKrallenkettenzauberById: GetById.Static.Krallenkettenzauber, - getLiturgicalStyleSpecialAbilityById: GetById.Static.LiturgicalStyleSpecialAbility, - getLycantropicGiftById: GetById.Static.LycantropicGift, - getMagicalSignById: GetById.Static.MagicalSign, - getMagicalSpecialAbilityById: GetById.Static.MagicalSpecialAbility, - getMagicalTraditionById: GetById.Static.MagicalTradition, - getMagicStyleSpecialAbilityById: GetById.Static.MagicStyleSpecialAbility, - getOrbEnchantmentById: GetById.Static.OrbEnchantment, - getPactGiftById: GetById.Static.PactGift, - getProtectiveWardingCircleSpecialAbilityById: GetById.Static.ProtectiveWardingCircleSpecialAbility, - getRingEnchantmentById: GetById.Static.RingEnchantment, - getSermonById: GetById.Static.Sermon, - getSexSpecialAbilityById: GetById.Static.SexSpecialAbility, - getSickleRitualById: GetById.Static.SickleRitual, - getSikaryanDrainSpecialAbilityById: GetById.Static.SikaryanDrainSpecialAbility, - getSkillStyleSpecialAbilityById: GetById.Static.SkillStyleSpecialAbility, - getSpellSwordEnchantmentById: GetById.Static.SpellSwordEnchantment, - getStaffEnchantmentById: GetById.Static.StaffEnchantment, - getToyEnchantmentById: GetById.Static.ToyEnchantment, - getTrinkhornzauberById: GetById.Static.Trinkhornzauber, - getVampiricGiftById: GetById.Static.VampiricGift, - getVisionById: GetById.Static.Vision, - getWandEnchantmentById: GetById.Static.WandEnchantment, - getWeaponEnchantmentById: GetById.Static.WeaponEnchantment, - getAttributeById: GetById.Static.Attribute, - getSkillById: GetById.Static.Skill, - getCloseCombatTechniqueById: GetById.Static.CloseCombatTechnique, - getRangedCombatTechniqueById: GetById.Static.RangedCombatTechnique, - getSpellById: GetById.Static.Spell, - getRitualById: GetById.Static.Ritual, - getLiturgicalChantById: GetById.Static.LiturgicalChant, - getCeremonyById: GetById.Static.Ceremony, - getAspectById: GetById.Static.Aspect, + getInstanceById: GetInstanceById< + | "Race" + | "Culture" + | "Advantage" + | "Disadvantage" + | "AdvancedCombatSpecialAbility" + | "AdvancedKarmaSpecialAbility" + | "AdvancedMagicalSpecialAbility" + | "AdvancedSkillSpecialAbility" + | "AncestorGlyph" + | "ArcaneOrbEnchantment" + | "AttireEnchantment" + | "BlessedTradition" + | "BowlEnchantment" + | "BrawlingSpecialAbility" + | "CauldronEnchantment" + | "CeremonialItemSpecialAbility" + | "ChronicleEnchantment" + | "CombatSpecialAbility" + | "CombatStyleSpecialAbility" + | "CommandSpecialAbility" + | "DaggerRitual" + | "FamiliarSpecialAbility" + | "FatePointSexSpecialAbility" + | "FatePointSpecialAbility" + | "FoolsHatEnchantment" + | "GeneralSpecialAbility" + | "InstrumentEnchantment" + | "KarmaSpecialAbility" + | "Krallenkettenzauber" + | "LiturgicalStyleSpecialAbility" + | "LycantropicGift" + | "MagicalSign" + | "MagicalSpecialAbility" + | "MagicalTradition" + | "MagicStyleSpecialAbility" + | "OrbEnchantment" + | "PactGift" + | "ProtectiveWardingCircleSpecialAbility" + | "RingEnchantment" + | "Sermon" + | "SexSpecialAbility" + | "SickleRitual" + | "SikaryanDrainSpecialAbility" + | "SkillStyleSpecialAbility" + | "SpellSwordEnchantment" + | "StaffEnchantment" + | "ToyEnchantment" + | "Trinkhornzauber" + | "VampiricGift" + | "Vision" + | "WandEnchantment" + | "WeaponEnchantment" + | "Attribute" + | "Skill" + | "CloseCombatTechnique" + | "RangedCombatTechnique" + | "Spell" + | "Ritual" + | "LiturgicalChant" + | "Ceremony" + | "Aspect" + >, getResolvedSelectOptionById: GetResolvedSelectOptionById, locale: LocaleEnvironment, value: ProfessionPrerequisites, @@ -643,67 +516,7 @@ export const printProfessionPrerequisites = ( printPlainPrerequisites( prerequisite => printProfessionPrerequisiteGroup( - getRaceById, - getCultureById, - getAdvantageById, - getDisadvantageById, - getAdvancedCombatSpecialAbilityById, - getAdvancedKarmaSpecialAbilityById, - getAdvancedMagicalSpecialAbilityById, - getAdvancedSkillSpecialAbilityById, - getAncestorGlyphById, - getArcaneOrbEnchantmentById, - getAttireEnchantmentById, - getBlessedTraditionById, - getBowlEnchantmentById, - getBrawlingSpecialAbilityById, - getCauldronEnchantmentById, - getCeremonialItemSpecialAbilityById, - getChronicleEnchantmentById, - getCombatSpecialAbilityById, - getCombatStyleSpecialAbilityById, - getCommandSpecialAbilityById, - getDaggerRitualById, - getFamiliarSpecialAbilityById, - getFatePointSexSpecialAbilityById, - getFatePointSpecialAbilityById, - getFoolsHatEnchantmentById, - getGeneralSpecialAbilityById, - getInstrumentEnchantmentById, - getKarmaSpecialAbilityById, - getKrallenkettenzauberById, - getLiturgicalStyleSpecialAbilityById, - getLycantropicGiftById, - getMagicalSignById, - getMagicalSpecialAbilityById, - getMagicalTraditionById, - getMagicStyleSpecialAbilityById, - getOrbEnchantmentById, - getPactGiftById, - getProtectiveWardingCircleSpecialAbilityById, - getRingEnchantmentById, - getSermonById, - getSexSpecialAbilityById, - getSickleRitualById, - getSikaryanDrainSpecialAbilityById, - getSkillStyleSpecialAbilityById, - getSpellSwordEnchantmentById, - getStaffEnchantmentById, - getToyEnchantmentById, - getTrinkhornzauberById, - getVampiricGiftById, - getVisionById, - getWandEnchantmentById, - getWeaponEnchantmentById, - getAttributeById, - getSkillById, - getCloseCombatTechniqueById, - getRangedCombatTechniqueById, - getSpellById, - getRitualById, - getLiturgicalChantById, - getCeremonyById, - getAspectById, + getInstanceById, getResolvedSelectOptionById, locale, prerequisite, @@ -716,71 +529,73 @@ export const printProfessionPrerequisites = ( * Print advantage disadvantage prerequisites as a string. */ export const printAdvantageDisadvantagePrerequisites = ( - getRaceById: GetById.Static.Race, - getCultureById: GetById.Static.Culture, - getPactCategoryById: GetById.Static.PactCategory, - getSocialStatusById: GetById.Static.SocialStatus, - getStateById: GetById.Static.State, - getAdvantageById: GetById.Static.Advantage, - getDisadvantageById: GetById.Static.Disadvantage, - getAdvancedCombatSpecialAbilityById: GetById.Static.AdvancedCombatSpecialAbility, - getAdvancedKarmaSpecialAbilityById: GetById.Static.AdvancedKarmaSpecialAbility, - getAdvancedMagicalSpecialAbilityById: GetById.Static.AdvancedMagicalSpecialAbility, - getAdvancedSkillSpecialAbilityById: GetById.Static.AdvancedSkillSpecialAbility, - getAncestorGlyphById: GetById.Static.AncestorGlyph, - getArcaneOrbEnchantmentById: GetById.Static.ArcaneOrbEnchantment, - getAttireEnchantmentById: GetById.Static.AttireEnchantment, - getBlessedTraditionById: GetById.Static.BlessedTradition, - getBowlEnchantmentById: GetById.Static.BowlEnchantment, - getBrawlingSpecialAbilityById: GetById.Static.BrawlingSpecialAbility, - getCauldronEnchantmentById: GetById.Static.CauldronEnchantment, - getCeremonialItemSpecialAbilityById: GetById.Static.CeremonialItemSpecialAbility, - getChronicleEnchantmentById: GetById.Static.ChronicleEnchantment, - getCombatSpecialAbilityById: GetById.Static.CombatSpecialAbility, - getCombatStyleSpecialAbilityById: GetById.Static.CombatStyleSpecialAbility, - getCommandSpecialAbilityById: GetById.Static.CommandSpecialAbility, - getDaggerRitualById: GetById.Static.DaggerRitual, - getFamiliarSpecialAbilityById: GetById.Static.FamiliarSpecialAbility, - getFatePointSexSpecialAbilityById: GetById.Static.FatePointSexSpecialAbility, - getFatePointSpecialAbilityById: GetById.Static.FatePointSpecialAbility, - getFoolsHatEnchantmentById: GetById.Static.FoolsHatEnchantment, - getGeneralSpecialAbilityById: GetById.Static.GeneralSpecialAbility, - getInstrumentEnchantmentById: GetById.Static.InstrumentEnchantment, - getKarmaSpecialAbilityById: GetById.Static.KarmaSpecialAbility, - getKrallenkettenzauberById: GetById.Static.Krallenkettenzauber, - getLiturgicalStyleSpecialAbilityById: GetById.Static.LiturgicalStyleSpecialAbility, - getLycantropicGiftById: GetById.Static.LycantropicGift, - getMagicalSignById: GetById.Static.MagicalSign, - getMagicalSpecialAbilityById: GetById.Static.MagicalSpecialAbility, - getMagicalTraditionById: GetById.Static.MagicalTradition, - getMagicStyleSpecialAbilityById: GetById.Static.MagicStyleSpecialAbility, - getOrbEnchantmentById: GetById.Static.OrbEnchantment, - getPactGiftById: GetById.Static.PactGift, - getProtectiveWardingCircleSpecialAbilityById: GetById.Static.ProtectiveWardingCircleSpecialAbility, - getRingEnchantmentById: GetById.Static.RingEnchantment, - getSermonById: GetById.Static.Sermon, - getSexSpecialAbilityById: GetById.Static.SexSpecialAbility, - getSickleRitualById: GetById.Static.SickleRitual, - getSikaryanDrainSpecialAbilityById: GetById.Static.SikaryanDrainSpecialAbility, - getSkillStyleSpecialAbilityById: GetById.Static.SkillStyleSpecialAbility, - getSpellSwordEnchantmentById: GetById.Static.SpellSwordEnchantment, - getStaffEnchantmentById: GetById.Static.StaffEnchantment, - getToyEnchantmentById: GetById.Static.ToyEnchantment, - getTrinkhornzauberById: GetById.Static.Trinkhornzauber, - getVampiricGiftById: GetById.Static.VampiricGift, - getVisionById: GetById.Static.Vision, - getWandEnchantmentById: GetById.Static.WandEnchantment, - getWeaponEnchantmentById: GetById.Static.WeaponEnchantment, - getAttributeById: GetById.Static.Attribute, - getSkillById: GetById.Static.Skill, - getCloseCombatTechniqueById: GetById.Static.CloseCombatTechnique, - getRangedCombatTechniqueById: GetById.Static.RangedCombatTechnique, - getSpellById: GetById.Static.Spell, - getRitualById: GetById.Static.Ritual, - getLiturgicalChantById: GetById.Static.LiturgicalChant, - getCeremonyById: GetById.Static.Ceremony, - getPropertyById: GetById.Static.Property, - getAspectById: GetById.Static.Aspect, + getInstanceById: GetInstanceById< + | "Race" + | "Culture" + | "PactCategory" + | "SocialStatus" + | "State" + | "Advantage" + | "Disadvantage" + | "AdvancedCombatSpecialAbility" + | "AdvancedKarmaSpecialAbility" + | "AdvancedMagicalSpecialAbility" + | "AdvancedSkillSpecialAbility" + | "AncestorGlyph" + | "ArcaneOrbEnchantment" + | "AttireEnchantment" + | "BlessedTradition" + | "BowlEnchantment" + | "BrawlingSpecialAbility" + | "CauldronEnchantment" + | "CeremonialItemSpecialAbility" + | "ChronicleEnchantment" + | "CombatSpecialAbility" + | "CombatStyleSpecialAbility" + | "CommandSpecialAbility" + | "DaggerRitual" + | "FamiliarSpecialAbility" + | "FatePointSexSpecialAbility" + | "FatePointSpecialAbility" + | "FoolsHatEnchantment" + | "GeneralSpecialAbility" + | "InstrumentEnchantment" + | "KarmaSpecialAbility" + | "Krallenkettenzauber" + | "LiturgicalStyleSpecialAbility" + | "LycantropicGift" + | "MagicalSign" + | "MagicalSpecialAbility" + | "MagicalTradition" + | "MagicStyleSpecialAbility" + | "OrbEnchantment" + | "PactGift" + | "ProtectiveWardingCircleSpecialAbility" + | "RingEnchantment" + | "Sermon" + | "SexSpecialAbility" + | "SickleRitual" + | "SikaryanDrainSpecialAbility" + | "SkillStyleSpecialAbility" + | "SpellSwordEnchantment" + | "StaffEnchantment" + | "ToyEnchantment" + | "Trinkhornzauber" + | "VampiricGift" + | "Vision" + | "WandEnchantment" + | "WeaponEnchantment" + | "Attribute" + | "Skill" + | "CloseCombatTechnique" + | "RangedCombatTechnique" + | "Spell" + | "Ritual" + | "LiturgicalChant" + | "Ceremony" + | "Property" + | "Aspect" + >, getResolvedSelectOptionById: GetResolvedSelectOptionById, locale: LocaleEnvironment, value: AdvantageDisadvantagePrerequisites, @@ -790,71 +605,7 @@ export const printAdvantageDisadvantagePrerequisites = ( printPrerequisitesForLevels( prerequisite => printAdvantageDisadvantagePrerequisiteGroup( - getRaceById, - getCultureById, - getPactCategoryById, - getSocialStatusById, - getStateById, - getAdvantageById, - getDisadvantageById, - getAdvancedCombatSpecialAbilityById, - getAdvancedKarmaSpecialAbilityById, - getAdvancedMagicalSpecialAbilityById, - getAdvancedSkillSpecialAbilityById, - getAncestorGlyphById, - getArcaneOrbEnchantmentById, - getAttireEnchantmentById, - getBlessedTraditionById, - getBowlEnchantmentById, - getBrawlingSpecialAbilityById, - getCauldronEnchantmentById, - getCeremonialItemSpecialAbilityById, - getChronicleEnchantmentById, - getCombatSpecialAbilityById, - getCombatStyleSpecialAbilityById, - getCommandSpecialAbilityById, - getDaggerRitualById, - getFamiliarSpecialAbilityById, - getFatePointSexSpecialAbilityById, - getFatePointSpecialAbilityById, - getFoolsHatEnchantmentById, - getGeneralSpecialAbilityById, - getInstrumentEnchantmentById, - getKarmaSpecialAbilityById, - getKrallenkettenzauberById, - getLiturgicalStyleSpecialAbilityById, - getLycantropicGiftById, - getMagicalSignById, - getMagicalSpecialAbilityById, - getMagicalTraditionById, - getMagicStyleSpecialAbilityById, - getOrbEnchantmentById, - getPactGiftById, - getProtectiveWardingCircleSpecialAbilityById, - getRingEnchantmentById, - getSermonById, - getSexSpecialAbilityById, - getSickleRitualById, - getSikaryanDrainSpecialAbilityById, - getSkillStyleSpecialAbilityById, - getSpellSwordEnchantmentById, - getStaffEnchantmentById, - getToyEnchantmentById, - getTrinkhornzauberById, - getVampiricGiftById, - getVisionById, - getWandEnchantmentById, - getWeaponEnchantmentById, - getAttributeById, - getSkillById, - getCloseCombatTechniqueById, - getRangedCombatTechniqueById, - getSpellById, - getRitualById, - getLiturgicalChantById, - getCeremonyById, - getPropertyById, - getAspectById, + getInstanceById, getResolvedSelectOptionById, locale, prerequisite, @@ -869,14 +620,14 @@ export const printAdvantageDisadvantagePrerequisites = ( * Print arcane tradition prerequisites as a string. */ export const printArcaneTraditionPrerequisites = ( - getCultureById: GetById.Static.Culture, + getInstanceById: GetInstanceById<"Culture">, locale: LocaleEnvironment, value: ArcaneTraditionPrerequisites, ): string => printPlainPrerequisites( prerequisite => printArcaneTraditionPrerequisiteGroup( - getCultureById, + getInstanceById, locale, prerequisite, ), @@ -888,14 +639,14 @@ export const printArcaneTraditionPrerequisites = ( * Print personality trait prerequisites as a string. */ export const printPersonalityTraitPrerequisites = ( - getCultureById: GetById.Static.Culture, + getInstanceById: GetInstanceById<"Culture">, locale: LocaleEnvironment, value: PersonalityTraitPrerequisites, ): string => printPlainPrerequisites( prerequisite => printPersonalityTraitPrerequisiteGroup( - getCultureById, + getInstanceById, locale, prerequisite, ), @@ -907,31 +658,22 @@ export const printPersonalityTraitPrerequisites = ( * Print spellwork prerequisites as a string. */ export const printSpellworkPrerequisites = ( - getAttributeById: GetById.Static.Attribute, - getSkillById: GetById.Static.Skill, - getCloseCombatTechniqueById: GetById.Static.CloseCombatTechnique, - getRangedCombatTechniqueById: GetById.Static.RangedCombatTechnique, - getSpellById: GetById.Static.Spell, - getRitualById: GetById.Static.Ritual, - getLiturgicalChantById: GetById.Static.LiturgicalChant, - getCeremonyById: GetById.Static.Ceremony, + getInstanceById: GetInstanceById< + | "Attribute" + | "Skill" + | "CloseCombatTechnique" + | "RangedCombatTechnique" + | "Spell" + | "Ritual" + | "LiturgicalChant" + | "Ceremony" + >, locale: LocaleEnvironment, value: SpellworkPrerequisites, ): string => printPlainPrerequisites( prerequisite => - printSpellworkPrerequisiteGroup( - getAttributeById, - getSkillById, - getCloseCombatTechniqueById, - getRangedCombatTechniqueById, - getSpellById, - getRitualById, - getLiturgicalChantById, - getCeremonyById, - locale, - prerequisite, - ), + printSpellworkPrerequisiteGroup(getInstanceById, locale, prerequisite), locale, value, ) @@ -966,58 +708,60 @@ export const printInfluencePrerequisites = ( * Print language prerequisites as a string. */ export const printLanguagePrerequisites = ( - getRaceById: GetById.Static.Race, - getAdvantageById: GetById.Static.Advantage, - getDisadvantageById: GetById.Static.Disadvantage, - getAdvancedCombatSpecialAbilityById: GetById.Static.AdvancedCombatSpecialAbility, - getAdvancedKarmaSpecialAbilityById: GetById.Static.AdvancedKarmaSpecialAbility, - getAdvancedMagicalSpecialAbilityById: GetById.Static.AdvancedMagicalSpecialAbility, - getAdvancedSkillSpecialAbilityById: GetById.Static.AdvancedSkillSpecialAbility, - getAncestorGlyphById: GetById.Static.AncestorGlyph, - getArcaneOrbEnchantmentById: GetById.Static.ArcaneOrbEnchantment, - getAttireEnchantmentById: GetById.Static.AttireEnchantment, - getBlessedTraditionById: GetById.Static.BlessedTradition, - getBowlEnchantmentById: GetById.Static.BowlEnchantment, - getBrawlingSpecialAbilityById: GetById.Static.BrawlingSpecialAbility, - getCauldronEnchantmentById: GetById.Static.CauldronEnchantment, - getCeremonialItemSpecialAbilityById: GetById.Static.CeremonialItemSpecialAbility, - getChronicleEnchantmentById: GetById.Static.ChronicleEnchantment, - getCombatSpecialAbilityById: GetById.Static.CombatSpecialAbility, - getCombatStyleSpecialAbilityById: GetById.Static.CombatStyleSpecialAbility, - getCommandSpecialAbilityById: GetById.Static.CommandSpecialAbility, - getDaggerRitualById: GetById.Static.DaggerRitual, - getFamiliarSpecialAbilityById: GetById.Static.FamiliarSpecialAbility, - getFatePointSexSpecialAbilityById: GetById.Static.FatePointSexSpecialAbility, - getFatePointSpecialAbilityById: GetById.Static.FatePointSpecialAbility, - getFoolsHatEnchantmentById: GetById.Static.FoolsHatEnchantment, - getGeneralSpecialAbilityById: GetById.Static.GeneralSpecialAbility, - getInstrumentEnchantmentById: GetById.Static.InstrumentEnchantment, - getKarmaSpecialAbilityById: GetById.Static.KarmaSpecialAbility, - getKrallenkettenzauberById: GetById.Static.Krallenkettenzauber, - getLiturgicalStyleSpecialAbilityById: GetById.Static.LiturgicalStyleSpecialAbility, - getLycantropicGiftById: GetById.Static.LycantropicGift, - getMagicalSignById: GetById.Static.MagicalSign, - getMagicalSpecialAbilityById: GetById.Static.MagicalSpecialAbility, - getMagicalTraditionById: GetById.Static.MagicalTradition, - getMagicStyleSpecialAbilityById: GetById.Static.MagicStyleSpecialAbility, - getOrbEnchantmentById: GetById.Static.OrbEnchantment, - getPactGiftById: GetById.Static.PactGift, - getProtectiveWardingCircleSpecialAbilityById: GetById.Static.ProtectiveWardingCircleSpecialAbility, - getRingEnchantmentById: GetById.Static.RingEnchantment, - getSermonById: GetById.Static.Sermon, - getSexSpecialAbilityById: GetById.Static.SexSpecialAbility, - getSickleRitualById: GetById.Static.SickleRitual, - getSikaryanDrainSpecialAbilityById: GetById.Static.SikaryanDrainSpecialAbility, - getSkillStyleSpecialAbilityById: GetById.Static.SkillStyleSpecialAbility, - getSpellSwordEnchantmentById: GetById.Static.SpellSwordEnchantment, - getStaffEnchantmentById: GetById.Static.StaffEnchantment, - getToyEnchantmentById: GetById.Static.ToyEnchantment, - getTrinkhornzauberById: GetById.Static.Trinkhornzauber, - getVampiricGiftById: GetById.Static.VampiricGift, - getVisionById: GetById.Static.Vision, - getWandEnchantmentById: GetById.Static.WandEnchantment, - getWeaponEnchantmentById: GetById.Static.WeaponEnchantment, - getAspectById: GetById.Static.Aspect, + getInstanceById: GetInstanceById< + | "Race" + | "Advantage" + | "Disadvantage" + | "AdvancedCombatSpecialAbility" + | "AdvancedKarmaSpecialAbility" + | "AdvancedMagicalSpecialAbility" + | "AdvancedSkillSpecialAbility" + | "AncestorGlyph" + | "ArcaneOrbEnchantment" + | "AttireEnchantment" + | "BlessedTradition" + | "BowlEnchantment" + | "BrawlingSpecialAbility" + | "CauldronEnchantment" + | "CeremonialItemSpecialAbility" + | "ChronicleEnchantment" + | "CombatSpecialAbility" + | "CombatStyleSpecialAbility" + | "CommandSpecialAbility" + | "DaggerRitual" + | "FamiliarSpecialAbility" + | "FatePointSexSpecialAbility" + | "FatePointSpecialAbility" + | "FoolsHatEnchantment" + | "GeneralSpecialAbility" + | "InstrumentEnchantment" + | "KarmaSpecialAbility" + | "Krallenkettenzauber" + | "LiturgicalStyleSpecialAbility" + | "LycantropicGift" + | "MagicalSign" + | "MagicalSpecialAbility" + | "MagicalTradition" + | "MagicStyleSpecialAbility" + | "OrbEnchantment" + | "PactGift" + | "ProtectiveWardingCircleSpecialAbility" + | "RingEnchantment" + | "Sermon" + | "SexSpecialAbility" + | "SickleRitual" + | "SikaryanDrainSpecialAbility" + | "SkillStyleSpecialAbility" + | "SpellSwordEnchantment" + | "StaffEnchantment" + | "ToyEnchantment" + | "Trinkhornzauber" + | "VampiricGift" + | "Vision" + | "WandEnchantment" + | "WeaponEnchantment" + | "Aspect" + >, getResolvedSelectOptionById: GetResolvedSelectOptionById, locale: LocaleEnvironment, value: LanguagePrerequisites, @@ -1025,58 +769,7 @@ export const printLanguagePrerequisites = ( printPrerequisitesForLevels( prerequisite => printLanguagePrerequisiteGroup( - getRaceById, - getAdvantageById, - getDisadvantageById, - getAdvancedCombatSpecialAbilityById, - getAdvancedKarmaSpecialAbilityById, - getAdvancedMagicalSpecialAbilityById, - getAdvancedSkillSpecialAbilityById, - getAncestorGlyphById, - getArcaneOrbEnchantmentById, - getAttireEnchantmentById, - getBlessedTraditionById, - getBowlEnchantmentById, - getBrawlingSpecialAbilityById, - getCauldronEnchantmentById, - getCeremonialItemSpecialAbilityById, - getChronicleEnchantmentById, - getCombatSpecialAbilityById, - getCombatStyleSpecialAbilityById, - getCommandSpecialAbilityById, - getDaggerRitualById, - getFamiliarSpecialAbilityById, - getFatePointSexSpecialAbilityById, - getFatePointSpecialAbilityById, - getFoolsHatEnchantmentById, - getGeneralSpecialAbilityById, - getInstrumentEnchantmentById, - getKarmaSpecialAbilityById, - getKrallenkettenzauberById, - getLiturgicalStyleSpecialAbilityById, - getLycantropicGiftById, - getMagicalSignById, - getMagicalSpecialAbilityById, - getMagicalTraditionById, - getMagicStyleSpecialAbilityById, - getOrbEnchantmentById, - getPactGiftById, - getProtectiveWardingCircleSpecialAbilityById, - getRingEnchantmentById, - getSermonById, - getSexSpecialAbilityById, - getSickleRitualById, - getSikaryanDrainSpecialAbilityById, - getSkillStyleSpecialAbilityById, - getSpellSwordEnchantmentById, - getStaffEnchantmentById, - getToyEnchantmentById, - getTrinkhornzauberById, - getVampiricGiftById, - getVisionById, - getWandEnchantmentById, - getWeaponEnchantmentById, - getAspectById, + getInstanceById, getResolvedSelectOptionById, locale, prerequisite, @@ -1089,17 +782,13 @@ export const printLanguagePrerequisites = ( * Print animist power prerequisites as a string. */ export const printAnimistPowerPrerequisites = ( - getAnimistPowerById: GetById.Static.AnimistPower, + getInstanceById: GetInstanceById<"AnimistPower">, locale: LocaleEnvironment, value: AnimistPowerPrerequisites, ): string => printPlainPrerequisites( prerequisite => - printAnimistPowerPrerequisiteGroup( - getAnimistPowerById, - locale, - prerequisite, - ), + printAnimistPowerPrerequisiteGroup(getInstanceById, locale, prerequisite), locale, value, ) @@ -1121,25 +810,15 @@ export const printGeodeRitualPrerequisites = ( * Print enhancement prerequisites as a string. */ export const printEnhancementPrerequisites = ( - getSpellById: GetById.Static.Spell, - getRitualById: GetById.Static.Ritual, - getLiturgicalChantById: GetById.Static.LiturgicalChant, - getCeremonyById: GetById.Static.Ceremony, + getInstanceById: GetInstanceById< + "Spell" | "Ritual" | "LiturgicalChant" | "Ceremony" + >, locale: LocaleEnvironment, value: EnhancementPrerequisites, - parentId: SkillWithEnhancementsIdentifier, ): string => printPlainPrerequisites( prerequisite => - printEnhancementPrerequisiteGroup( - getSpellById, - getRitualById, - getLiturgicalChantById, - getCeremonyById, - locale, - prerequisite, - parentId, - ), + printEnhancementPrerequisiteGroup(getInstanceById, locale, prerequisite), locale, value, ) diff --git a/src/entities/partial/prerequisites/part.ts b/src/entities/partial/prerequisites/part.ts index dc14f1b..40d59dd 100644 --- a/src/entities/partial/prerequisites/part.ts +++ b/src/entities/partial/prerequisites/part.ts @@ -1,5 +1,5 @@ import { assertExhaustive } from "@optolith/helpers/typeSafety" -import { SentenceType } from "optolith-database-schema/types/prerequisites/single/TextPrerequisite" +import { SentenceType } from "optolith-database-schema/gen" import { LocaleEnvironment } from "../../../helpers/locale.js" /** @@ -28,7 +28,7 @@ export const joinPrerequisiteParts = ( return text } - switch (part.sentenceType) { + switch (part.sentenceType?.kind) { case "Standalone": return `${ /[.;]$/u.test(acc) ? `${acc.slice(0, -1)}. ` : `${acc}. ` diff --git a/src/entities/partial/prerequisites/prerequisiteGroups.ts b/src/entities/partial/prerequisites/prerequisiteGroups.ts index 82b2875..1ac98a4 100644 --- a/src/entities/partial/prerequisites/prerequisiteGroups.ts +++ b/src/entities/partial/prerequisites/prerequisiteGroups.ts @@ -1,5 +1,4 @@ import { assertExhaustive } from "@optolith/helpers/typeSafety" -import { SkillWithEnhancementsIdentifier } from "optolith-database-schema/types/_IdentifierGroup" import { AdvantageDisadvantagePrerequisiteGroup, AnimistPowerPrerequisiteGroup, @@ -16,8 +15,8 @@ import { ProfessionPrerequisiteGroup, PublicationPrerequisiteGroup, SpellworkPrerequisiteGroup, -} from "optolith-database-schema/types/prerequisites/PrerequisiteGroups" -import { GetById } from "../../../helpers/getTypes.js" +} from "optolith-database-schema/gen" +import type { GetInstanceById } from "../../../helpers/getTypes.js" import { LocaleEnvironment } from "../../../helpers/locale.js" import { PrerequisitePart } from "./part.js" import { @@ -28,14 +27,12 @@ import { printAnimistPowerPrerequisite } from "./single/animistPower.js" import { printBlessedTraditionPrerequisite } from "./single/blessedTradition.js" import { printCommonSuggestedByRCPPrerequisite } from "./single/commonSuggestedByRCP.js" import { printCulturePrerequisite } from "./single/culture.js" -import { - printExternalEnhancementPrerequisite, - printInternalEnhancementPrerequisite, -} from "./single/enhancement.js" +import { printEnhancementPrerequisite } from "./single/enhancement.js" import { printInfluencePrerequisite } from "./single/influence.js" import { printMagicalTraditionPrerequisite } from "./single/magicalTradition.js" import { printNoOtherAncestorBloodAdvantagePrerequisite } from "./single/noOtherAncestorBloodAdvantage.js" import { printPactPrerequisite } from "./single/pact.js" +import { printPersonalityTraitPrerequisite } from "./single/personalityTrait.js" import { printPrimaryAttributePrerequisite } from "./single/primaryAttribute.js" import { printPublicationPrerequisite } from "./single/publication.js" import { printRacePrerequisite } from "./single/race.js" @@ -61,13 +58,13 @@ export const printDerivedCharacteristicPrerequisiteGroup = ( // default: // return assertExhaustive(prerequisite) // } - printRulePrerequisite(locale, prerequisite.rule) + printRulePrerequisite(locale, prerequisite.Rule) /** * Print the translation of a publication prerequisite group. */ export const printPublicationPrerequisiteGroup = ( - getPublicationById: GetById.Static.Publication, + getInstanceById: GetInstanceById<"Publication">, locale: LocaleEnvironment, prerequisite: PublicationPrerequisiteGroup, ): PrerequisitePart | undefined => @@ -77,225 +74,157 @@ export const printPublicationPrerequisiteGroup = ( // return assertExhaustive(prerequisite) // } printPublicationPrerequisite( - getPublicationById, + getInstanceById, locale, - prerequisite.publication, + prerequisite.Publication, ) /** * Print the translation of a general prerequisite group. */ export const printGeneralPrerequisiteGroup = ( - getRaceById: GetById.Static.Race, - getCultureById: GetById.Static.Culture, - getPactCategoryById: GetById.Static.PactCategory, - getSocialStatusById: GetById.Static.SocialStatus, - getStateById: GetById.Static.State, - getAdvantageById: GetById.Static.Advantage, - getDisadvantageById: GetById.Static.Disadvantage, - getAdvancedCombatSpecialAbilityById: GetById.Static.AdvancedCombatSpecialAbility, - getAdvancedKarmaSpecialAbilityById: GetById.Static.AdvancedKarmaSpecialAbility, - getAdvancedMagicalSpecialAbilityById: GetById.Static.AdvancedMagicalSpecialAbility, - getAdvancedSkillSpecialAbilityById: GetById.Static.AdvancedSkillSpecialAbility, - getAncestorGlyphById: GetById.Static.AncestorGlyph, - getArcaneOrbEnchantmentById: GetById.Static.ArcaneOrbEnchantment, - getAttireEnchantmentById: GetById.Static.AttireEnchantment, - getBlessedTraditionById: GetById.Static.BlessedTradition, - getBowlEnchantmentById: GetById.Static.BowlEnchantment, - getBrawlingSpecialAbilityById: GetById.Static.BrawlingSpecialAbility, - getCauldronEnchantmentById: GetById.Static.CauldronEnchantment, - getCeremonialItemSpecialAbilityById: GetById.Static.CeremonialItemSpecialAbility, - getChronicleEnchantmentById: GetById.Static.ChronicleEnchantment, - getCombatSpecialAbilityById: GetById.Static.CombatSpecialAbility, - getCombatStyleSpecialAbilityById: GetById.Static.CombatStyleSpecialAbility, - getCommandSpecialAbilityById: GetById.Static.CommandSpecialAbility, - getDaggerRitualById: GetById.Static.DaggerRitual, - getFamiliarSpecialAbilityById: GetById.Static.FamiliarSpecialAbility, - getFatePointSexSpecialAbilityById: GetById.Static.FatePointSexSpecialAbility, - getFatePointSpecialAbilityById: GetById.Static.FatePointSpecialAbility, - getFoolsHatEnchantmentById: GetById.Static.FoolsHatEnchantment, - getGeneralSpecialAbilityById: GetById.Static.GeneralSpecialAbility, - getInstrumentEnchantmentById: GetById.Static.InstrumentEnchantment, - getKarmaSpecialAbilityById: GetById.Static.KarmaSpecialAbility, - getKrallenkettenzauberById: GetById.Static.Krallenkettenzauber, - getLiturgicalStyleSpecialAbilityById: GetById.Static.LiturgicalStyleSpecialAbility, - getLycantropicGiftById: GetById.Static.LycantropicGift, - getMagicalSignById: GetById.Static.MagicalSign, - getMagicalSpecialAbilityById: GetById.Static.MagicalSpecialAbility, - getMagicalTraditionById: GetById.Static.MagicalTradition, - getMagicStyleSpecialAbilityById: GetById.Static.MagicStyleSpecialAbility, - getOrbEnchantmentById: GetById.Static.OrbEnchantment, - getPactGiftById: GetById.Static.PactGift, - getProtectiveWardingCircleSpecialAbilityById: GetById.Static.ProtectiveWardingCircleSpecialAbility, - getRingEnchantmentById: GetById.Static.RingEnchantment, - getSermonById: GetById.Static.Sermon, - getSexSpecialAbilityById: GetById.Static.SexSpecialAbility, - getSickleRitualById: GetById.Static.SickleRitual, - getSikaryanDrainSpecialAbilityById: GetById.Static.SikaryanDrainSpecialAbility, - getSkillStyleSpecialAbilityById: GetById.Static.SkillStyleSpecialAbility, - getSpellSwordEnchantmentById: GetById.Static.SpellSwordEnchantment, - getStaffEnchantmentById: GetById.Static.StaffEnchantment, - getToyEnchantmentById: GetById.Static.ToyEnchantment, - getTrinkhornzauberById: GetById.Static.Trinkhornzauber, - getVampiricGiftById: GetById.Static.VampiricGift, - getVisionById: GetById.Static.Vision, - getWandEnchantmentById: GetById.Static.WandEnchantment, - getWeaponEnchantmentById: GetById.Static.WeaponEnchantment, - getAttributeById: GetById.Static.Attribute, - getSkillById: GetById.Static.Skill, - getCloseCombatTechniqueById: GetById.Static.CloseCombatTechnique, - getRangedCombatTechniqueById: GetById.Static.RangedCombatTechnique, - getSpellById: GetById.Static.Spell, - getRitualById: GetById.Static.Ritual, - getLiturgicalChantById: GetById.Static.LiturgicalChant, - getCeremonyById: GetById.Static.Ceremony, - getPropertyById: GetById.Static.Property, - getAspectById: GetById.Static.Aspect, + getInstanceById: GetInstanceById< + | "Race" + | "Culture" + | "PactCategory" + | "SocialStatus" + | "State" + | "Advantage" + | "Disadvantage" + | "AdvancedCombatSpecialAbility" + | "AdvancedKarmaSpecialAbility" + | "AdvancedMagicalSpecialAbility" + | "AdvancedSkillSpecialAbility" + | "AncestorGlyph" + | "ArcaneOrbEnchantment" + | "AttireEnchantment" + | "BlessedTradition" + | "BowlEnchantment" + | "BrawlingSpecialAbility" + | "CauldronEnchantment" + | "CeremonialItemSpecialAbility" + | "ChronicleEnchantment" + | "CombatSpecialAbility" + | "CombatStyleSpecialAbility" + | "CommandSpecialAbility" + | "DaggerRitual" + | "FamiliarSpecialAbility" + | "FatePointSexSpecialAbility" + | "FatePointSpecialAbility" + | "FoolsHatEnchantment" + | "GeneralSpecialAbility" + | "InstrumentEnchantment" + | "KarmaSpecialAbility" + | "Krallenkettenzauber" + | "LiturgicalStyleSpecialAbility" + | "LycantropicGift" + | "MagicalSign" + | "MagicalSpecialAbility" + | "MagicalTradition" + | "MagicStyleSpecialAbility" + | "OrbEnchantment" + | "PactGift" + | "ProtectiveWardingCircleSpecialAbility" + | "RingEnchantment" + | "Sermon" + | "SexSpecialAbility" + | "SickleRitual" + | "SikaryanDrainSpecialAbility" + | "SkillStyleSpecialAbility" + | "SpellSwordEnchantment" + | "StaffEnchantment" + | "ToyEnchantment" + | "Trinkhornzauber" + | "VampiricGift" + | "Vision" + | "WandEnchantment" + | "WeaponEnchantment" + | "Attribute" + | "Skill" + | "CloseCombatTechnique" + | "RangedCombatTechnique" + | "Spell" + | "Ritual" + | "LiturgicalChant" + | "Ceremony" + | "Property" + | "Aspect" + >, getResolvedSelectOptionById: GetResolvedSelectOptionById, locale: LocaleEnvironment, prerequisite: GeneralPrerequisiteGroup, ): PrerequisitePart | undefined => { - switch (prerequisite.tag) { + switch (prerequisite.kind) { case "Sex": - return printBinarySexPrerequisite(locale, prerequisite.sex) + return printBinarySexPrerequisite(locale, prerequisite.Sex) case "Race": - return printRacePrerequisite(getRaceById, locale, prerequisite.race) + return printRacePrerequisite(getInstanceById, locale, prerequisite.Race) case "Culture": return printCulturePrerequisite( - getCultureById, + getInstanceById, locale, - prerequisite.culture, + prerequisite.Culture, ) case "Pact": - return printPactPrerequisite( - getPactCategoryById, - locale, - prerequisite.pact, - ) + return printPactPrerequisite(getInstanceById, locale, prerequisite.Pact) case "SocialStatus": return printSocialStatusPrerequisite( - getSocialStatusById, + getInstanceById, locale, - prerequisite.social_status, + prerequisite.SocialStatus, ) case "State": - return printStatePrerequisite(getStateById, locale, prerequisite.state) + return printStatePrerequisite(getInstanceById, locale, prerequisite.State) case "Rule": - return printRulePrerequisite(locale, prerequisite.rule) + return printRulePrerequisite(locale, prerequisite.Rule) case "PrimaryAttribute": return printPrimaryAttributePrerequisite( locale, - prerequisite.primary_attribute, + prerequisite.PrimaryAttribute, ) case "Activatable": return printActivatablePrerequisite( - getAdvantageById, - getDisadvantageById, - getAdvancedCombatSpecialAbilityById, - getAdvancedKarmaSpecialAbilityById, - getAdvancedMagicalSpecialAbilityById, - getAdvancedSkillSpecialAbilityById, - getAncestorGlyphById, - getArcaneOrbEnchantmentById, - getAttireEnchantmentById, - getBlessedTraditionById, - getBowlEnchantmentById, - getBrawlingSpecialAbilityById, - getCauldronEnchantmentById, - getCeremonialItemSpecialAbilityById, - getChronicleEnchantmentById, - getCombatSpecialAbilityById, - getCombatStyleSpecialAbilityById, - getCommandSpecialAbilityById, - getDaggerRitualById, - getFamiliarSpecialAbilityById, - getFatePointSexSpecialAbilityById, - getFatePointSpecialAbilityById, - getFoolsHatEnchantmentById, - getGeneralSpecialAbilityById, - getInstrumentEnchantmentById, - getKarmaSpecialAbilityById, - getKrallenkettenzauberById, - getLiturgicalStyleSpecialAbilityById, - getLycantropicGiftById, - getMagicalSignById, - getMagicalSpecialAbilityById, - getMagicalTraditionById, - getMagicStyleSpecialAbilityById, - getOrbEnchantmentById, - getPactGiftById, - getProtectiveWardingCircleSpecialAbilityById, - getRingEnchantmentById, - getSermonById, - getSexSpecialAbilityById, - getSickleRitualById, - getSikaryanDrainSpecialAbilityById, - getSkillStyleSpecialAbilityById, - getSpellSwordEnchantmentById, - getStaffEnchantmentById, - getToyEnchantmentById, - getTrinkhornzauberById, - getVampiricGiftById, - getVisionById, - getWandEnchantmentById, - getWeaponEnchantmentById, - getAspectById, + getInstanceById, getResolvedSelectOptionById, locale, - prerequisite.activatable, + prerequisite.Activatable, ) case "BlessedTradition": return printBlessedTraditionPrerequisite( locale, - prerequisite.blessed_tradition, + prerequisite.BlessedTradition, ) case "MagicalTradition": return printMagicalTraditionPrerequisite( locale, - prerequisite.magical_tradition, + prerequisite.MagicalTradition, ) case "Rated": - return printRatedPrerequisite( - getAttributeById, - getSkillById, - getCloseCombatTechniqueById, - getRangedCombatTechniqueById, - getSpellById, - getRitualById, - getLiturgicalChantById, - getCeremonyById, - locale, - prerequisite.rated, - ) + return printRatedPrerequisite(getInstanceById, locale, prerequisite.Rated) case "RatedMinimumNumber": return printRatedMinimumNumberPrerequisite( - getSkillById, - getPropertyById, - getAspectById, + getInstanceById, locale, - prerequisite.rated_minimum_number, + prerequisite.RatedMinimumNumber, ) case "RatedSum": return printRatedSumPrerequisite( - getSkillById, + getInstanceById, locale, - prerequisite.rated_sum, + prerequisite.RatedSum, ) - case "ExternalEnhancement": - return printExternalEnhancementPrerequisite( - getSpellById, - getRitualById, - getLiturgicalChantById, - getCeremonyById, + case "Enhancement": + return printEnhancementPrerequisite( + getInstanceById, locale, - prerequisite.external_enhancement, + prerequisite.Enhancement, ) case "Text": - return printTextPrerequisite(locale, prerequisite.text) + return printTextPrerequisite(locale, prerequisite.Text) case "SexualCharacteristic": return printSexualCharacteristicPrerequisite( locale, - prerequisite.sexual_characteristic, + prerequisite.SexualCharacteristic, ) default: return assertExhaustive(prerequisite) @@ -306,152 +235,93 @@ export const printGeneralPrerequisiteGroup = ( * Print the translation of a profession prerequisite group. */ export const printProfessionPrerequisiteGroup = ( - getRaceById: GetById.Static.Race, - getCultureById: GetById.Static.Culture, - getAdvantageById: GetById.Static.Advantage, - getDisadvantageById: GetById.Static.Disadvantage, - getAdvancedCombatSpecialAbilityById: GetById.Static.AdvancedCombatSpecialAbility, - getAdvancedKarmaSpecialAbilityById: GetById.Static.AdvancedKarmaSpecialAbility, - getAdvancedMagicalSpecialAbilityById: GetById.Static.AdvancedMagicalSpecialAbility, - getAdvancedSkillSpecialAbilityById: GetById.Static.AdvancedSkillSpecialAbility, - getAncestorGlyphById: GetById.Static.AncestorGlyph, - getArcaneOrbEnchantmentById: GetById.Static.ArcaneOrbEnchantment, - getAttireEnchantmentById: GetById.Static.AttireEnchantment, - getBlessedTraditionById: GetById.Static.BlessedTradition, - getBowlEnchantmentById: GetById.Static.BowlEnchantment, - getBrawlingSpecialAbilityById: GetById.Static.BrawlingSpecialAbility, - getCauldronEnchantmentById: GetById.Static.CauldronEnchantment, - getCeremonialItemSpecialAbilityById: GetById.Static.CeremonialItemSpecialAbility, - getChronicleEnchantmentById: GetById.Static.ChronicleEnchantment, - getCombatSpecialAbilityById: GetById.Static.CombatSpecialAbility, - getCombatStyleSpecialAbilityById: GetById.Static.CombatStyleSpecialAbility, - getCommandSpecialAbilityById: GetById.Static.CommandSpecialAbility, - getDaggerRitualById: GetById.Static.DaggerRitual, - getFamiliarSpecialAbilityById: GetById.Static.FamiliarSpecialAbility, - getFatePointSexSpecialAbilityById: GetById.Static.FatePointSexSpecialAbility, - getFatePointSpecialAbilityById: GetById.Static.FatePointSpecialAbility, - getFoolsHatEnchantmentById: GetById.Static.FoolsHatEnchantment, - getGeneralSpecialAbilityById: GetById.Static.GeneralSpecialAbility, - getInstrumentEnchantmentById: GetById.Static.InstrumentEnchantment, - getKarmaSpecialAbilityById: GetById.Static.KarmaSpecialAbility, - getKrallenkettenzauberById: GetById.Static.Krallenkettenzauber, - getLiturgicalStyleSpecialAbilityById: GetById.Static.LiturgicalStyleSpecialAbility, - getLycantropicGiftById: GetById.Static.LycantropicGift, - getMagicalSignById: GetById.Static.MagicalSign, - getMagicalSpecialAbilityById: GetById.Static.MagicalSpecialAbility, - getMagicalTraditionById: GetById.Static.MagicalTradition, - getMagicStyleSpecialAbilityById: GetById.Static.MagicStyleSpecialAbility, - getOrbEnchantmentById: GetById.Static.OrbEnchantment, - getPactGiftById: GetById.Static.PactGift, - getProtectiveWardingCircleSpecialAbilityById: GetById.Static.ProtectiveWardingCircleSpecialAbility, - getRingEnchantmentById: GetById.Static.RingEnchantment, - getSermonById: GetById.Static.Sermon, - getSexSpecialAbilityById: GetById.Static.SexSpecialAbility, - getSickleRitualById: GetById.Static.SickleRitual, - getSikaryanDrainSpecialAbilityById: GetById.Static.SikaryanDrainSpecialAbility, - getSkillStyleSpecialAbilityById: GetById.Static.SkillStyleSpecialAbility, - getSpellSwordEnchantmentById: GetById.Static.SpellSwordEnchantment, - getStaffEnchantmentById: GetById.Static.StaffEnchantment, - getToyEnchantmentById: GetById.Static.ToyEnchantment, - getTrinkhornzauberById: GetById.Static.Trinkhornzauber, - getVampiricGiftById: GetById.Static.VampiricGift, - getVisionById: GetById.Static.Vision, - getWandEnchantmentById: GetById.Static.WandEnchantment, - getWeaponEnchantmentById: GetById.Static.WeaponEnchantment, - getAttributeById: GetById.Static.Attribute, - getSkillById: GetById.Static.Skill, - getCloseCombatTechniqueById: GetById.Static.CloseCombatTechnique, - getRangedCombatTechniqueById: GetById.Static.RangedCombatTechnique, - getSpellById: GetById.Static.Spell, - getRitualById: GetById.Static.Ritual, - getLiturgicalChantById: GetById.Static.LiturgicalChant, - getCeremonyById: GetById.Static.Ceremony, - getAspectById: GetById.Static.Aspect, + getInstanceById: GetInstanceById< + | "Race" + | "Culture" + | "Advantage" + | "Disadvantage" + | "AdvancedCombatSpecialAbility" + | "AdvancedKarmaSpecialAbility" + | "AdvancedMagicalSpecialAbility" + | "AdvancedSkillSpecialAbility" + | "AncestorGlyph" + | "ArcaneOrbEnchantment" + | "AttireEnchantment" + | "BlessedTradition" + | "BowlEnchantment" + | "BrawlingSpecialAbility" + | "CauldronEnchantment" + | "CeremonialItemSpecialAbility" + | "ChronicleEnchantment" + | "CombatSpecialAbility" + | "CombatStyleSpecialAbility" + | "CommandSpecialAbility" + | "DaggerRitual" + | "FamiliarSpecialAbility" + | "FatePointSexSpecialAbility" + | "FatePointSpecialAbility" + | "FoolsHatEnchantment" + | "GeneralSpecialAbility" + | "InstrumentEnchantment" + | "KarmaSpecialAbility" + | "Krallenkettenzauber" + | "LiturgicalStyleSpecialAbility" + | "LycantropicGift" + | "MagicalSign" + | "MagicalSpecialAbility" + | "MagicalTradition" + | "MagicStyleSpecialAbility" + | "OrbEnchantment" + | "PactGift" + | "ProtectiveWardingCircleSpecialAbility" + | "RingEnchantment" + | "Sermon" + | "SexSpecialAbility" + | "SickleRitual" + | "SikaryanDrainSpecialAbility" + | "SkillStyleSpecialAbility" + | "SpellSwordEnchantment" + | "StaffEnchantment" + | "ToyEnchantment" + | "Trinkhornzauber" + | "VampiricGift" + | "Vision" + | "WandEnchantment" + | "WeaponEnchantment" + | "Attribute" + | "Skill" + | "CloseCombatTechnique" + | "RangedCombatTechnique" + | "Spell" + | "Ritual" + | "LiturgicalChant" + | "Ceremony" + | "Aspect" + >, getResolvedSelectOptionById: GetResolvedSelectOptionById, locale: LocaleEnvironment, prerequisite: ProfessionPrerequisiteGroup, ): PrerequisitePart | undefined => { - switch (prerequisite.tag) { + switch (prerequisite.kind) { case "Sex": - return printBinarySexPrerequisite(locale, prerequisite.sex) + return printBinarySexPrerequisite(locale, prerequisite.Sex) case "Race": - return printRacePrerequisite(getRaceById, locale, prerequisite.race) + return printRacePrerequisite(getInstanceById, locale, prerequisite.Race) case "Culture": return printCulturePrerequisite( - getCultureById, + getInstanceById, locale, - prerequisite.culture, + prerequisite.Culture, ) case "Activatable": return printActivatablePrerequisite( - getAdvantageById, - getDisadvantageById, - getAdvancedCombatSpecialAbilityById, - getAdvancedKarmaSpecialAbilityById, - getAdvancedMagicalSpecialAbilityById, - getAdvancedSkillSpecialAbilityById, - getAncestorGlyphById, - getArcaneOrbEnchantmentById, - getAttireEnchantmentById, - getBlessedTraditionById, - getBowlEnchantmentById, - getBrawlingSpecialAbilityById, - getCauldronEnchantmentById, - getCeremonialItemSpecialAbilityById, - getChronicleEnchantmentById, - getCombatSpecialAbilityById, - getCombatStyleSpecialAbilityById, - getCommandSpecialAbilityById, - getDaggerRitualById, - getFamiliarSpecialAbilityById, - getFatePointSexSpecialAbilityById, - getFatePointSpecialAbilityById, - getFoolsHatEnchantmentById, - getGeneralSpecialAbilityById, - getInstrumentEnchantmentById, - getKarmaSpecialAbilityById, - getKrallenkettenzauberById, - getLiturgicalStyleSpecialAbilityById, - getLycantropicGiftById, - getMagicalSignById, - getMagicalSpecialAbilityById, - getMagicalTraditionById, - getMagicStyleSpecialAbilityById, - getOrbEnchantmentById, - getPactGiftById, - getProtectiveWardingCircleSpecialAbilityById, - getRingEnchantmentById, - getSermonById, - getSexSpecialAbilityById, - getSickleRitualById, - getSikaryanDrainSpecialAbilityById, - getSkillStyleSpecialAbilityById, - getSpellSwordEnchantmentById, - getStaffEnchantmentById, - getToyEnchantmentById, - getTrinkhornzauberById, - getVampiricGiftById, - getVisionById, - getWandEnchantmentById, - getWeaponEnchantmentById, - getAspectById, + getInstanceById, getResolvedSelectOptionById, locale, - prerequisite.activatable, + prerequisite.Activatable, ) case "Rated": - return printRatedPrerequisite( - getAttributeById, - getSkillById, - getCloseCombatTechniqueById, - getRangedCombatTechniqueById, - getSpellById, - getRitualById, - getLiturgicalChantById, - getCeremonyById, - locale, - prerequisite.rated, - ) + return printRatedPrerequisite(getInstanceById, locale, prerequisite.Rated) default: return assertExhaustive(prerequisite) } @@ -461,230 +331,154 @@ export const printProfessionPrerequisiteGroup = ( * Print the translation of an advantage/disadvantage prerequisite group. */ export const printAdvantageDisadvantagePrerequisiteGroup = ( - getRaceById: GetById.Static.Race, - getCultureById: GetById.Static.Culture, - getPactCategoryById: GetById.Static.PactCategory, - getSocialStatusById: GetById.Static.SocialStatus, - getStateById: GetById.Static.State, - getAdvantageById: GetById.Static.Advantage, - getDisadvantageById: GetById.Static.Disadvantage, - getAdvancedCombatSpecialAbilityById: GetById.Static.AdvancedCombatSpecialAbility, - getAdvancedKarmaSpecialAbilityById: GetById.Static.AdvancedKarmaSpecialAbility, - getAdvancedMagicalSpecialAbilityById: GetById.Static.AdvancedMagicalSpecialAbility, - getAdvancedSkillSpecialAbilityById: GetById.Static.AdvancedSkillSpecialAbility, - getAncestorGlyphById: GetById.Static.AncestorGlyph, - getArcaneOrbEnchantmentById: GetById.Static.ArcaneOrbEnchantment, - getAttireEnchantmentById: GetById.Static.AttireEnchantment, - getBlessedTraditionById: GetById.Static.BlessedTradition, - getBowlEnchantmentById: GetById.Static.BowlEnchantment, - getBrawlingSpecialAbilityById: GetById.Static.BrawlingSpecialAbility, - getCauldronEnchantmentById: GetById.Static.CauldronEnchantment, - getCeremonialItemSpecialAbilityById: GetById.Static.CeremonialItemSpecialAbility, - getChronicleEnchantmentById: GetById.Static.ChronicleEnchantment, - getCombatSpecialAbilityById: GetById.Static.CombatSpecialAbility, - getCombatStyleSpecialAbilityById: GetById.Static.CombatStyleSpecialAbility, - getCommandSpecialAbilityById: GetById.Static.CommandSpecialAbility, - getDaggerRitualById: GetById.Static.DaggerRitual, - getFamiliarSpecialAbilityById: GetById.Static.FamiliarSpecialAbility, - getFatePointSexSpecialAbilityById: GetById.Static.FatePointSexSpecialAbility, - getFatePointSpecialAbilityById: GetById.Static.FatePointSpecialAbility, - getFoolsHatEnchantmentById: GetById.Static.FoolsHatEnchantment, - getGeneralSpecialAbilityById: GetById.Static.GeneralSpecialAbility, - getInstrumentEnchantmentById: GetById.Static.InstrumentEnchantment, - getKarmaSpecialAbilityById: GetById.Static.KarmaSpecialAbility, - getKrallenkettenzauberById: GetById.Static.Krallenkettenzauber, - getLiturgicalStyleSpecialAbilityById: GetById.Static.LiturgicalStyleSpecialAbility, - getLycantropicGiftById: GetById.Static.LycantropicGift, - getMagicalSignById: GetById.Static.MagicalSign, - getMagicalSpecialAbilityById: GetById.Static.MagicalSpecialAbility, - getMagicalTraditionById: GetById.Static.MagicalTradition, - getMagicStyleSpecialAbilityById: GetById.Static.MagicStyleSpecialAbility, - getOrbEnchantmentById: GetById.Static.OrbEnchantment, - getPactGiftById: GetById.Static.PactGift, - getProtectiveWardingCircleSpecialAbilityById: GetById.Static.ProtectiveWardingCircleSpecialAbility, - getRingEnchantmentById: GetById.Static.RingEnchantment, - getSermonById: GetById.Static.Sermon, - getSexSpecialAbilityById: GetById.Static.SexSpecialAbility, - getSickleRitualById: GetById.Static.SickleRitual, - getSikaryanDrainSpecialAbilityById: GetById.Static.SikaryanDrainSpecialAbility, - getSkillStyleSpecialAbilityById: GetById.Static.SkillStyleSpecialAbility, - getSpellSwordEnchantmentById: GetById.Static.SpellSwordEnchantment, - getStaffEnchantmentById: GetById.Static.StaffEnchantment, - getToyEnchantmentById: GetById.Static.ToyEnchantment, - getTrinkhornzauberById: GetById.Static.Trinkhornzauber, - getVampiricGiftById: GetById.Static.VampiricGift, - getVisionById: GetById.Static.Vision, - getWandEnchantmentById: GetById.Static.WandEnchantment, - getWeaponEnchantmentById: GetById.Static.WeaponEnchantment, - getAttributeById: GetById.Static.Attribute, - getSkillById: GetById.Static.Skill, - getCloseCombatTechniqueById: GetById.Static.CloseCombatTechnique, - getRangedCombatTechniqueById: GetById.Static.RangedCombatTechnique, - getSpellById: GetById.Static.Spell, - getRitualById: GetById.Static.Ritual, - getLiturgicalChantById: GetById.Static.LiturgicalChant, - getCeremonyById: GetById.Static.Ceremony, - getPropertyById: GetById.Static.Property, - getAspectById: GetById.Static.Aspect, + getInstanceById: GetInstanceById< + | "Race" + | "Culture" + | "PactCategory" + | "SocialStatus" + | "State" + | "Advantage" + | "Disadvantage" + | "AdvancedCombatSpecialAbility" + | "AdvancedKarmaSpecialAbility" + | "AdvancedMagicalSpecialAbility" + | "AdvancedSkillSpecialAbility" + | "AncestorGlyph" + | "ArcaneOrbEnchantment" + | "AttireEnchantment" + | "BlessedTradition" + | "BowlEnchantment" + | "BrawlingSpecialAbility" + | "CauldronEnchantment" + | "CeremonialItemSpecialAbility" + | "ChronicleEnchantment" + | "CombatSpecialAbility" + | "CombatStyleSpecialAbility" + | "CommandSpecialAbility" + | "DaggerRitual" + | "FamiliarSpecialAbility" + | "FatePointSexSpecialAbility" + | "FatePointSpecialAbility" + | "FoolsHatEnchantment" + | "GeneralSpecialAbility" + | "InstrumentEnchantment" + | "KarmaSpecialAbility" + | "Krallenkettenzauber" + | "LiturgicalStyleSpecialAbility" + | "LycantropicGift" + | "MagicalSign" + | "MagicalSpecialAbility" + | "MagicalTradition" + | "MagicStyleSpecialAbility" + | "OrbEnchantment" + | "PactGift" + | "ProtectiveWardingCircleSpecialAbility" + | "RingEnchantment" + | "Sermon" + | "SexSpecialAbility" + | "SickleRitual" + | "SikaryanDrainSpecialAbility" + | "SkillStyleSpecialAbility" + | "SpellSwordEnchantment" + | "StaffEnchantment" + | "ToyEnchantment" + | "Trinkhornzauber" + | "VampiricGift" + | "Vision" + | "WandEnchantment" + | "WeaponEnchantment" + | "Attribute" + | "Skill" + | "CloseCombatTechnique" + | "RangedCombatTechnique" + | "Spell" + | "Ritual" + | "LiturgicalChant" + | "Ceremony" + | "Property" + | "Aspect" + >, getResolvedSelectOptionById: GetResolvedSelectOptionById, locale: LocaleEnvironment, prerequisite: AdvantageDisadvantagePrerequisiteGroup, name: string, type: "advantage" | "disadvantage", ): PrerequisitePart | undefined => { - switch (prerequisite.tag) { + switch (prerequisite.kind) { case "CommonSuggestedByRCP": - return printCommonSuggestedByRCPPrerequisite( - locale, - prerequisite.common_suggested_by_rcp, - name, - type, - ) + return printCommonSuggestedByRCPPrerequisite(locale, name, type) case "Sex": - return printBinarySexPrerequisite(locale, prerequisite.sex) + return printBinarySexPrerequisite(locale, prerequisite.Sex) case "Race": - return printRacePrerequisite(getRaceById, locale, prerequisite.race) + return printRacePrerequisite(getInstanceById, locale, prerequisite.Race) case "Culture": return printCulturePrerequisite( - getCultureById, + getInstanceById, locale, - prerequisite.culture, + prerequisite.Culture, ) case "Pact": - return printPactPrerequisite( - getPactCategoryById, - locale, - prerequisite.pact, - ) + return printPactPrerequisite(getInstanceById, locale, prerequisite.Pact) case "SocialStatus": return printSocialStatusPrerequisite( - getSocialStatusById, + getInstanceById, locale, - prerequisite.social_status, + prerequisite.SocialStatus, ) case "State": - return printStatePrerequisite(getStateById, locale, prerequisite.state) + return printStatePrerequisite(getInstanceById, locale, prerequisite.State) case "Rule": - return printRulePrerequisite(locale, prerequisite.rule) + return printRulePrerequisite(locale, prerequisite.Rule) case "PrimaryAttribute": return printPrimaryAttributePrerequisite( locale, - prerequisite.primary_attribute, + prerequisite.PrimaryAttribute, ) case "Activatable": return printActivatablePrerequisite( - getAdvantageById, - getDisadvantageById, - getAdvancedCombatSpecialAbilityById, - getAdvancedKarmaSpecialAbilityById, - getAdvancedMagicalSpecialAbilityById, - getAdvancedSkillSpecialAbilityById, - getAncestorGlyphById, - getArcaneOrbEnchantmentById, - getAttireEnchantmentById, - getBlessedTraditionById, - getBowlEnchantmentById, - getBrawlingSpecialAbilityById, - getCauldronEnchantmentById, - getCeremonialItemSpecialAbilityById, - getChronicleEnchantmentById, - getCombatSpecialAbilityById, - getCombatStyleSpecialAbilityById, - getCommandSpecialAbilityById, - getDaggerRitualById, - getFamiliarSpecialAbilityById, - getFatePointSexSpecialAbilityById, - getFatePointSpecialAbilityById, - getFoolsHatEnchantmentById, - getGeneralSpecialAbilityById, - getInstrumentEnchantmentById, - getKarmaSpecialAbilityById, - getKrallenkettenzauberById, - getLiturgicalStyleSpecialAbilityById, - getLycantropicGiftById, - getMagicalSignById, - getMagicalSpecialAbilityById, - getMagicalTraditionById, - getMagicStyleSpecialAbilityById, - getOrbEnchantmentById, - getPactGiftById, - getProtectiveWardingCircleSpecialAbilityById, - getRingEnchantmentById, - getSermonById, - getSexSpecialAbilityById, - getSickleRitualById, - getSikaryanDrainSpecialAbilityById, - getSkillStyleSpecialAbilityById, - getSpellSwordEnchantmentById, - getStaffEnchantmentById, - getToyEnchantmentById, - getTrinkhornzauberById, - getVampiricGiftById, - getVisionById, - getWandEnchantmentById, - getWeaponEnchantmentById, - getAspectById, + getInstanceById, getResolvedSelectOptionById, locale, - prerequisite.activatable, + prerequisite.Activatable, ) case "BlessedTradition": return printBlessedTraditionPrerequisite( locale, - prerequisite.blessed_tradition, + prerequisite.BlessedTradition, ) case "MagicalTradition": return printMagicalTraditionPrerequisite( locale, - prerequisite.magical_tradition, + prerequisite.MagicalTradition, ) case "Rated": - return printRatedPrerequisite( - getAttributeById, - getSkillById, - getCloseCombatTechniqueById, - getRangedCombatTechniqueById, - getSpellById, - getRitualById, - getLiturgicalChantById, - getCeremonyById, - locale, - prerequisite.rated, - ) + return printRatedPrerequisite(getInstanceById, locale, prerequisite.Rated) case "RatedMinimumNumber": return printRatedMinimumNumberPrerequisite( - getSkillById, - getPropertyById, - getAspectById, + getInstanceById, locale, - prerequisite.rated_minimum_number, + prerequisite.RatedMinimumNumber, ) case "RatedSum": return printRatedSumPrerequisite( - getSkillById, + getInstanceById, locale, - prerequisite.rated_sum, + prerequisite.RatedSum, ) - case "ExternalEnhancement": - return printExternalEnhancementPrerequisite( - getSpellById, - getRitualById, - getLiturgicalChantById, - getCeremonyById, + case "Enhancement": + return printEnhancementPrerequisite( + getInstanceById, locale, - prerequisite.external_enhancement, + prerequisite.Enhancement, ) case "Text": - return printTextPrerequisite(locale, prerequisite.text) + return printTextPrerequisite(locale, prerequisite.Text) case "NoOtherAncestorBloodAdvantage": - return printNoOtherAncestorBloodAdvantagePrerequisite( - locale, - prerequisite.no_other_ancestor_blood_advantage, - ) + return printNoOtherAncestorBloodAdvantagePrerequisite(locale) case "SexualCharacteristic": return printSexualCharacteristicPrerequisite( locale, - prerequisite.sexual_characteristic, + prerequisite.SexualCharacteristic, ) default: return assertExhaustive(prerequisite) @@ -695,18 +489,18 @@ export const printAdvantageDisadvantagePrerequisiteGroup = ( * Print the translation of an arcane tradition prerequisite group. */ export const printArcaneTraditionPrerequisiteGroup = ( - getCultureById: GetById.Static.Culture, + getInstanceById: GetInstanceById<"Culture">, locale: LocaleEnvironment, prerequisite: ArcaneTraditionPrerequisiteGroup, ): PrerequisitePart | undefined => { - switch (prerequisite.tag) { + switch (prerequisite.kind) { case "Sex": - return printBinarySexPrerequisite(locale, prerequisite.sex) + return printBinarySexPrerequisite(locale, prerequisite.Sex) case "Culture": return printCulturePrerequisite( - getCultureById, + getInstanceById, locale, - prerequisite.culture, + prerequisite.Culture, ) default: return assertExhaustive(prerequisite) @@ -717,19 +511,27 @@ export const printArcaneTraditionPrerequisiteGroup = ( * Print the translation of a personality trait prerequisite group. */ export const printPersonalityTraitPrerequisiteGroup = ( - getCultureById: GetById.Static.Culture, + getInstanceById: GetInstanceById<"Race" | "Culture" | "PersonalityTrait">, locale: LocaleEnvironment, prerequisite: PersonalityTraitPrerequisiteGroup, ): PrerequisitePart | undefined => { - switch (prerequisite.tag) { + switch (prerequisite.kind) { + case "Race": + return printRacePrerequisite(getInstanceById, locale, prerequisite.Race) case "Culture": return printCulturePrerequisite( - getCultureById, + getInstanceById, locale, - prerequisite.culture, + prerequisite.Culture, + ) + case "PersonalityTrait": + return printPersonalityTraitPrerequisite( + getInstanceById, + locale, + prerequisite.PersonalityTrait, ) case "Text": - return printTextPrerequisite(locale, prerequisite.text) + return printTextPrerequisite(locale, prerequisite.Text) default: return assertExhaustive(prerequisite) } @@ -739,33 +541,24 @@ export const printPersonalityTraitPrerequisiteGroup = ( * Print the translation of a spellwork prerequisite group. */ export const printSpellworkPrerequisiteGroup = ( - getAttributeById: GetById.Static.Attribute, - getSkillById: GetById.Static.Skill, - getCloseCombatTechniqueById: GetById.Static.CloseCombatTechnique, - getRangedCombatTechniqueById: GetById.Static.RangedCombatTechnique, - getSpellById: GetById.Static.Spell, - getRitualById: GetById.Static.Ritual, - getLiturgicalChantById: GetById.Static.LiturgicalChant, - getCeremonyById: GetById.Static.Ceremony, + getInstanceById: GetInstanceById< + | "Attribute" + | "Skill" + | "CloseCombatTechnique" + | "RangedCombatTechnique" + | "Spell" + | "Ritual" + | "LiturgicalChant" + | "Ceremony" + >, locale: LocaleEnvironment, prerequisite: SpellworkPrerequisiteGroup, ): PrerequisitePart | undefined => { - switch (prerequisite.tag) { + switch (prerequisite.kind) { case "Rule": - return printRulePrerequisite(locale, prerequisite.rule) + return printRulePrerequisite(locale, prerequisite.Rule) case "Rated": - return printRatedPrerequisite( - getAttributeById, - getSkillById, - getCloseCombatTechniqueById, - getRangedCombatTechniqueById, - getSpellById, - getRitualById, - getLiturgicalChantById, - getCeremonyById, - locale, - prerequisite.rated, - ) + return printRatedPrerequisite(getInstanceById, locale, prerequisite.Rated) default: return assertExhaustive(prerequisite) } @@ -783,7 +576,7 @@ export const printLiturgyPrerequisiteGroup = ( // default: // return assertExhaustive(prerequisite) // } - printRulePrerequisite(locale, prerequisite.rule) + printRulePrerequisite(locale, prerequisite.Rule) /** * Print the translation of an influence prerequisite group. @@ -792,11 +585,11 @@ export const printInfluencePrerequisiteGroup = ( locale: LocaleEnvironment, prerequisite: InfluencePrerequisiteGroup, ): PrerequisitePart | undefined => { - switch (prerequisite.tag) { + switch (prerequisite.kind) { case "Influence": - return printInfluencePrerequisite(locale, prerequisite.influence) + return printInfluencePrerequisite(locale, prerequisite.Influence) case "Text": - return printTextPrerequisite(locale, prerequisite.text) + return printTextPrerequisite(locale, prerequisite.Text) default: return assertExhaustive(prerequisite) } @@ -806,124 +599,76 @@ export const printInfluencePrerequisiteGroup = ( * Print the translation of a language prerequisite group. */ export const printLanguagePrerequisiteGroup = ( - getRaceById: GetById.Static.Race, - getAdvantageById: GetById.Static.Advantage, - getDisadvantageById: GetById.Static.Disadvantage, - getAdvancedCombatSpecialAbilityById: GetById.Static.AdvancedCombatSpecialAbility, - getAdvancedKarmaSpecialAbilityById: GetById.Static.AdvancedKarmaSpecialAbility, - getAdvancedMagicalSpecialAbilityById: GetById.Static.AdvancedMagicalSpecialAbility, - getAdvancedSkillSpecialAbilityById: GetById.Static.AdvancedSkillSpecialAbility, - getAncestorGlyphById: GetById.Static.AncestorGlyph, - getArcaneOrbEnchantmentById: GetById.Static.ArcaneOrbEnchantment, - getAttireEnchantmentById: GetById.Static.AttireEnchantment, - getBlessedTraditionById: GetById.Static.BlessedTradition, - getBowlEnchantmentById: GetById.Static.BowlEnchantment, - getBrawlingSpecialAbilityById: GetById.Static.BrawlingSpecialAbility, - getCauldronEnchantmentById: GetById.Static.CauldronEnchantment, - getCeremonialItemSpecialAbilityById: GetById.Static.CeremonialItemSpecialAbility, - getChronicleEnchantmentById: GetById.Static.ChronicleEnchantment, - getCombatSpecialAbilityById: GetById.Static.CombatSpecialAbility, - getCombatStyleSpecialAbilityById: GetById.Static.CombatStyleSpecialAbility, - getCommandSpecialAbilityById: GetById.Static.CommandSpecialAbility, - getDaggerRitualById: GetById.Static.DaggerRitual, - getFamiliarSpecialAbilityById: GetById.Static.FamiliarSpecialAbility, - getFatePointSexSpecialAbilityById: GetById.Static.FatePointSexSpecialAbility, - getFatePointSpecialAbilityById: GetById.Static.FatePointSpecialAbility, - getFoolsHatEnchantmentById: GetById.Static.FoolsHatEnchantment, - getGeneralSpecialAbilityById: GetById.Static.GeneralSpecialAbility, - getInstrumentEnchantmentById: GetById.Static.InstrumentEnchantment, - getKarmaSpecialAbilityById: GetById.Static.KarmaSpecialAbility, - getKrallenkettenzauberById: GetById.Static.Krallenkettenzauber, - getLiturgicalStyleSpecialAbilityById: GetById.Static.LiturgicalStyleSpecialAbility, - getLycantropicGiftById: GetById.Static.LycantropicGift, - getMagicalSignById: GetById.Static.MagicalSign, - getMagicalSpecialAbilityById: GetById.Static.MagicalSpecialAbility, - getMagicalTraditionById: GetById.Static.MagicalTradition, - getMagicStyleSpecialAbilityById: GetById.Static.MagicStyleSpecialAbility, - getOrbEnchantmentById: GetById.Static.OrbEnchantment, - getPactGiftById: GetById.Static.PactGift, - getProtectiveWardingCircleSpecialAbilityById: GetById.Static.ProtectiveWardingCircleSpecialAbility, - getRingEnchantmentById: GetById.Static.RingEnchantment, - getSermonById: GetById.Static.Sermon, - getSexSpecialAbilityById: GetById.Static.SexSpecialAbility, - getSickleRitualById: GetById.Static.SickleRitual, - getSikaryanDrainSpecialAbilityById: GetById.Static.SikaryanDrainSpecialAbility, - getSkillStyleSpecialAbilityById: GetById.Static.SkillStyleSpecialAbility, - getSpellSwordEnchantmentById: GetById.Static.SpellSwordEnchantment, - getStaffEnchantmentById: GetById.Static.StaffEnchantment, - getToyEnchantmentById: GetById.Static.ToyEnchantment, - getTrinkhornzauberById: GetById.Static.Trinkhornzauber, - getVampiricGiftById: GetById.Static.VampiricGift, - getVisionById: GetById.Static.Vision, - getWandEnchantmentById: GetById.Static.WandEnchantment, - getWeaponEnchantmentById: GetById.Static.WeaponEnchantment, - getAspectById: GetById.Static.Aspect, + getInstanceById: GetInstanceById< + | "Race" + | "Advantage" + | "Disadvantage" + | "AdvancedCombatSpecialAbility" + | "AdvancedKarmaSpecialAbility" + | "AdvancedMagicalSpecialAbility" + | "AdvancedSkillSpecialAbility" + | "AncestorGlyph" + | "ArcaneOrbEnchantment" + | "AttireEnchantment" + | "BlessedTradition" + | "BowlEnchantment" + | "BrawlingSpecialAbility" + | "CauldronEnchantment" + | "CeremonialItemSpecialAbility" + | "ChronicleEnchantment" + | "CombatSpecialAbility" + | "CombatStyleSpecialAbility" + | "CommandSpecialAbility" + | "DaggerRitual" + | "FamiliarSpecialAbility" + | "FatePointSexSpecialAbility" + | "FatePointSpecialAbility" + | "FoolsHatEnchantment" + | "GeneralSpecialAbility" + | "InstrumentEnchantment" + | "KarmaSpecialAbility" + | "Krallenkettenzauber" + | "LiturgicalStyleSpecialAbility" + | "LycantropicGift" + | "MagicalSign" + | "MagicalSpecialAbility" + | "MagicalTradition" + | "MagicStyleSpecialAbility" + | "OrbEnchantment" + | "PactGift" + | "ProtectiveWardingCircleSpecialAbility" + | "RingEnchantment" + | "Sermon" + | "SexSpecialAbility" + | "SickleRitual" + | "SikaryanDrainSpecialAbility" + | "SkillStyleSpecialAbility" + | "SpellSwordEnchantment" + | "StaffEnchantment" + | "ToyEnchantment" + | "Trinkhornzauber" + | "VampiricGift" + | "Vision" + | "WandEnchantment" + | "WeaponEnchantment" + | "Aspect" + >, getResolvedSelectOptionById: GetResolvedSelectOptionById, locale: LocaleEnvironment, prerequisite: LanguagePrerequisiteGroup, ): PrerequisitePart | undefined => { - switch (prerequisite.tag) { + switch (prerequisite.kind) { case "Race": - return printRacePrerequisite(getRaceById, locale, prerequisite.race) + return printRacePrerequisite(getInstanceById, locale, prerequisite.Race) case "Activatable": return printActivatablePrerequisite( - getAdvantageById, - getDisadvantageById, - getAdvancedCombatSpecialAbilityById, - getAdvancedKarmaSpecialAbilityById, - getAdvancedMagicalSpecialAbilityById, - getAdvancedSkillSpecialAbilityById, - getAncestorGlyphById, - getArcaneOrbEnchantmentById, - getAttireEnchantmentById, - getBlessedTraditionById, - getBowlEnchantmentById, - getBrawlingSpecialAbilityById, - getCauldronEnchantmentById, - getCeremonialItemSpecialAbilityById, - getChronicleEnchantmentById, - getCombatSpecialAbilityById, - getCombatStyleSpecialAbilityById, - getCommandSpecialAbilityById, - getDaggerRitualById, - getFamiliarSpecialAbilityById, - getFatePointSexSpecialAbilityById, - getFatePointSpecialAbilityById, - getFoolsHatEnchantmentById, - getGeneralSpecialAbilityById, - getInstrumentEnchantmentById, - getKarmaSpecialAbilityById, - getKrallenkettenzauberById, - getLiturgicalStyleSpecialAbilityById, - getLycantropicGiftById, - getMagicalSignById, - getMagicalSpecialAbilityById, - getMagicalTraditionById, - getMagicStyleSpecialAbilityById, - getOrbEnchantmentById, - getPactGiftById, - getProtectiveWardingCircleSpecialAbilityById, - getRingEnchantmentById, - getSermonById, - getSexSpecialAbilityById, - getSickleRitualById, - getSikaryanDrainSpecialAbilityById, - getSkillStyleSpecialAbilityById, - getSpellSwordEnchantmentById, - getStaffEnchantmentById, - getToyEnchantmentById, - getTrinkhornzauberById, - getVampiricGiftById, - getVisionById, - getWandEnchantmentById, - getWeaponEnchantmentById, - getAspectById, + getInstanceById, getResolvedSelectOptionById, locale, - prerequisite.activatable, + prerequisite.Activatable, ) case "Text": - return printTextPrerequisite(locale, prerequisite.text) + return printTextPrerequisite(locale, prerequisite.Text) default: return assertExhaustive(prerequisite) } @@ -933,7 +678,7 @@ export const printLanguagePrerequisiteGroup = ( * Print the translation of an animist power prerequisite group. */ export const printAnimistPowerPrerequisiteGroup = ( - getAnimistPowerById: GetById.Static.AnimistPower, + getInstanceById: GetInstanceById<"AnimistPower">, locale: LocaleEnvironment, prerequisite: AnimistPowerPrerequisiteGroup, ): PrerequisitePart | undefined => @@ -943,9 +688,9 @@ export const printAnimistPowerPrerequisiteGroup = ( // return assertExhaustive(prerequisite) // } printAnimistPowerPrerequisite( - getAnimistPowerById, + getInstanceById, locale, - prerequisite.animist_power, + prerequisite.AnimistPower, ) /** @@ -960,54 +705,51 @@ export const printGeodeRitualPrerequisiteGroup = ( // default: // return assertExhaustive(prerequisite) // } - printInfluencePrerequisite(locale, prerequisite.influence) + printInfluencePrerequisite(locale, prerequisite.Influence) /** * Print the translation of an enhancement prerequisite group. */ export const printEnhancementPrerequisiteGroup = ( - getSpellById: GetById.Static.Spell, - getRitualById: GetById.Static.Ritual, - getLiturgicalChantById: GetById.Static.LiturgicalChant, - getCeremonyById: GetById.Static.Ceremony, + getInstanceById: GetInstanceById< + "Spell" | "Ritual" | "LiturgicalChant" | "Ceremony" + >, locale: LocaleEnvironment, prerequisite: EnhancementPrerequisiteGroup, - parentId: SkillWithEnhancementsIdentifier, -): PrerequisitePart | undefined => - // switch (prerequisite.tag) { - // case "InternalEnhancement": - // default: - // return assertExhaustive(prerequisite) - // } - printInternalEnhancementPrerequisite( - getSpellById, - getRitualById, - getLiturgicalChantById, - getCeremonyById, - locale, - prerequisite.internal_enhancement, - parentId, - ) - -/** - * Print the translation of a precondition group. - */ -export const printPreconditionGroup = ( - getPublicationById: GetById.Static.Publication, - locale: LocaleEnvironment, - prerequisite: PreconditionGroup, ): PrerequisitePart | undefined => { - switch (prerequisite.tag) { - case "Publication": - return printPublicationPrerequisite( - getPublicationById, + switch (prerequisite.kind) { + case "Rated": + return printRatedPrerequisite(getInstanceById, locale, prerequisite.Rated) + case "Enhancement": + return printEnhancementPrerequisite( + getInstanceById, locale, - prerequisite.publication, + prerequisite.Enhancement, ) + default: + return assertExhaustive(prerequisite) + } +} + +/** + * Print the translation of a precondition group. + */ +export const printPreconditionGroup = ( + getInstanceById: GetInstanceById<"Publication">, + locale: LocaleEnvironment, + prerequisite: PreconditionGroup, +): PrerequisitePart | undefined => { + switch (prerequisite.kind) { + case "Publication": + return printPublicationPrerequisite( + getInstanceById, + locale, + prerequisite.Publication, + ) case "SexualCharacteristic": return printSexualCharacteristicPrerequisite( locale, - prerequisite.sexual_characteristic, + prerequisite.SexualCharacteristic, ) default: return assertExhaustive(prerequisite) diff --git a/src/entities/partial/prerequisites/single/activatable.ts b/src/entities/partial/prerequisites/single/activatable.ts index 2185635..0daf773 100644 --- a/src/entities/partial/prerequisites/single/activatable.ts +++ b/src/entities/partial/prerequisites/single/activatable.ts @@ -1,13 +1,13 @@ import { assertExhaustive } from "@optolith/helpers/typeSafety" -import { ResolvedSelectOption } from "optolith-database-schema/cache/activatableSelectOptions" -import { +import type { ResolvedSelectOption } from "optolith-database-schema/cache" +import type { ActivatableIdentifier, - SelectOptionIdentifier, -} from "optolith-database-schema/types/_IdentifierGroup" -import { LocaleMap } from "optolith-database-schema/types/_LocaleMap" -import { ActivatablePrerequisite } from "optolith-database-schema/types/prerequisites/single/ActivatablePrerequisite" -import { GetById } from "../../../../helpers/getTypes.js" + ActivatablePrerequisite, + RequirableSelectOptionIdentifier, +} from "optolith-database-schema/gen" +import { type GetInstanceById } from "../../../../helpers/getTypes.js" import { LocaleEnvironment } from "../../../../helpers/locale.js" +import type { LocaleMap } from "../../../../helpers/translate.js" import { getNameComponents, printActivatableNameChunk, @@ -16,177 +16,215 @@ import { printDisplayOption } from "../displayOption.js" import { PrerequisitePart } from "../part.js" const getTranslationsForActivatable = ( - getAdvantageById: GetById.Static.Advantage, - getDisadvantageById: GetById.Static.Disadvantage, - getAdvancedCombatSpecialAbilityById: GetById.Static.AdvancedCombatSpecialAbility, - getAdvancedKarmaSpecialAbilityById: GetById.Static.AdvancedKarmaSpecialAbility, - getAdvancedMagicalSpecialAbilityById: GetById.Static.AdvancedMagicalSpecialAbility, - getAdvancedSkillSpecialAbilityById: GetById.Static.AdvancedSkillSpecialAbility, - getAncestorGlyphById: GetById.Static.AncestorGlyph, - getArcaneOrbEnchantmentById: GetById.Static.ArcaneOrbEnchantment, - getAttireEnchantmentById: GetById.Static.AttireEnchantment, - getBlessedTraditionById: GetById.Static.BlessedTradition, - getBowlEnchantmentById: GetById.Static.BowlEnchantment, - getBrawlingSpecialAbilityById: GetById.Static.BrawlingSpecialAbility, - getCauldronEnchantmentById: GetById.Static.CauldronEnchantment, - getCeremonialItemSpecialAbilityById: GetById.Static.CeremonialItemSpecialAbility, - getChronicleEnchantmentById: GetById.Static.ChronicleEnchantment, - getCombatSpecialAbilityById: GetById.Static.CombatSpecialAbility, - getCombatStyleSpecialAbilityById: GetById.Static.CombatStyleSpecialAbility, - getCommandSpecialAbilityById: GetById.Static.CommandSpecialAbility, - getDaggerRitualById: GetById.Static.DaggerRitual, - getFamiliarSpecialAbilityById: GetById.Static.FamiliarSpecialAbility, - getFatePointSexSpecialAbilityById: GetById.Static.FatePointSexSpecialAbility, - getFatePointSpecialAbilityById: GetById.Static.FatePointSpecialAbility, - getFoolsHatEnchantmentById: GetById.Static.FoolsHatEnchantment, - getGeneralSpecialAbilityById: GetById.Static.GeneralSpecialAbility, - getInstrumentEnchantmentById: GetById.Static.InstrumentEnchantment, - getKarmaSpecialAbilityById: GetById.Static.KarmaSpecialAbility, - getKrallenkettenzauberById: GetById.Static.Krallenkettenzauber, - getLiturgicalStyleSpecialAbilityById: GetById.Static.LiturgicalStyleSpecialAbility, - getLycantropicGiftById: GetById.Static.LycantropicGift, - getMagicalSignById: GetById.Static.MagicalSign, - getMagicalSpecialAbilityById: GetById.Static.MagicalSpecialAbility, - getMagicalTraditionById: GetById.Static.MagicalTradition, - getMagicStyleSpecialAbilityById: GetById.Static.MagicStyleSpecialAbility, - getOrbEnchantmentById: GetById.Static.OrbEnchantment, - getPactGiftById: GetById.Static.PactGift, - getProtectiveWardingCircleSpecialAbilityById: GetById.Static.ProtectiveWardingCircleSpecialAbility, - getRingEnchantmentById: GetById.Static.RingEnchantment, - getSermonById: GetById.Static.Sermon, - getSexSpecialAbilityById: GetById.Static.SexSpecialAbility, - getSickleRitualById: GetById.Static.SickleRitual, - getSikaryanDrainSpecialAbilityById: GetById.Static.SikaryanDrainSpecialAbility, - getSkillStyleSpecialAbilityById: GetById.Static.SkillStyleSpecialAbility, - getSpellSwordEnchantmentById: GetById.Static.SpellSwordEnchantment, - getStaffEnchantmentById: GetById.Static.StaffEnchantment, - getToyEnchantmentById: GetById.Static.ToyEnchantment, - getTrinkhornzauberById: GetById.Static.Trinkhornzauber, - getVampiricGiftById: GetById.Static.VampiricGift, - getVisionById: GetById.Static.Vision, - getWandEnchantmentById: GetById.Static.WandEnchantment, - getWeaponEnchantmentById: GetById.Static.WeaponEnchantment, + getInstanceById: GetInstanceById< + | "AdvancedCombatSpecialAbility" + | "AdvancedKarmaSpecialAbility" + | "AdvancedMagicalSpecialAbility" + | "AdvancedSkillSpecialAbility" + | "Advantage" + | "AncestorGlyph" + | "ArcaneOrbEnchantment" + | "AttireEnchantment" + | "Beutelzauber" + | "BlessedTradition" + | "BowlEnchantment" + | "BrawlingSpecialAbility" + | "CauldronEnchantment" + | "CeremonialItemSpecialAbility" + | "ChronicleEnchantment" + | "CombatSpecialAbility" + | "CombatStyleSpecialAbility" + | "CommandSpecialAbility" + | "DaggerRitual" + | "Disadvantage" + | "FamiliarSpecialAbility" + | "FatePointSexSpecialAbility" + | "FatePointSpecialAbility" + | "FoolsHatEnchantment" + | "GeneralSpecialAbility" + | "Haubenzauber" + | "InstrumentEnchantment" + | "KarmaSpecialAbility" + | "Krallenkettenzauber" + | "Kristallkugelzauber" + | "LiturgicalStyleSpecialAbility" + | "LycantropicGift" + | "MagicalSign" + | "MagicalSpecialAbility" + | "MagicalTradition" + | "MagicStyleSpecialAbility" + | "OrbEnchantment" + | "PactGift" + | "ProtectiveWardingCircleSpecialAbility" + | "RingEnchantment" + | "Sermon" + | "SexSpecialAbility" + | "SickleRitual" + | "SikaryanDrainSpecialAbility" + | "SkillStyleSpecialAbility" + | "SpellSwordEnchantment" + | "StaffEnchantment" + | "ToyEnchantment" + | "Trinkhornzauber" + | "VampiricGift" + | "Vision" + | "WandEnchantment" + | "WeaponEnchantment" + >, id: ActivatableIdentifier, ): { translations: LocaleMap<{ name: string }> } | undefined => { - switch (id.tag) { + switch (id.kind) { case "Advantage": - return getAdvantageById(id.advantage) + return getInstanceById("Advantage", id.Advantage) case "Disadvantage": - return getDisadvantageById(id.disadvantage) + return getInstanceById("Disadvantage", id.Disadvantage) case "AdvancedCombatSpecialAbility": - return getAdvancedCombatSpecialAbilityById( - id.advanced_combat_special_ability, + return getInstanceById( + "AdvancedCombatSpecialAbility", + id.AdvancedCombatSpecialAbility, ) case "AdvancedKarmaSpecialAbility": - return getAdvancedKarmaSpecialAbilityById( - id.advanced_karma_special_ability, + return getInstanceById( + "AdvancedKarmaSpecialAbility", + id.AdvancedKarmaSpecialAbility, ) case "AdvancedMagicalSpecialAbility": - return getAdvancedMagicalSpecialAbilityById( - id.advanced_magical_special_ability, + return getInstanceById( + "AdvancedMagicalSpecialAbility", + id.AdvancedMagicalSpecialAbility, ) case "AdvancedSkillSpecialAbility": - return getAdvancedSkillSpecialAbilityById( - id.advanced_skill_special_ability, + return getInstanceById( + "AdvancedSkillSpecialAbility", + id.AdvancedSkillSpecialAbility, ) case "AncestorGlyph": - return getAncestorGlyphById(id.ancestor_glyph) + return getInstanceById("AncestorGlyph", id.AncestorGlyph) case "ArcaneOrbEnchantment": - return getArcaneOrbEnchantmentById(id.arcane_orb_enchantment) + return getInstanceById("ArcaneOrbEnchantment", id.ArcaneOrbEnchantment) case "AttireEnchantment": - return getAttireEnchantmentById(id.attire_enchantment) + return getInstanceById("AttireEnchantment", id.AttireEnchantment) case "BlessedTradition": - return getBlessedTraditionById(id.blessed_tradition) + return getInstanceById("BlessedTradition", id.BlessedTradition) + case "Beutelzauber": + return getInstanceById("Beutelzauber", id.Beutelzauber) + case "Haubenzauber": + return getInstanceById("Haubenzauber", id.Haubenzauber) + case "Kristallkugelzauber": + return getInstanceById("Kristallkugelzauber", id.Kristallkugelzauber) case "BowlEnchantment": - return getBowlEnchantmentById(id.bowl_enchantment) + return getInstanceById("BowlEnchantment", id.BowlEnchantment) case "BrawlingSpecialAbility": - return getBrawlingSpecialAbilityById(id.brawling_special_ability) + return getInstanceById( + "BrawlingSpecialAbility", + id.BrawlingSpecialAbility, + ) case "CauldronEnchantment": - return getCauldronEnchantmentById(id.cauldron_enchantment) + return getInstanceById("CauldronEnchantment", id.CauldronEnchantment) case "CeremonialItemSpecialAbility": - return getCeremonialItemSpecialAbilityById( - id.ceremonial_item_special_ability, + return getInstanceById( + "CeremonialItemSpecialAbility", + id.CeremonialItemSpecialAbility, ) case "ChronicleEnchantment": - return getChronicleEnchantmentById(id.chronicle_enchantment) + return getInstanceById("ChronicleEnchantment", id.ChronicleEnchantment) case "CombatSpecialAbility": - return getCombatSpecialAbilityById(id.combat_special_ability) + return getInstanceById("CombatSpecialAbility", id.CombatSpecialAbility) case "CombatStyleSpecialAbility": - return getCombatStyleSpecialAbilityById(id.combat_style_special_ability) + return getInstanceById( + "CombatStyleSpecialAbility", + id.CombatStyleSpecialAbility, + ) case "CommandSpecialAbility": - return getCommandSpecialAbilityById(id.command_special_ability) + return getInstanceById("CommandSpecialAbility", id.CommandSpecialAbility) case "DaggerRitual": - return getDaggerRitualById(id.dagger_ritual) + return getInstanceById("DaggerRitual", id.DaggerRitual) case "FamiliarSpecialAbility": - return getFamiliarSpecialAbilityById(id.familiar_special_ability) + return getInstanceById( + "FamiliarSpecialAbility", + id.FamiliarSpecialAbility, + ) case "FatePointSexSpecialAbility": - return getFatePointSexSpecialAbilityById( - id.fate_point_sex_special_ability, + return getInstanceById( + "FatePointSexSpecialAbility", + id.FatePointSexSpecialAbility, ) case "FatePointSpecialAbility": - return getFatePointSpecialAbilityById(id.fate_point_special_ability) + return getInstanceById( + "FatePointSpecialAbility", + id.FatePointSpecialAbility, + ) case "FoolsHatEnchantment": - return getFoolsHatEnchantmentById(id.fools_hat_enchantment) + return getInstanceById("FoolsHatEnchantment", id.FoolsHatEnchantment) case "GeneralSpecialAbility": - return getGeneralSpecialAbilityById(id.general_special_ability) + return getInstanceById("GeneralSpecialAbility", id.GeneralSpecialAbility) case "InstrumentEnchantment": - return getInstrumentEnchantmentById(id.instrument_enchantment) + return getInstanceById("InstrumentEnchantment", id.InstrumentEnchantment) case "KarmaSpecialAbility": - return getKarmaSpecialAbilityById(id.karma_special_ability) + return getInstanceById("KarmaSpecialAbility", id.KarmaSpecialAbility) case "Krallenkettenzauber": - return getKrallenkettenzauberById(id.krallenkettenzauber) + return getInstanceById("Krallenkettenzauber", id.Krallenkettenzauber) case "LiturgicalStyleSpecialAbility": - return getLiturgicalStyleSpecialAbilityById( - id.liturgical_style_special_ability, + return getInstanceById( + "LiturgicalStyleSpecialAbility", + id.LiturgicalStyleSpecialAbility, ) case "LycantropicGift": - return getLycantropicGiftById(id.lycantropic_gift) + return getInstanceById("LycantropicGift", id.LycantropicGift) case "MagicalSign": - return getMagicalSignById(id.magical_sign) + return getInstanceById("MagicalSign", id.MagicalSign) case "MagicalSpecialAbility": - return getMagicalSpecialAbilityById(id.magical_special_ability) + return getInstanceById("MagicalSpecialAbility", id.MagicalSpecialAbility) case "MagicalTradition": - return getMagicalTraditionById(id.magical_tradition) + return getInstanceById("MagicalTradition", id.MagicalTradition) case "MagicStyleSpecialAbility": - return getMagicStyleSpecialAbilityById(id.magic_style_special_ability) + return getInstanceById( + "MagicStyleSpecialAbility", + id.MagicStyleSpecialAbility, + ) case "OrbEnchantment": - return getOrbEnchantmentById(id.orb_enchantment) + return getInstanceById("OrbEnchantment", id.OrbEnchantment) case "PactGift": - return getPactGiftById(id.pact_gift) + return getInstanceById("PactGift", id.PactGift) case "ProtectiveWardingCircleSpecialAbility": - return getProtectiveWardingCircleSpecialAbilityById( - id.protective_warding_circle_special_ability, + return getInstanceById( + "ProtectiveWardingCircleSpecialAbility", + id.ProtectiveWardingCircleSpecialAbility, ) case "RingEnchantment": - return getRingEnchantmentById(id.ring_enchantment) + return getInstanceById("RingEnchantment", id.RingEnchantment) case "Sermon": - return getSermonById(id.sermon) + return getInstanceById("Sermon", id.Sermon) case "SexSpecialAbility": - return getSexSpecialAbilityById(id.sex_special_ability) + return getInstanceById("SexSpecialAbility", id.SexSpecialAbility) case "SickleRitual": - return getSickleRitualById(id.sickle_ritual) + return getInstanceById("SickleRitual", id.SickleRitual) case "SikaryanDrainSpecialAbility": - return getSikaryanDrainSpecialAbilityById( - id.sikaryan_drain_special_ability, + return getInstanceById( + "SikaryanDrainSpecialAbility", + id.SikaryanDrainSpecialAbility, ) case "SkillStyleSpecialAbility": - return getSkillStyleSpecialAbilityById(id.skill_style_special_ability) + return getInstanceById( + "SkillStyleSpecialAbility", + id.SkillStyleSpecialAbility, + ) case "SpellSwordEnchantment": - return getSpellSwordEnchantmentById(id.spell_sword_enchantment) + return getInstanceById("SpellSwordEnchantment", id.SpellSwordEnchantment) case "StaffEnchantment": - return getStaffEnchantmentById(id.staff_enchantment) + return getInstanceById("StaffEnchantment", id.StaffEnchantment) case "ToyEnchantment": - return getToyEnchantmentById(id.toy_enchantment) + return getInstanceById("ToyEnchantment", id.ToyEnchantment) case "Trinkhornzauber": - return getTrinkhornzauberById(id.trinkhornzauber) + return getInstanceById("Trinkhornzauber", id.Trinkhornzauber) case "VampiricGift": - return getVampiricGiftById(id.vampiric_gift) + return getInstanceById("VampiricGift", id.VampiricGift) case "Vision": - return getVisionById(id.vision) + return getInstanceById("Vision", id.Vision) case "WandEnchantment": - return getWandEnchantmentById(id.wand_enchantment) + return getInstanceById("WandEnchantment", id.WandEnchantment) case "WeaponEnchantment": - return getWeaponEnchantmentById(id.weapon_enchantment) + return getInstanceById("WeaponEnchantment", id.WeaponEnchantment) default: return assertExhaustive(id) } @@ -196,127 +234,77 @@ const getTranslationsForActivatable = ( */ export type GetResolvedSelectOptionById = ( id: ActivatableIdentifier, - selectOptionId: SelectOptionIdentifier, + selectOptionId: RequirableSelectOptionIdentifier, ) => ResolvedSelectOption | undefined const printActivatableName = ( - getAdvantageById: GetById.Static.Advantage, - getDisadvantageById: GetById.Static.Disadvantage, - getAdvancedCombatSpecialAbilityById: GetById.Static.AdvancedCombatSpecialAbility, - getAdvancedKarmaSpecialAbilityById: GetById.Static.AdvancedKarmaSpecialAbility, - getAdvancedMagicalSpecialAbilityById: GetById.Static.AdvancedMagicalSpecialAbility, - getAdvancedSkillSpecialAbilityById: GetById.Static.AdvancedSkillSpecialAbility, - getAncestorGlyphById: GetById.Static.AncestorGlyph, - getArcaneOrbEnchantmentById: GetById.Static.ArcaneOrbEnchantment, - getAttireEnchantmentById: GetById.Static.AttireEnchantment, - getBlessedTraditionById: GetById.Static.BlessedTradition, - getBowlEnchantmentById: GetById.Static.BowlEnchantment, - getBrawlingSpecialAbilityById: GetById.Static.BrawlingSpecialAbility, - getCauldronEnchantmentById: GetById.Static.CauldronEnchantment, - getCeremonialItemSpecialAbilityById: GetById.Static.CeremonialItemSpecialAbility, - getChronicleEnchantmentById: GetById.Static.ChronicleEnchantment, - getCombatSpecialAbilityById: GetById.Static.CombatSpecialAbility, - getCombatStyleSpecialAbilityById: GetById.Static.CombatStyleSpecialAbility, - getCommandSpecialAbilityById: GetById.Static.CommandSpecialAbility, - getDaggerRitualById: GetById.Static.DaggerRitual, - getFamiliarSpecialAbilityById: GetById.Static.FamiliarSpecialAbility, - getFatePointSexSpecialAbilityById: GetById.Static.FatePointSexSpecialAbility, - getFatePointSpecialAbilityById: GetById.Static.FatePointSpecialAbility, - getFoolsHatEnchantmentById: GetById.Static.FoolsHatEnchantment, - getGeneralSpecialAbilityById: GetById.Static.GeneralSpecialAbility, - getInstrumentEnchantmentById: GetById.Static.InstrumentEnchantment, - getKarmaSpecialAbilityById: GetById.Static.KarmaSpecialAbility, - getKrallenkettenzauberById: GetById.Static.Krallenkettenzauber, - getLiturgicalStyleSpecialAbilityById: GetById.Static.LiturgicalStyleSpecialAbility, - getLycantropicGiftById: GetById.Static.LycantropicGift, - getMagicalSignById: GetById.Static.MagicalSign, - getMagicalSpecialAbilityById: GetById.Static.MagicalSpecialAbility, - getMagicalTraditionById: GetById.Static.MagicalTradition, - getMagicStyleSpecialAbilityById: GetById.Static.MagicStyleSpecialAbility, - getOrbEnchantmentById: GetById.Static.OrbEnchantment, - getPactGiftById: GetById.Static.PactGift, - getProtectiveWardingCircleSpecialAbilityById: GetById.Static.ProtectiveWardingCircleSpecialAbility, - getRingEnchantmentById: GetById.Static.RingEnchantment, - getSermonById: GetById.Static.Sermon, - getSexSpecialAbilityById: GetById.Static.SexSpecialAbility, - getSickleRitualById: GetById.Static.SickleRitual, - getSikaryanDrainSpecialAbilityById: GetById.Static.SikaryanDrainSpecialAbility, - getSkillStyleSpecialAbilityById: GetById.Static.SkillStyleSpecialAbility, - getSpellSwordEnchantmentById: GetById.Static.SpellSwordEnchantment, - getStaffEnchantmentById: GetById.Static.StaffEnchantment, - getToyEnchantmentById: GetById.Static.ToyEnchantment, - getTrinkhornzauberById: GetById.Static.Trinkhornzauber, - getVampiricGiftById: GetById.Static.VampiricGift, - getVisionById: GetById.Static.Vision, - getWandEnchantmentById: GetById.Static.WandEnchantment, - getWeaponEnchantmentById: GetById.Static.WeaponEnchantment, - getAspectById: GetById.Static.Aspect, + getInstanceById: GetInstanceById< + | "Advantage" + | "Disadvantage" + | "AdvancedCombatSpecialAbility" + | "AdvancedKarmaSpecialAbility" + | "AdvancedMagicalSpecialAbility" + | "AdvancedSkillSpecialAbility" + | "AncestorGlyph" + | "ArcaneOrbEnchantment" + | "AttireEnchantment" + | "BlessedTradition" + | "BowlEnchantment" + | "BrawlingSpecialAbility" + | "CauldronEnchantment" + | "CeremonialItemSpecialAbility" + | "ChronicleEnchantment" + | "CombatSpecialAbility" + | "CombatStyleSpecialAbility" + | "CommandSpecialAbility" + | "DaggerRitual" + | "FamiliarSpecialAbility" + | "FatePointSexSpecialAbility" + | "FatePointSpecialAbility" + | "FoolsHatEnchantment" + | "GeneralSpecialAbility" + | "InstrumentEnchantment" + | "KarmaSpecialAbility" + | "Krallenkettenzauber" + | "LiturgicalStyleSpecialAbility" + | "LycantropicGift" + | "MagicalSign" + | "MagicalSpecialAbility" + | "MagicalTradition" + | "MagicStyleSpecialAbility" + | "OrbEnchantment" + | "PactGift" + | "ProtectiveWardingCircleSpecialAbility" + | "RingEnchantment" + | "Sermon" + | "SexSpecialAbility" + | "SickleRitual" + | "SikaryanDrainSpecialAbility" + | "SkillStyleSpecialAbility" + | "SpellSwordEnchantment" + | "StaffEnchantment" + | "ToyEnchantment" + | "Trinkhornzauber" + | "VampiricGift" + | "Vision" + | "WandEnchantment" + | "WeaponEnchantment" + | "Aspect" + >, locale: LocaleEnvironment, id: ActivatableIdentifier, - options: SelectOptionIdentifier[] | undefined, + options: RequirableSelectOptionIdentifier[] | undefined, level: number | undefined, getResolvedSelectOptionById: GetResolvedSelectOptionById, ) => { - const entry = getTranslationsForActivatable( - getAdvantageById, - getDisadvantageById, - getAdvancedCombatSpecialAbilityById, - getAdvancedKarmaSpecialAbilityById, - getAdvancedMagicalSpecialAbilityById, - getAdvancedSkillSpecialAbilityById, - getAncestorGlyphById, - getArcaneOrbEnchantmentById, - getAttireEnchantmentById, - getBlessedTraditionById, - getBowlEnchantmentById, - getBrawlingSpecialAbilityById, - getCauldronEnchantmentById, - getCeremonialItemSpecialAbilityById, - getChronicleEnchantmentById, - getCombatSpecialAbilityById, - getCombatStyleSpecialAbilityById, - getCommandSpecialAbilityById, - getDaggerRitualById, - getFamiliarSpecialAbilityById, - getFatePointSexSpecialAbilityById, - getFatePointSpecialAbilityById, - getFoolsHatEnchantmentById, - getGeneralSpecialAbilityById, - getInstrumentEnchantmentById, - getKarmaSpecialAbilityById, - getKrallenkettenzauberById, - getLiturgicalStyleSpecialAbilityById, - getLycantropicGiftById, - getMagicalSignById, - getMagicalSpecialAbilityById, - getMagicalTraditionById, - getMagicStyleSpecialAbilityById, - getOrbEnchantmentById, - getPactGiftById, - getProtectiveWardingCircleSpecialAbilityById, - getRingEnchantmentById, - getSermonById, - getSexSpecialAbilityById, - getSickleRitualById, - getSikaryanDrainSpecialAbilityById, - getSkillStyleSpecialAbilityById, - getSpellSwordEnchantmentById, - getStaffEnchantmentById, - getToyEnchantmentById, - getTrinkhornzauberById, - getVampiricGiftById, - getVisionById, - getWandEnchantmentById, - getWeaponEnchantmentById, - id, - ) + const entry = getTranslationsForActivatable(getInstanceById, id) if (entry === undefined) { return undefined } return getNameComponents( - getAspectById, + getInstanceById, locale, id, options, @@ -332,57 +320,59 @@ const printActivatableName = ( * Get the translation of a blessed tradition prerequisite. */ export const printActivatablePrerequisite = ( - getAdvantageById: GetById.Static.Advantage, - getDisadvantageById: GetById.Static.Disadvantage, - getAdvancedCombatSpecialAbilityById: GetById.Static.AdvancedCombatSpecialAbility, - getAdvancedKarmaSpecialAbilityById: GetById.Static.AdvancedKarmaSpecialAbility, - getAdvancedMagicalSpecialAbilityById: GetById.Static.AdvancedMagicalSpecialAbility, - getAdvancedSkillSpecialAbilityById: GetById.Static.AdvancedSkillSpecialAbility, - getAncestorGlyphById: GetById.Static.AncestorGlyph, - getArcaneOrbEnchantmentById: GetById.Static.ArcaneOrbEnchantment, - getAttireEnchantmentById: GetById.Static.AttireEnchantment, - getBlessedTraditionById: GetById.Static.BlessedTradition, - getBowlEnchantmentById: GetById.Static.BowlEnchantment, - getBrawlingSpecialAbilityById: GetById.Static.BrawlingSpecialAbility, - getCauldronEnchantmentById: GetById.Static.CauldronEnchantment, - getCeremonialItemSpecialAbilityById: GetById.Static.CeremonialItemSpecialAbility, - getChronicleEnchantmentById: GetById.Static.ChronicleEnchantment, - getCombatSpecialAbilityById: GetById.Static.CombatSpecialAbility, - getCombatStyleSpecialAbilityById: GetById.Static.CombatStyleSpecialAbility, - getCommandSpecialAbilityById: GetById.Static.CommandSpecialAbility, - getDaggerRitualById: GetById.Static.DaggerRitual, - getFamiliarSpecialAbilityById: GetById.Static.FamiliarSpecialAbility, - getFatePointSexSpecialAbilityById: GetById.Static.FatePointSexSpecialAbility, - getFatePointSpecialAbilityById: GetById.Static.FatePointSpecialAbility, - getFoolsHatEnchantmentById: GetById.Static.FoolsHatEnchantment, - getGeneralSpecialAbilityById: GetById.Static.GeneralSpecialAbility, - getInstrumentEnchantmentById: GetById.Static.InstrumentEnchantment, - getKarmaSpecialAbilityById: GetById.Static.KarmaSpecialAbility, - getKrallenkettenzauberById: GetById.Static.Krallenkettenzauber, - getLiturgicalStyleSpecialAbilityById: GetById.Static.LiturgicalStyleSpecialAbility, - getLycantropicGiftById: GetById.Static.LycantropicGift, - getMagicalSignById: GetById.Static.MagicalSign, - getMagicalSpecialAbilityById: GetById.Static.MagicalSpecialAbility, - getMagicalTraditionById: GetById.Static.MagicalTradition, - getMagicStyleSpecialAbilityById: GetById.Static.MagicStyleSpecialAbility, - getOrbEnchantmentById: GetById.Static.OrbEnchantment, - getPactGiftById: GetById.Static.PactGift, - getProtectiveWardingCircleSpecialAbilityById: GetById.Static.ProtectiveWardingCircleSpecialAbility, - getRingEnchantmentById: GetById.Static.RingEnchantment, - getSermonById: GetById.Static.Sermon, - getSexSpecialAbilityById: GetById.Static.SexSpecialAbility, - getSickleRitualById: GetById.Static.SickleRitual, - getSikaryanDrainSpecialAbilityById: GetById.Static.SikaryanDrainSpecialAbility, - getSkillStyleSpecialAbilityById: GetById.Static.SkillStyleSpecialAbility, - getSpellSwordEnchantmentById: GetById.Static.SpellSwordEnchantment, - getStaffEnchantmentById: GetById.Static.StaffEnchantment, - getToyEnchantmentById: GetById.Static.ToyEnchantment, - getTrinkhornzauberById: GetById.Static.Trinkhornzauber, - getVampiricGiftById: GetById.Static.VampiricGift, - getVisionById: GetById.Static.Vision, - getWandEnchantmentById: GetById.Static.WandEnchantment, - getWeaponEnchantmentById: GetById.Static.WeaponEnchantment, - getAspectById: GetById.Static.Aspect, + getInstanceById: GetInstanceById< + | "Advantage" + | "Disadvantage" + | "AdvancedCombatSpecialAbility" + | "AdvancedKarmaSpecialAbility" + | "AdvancedMagicalSpecialAbility" + | "AdvancedSkillSpecialAbility" + | "AncestorGlyph" + | "ArcaneOrbEnchantment" + | "AttireEnchantment" + | "BlessedTradition" + | "BowlEnchantment" + | "BrawlingSpecialAbility" + | "CauldronEnchantment" + | "CeremonialItemSpecialAbility" + | "ChronicleEnchantment" + | "CombatSpecialAbility" + | "CombatStyleSpecialAbility" + | "CommandSpecialAbility" + | "DaggerRitual" + | "FamiliarSpecialAbility" + | "FatePointSexSpecialAbility" + | "FatePointSpecialAbility" + | "FoolsHatEnchantment" + | "GeneralSpecialAbility" + | "InstrumentEnchantment" + | "KarmaSpecialAbility" + | "Krallenkettenzauber" + | "LiturgicalStyleSpecialAbility" + | "LycantropicGift" + | "MagicalSign" + | "MagicalSpecialAbility" + | "MagicalTradition" + | "MagicStyleSpecialAbility" + | "OrbEnchantment" + | "PactGift" + | "ProtectiveWardingCircleSpecialAbility" + | "RingEnchantment" + | "Sermon" + | "SexSpecialAbility" + | "SickleRitual" + | "SikaryanDrainSpecialAbility" + | "SkillStyleSpecialAbility" + | "SpellSwordEnchantment" + | "StaffEnchantment" + | "ToyEnchantment" + | "Trinkhornzauber" + | "VampiricGift" + | "Vision" + | "WandEnchantment" + | "WeaponEnchantment" + | "Aspect" + >, getResolvedSelectOptionById: GetResolvedSelectOptionById, locale: LocaleEnvironment, prerequisite: ActivatablePrerequisite, @@ -392,57 +382,7 @@ export const printActivatablePrerequisite = ( } const nameComponents = printActivatableName( - getAdvantageById, - getDisadvantageById, - getAdvancedCombatSpecialAbilityById, - getAdvancedKarmaSpecialAbilityById, - getAdvancedMagicalSpecialAbilityById, - getAdvancedSkillSpecialAbilityById, - getAncestorGlyphById, - getArcaneOrbEnchantmentById, - getAttireEnchantmentById, - getBlessedTraditionById, - getBowlEnchantmentById, - getBrawlingSpecialAbilityById, - getCauldronEnchantmentById, - getCeremonialItemSpecialAbilityById, - getChronicleEnchantmentById, - getCombatSpecialAbilityById, - getCombatStyleSpecialAbilityById, - getCommandSpecialAbilityById, - getDaggerRitualById, - getFamiliarSpecialAbilityById, - getFatePointSexSpecialAbilityById, - getFatePointSpecialAbilityById, - getFoolsHatEnchantmentById, - getGeneralSpecialAbilityById, - getInstrumentEnchantmentById, - getKarmaSpecialAbilityById, - getKrallenkettenzauberById, - getLiturgicalStyleSpecialAbilityById, - getLycantropicGiftById, - getMagicalSignById, - getMagicalSpecialAbilityById, - getMagicalTraditionById, - getMagicStyleSpecialAbilityById, - getOrbEnchantmentById, - getPactGiftById, - getProtectiveWardingCircleSpecialAbilityById, - getRingEnchantmentById, - getSermonById, - getSexSpecialAbilityById, - getSickleRitualById, - getSikaryanDrainSpecialAbilityById, - getSkillStyleSpecialAbilityById, - getSpellSwordEnchantmentById, - getStaffEnchantmentById, - getToyEnchantmentById, - getTrinkhornzauberById, - getVampiricGiftById, - getVisionById, - getWandEnchantmentById, - getWeaponEnchantmentById, - getAspectById, + getInstanceById, locale, prerequisite.id, prerequisite.options, diff --git a/src/entities/partial/prerequisites/single/animistPower.ts b/src/entities/partial/prerequisites/single/animistPower.ts index 5aeb471..697c5e7 100644 --- a/src/entities/partial/prerequisites/single/animistPower.ts +++ b/src/entities/partial/prerequisites/single/animistPower.ts @@ -1,7 +1,7 @@ import { isNotNullish } from "@optolith/helpers/nullable" import { romanize } from "@optolith/helpers/roman" -import { AnimistPowerPrerequisite } from "optolith-database-schema/types/prerequisites/single/AnimistPowerPrerequisite" -import { GetById } from "../../../../helpers/getTypes.js" +import type { AnimistPowerPrerequisite } from "optolith-database-schema/gen" +import { type GetInstanceById } from "../../../../helpers/getTypes.js" import { LocaleEnvironment } from "../../../../helpers/locale.js" import { printDisplayOption } from "../displayOption.js" import { PrerequisitePart } from "../part.js" @@ -10,7 +10,7 @@ import { PrerequisitePart } from "../part.js" * Get the translation of a culture prerequisite. */ export const printAnimistPowerPrerequisite = ( - getAnimistPowerById: GetById.Static.AnimistPower, + getInstanceById: GetInstanceById<"AnimistPower">, locale: LocaleEnvironment, prerequisite: AnimistPowerPrerequisite, ): PrerequisitePart | undefined => { @@ -18,7 +18,7 @@ export const printAnimistPowerPrerequisite = ( return printDisplayOption(locale, prerequisite.display_option) } - const animistPower = getAnimistPowerById(prerequisite.id.animist_power) + const animistPower = getInstanceById("AnimistPower", prerequisite.id) return { value: [ diff --git a/src/entities/partial/prerequisites/single/blessedTradition.ts b/src/entities/partial/prerequisites/single/blessedTradition.ts index 5b92adb..df013ac 100644 --- a/src/entities/partial/prerequisites/single/blessedTradition.ts +++ b/src/entities/partial/prerequisites/single/blessedTradition.ts @@ -1,8 +1,8 @@ import { assertExhaustive } from "@optolith/helpers/typeSafety" -import { +import type { BlessedTraditionPrerequisite, BlessedTraditionPrerequisiteRestriction, -} from "optolith-database-schema/types/prerequisites/single/TraditionPrerequisite" +} from "optolith-database-schema/gen" import { LocaleEnvironment } from "../../../../helpers/locale.js" import { printDisplayOption } from "../displayOption.js" import { PrerequisitePart } from "../part.js" @@ -11,11 +11,15 @@ const printValue = ( locale: LocaleEnvironment, restriction: BlessedTraditionPrerequisiteRestriction | undefined, ) => { - switch (restriction) { + switch (restriction?.kind) { case "Church": - return locale.translate("Tradition ({0})", locale.translate("Church")) + return locale.translate("Tradition ({$tradition})", { + tradition: locale.translate("Church"), + }) case "Shamanistic": - return locale.translate("Tradition ({0})", locale.translate("Shaman")) + return locale.translate("Tradition ({$tradition})", { + tradition: locale.translate("Shaman"), + }) case undefined: return locale.translate("Tradition") default: diff --git a/src/entities/partial/prerequisites/single/commonSuggestedByRCP.ts b/src/entities/partial/prerequisites/single/commonSuggestedByRCP.ts index 8c32723..860898f 100644 --- a/src/entities/partial/prerequisites/single/commonSuggestedByRCP.ts +++ b/src/entities/partial/prerequisites/single/commonSuggestedByRCP.ts @@ -21,14 +21,12 @@ const printType = ( */ export const printCommonSuggestedByRCPPrerequisite = ( locale: LocaleEnvironment, - _prerequisite: Record, name: string, type: "advantage" | "disadvantage", ): PrerequisitePart | undefined => ({ value: locale.translate( - "Race, culture, or profession must have {0} as an automatic or suggested {1}", - name, - printType(locale, type), + "Race, culture, or profession must have {$entry} as an automatic or suggested {$itemOfCategory}", + { entry: name, itemOfCategory: printType(locale, type) }, ), sentenceType: undefined, isMeta: false, diff --git a/src/entities/partial/prerequisites/single/culture.ts b/src/entities/partial/prerequisites/single/culture.ts index 4b30ced..ed33326 100644 --- a/src/entities/partial/prerequisites/single/culture.ts +++ b/src/entities/partial/prerequisites/single/culture.ts @@ -1,5 +1,5 @@ -import { CulturePrerequisite } from "optolith-database-schema/types/prerequisites/single/CulturePrerequisite" -import { GetById } from "../../../../helpers/getTypes.js" +import { CulturePrerequisite } from "optolith-database-schema/gen" +import { type GetInstanceById } from "../../../../helpers/getTypes.js" import { LocaleEnvironment } from "../../../../helpers/locale.js" import { printDisplayOption } from "../displayOption.js" import { PrerequisitePart } from "../part.js" @@ -8,7 +8,7 @@ import { PrerequisitePart } from "../part.js" * Get the translation of a culture prerequisite. */ export const printCulturePrerequisite = ( - getCultureById: GetById.Static.Culture, + getInstanceById: GetInstanceById<"Culture">, locale: LocaleEnvironment, prerequisite: CulturePrerequisite, ): PrerequisitePart | undefined => { @@ -16,7 +16,7 @@ export const printCulturePrerequisite = ( return printDisplayOption(locale, prerequisite.display_option) } - const culture = getCultureById(prerequisite.id.culture) + const culture = getInstanceById("Culture", prerequisite.id) const cultureTranslation = locale.translateMap(culture?.translations) if (cultureTranslation === undefined) { diff --git a/src/entities/partial/prerequisites/single/enhancement.ts b/src/entities/partial/prerequisites/single/enhancement.ts index 3b741d2..c5f57d7 100644 --- a/src/entities/partial/prerequisites/single/enhancement.ts +++ b/src/entities/partial/prerequisites/single/enhancement.ts @@ -1,21 +1,19 @@ import { assertExhaustive } from "@optolith/helpers/typeSafety" -import { Enhancements } from "optolith-database-schema/types/_Enhancements" -import { SkillWithEnhancementsIdentifier } from "optolith-database-schema/types/_IdentifierGroup" -import { LocaleMap } from "optolith-database-schema/types/_LocaleMap" import { - ExternalEnhancementPrerequisite, - InternalEnhancementPrerequisite, -} from "optolith-database-schema/types/prerequisites/single/EnhancementPrerequisite" -import { GetById } from "../../../../helpers/getTypes.js" + type EnhancementPrerequisite, + type SkillWithEnhancementsIdentifier, +} from "optolith-database-schema/gen" +import { type GetInstanceById } from "../../../../helpers/getTypes.js" import { LocaleEnvironment } from "../../../../helpers/locale.js" -import { printDisplayOption } from "../displayOption.js" +import type { LocaleMap } from "../../../../helpers/translate.js" +import { MISSING_VALUE } from "../../unknown.js" import { PrerequisitePart } from "../part.js" const printLabel = ( locale: LocaleEnvironment, skillId: SkillWithEnhancementsIdentifier, ): string => { - switch (skillId.tag) { + switch (skillId.kind) { case "Spell": case "Ritual": return locale.translate("spell enhancement") @@ -28,23 +26,20 @@ const printLabel = ( } const getSkill = ( - getSpellById: GetById.Static.Spell, - getRitualById: GetById.Static.Ritual, - getLiturgicalChantById: GetById.Static.LiturgicalChant, - getCeremonyById: GetById.Static.Ceremony, + getInstanceById: GetInstanceById< + "Spell" | "Ritual" | "LiturgicalChant" | "Ceremony" + >, parentId: SkillWithEnhancementsIdentifier, -): - | { translations: LocaleMap<{ name: string }>; enhancements?: Enhancements } - | undefined => { - switch (parentId.tag) { +): { translations: LocaleMap<{ name: string }> } | undefined => { + switch (parentId.kind) { case "Spell": - return getSpellById(parentId.spell) + return getInstanceById("Spell", parentId.Spell) case "Ritual": - return getRitualById(parentId.ritual) + return getInstanceById("Ritual", parentId.Ritual) case "LiturgicalChant": - return getLiturgicalChantById(parentId.liturgical_chant) + return getInstanceById("LiturgicalChant", parentId.LiturgicalChant) case "Ceremony": - return getCeremonyById(parentId.ceremony) + return getInstanceById("Ceremony", parentId.Ceremony) default: return assertExhaustive(parentId) } @@ -53,68 +48,27 @@ const getSkill = ( /** * Get the translation of an external enhancement prerequisite. */ -export const printExternalEnhancementPrerequisite = ( - getSpellById: GetById.Static.Spell, - getRitualById: GetById.Static.Ritual, - getLiturgicalChantById: GetById.Static.LiturgicalChant, - getCeremonyById: GetById.Static.Ceremony, +export const printEnhancementPrerequisite = ( + getInstanceById: GetInstanceById< + "Spell" | "Ritual" | "LiturgicalChant" | "Ceremony" | "Enhancement" + >, locale: LocaleEnvironment, - prerequisite: ExternalEnhancementPrerequisite, + prerequisite: EnhancementPrerequisite, ): PrerequisitePart | undefined => { - if (prerequisite.display_option !== undefined) { - return printDisplayOption(locale, prerequisite.display_option) - } + const enhancement = getInstanceById("Enhancement", prerequisite.id) - const skill = getSkill( - getSpellById, - getRitualById, - getLiturgicalChantById, - getCeremonyById, - prerequisite.skill.id, - ) - - const enhancement = skill?.enhancements?.find( - e => e.id === prerequisite.enhancement.id, - ) + const skill = enhancement && getSkill(getInstanceById, enhancement.parent) return { - label: `${printLabel(locale, prerequisite.skill.id)} `, + label: `${ + enhancement ? printLabel(locale, enhancement.parent) : MISSING_VALUE + } `, value: `*${ - locale.translateMap(enhancement?.translations)?.name + locale.translateMap(enhancement?.translations)?.name ?? MISSING_VALUE }* ${locale.translate("for")} ${ - locale.translateMap(skill?.translations)?.name + locale.translateMap(skill?.translations)?.name ?? MISSING_VALUE }`, sentenceType: undefined, isMeta: false, } } - -/** - * Get the translation of an internal enhancement prerequisite. - */ -export const printInternalEnhancementPrerequisite = ( - getSpellById: GetById.Static.Spell, - getRitualById: GetById.Static.Ritual, - getLiturgicalChantById: GetById.Static.LiturgicalChant, - getCeremonyById: GetById.Static.Ceremony, - locale: LocaleEnvironment, - prerequisite: InternalEnhancementPrerequisite, - parentId: SkillWithEnhancementsIdentifier, -): PrerequisitePart | undefined => { - const skill = getSkill( - getSpellById, - getRitualById, - getLiturgicalChantById, - getCeremonyById, - parentId, - ) - - const enhancement = skill?.enhancements?.find(e => e.id === prerequisite.id) - - return { - label: `${printLabel(locale, parentId)} `, - value: `*${locale.translateMap(enhancement?.translations)?.name}*`, - sentenceType: undefined, - isMeta: false, - } -} diff --git a/src/entities/partial/prerequisites/single/influence.ts b/src/entities/partial/prerequisites/single/influence.ts index 34e4c5b..4bc9c5e 100644 --- a/src/entities/partial/prerequisites/single/influence.ts +++ b/src/entities/partial/prerequisites/single/influence.ts @@ -1,4 +1,4 @@ -import { InfluencePrerequisite } from "optolith-database-schema/types/prerequisites/single/InfluencePrerequisite" +import { InfluencePrerequisite } from "optolith-database-schema/gen" import { LocaleEnvironment } from "../../../../helpers/locale.js" import { MISSING_VALUE } from "../../unknown.js" import { printDisplayOption } from "../displayOption.js" diff --git a/src/entities/partial/prerequisites/single/magicalTradition.ts b/src/entities/partial/prerequisites/single/magicalTradition.ts index a573f68..d8d7db3 100644 --- a/src/entities/partial/prerequisites/single/magicalTradition.ts +++ b/src/entities/partial/prerequisites/single/magicalTradition.ts @@ -1,8 +1,8 @@ import { assertExhaustive } from "@optolith/helpers/typeSafety" -import { +import type { MagicalTraditionPrerequisite, MagicalTraditionPrerequisiteRestriction, -} from "optolith-database-schema/types/prerequisites/single/TraditionPrerequisite" +} from "optolith-database-schema/gen" import { LocaleEnvironment } from "../../../../helpers/locale.js" import { printDisplayOption } from "../displayOption.js" import { PrerequisitePart } from "../part.js" @@ -11,17 +11,11 @@ const printValue = ( locale: LocaleEnvironment, restriction: MagicalTraditionPrerequisiteRestriction | undefined, ) => { - switch (restriction) { + switch (restriction?.kind) { case "CanLearnRituals": - return locale.translate( - "Tradition must be able to use rituals", - locale.translate("Church"), - ) + return locale.translate("Tradition must be able to use rituals") case "CanBindFamiliars": - return locale.translate( - "Tradition must be able to bind familiars", - locale.translate("Shaman"), - ) + return locale.translate("Tradition must be able to bind familiars") case undefined: return locale.translate("Tradition") default: diff --git a/src/entities/partial/prerequisites/single/noOtherAncestorBloodAdvantage.ts b/src/entities/partial/prerequisites/single/noOtherAncestorBloodAdvantage.ts index 1deb4ed..14168f5 100644 --- a/src/entities/partial/prerequisites/single/noOtherAncestorBloodAdvantage.ts +++ b/src/entities/partial/prerequisites/single/noOtherAncestorBloodAdvantage.ts @@ -6,7 +6,6 @@ import { PrerequisitePart } from "../part.js" */ export const printNoOtherAncestorBloodAdvantagePrerequisite = ( locale: LocaleEnvironment, - _prerequisite: Record, ): PrerequisitePart | undefined => ({ value: locale.translate("no other ancestor blood advantage"), sentenceType: undefined, diff --git a/src/entities/partial/prerequisites/single/pact.ts b/src/entities/partial/prerequisites/single/pact.ts index b444ce8..51c2e04 100644 --- a/src/entities/partial/prerequisites/single/pact.ts +++ b/src/entities/partial/prerequisites/single/pact.ts @@ -1,7 +1,7 @@ import { isNotNullish } from "@optolith/helpers/nullable" import { romanize } from "@optolith/helpers/roman" -import { PactPrerequisite } from "optolith-database-schema/types/prerequisites/single/PactPrerequisite" -import { GetById } from "../../../../helpers/getTypes.js" +import type { PactPrerequisite } from "optolith-database-schema/gen" +import { type GetInstanceById } from "../../../../helpers/getTypes.js" import { LocaleEnvironment } from "../../../../helpers/locale.js" import { MISSING_VALUE } from "../../unknown.js" import { printDisplayOption } from "../displayOption.js" @@ -11,7 +11,7 @@ import { PrerequisitePart } from "../part.js" * Get the translation of a culture prerequisite. */ export const printPactPrerequisite = ( - getPactCategoryById: GetById.Static.PactCategory, + getInstanceById: GetInstanceById<"PactCategory" | "PactDomain">, locale: LocaleEnvironment, prerequisite: PactPrerequisite, ): PrerequisitePart | undefined => { @@ -19,31 +19,26 @@ export const printPactPrerequisite = ( return printDisplayOption(locale, prerequisite.display_option) } - const pactCategory = getPactCategoryById( - prerequisite.category.id.pact_category, - ) + const pactCategory = getInstanceById("PactCategory", prerequisite.category) const parts = [ - prerequisite.domain_id === undefined + prerequisite.domain === undefined ? undefined - : locale.translate( - "domain {0}", - locale.joinDisjunctionList( - prerequisite.domain_id.map( - ref => + : locale.translate("domain {$domain}", { + domain: locale.joinDisjunctionList( + prerequisite.domain.map( + id => locale.translateMap( - pactCategory?.domains.find( - domain => domain.id === ref.id.pact_domain, - )?.translations, + getInstanceById("PactDomain", id)?.translations, )?.name ?? MISSING_VALUE, ), ), - ), - locale.translate( - "{0} level {1}", - locale.translateMap(pactCategory?.translations)?.name ?? MISSING_VALUE, - romanize(prerequisite.level ?? 1), - ), + }), + locale.translate("{$pact} level {$pactLevel}", { + pact: + locale.translateMap(pactCategory?.translations)?.name ?? MISSING_VALUE, + pactLevel: romanize(prerequisite.level ?? 1), + }), ].filter(isNotNullish) return { diff --git a/src/entities/partial/prerequisites/single/personalityTrait.ts b/src/entities/partial/prerequisites/single/personalityTrait.ts new file mode 100644 index 0000000..c479a69 --- /dev/null +++ b/src/entities/partial/prerequisites/single/personalityTrait.ts @@ -0,0 +1,47 @@ +import { type PersonalityTraitPrerequisite } from "optolith-database-schema/gen" +import { type GetInstanceById } from "../../../../helpers/getTypes.js" +import { LocaleEnvironment } from "../../../../helpers/locale.js" +import { printDisplayOption } from "../displayOption.js" +import { PrerequisitePart } from "../part.js" + +/** + * Get the translation of a personality trait prerequisite. + */ +export const printPersonalityTraitPrerequisite = ( + getInstanceById: GetInstanceById<"PersonalityTrait">, + locale: LocaleEnvironment, + prerequisite: PersonalityTraitPrerequisite, +): PrerequisitePart | undefined => { + if (prerequisite.display_option !== undefined) { + return printDisplayOption(locale, prerequisite.display_option) + } + + const personalityTrait = getInstanceById("PersonalityTrait", prerequisite.id) + const personalityTraitTranslation = locale.translateMap( + personalityTrait?.translations, + ) + + if ( + personalityTrait === undefined || + personalityTraitTranslation === undefined + ) { + return undefined + } + + const name = `${personalityTraitTranslation.name} (${locale.translate( + ".input {$level :number} {{Level {$level}}}", + { level: personalityTrait.level }, + )})` + + return { + value: prerequisite.active + ? locale.translate("cannot be chosen at the same time as {$trait}", { + trait: name, + }) + : locale.translate("must have {$trait}", { + trait: name, + }), + sentenceType: undefined, + isMeta: false, + } +} diff --git a/src/entities/partial/prerequisites/single/primaryAttribute.ts b/src/entities/partial/prerequisites/single/primaryAttribute.ts index 7d48211..256216f 100644 --- a/src/entities/partial/prerequisites/single/primaryAttribute.ts +++ b/src/entities/partial/prerequisites/single/primaryAttribute.ts @@ -1,4 +1,4 @@ -import { PrimaryAttributePrerequisite } from "optolith-database-schema/types/prerequisites/single/PrimaryAttributePrerequisite" +import { PrimaryAttributePrerequisite } from "optolith-database-schema/gen" import { LocaleEnvironment } from "../../../../helpers/locale.js" import { printDisplayOption } from "../displayOption.js" import { PrerequisitePart } from "../part.js" diff --git a/src/entities/partial/prerequisites/single/publication.ts b/src/entities/partial/prerequisites/single/publication.ts index 946c850..28134bf 100644 --- a/src/entities/partial/prerequisites/single/publication.ts +++ b/src/entities/partial/prerequisites/single/publication.ts @@ -1,5 +1,5 @@ -import { PublicationPrerequisite } from "optolith-database-schema/types/prerequisites/single/PublicationPrerequisite" -import { GetById } from "../../../../helpers/getTypes.js" +import { PublicationPrerequisite } from "optolith-database-schema/gen" +import { type GetInstanceById } from "../../../../helpers/getTypes.js" import { LocaleEnvironment } from "../../../../helpers/locale.js" import { printDisplayOption } from "../displayOption.js" import { PrerequisitePart } from "../part.js" @@ -8,7 +8,7 @@ import { PrerequisitePart } from "../part.js" * Get the translation of a state prerequisite. */ export const printPublicationPrerequisite = ( - getPublicationById: GetById.Static.Publication, + getInstanceById: GetInstanceById<"Publication">, locale: LocaleEnvironment, prerequisite: PublicationPrerequisite, ): PrerequisitePart | undefined => { @@ -16,7 +16,7 @@ export const printPublicationPrerequisite = ( return printDisplayOption(locale, prerequisite.display_option) } - const publication = getPublicationById(prerequisite.id.publication) + const publication = getInstanceById("Publication", prerequisite.id) const publicationTranslation = locale.translateMap(publication?.translations) if (publicationTranslation === undefined) { diff --git a/src/entities/partial/prerequisites/single/race.ts b/src/entities/partial/prerequisites/single/race.ts index 9b180be..4ec811d 100644 --- a/src/entities/partial/prerequisites/single/race.ts +++ b/src/entities/partial/prerequisites/single/race.ts @@ -1,5 +1,5 @@ -import { RacePrerequisite } from "optolith-database-schema/types/prerequisites/single/RacePrerequisite" -import { GetById } from "../../../../helpers/getTypes.js" +import { RacePrerequisite } from "optolith-database-schema/gen" +import { type GetInstanceById } from "../../../../helpers/getTypes.js" import { LocaleEnvironment } from "../../../../helpers/locale.js" import { printDisplayOption } from "../displayOption.js" import { PrerequisitePart } from "../part.js" @@ -8,7 +8,7 @@ import { PrerequisitePart } from "../part.js" * Get the translation of a race prerequisite. */ export const printRacePrerequisite = ( - getRaceById: GetById.Static.Race, + getInstanceById: GetInstanceById<"Race">, locale: LocaleEnvironment, prerequisite: RacePrerequisite, ): PrerequisitePart | undefined => { @@ -16,7 +16,7 @@ export const printRacePrerequisite = ( return printDisplayOption(locale, prerequisite.display_option) } - const race = getRaceById(prerequisite.id.race) + const race = getInstanceById("Race", prerequisite.id) const raceTranslation = locale.translateMap(race?.translations) if (raceTranslation === undefined) { diff --git a/src/entities/partial/prerequisites/single/rated.ts b/src/entities/partial/prerequisites/single/rated.ts index 3ee0f0a..3ee2d5f 100644 --- a/src/entities/partial/prerequisites/single/rated.ts +++ b/src/entities/partial/prerequisites/single/rated.ts @@ -1,68 +1,75 @@ import { assertExhaustive } from "@optolith/helpers/typeSafety" -import { RatedIdentifier } from "optolith-database-schema/types/_IdentifierGroup" -import { RatedPrerequisite } from "optolith-database-schema/types/prerequisites/single/RatedPrerequisite" -import { GetById } from "../../../../helpers/getTypes.js" +import type { + RatedIdentifier, + RatedPrerequisite, +} from "optolith-database-schema/gen" +import { type GetInstanceById } from "../../../../helpers/getTypes.js" import { LocaleEnvironment } from "../../../../helpers/locale.js" import { MISSING_VALUE } from "../../unknown.js" import { printDisplayOption } from "../displayOption.js" import { PrerequisitePart } from "../part.js" const printRatedName = ( - getAttributeById: GetById.Static.Attribute, - getSkillById: GetById.Static.Skill, - getCloseCombatTechniqueById: GetById.Static.CloseCombatTechnique, - getRangedCombatTechniqueById: GetById.Static.RangedCombatTechnique, - getSpellById: GetById.Static.Spell, - getRitualById: GetById.Static.Ritual, - getLiturgicalChantById: GetById.Static.LiturgicalChant, - getCeremonyById: GetById.Static.Ceremony, + getInstanceById: GetInstanceById< + | "Attribute" + | "Skill" + | "CloseCombatTechnique" + | "RangedCombatTechnique" + | "Spell" + | "Ritual" + | "LiturgicalChant" + | "Ceremony" + >, locale: LocaleEnvironment, id: RatedIdentifier, ) => { - switch (id.tag) { + switch (id.kind) { case "Attribute": return ( - locale.translateMap(getAttributeById(id.attribute)?.translations) - ?.name ?? MISSING_VALUE + locale.translateMap( + getInstanceById("Attribute", id.Attribute)?.translations, + )?.name ?? MISSING_VALUE ) case "Skill": return ( - locale.translateMap(getSkillById(id.skill)?.translations)?.name ?? - MISSING_VALUE + locale.translateMap(getInstanceById("Skill", id.Skill)?.translations) + ?.name ?? MISSING_VALUE ) case "CloseCombatTechnique": return ( locale.translateMap( - getCloseCombatTechniqueById(id.close_combat_technique)?.translations, + getInstanceById("CloseCombatTechnique", id.CloseCombatTechnique) + ?.translations, )?.name ?? MISSING_VALUE ) case "RangedCombatTechnique": return ( locale.translateMap( - getRangedCombatTechniqueById(id.ranged_combat_technique) + getInstanceById("RangedCombatTechnique", id.RangedCombatTechnique) ?.translations, )?.name ?? MISSING_VALUE ) case "Spell": return ( - locale.translateMap(getSpellById(id.spell)?.translations)?.name ?? - MISSING_VALUE + locale.translateMap(getInstanceById("Spell", id.Spell)?.translations) + ?.name ?? MISSING_VALUE ) case "Ritual": return ( - locale.translateMap(getRitualById(id.ritual)?.translations)?.name ?? - MISSING_VALUE + locale.translateMap(getInstanceById("Ritual", id.Ritual)?.translations) + ?.name ?? MISSING_VALUE ) case "LiturgicalChant": return ( locale.translateMap( - getLiturgicalChantById(id.liturgical_chant)?.translations, + getInstanceById("LiturgicalChant", id.LiturgicalChant)?.translations, )?.name ?? MISSING_VALUE ) case "Ceremony": return ( - locale.translateMap(getCeremonyById(id.ceremony)?.translations)?.name ?? - MISSING_VALUE + locale.translateMap( + getInstanceById("Ceremony", id.Ceremony)?.translations, + )?.name ?? MISSING_VALUE ) default: return assertExhaustive(id) @@ -73,14 +80,16 @@ const printRatedName = ( * Get the translation of a blessed tradition prerequisite. */ export const printRatedPrerequisite = ( - getAttributeById: GetById.Static.Attribute, - getSkillById: GetById.Static.Skill, - getCloseCombatTechniqueById: GetById.Static.CloseCombatTechnique, - getRangedCombatTechniqueById: GetById.Static.RangedCombatTechnique, - getSpellById: GetById.Static.Spell, - getRitualById: GetById.Static.Ritual, - getLiturgicalChantById: GetById.Static.LiturgicalChant, - getCeremonyById: GetById.Static.Ceremony, + getInstanceById: GetInstanceById< + | "Attribute" + | "Skill" + | "CloseCombatTechnique" + | "RangedCombatTechnique" + | "Spell" + | "Ritual" + | "LiturgicalChant" + | "Ceremony" + >, locale: LocaleEnvironment, prerequisite: RatedPrerequisite, ): PrerequisitePart | undefined => { @@ -89,18 +98,9 @@ export const printRatedPrerequisite = ( } return { - value: `${printRatedName( - getAttributeById, - getSkillById, - getCloseCombatTechniqueById, - getRangedCombatTechniqueById, - getSpellById, - getRitualById, - getLiturgicalChantById, - getCeremonyById, - locale, - prerequisite.id, - )} ${prerequisite.value}`, + value: `${printRatedName(getInstanceById, locale, prerequisite.id)} ${ + prerequisite.value + }`, sentenceType: undefined, isMeta: false, } diff --git a/src/entities/partial/prerequisites/single/ratedMinimumNumber.ts b/src/entities/partial/prerequisites/single/ratedMinimumNumber.ts index c5e818c..d462a97 100644 --- a/src/entities/partial/prerequisites/single/ratedMinimumNumber.ts +++ b/src/entities/partial/prerequisites/single/ratedMinimumNumber.ts @@ -1,10 +1,10 @@ import { isNotNullish } from "@optolith/helpers/nullable" import { assertExhaustive } from "@optolith/helpers/typeSafety" -import { - CombatTechniquesTargetGroup, +import type { RatedMinimumNumberPrerequisite, -} from "optolith-database-schema/types/prerequisites/single/RatedMinimumNumberPrerequisite" -import { GetById } from "../../../../helpers/getTypes.js" + RatedMinimumNumberPrerequisiteCombatTechniquesTargetGroup, +} from "optolith-database-schema/gen" +import { type GetInstanceById } from "../../../../helpers/getTypes.js" import { LocaleEnvironment } from "../../../../helpers/locale.js" import { MISSING_VALUE } from "../../unknown.js" import { printDisplayOption } from "../displayOption.js" @@ -13,121 +13,44 @@ import { PrerequisitePart } from "../part.js" const printNumberOfTheFollowingSkills = ( locale: LocaleEnvironment, number: number, -): string => { - switch (number) { - case 1: - return locale.translate("one of the following skills") - case 2: - return locale.translate("two of the following skills") - case 3: - return locale.translate("three of the following skills") - case 4: - return locale.translate("four of the following skills") - case 5: - return locale.translate("five of the following skills") - case 6: - return locale.translate("six of the following skills") - case 7: - return locale.translate("seven of the following skills") - case 8: - return locale.translate("eight of the following skills") - case 9: - return locale.translate("nine of the following skills") - default: - return locale.translate("{0} of the following skills") - } -} +): string => + locale.translate( + ".input {$count :number} {{{$count} of the following skills}}", + { count: number }, + ) const printNumberOfAllCombatTechniques = ( locale: LocaleEnvironment, number: number, -): string => { - switch (number) { - case 1: - return locale.translate("one combat technique") - case 2: - return locale.translate("two combat techniques") - case 3: - return locale.translate("three combat techniques") - case 4: - return locale.translate("four combat techniques") - case 5: - return locale.translate("five combat techniques") - case 6: - return locale.translate("six combat techniques") - case 7: - return locale.translate("seven combat techniques") - case 8: - return locale.translate("eight combat techniques") - case 9: - return locale.translate("nine combat techniques") - default: - return locale.translate("{0} combat techniques") - } -} +): string => + locale.translate(".input {$count :number} {{{$count} combat techniques}}", { + count: number, + }) const printNumberOfCloseCombatTechniques = ( locale: LocaleEnvironment, number: number, -): string => { - switch (number) { - case 1: - return locale.translate("one close combat technique") - case 2: - return locale.translate("two close combat techniques") - case 3: - return locale.translate("three close combat techniques") - case 4: - return locale.translate("four close combat techniques") - case 5: - return locale.translate("five close combat techniques") - case 6: - return locale.translate("six close combat techniques") - case 7: - return locale.translate("seven close combat techniques") - case 8: - return locale.translate("eight close combat techniques") - case 9: - return locale.translate("nine close combat techniques") - default: - return locale.translate("{0} close combat techniques") - } -} +): string => + locale.translate( + ".input {$count :number} {{{$count} close combat techniques}}", + { count: number }, + ) const printNumberOfRangedCombatTechniques = ( locale: LocaleEnvironment, number: number, -): string => { - switch (number) { - case 1: - return locale.translate("one ranged combat technique") - case 2: - return locale.translate("two ranged combat techniques") - case 3: - return locale.translate("three ranged combat techniques") - case 4: - return locale.translate("four ranged combat techniques") - case 5: - return locale.translate("five ranged combat techniques") - case 6: - return locale.translate("six ranged combat techniques") - case 7: - return locale.translate("seven ranged combat techniques") - case 8: - return locale.translate("eight ranged combat techniques") - case 9: - return locale.translate("nine ranged combat techniques") - default: - return locale.translate("{0} ranged combat techniques") - } -} +): string => + locale.translate( + ".input {$count :number} {{{$count} ranged combat techniques}}", + { count: number }, + ) const printNumberOfCombatTechniques = ( locale: LocaleEnvironment, - category: CombatTechniquesTargetGroup, + category: RatedMinimumNumberPrerequisiteCombatTechniquesTargetGroup, number: number, ): string => { - switch (category) { + switch (category.kind) { case "All": return printNumberOfAllCombatTechniques(locale, number) case "Close": @@ -143,9 +66,7 @@ const printNumberOfCombatTechniques = ( * Get the translation of a rated minimum number prerequisite. */ export const printRatedMinimumNumberPrerequisite = ( - getSkillById: GetById.Static.Skill, - getPropertyById: GetById.Static.Property, - getAspectById: GetById.Static.Aspect, + getInstanceById: GetInstanceById<"Skill" | "Property" | "Aspect">, locale: LocaleEnvironment, prerequisite: RatedMinimumNumberPrerequisite, ): PrerequisitePart | undefined => { @@ -153,21 +74,24 @@ export const printRatedMinimumNumberPrerequisite = ( return printDisplayOption(locale, prerequisite.display_option) } - switch (prerequisite.targets.tag) { + switch (prerequisite.targets.kind) { case "Skills": { - const skills = prerequisite.targets.skills.list + const skills = prerequisite.targets.Skills.targets .map( - ref => - locale.translateMap(getSkillById(ref.id.skill)?.translations)?.name, + id => + locale.translateMap(getInstanceById("Skill", id)?.translations) + ?.name, ) .filter(isNotNullish) return { value: locale.translate( - "{0} on at least SR {1}: {2}", // zwei der folgenden Talente mindestens FW 10: - printNumberOfTheFollowingSkills(locale, prerequisite.number), - prerequisite.value, - locale.joinConjunctionList(skills), + ".input {$minRating :number} {{{$count} on at least SR {$minRating}: {$list}}}", // zwei der folgenden Talente mindestens FW 10: + { + count: printNumberOfTheFollowingSkills(locale, prerequisite.number), + minRating: prerequisite.value, + list: locale.joinConjunctionList(skills), + }, ), sentenceType: undefined, isMeta: false, @@ -184,7 +108,7 @@ export const printRatedMinimumNumberPrerequisite = ( return { value: `${printNumberOfCombatTechniques( locale, - prerequisite.targets.combat_techniques.group, + prerequisite.targets.CombatTechniques.group, prerequisite.number, )} ${prerequisite.value}`, sentenceType: undefined, @@ -195,13 +119,18 @@ export const printRatedMinimumNumberPrerequisite = ( case "Spellworks": { return { value: locale.translate( - "{0} arcane works with the property {1} at SR {2} or higher", - prerequisite.number, - locale.translateMap( - getPropertyById(prerequisite.targets.spellworks.id.property) - ?.translations, - )?.name ?? MISSING_VALUE, - prerequisite.value, + ".input {$count :number} .input {$minRating :number} {{{$count} arcane works with the property {$property} at SR {$minRating} or higher}}", + { + count: prerequisite.number, + property: + locale.translateMap( + getInstanceById( + "Property", + prerequisite.targets.Spellworks.property, + )?.translations, + )?.name ?? MISSING_VALUE, + minRating: prerequisite.value, + }, ), sentenceType: undefined, isMeta: false, @@ -211,13 +140,16 @@ export const printRatedMinimumNumberPrerequisite = ( case "Liturgies": { return { value: locale.translate( - "{0} liturgical chants and ceremonies with the aspect {1} at SR {2} or higher", - prerequisite.number, - locale.translateMap( - getAspectById(prerequisite.targets.liturgies.id.aspect) - ?.translations, - )?.name ?? MISSING_VALUE, - prerequisite.value, + ".input {$count :number} .input {$minRating :number} {{{$count} liturgical chants and ceremonies with the aspect {$aspect} at SR {$minRating} or higher}}", + { + count: prerequisite.number, + aspect: + locale.translateMap( + getInstanceById("Aspect", prerequisite.targets.Liturgies.aspect) + ?.translations, + )?.name ?? MISSING_VALUE, + minRating: prerequisite.value, + }, ), sentenceType: undefined, isMeta: false, diff --git a/src/entities/partial/prerequisites/single/ratedSum.ts b/src/entities/partial/prerequisites/single/ratedSum.ts index de9055f..a82b6ae 100644 --- a/src/entities/partial/prerequisites/single/ratedSum.ts +++ b/src/entities/partial/prerequisites/single/ratedSum.ts @@ -1,6 +1,6 @@ import { isNotNullish } from "@optolith/helpers/nullable" -import { RatedSumPrerequisite } from "optolith-database-schema/types/prerequisites/single/RatedSumPrerequisite" -import { GetById } from "../../../../helpers/getTypes.js" +import { RatedSumPrerequisite } from "optolith-database-schema/gen" +import { type GetInstanceById } from "../../../../helpers/getTypes.js" import { LocaleEnvironment } from "../../../../helpers/locale.js" import { printDisplayOption } from "../displayOption.js" import { PrerequisitePart } from "../part.js" @@ -9,7 +9,7 @@ import { PrerequisitePart } from "../part.js" * Get the translation of a rated sum prerequisite. */ export const printRatedSumPrerequisite = ( - getSkillById: GetById.Static.Skill, + getInstanceById: GetInstanceById<"Skill">, locale: LocaleEnvironment, prerequisite: RatedSumPrerequisite, ): PrerequisitePart | undefined => { @@ -19,16 +19,19 @@ export const printRatedSumPrerequisite = ( const skills = prerequisite.targets .map( - target => - locale.translateMap(getSkillById(target.skill)?.translations)?.name, + skillId => + locale.translateMap(getInstanceById("Skill", skillId)?.translations) + ?.name, ) .filter(isNotNullish) return { value: locale.translate( - "the SR for {0} combined must add up to at least {1}", - locale.joinConjunctionList(skills), - prerequisite.sum, + "the SR for {$skill} combined must add up to at least {$minRating}", + { + skill: locale.joinConjunctionList(skills), + minRating: prerequisite.sum, + }, ), sentenceType: undefined, isMeta: false, diff --git a/src/entities/partial/prerequisites/single/rule.ts b/src/entities/partial/prerequisites/single/rule.ts index b4d9a88..8a42f2e 100644 --- a/src/entities/partial/prerequisites/single/rule.ts +++ b/src/entities/partial/prerequisites/single/rule.ts @@ -1,4 +1,4 @@ -import { RulePrerequisite } from "optolith-database-schema/types/prerequisites/single/RulePrerequisite" +import { RulePrerequisite } from "optolith-database-schema/gen" import { LocaleEnvironment } from "../../../../helpers/locale.js" import { PrerequisitePart } from "../part.js" diff --git a/src/entities/partial/prerequisites/single/sex.ts b/src/entities/partial/prerequisites/single/sex.ts index 41d2505..24a9e62 100644 --- a/src/entities/partial/prerequisites/single/sex.ts +++ b/src/entities/partial/prerequisites/single/sex.ts @@ -1,11 +1,10 @@ import { assertExhaustive } from "@optolith/helpers/typeSafety" -import { BinarySex } from "optolith-database-schema/types/_Sex" -import { SexPrerequisite } from "optolith-database-schema/types/prerequisites/single/SexPrerequisite" +import type { BinarySex, SexPrerequisite } from "optolith-database-schema/gen" import { LocaleEnvironment } from "../../../../helpers/locale.js" import { PrerequisitePart } from "../part.js" const printId = (locale: LocaleEnvironment, id: BinarySex): string => { - switch (id) { + switch (id.kind) { case "Male": return locale.translate("Male") case "Female": diff --git a/src/entities/partial/prerequisites/single/sexualCharacteristic.ts b/src/entities/partial/prerequisites/single/sexualCharacteristic.ts index 2965156..d7878db 100644 --- a/src/entities/partial/prerequisites/single/sexualCharacteristic.ts +++ b/src/entities/partial/prerequisites/single/sexualCharacteristic.ts @@ -2,7 +2,7 @@ import { assertExhaustive } from "@optolith/helpers/typeSafety" import { SexualCharacteristic, SexualCharacteristicPrerequisite, -} from "optolith-database-schema/types/prerequisites/single/SexualCharacteristicPrerequisite" +} from "optolith-database-schema/gen" import { LocaleEnvironment } from "../../../../helpers/locale.js" import { PrerequisitePart } from "../part.js" @@ -10,7 +10,7 @@ const printId = ( locale: LocaleEnvironment, id: SexualCharacteristic, ): string => { - switch (id) { + switch (id.kind) { case "Penis": return locale.translate("Penis") case "Vagina": @@ -27,7 +27,9 @@ export const printSexualCharacteristicPrerequisite = ( locale: LocaleEnvironment, prerequisite: SexualCharacteristicPrerequisite, ): PrerequisitePart | undefined => ({ - value: locale.translate("Person with {0}", printId(locale, prerequisite.id)), + value: locale.translate("Person with {$sexualCharacteristic}", { + sexualCharacteristic: printId(locale, prerequisite.id), + }), sentenceType: undefined, isMeta: false, }) diff --git a/src/entities/partial/prerequisites/single/socialStatus.ts b/src/entities/partial/prerequisites/single/socialStatus.ts index 923c691..0ca6ff0 100644 --- a/src/entities/partial/prerequisites/single/socialStatus.ts +++ b/src/entities/partial/prerequisites/single/socialStatus.ts @@ -1,5 +1,5 @@ -import { SocialStatusPrerequisite } from "optolith-database-schema/types/prerequisites/single/SocialStatusPrerequisite" -import { GetById } from "../../../../helpers/getTypes.js" +import type { SocialStatusPrerequisite } from "optolith-database-schema/gen" +import { type GetInstanceById } from "../../../../helpers/getTypes.js" import { LocaleEnvironment } from "../../../../helpers/locale.js" import { printDisplayOption } from "../displayOption.js" import { PrerequisitePart } from "../part.js" @@ -8,7 +8,7 @@ import { PrerequisitePart } from "../part.js" * Get the translation of a social status prerequisite. */ export const printSocialStatusPrerequisite = ( - getSocialStatusById: GetById.Static.SocialStatus, + getInstanceById: GetInstanceById<"SocialStatus">, locale: LocaleEnvironment, prerequisite: SocialStatusPrerequisite, ): PrerequisitePart | undefined => { @@ -16,7 +16,7 @@ export const printSocialStatusPrerequisite = ( return printDisplayOption(locale, prerequisite.display_option) } - const socialStatus = getSocialStatusById(prerequisite.id.social_status) + const socialStatus = getInstanceById("SocialStatus", prerequisite.id) const socialStatusTranslation = locale.translateMap( socialStatus?.translations, ) @@ -26,8 +26,9 @@ export const printSocialStatusPrerequisite = ( } return { - label: `${locale.translate("Social Status {0} or higher")} `, - value: `*${socialStatusTranslation.name}*`, + value: `${locale.translate("Social Status {$minStatus} or higher", { + minStatus: `*${socialStatusTranslation.name}*`, + })} `, sentenceType: undefined, isMeta: false, } diff --git a/src/entities/partial/prerequisites/single/state.ts b/src/entities/partial/prerequisites/single/state.ts index a58e0cd..640dfd5 100644 --- a/src/entities/partial/prerequisites/single/state.ts +++ b/src/entities/partial/prerequisites/single/state.ts @@ -1,5 +1,5 @@ -import { StatePrerequisite } from "optolith-database-schema/types/prerequisites/single/StatePrerequisite" -import { GetById } from "../../../../helpers/getTypes.js" +import { StatePrerequisite } from "optolith-database-schema/gen" +import { type GetInstanceById } from "../../../../helpers/getTypes.js" import { LocaleEnvironment } from "../../../../helpers/locale.js" import { printDisplayOption } from "../displayOption.js" import { PrerequisitePart } from "../part.js" @@ -8,7 +8,7 @@ import { PrerequisitePart } from "../part.js" * Get the translation of a state prerequisite. */ export const printStatePrerequisite = ( - getStateById: GetById.Static.State, + getInstanceById: GetInstanceById<"State">, locale: LocaleEnvironment, prerequisite: StatePrerequisite, ): PrerequisitePart | undefined => { @@ -16,7 +16,7 @@ export const printStatePrerequisite = ( return printDisplayOption(locale, prerequisite.display_option) } - const state = getStateById(prerequisite.id.state) + const state = getInstanceById("State", prerequisite.id) const stateTranslation = locale.translateMap(state?.translations) if (stateTranslation === undefined) { diff --git a/src/entities/partial/prerequisites/single/text.ts b/src/entities/partial/prerequisites/single/text.ts index 568db6b..11addea 100644 --- a/src/entities/partial/prerequisites/single/text.ts +++ b/src/entities/partial/prerequisites/single/text.ts @@ -1,4 +1,4 @@ -import { TextPrerequisite } from "optolith-database-schema/types/prerequisites/single/TextPrerequisite" +import { TextPrerequisite } from "optolith-database-schema/gen" import { LocaleEnvironment } from "../../../../helpers/locale.js" import { MISSING_VALUE } from "../../unknown.js" import { PrerequisitePart } from "../part.js" @@ -10,7 +10,7 @@ export const printTextPrerequisite = ( locale: LocaleEnvironment, prerequisite: TextPrerequisite, ): PrerequisitePart => ({ - value: locale.translateMap(prerequisite.translations) ?? MISSING_VALUE, + value: locale.translateMap(prerequisite.translations)?.text ?? MISSING_VALUE, sentenceType: prerequisite.sentence_type, isMeta: prerequisite.is_meta ?? false, }) diff --git a/src/entities/partial/rated/activatable/castingTime.ts b/src/entities/partial/rated/activatable/castingTime.ts index 79efc82..9b2a6a6 100644 --- a/src/entities/partial/rated/activatable/castingTime.ts +++ b/src/entities/partial/rated/activatable/castingTime.ts @@ -9,8 +9,9 @@ import { ModifiableCastingTime, SlowCastingTime, SlowSkillNonModifiableCastingTime, -} from "optolith-database-schema/types/_ActivatableSkillCastingTime" -import { GetById } from "../../../../helpers/getTypes.js" +} from "optolith-database-schema/gen" +import { Case } from "../../../../helpers/enums.js" +import type { GetInstanceById } from "../../../../helpers/getTypes.js" import { LocaleEnvironment } from "../../../../helpers/locale.js" import { ResponsiveTextSize } from "../../responsiveText.js" import { formatTimeSpan } from "../../units/timeSpan.js" @@ -23,21 +24,21 @@ import { import { getModifiableBySpeed, Speed } from "./speed.js" const getModifiableCastingTimeTranslation = ( - getSkillModificationLevelById: GetById.Static.SkillModificationLevel, + getInstanceById: GetInstanceById<"SkillModificationLevel">, locale: LocaleEnvironment, speed: Speed, responsiveTextSize: ResponsiveTextSize, value: ModifiableCastingTime, ): string => mapNullable( - getSkillModificationLevelById(value.initial_modification_level), + getInstanceById("SkillModificationLevel", value.initial_modification_level), modificationLevel => getModifiableBySpeed( config => formatTimeSpan( locale, responsiveTextSize, - "Actions", + Case("Actions"), config.casting_time, ), config => @@ -57,7 +58,7 @@ const getFastSkillNonModifiableCastingTimeTranslation = ( responsiveTextSize: ResponsiveTextSize, value: FastSkillNonModifiableCastingTime, ): string => - formatTimeSpan(locale, responsiveTextSize, "Actions", value.actions) + formatTimeSpan(locale, responsiveTextSize, Case("Actions"), value.actions) const getSlowSkillNonModifiableCastingTimeTranslation = ( locale: LocaleEnvironment, @@ -67,25 +68,25 @@ const getSlowSkillNonModifiableCastingTimeTranslation = ( const getCastingTimeTranslation = ( getNonModifiableCastingTimeTranslation: (value: NonModifiable) => string, - getSkillModificationLevelById: GetById.Static.SkillModificationLevel, + getInstanceById: GetInstanceById<"SkillModificationLevel">, locale: LocaleEnvironment, speed: Speed, entity: Entity, responsiveTextSize: ResponsiveTextSize, value: CastingTime, ): string => { - switch (value.tag) { + switch (value.kind) { case "Modifiable": return getModifiableCastingTimeTranslation( - getSkillModificationLevelById, + getInstanceById, locale, speed, responsiveTextSize, - value.modifiable, + value.Modifiable, ) case "NonModifiable": return ( - getNonModifiableCastingTimeTranslation(value.non_modifiable) + + getNonModifiableCastingTimeTranslation(value.NonModifiable) + getNonModifiableSuffixTranslation( locale, entity, @@ -108,7 +109,7 @@ const getCastingTimeIncludingLovemakingTranslation = < NonModifiable extends object, >( getNonModifiableCastingTimeTranslation: (value: NonModifiable) => string, - getSkillModificationLevelById: GetById.Static.SkillModificationLevel, + getInstanceById: GetInstanceById<"SkillModificationLevel">, locale: LocaleEnvironment, speed: Speed, entity: Entity, @@ -119,7 +120,7 @@ const getCastingTimeIncludingLovemakingTranslation = < mapNullable(value.default, def => getCastingTimeTranslation( getNonModifiableCastingTimeTranslation, - getSkillModificationLevelById, + getInstanceById, locale, speed, entity, @@ -142,7 +143,7 @@ const getCastingTimeIncludingLovemakingTranslation = < * Get the text for the casting time of a fast activatable skill. */ export const getFastCastingTimeTranslation = ( - getSkillModificationLevelById: GetById.Static.SkillModificationLevel, + getInstanceById: GetInstanceById<"SkillModificationLevel">, locale: LocaleEnvironment, entity: Entity, responsiveTextSize: ResponsiveTextSize, @@ -155,7 +156,7 @@ export const getFastCastingTimeTranslation = ( responsiveTextSize, nonModifiableValue, ), - getSkillModificationLevelById, + getInstanceById, locale, Speed.Fast, entity, @@ -167,7 +168,7 @@ export const getFastCastingTimeTranslation = ( * Get the text for the casting time of a slow activatable skill. */ export const getSlowCastingTimeTranslation = ( - getSkillModificationLevelById: GetById.Static.SkillModificationLevel, + getInstanceById: GetInstanceById<"SkillModificationLevel">, locale: LocaleEnvironment, entity: Entity, responsiveTextSize: ResponsiveTextSize, @@ -180,7 +181,7 @@ export const getSlowCastingTimeTranslation = ( responsiveTextSize, nonModifiableValue, ), - getSkillModificationLevelById, + getInstanceById, locale, Speed.Slow, entity, diff --git a/src/entities/partial/rated/activatable/checkResultBased.ts b/src/entities/partial/rated/activatable/checkResultBased.ts index 8d75a7a..dd58f0a 100644 --- a/src/entities/partial/rated/activatable/checkResultBased.ts +++ b/src/entities/partial/rated/activatable/checkResultBased.ts @@ -1,17 +1,17 @@ import { mapNullableDefault } from "@optolith/helpers/nullable" import { assertExhaustive } from "@optolith/helpers/typeSafety" -import { +import type { CheckResultArithmetic, - CheckResultBased, + CheckResultBasedModifier, CheckResultValue, -} from "optolith-database-schema/types/_ActivatableSkillCheckResultBased" +} from "optolith-database-schema/gen" import { Translate } from "../../../../helpers/translate.js" const getCheckResultBaseValueTranslation = ( translate: Translate, baseValue: CheckResultValue, ) => { - switch (baseValue) { + switch (baseValue.kind) { case "QualityLevels": return translate("QL") case "SkillPoints": @@ -22,7 +22,7 @@ const getCheckResultBaseValueTranslation = ( } const getArithmeticSymbol = (arithmetic: CheckResultArithmetic) => { - switch (arithmetic) { + switch (arithmetic.kind) { case "Divide": return ` / ` case "Multiply": @@ -32,6 +32,18 @@ const getArithmeticSymbol = (arithmetic: CheckResultArithmetic) => { } } +interface CheckResultBased { + /** + * The base value that is derived from the check result. + */ + base: CheckResultValue + + /** + * If defined, it modifies the base value. + */ + modifier?: CheckResultBasedModifier +} + /** * Returns the value text for a check-result-based parameter of an activatable * skill. diff --git a/src/entities/partial/rated/activatable/cost.ts b/src/entities/partial/rated/activatable/cost.ts index 6b04288..e1a502e 100644 --- a/src/entities/partial/rated/activatable/cost.ts +++ b/src/entities/partial/rated/activatable/cost.ts @@ -1,7 +1,6 @@ import { mapNullable, mapNullableDefault } from "@optolith/helpers/nullable" import { assertExhaustive } from "@optolith/helpers/typeSafety" import { - CostMap, IndefiniteOneTimeCost, ModifiableOneTimeCost, ModifiableSustainedCost, @@ -12,12 +11,15 @@ import { OneTimeCost, SingleOneTimeCost, SustainedCost, -} from "optolith-database-schema/types/_ActivatableSkillCost" -import { GetById } from "../../../../helpers/getTypes.js" + type OneTimeCostMap, + type SustainedCostMap, +} from "optolith-database-schema/gen" +import type { GetInstanceById } from "../../../../helpers/getTypes.js" import { LocaleEnvironment } from "../../../../helpers/locale.js" import { appendNoteIfRequested, getResponsiveText, + getResponsiveTextOptional, replaceTextIfRequested, responsive, ResponsiveTextSize, @@ -34,7 +36,7 @@ import { import { getModifiableBySpeed, Speed } from "./speed.js" const getModifiableOneTimeCostTranslation = ( - getSkillModificationLevelById: GetById.Static.SkillModificationLevel, + getInstanceById: GetInstanceById<"SkillModificationLevel">, locale: LocaleEnvironment, responsiveTextSize: ResponsiveTextSize, entity: Entity, @@ -42,7 +44,7 @@ const getModifiableOneTimeCostTranslation = ( value: ModifiableOneTimeCost, ): string => mapNullable( - getSkillModificationLevelById(value.initial_modification_level), + getInstanceById("SkillModificationLevel", value.initial_modification_level), modificationLevel => { const cost = getModifiableBySpeed( config => config.cost, @@ -75,13 +77,15 @@ const getNonModifiableOneTimeCostPerCountableTranslation = ( const countableText = responsive( responsiveTextSize, - () => locale.translate(" per {0}", entity), - () => locale.translate("/{0}", entity), + () => locale.translate(" per {$value}", { value: entity }), + () => locale.translate("/{$value}", { value: entity }), ) const minimumTotalText = mapNullable(perCountable.minimum_total, minimumTotal => - locale.translate(", minimum of {0}", formatCost(minimumTotal)), + locale.translate(", minimum of {$value}", { + value: formatCost(minimumTotal), + }), ) ?? "" return countableText + minimumTotalText @@ -96,8 +100,14 @@ const getPermanentValueTranslation = ( ? "" : responsive( responsiveTextSize, - () => locale.translate(", {0} of which are permanent", permanentValue), - () => locale.translate(" ({0} perm.)", permanentValue), + () => + locale.translate( + ".input {$value :number} {{, {$value} of which are permanent}}", + { + value: permanentValue, + }, + ), + () => locale.translate(" ({$value} perm.)", { value: permanentValue }), ) const getNonModifiableOneTimeCostTranslation = ( @@ -164,36 +174,36 @@ const getIndefiniteOneTimeCostTranslation = ( ) const getSingleOneTimeCostTranslation = ( - getSkillModificationLevelById: GetById.Static.SkillModificationLevel, + getInstanceById: GetInstanceById<"SkillModificationLevel">, locale: LocaleEnvironment, speed: Speed, entity: Entity, responsiveTextSize: ResponsiveTextSize, value: SingleOneTimeCost, ): string => { - switch (value.tag) { + switch (value.kind) { case "Modifiable": return getModifiableOneTimeCostTranslation( - getSkillModificationLevelById, + getInstanceById, locale, responsiveTextSize, entity, speed, - value.modifiable, + value.Modifiable, ) case "NonModifiable": return getNonModifiableOneTimeCostTranslation( locale, entity, responsiveTextSize, - value.non_modifiable, + value.NonModifiable, ) case "Indefinite": return getIndefiniteOneTimeCostTranslation( locale, entity, responsiveTextSize, - value.indefinite, + value.Indefinite, ) default: return assertExhaustive(value) @@ -202,14 +212,14 @@ const getSingleOneTimeCostTranslation = ( const getMultipleOneTimeCostsTranslation = ( type: "conjunction" | "disjunction", - getSkillModificationLevelById: GetById.Static.SkillModificationLevel, + getInstanceById: GetInstanceById<"SkillModificationLevel">, locale: LocaleEnvironment, speed: Speed, entity: Entity, responsiveTextSize: ResponsiveTextSize, value: MultipleOneTimeCosts, ): string => { - const modifiable = !value.every(part => part.tag === "Modifiable") + const modifiable = !value.every(part => part.kind === "Modifiable") ? getNonModifiableSuffixTranslation( locale, entity, @@ -222,7 +232,7 @@ const getMultipleOneTimeCostsTranslation = ( value .map(part => getSingleOneTimeCostTranslation( - getSkillModificationLevelById, + getInstanceById, locale, speed, entity, @@ -253,11 +263,11 @@ const getMultipleOneTimeCostsTranslation = ( ) } -const getCostMapTranslation = ( +const getOneTimeCostMapTranslation = ( locale: LocaleEnvironment, entity: Entity, responsiveTextSize: ResponsiveTextSize, - value: CostMap, + value: OneTimeCostMap, ): string => { const translation = locale.translateMap(value.translations) @@ -266,7 +276,14 @@ const getCostMapTranslation = ( } if (translation?.replacement !== undefined) { - return translation.replacement + const res = getResponsiveTextOptional( + translation.replacement, + responsiveTextSize, + ) + + if (res !== undefined) { + return res + } } const labels = value.options @@ -304,62 +321,116 @@ const getCostMapTranslation = ( labels + (translation?.list_append ?? "") + (permanentCosts !== undefined - ? locale.translate( - ", {0} of which are permanent", - formatCostP(permanentCosts), - ) + ? locale.translate(", {$value} of which are permanent", { + value: formatCostP(permanentCosts), + }) : "") + notModifiable ) } +const getSustainedCostMapTranslation = ( + locale: LocaleEnvironment, + entity: Entity, + responsiveTextSize: ResponsiveTextSize, + value: SustainedCostMap, +): string => { + const translation = locale.translateMap(value.translations) + + if (value.translations !== undefined && translation === undefined) { + return MISSING_VALUE + } + + if (translation?.replacement !== undefined) { + const res = getResponsiveTextOptional( + translation.replacement, + responsiveTextSize, + ) + + if (res !== undefined) { + return res + } + } + + const labels = value.options + .map( + option => + locale.translateMap(option.translations)?.label ?? MISSING_VALUE, + ) + .join("/") + + const costs = value.options.map(option => option.value).join("/") + + const formatCostP = formatEnergyByEntity.bind(this, locale, entity) + + const notModifiable = getNonModifiableSuffixTranslation( + locale, + entity, + ModifiableParameter.Cost, + responsiveTextSize, + ) + + return ( + formatCostP(costs) + + locale.translate(" for ") + + mapNullableDefault( + translation?.listPrefix, + listPrepend => `${listPrepend} `, + "", + ) + + labels + + (translation?.listSuffix ?? "") + + notModifiable + ) +} + /** * Returns the text for the cost of a one-time activatable skill. */ export const getOneTimeCostTranslation = ( - getSkillModificationLevelById: GetById.Static.SkillModificationLevel, + getInstanceById: GetInstanceById<"SkillModificationLevel">, locale: LocaleEnvironment, speed: Speed, entity: Entity, responsiveTextSize: ResponsiveTextSize, value: OneTimeCost, ): string => { - switch (value.tag) { + switch (value.kind) { case "Single": return getSingleOneTimeCostTranslation( - getSkillModificationLevelById, + getInstanceById, locale, speed, entity, responsiveTextSize, - value.single, + value.Single, ) case "Conjunction": return getMultipleOneTimeCostsTranslation( "conjunction", - getSkillModificationLevelById, + getInstanceById, locale, speed, entity, responsiveTextSize, - value.conjunction, + value.Conjunction, ) case "Disjunction": return getMultipleOneTimeCostsTranslation( "disjunction", - getSkillModificationLevelById, + getInstanceById, locale, speed, entity, responsiveTextSize, - value.disjunction, + value.Disjunction, ) case "Map": - return getCostMapTranslation( + return getOneTimeCostMapTranslation( locale, entity, responsiveTextSize, - value.map, + value.Map, ) default: return assertExhaustive(value) @@ -367,7 +438,7 @@ export const getOneTimeCostTranslation = ( } const getModifiableSustainedCostTranslation = ( - getSkillModificationLevelById: GetById.Static.SkillModificationLevel, + getInstanceById: GetInstanceById<"SkillModificationLevel">, locale: LocaleEnvironment, speed: Speed, entity: Entity, @@ -375,7 +446,7 @@ const getModifiableSustainedCostTranslation = ( value: ModifiableSustainedCost, ) => mapNullable( - getSkillModificationLevelById(value.initial_modification_level), + getInstanceById("SkillModificationLevel", value.initial_modification_level), modificationLevel => { const cost = getModifiableBySpeed( config => config.cost, @@ -397,11 +468,13 @@ const getModifiableSustainedCostTranslation = ( responsiveTextSize, () => `${formatCostP(cost) + locale.translate(" (casting)")} + ${ - formatCostP(cost / 2) + locale.translate(" per {0}", interval) + formatCostP(cost / 2) + + locale.translate(" per {$value}", { value: interval }) }`, () => `${formatCostP(cost)} + ${ - formatCostP(cost / 2) + locale.translate("/{0}", interval) + formatCostP(cost / 2) + + locale.translate("/{$value}", { value: interval }) }`, ) }, @@ -427,16 +500,15 @@ const getNonModifiableSustainedCostTranslation = ( const perCountable = responsive( responsiveTextSize, - () => locale.translate(" per {0}", countable), - () => locale.translate("/{0}", countable), + () => locale.translate(" per {$value}", { value: countable }), + () => locale.translate("/{$value}", { value: countable }), ) const minimumTotal = value.per.minimum_total !== undefined - ? locale.translate( - ", minimum of {0}", - formatCostP(value.per.minimum_total), - ) + ? locale.translate(", minimum of {$value}", { + value: formatCostP(value.per.minimum_total), + }) : "" return { countable: perCountable, minimumTotal } @@ -458,13 +530,13 @@ const getNonModifiableSustainedCostTranslation = ( ? locale.translate("half of the activation cost") : formatCostP(value.value / 2)) + per.countable + - locale.translate(" per {0}", interval) + locale.translate(" per {$value}", { value: interval }) }`, () => `${formatCostP(value.value)} + ${ (value.is_minimum === true ? "50%" : formatCostP(value.value / 2)) + per.countable + - locale.translate("/{0}", interval) + locale.translate("/{$value}", { value: interval }) }`, ) + per.minimumTotal @@ -490,29 +562,36 @@ const getNonModifiableSustainedCostTranslation = ( * Returns the text for the cost of a sustained activatable skill. */ export const getSustainedCostTranslation = ( - getSkillModificationLevelById: GetById.Static.SkillModificationLevel, + getInstanceById: GetInstanceById<"SkillModificationLevel">, locale: LocaleEnvironment, speed: Speed, entity: Entity, responsiveTextSize: ResponsiveTextSize, value: SustainedCost, ): string => { - switch (value.tag) { + switch (value.kind) { case "Modifiable": return getModifiableSustainedCostTranslation( - getSkillModificationLevelById, + getInstanceById, locale, speed, entity, responsiveTextSize, - value.modifiable, + value.Modifiable, ) case "NonModifiable": return getNonModifiableSustainedCostTranslation( locale, entity, responsiveTextSize, - value.non_modifiable, + value.NonModifiable, + ) + case "Map": + return getSustainedCostMapTranslation( + locale, + entity, + responsiveTextSize, + value.Map, ) default: return assertExhaustive(value) diff --git a/src/entities/partial/rated/activatable/duration.ts b/src/entities/partial/rated/activatable/duration.ts index 5bf1cf3..c1bf215 100644 --- a/src/entities/partial/rated/activatable/duration.ts +++ b/src/entities/partial/rated/activatable/duration.ts @@ -1,17 +1,20 @@ import { mapNullable } from "@optolith/helpers/nullable" import { assertExhaustive } from "@optolith/helpers/typeSafety" -import { CastingTimeDuringLovemaking } from "optolith-database-schema/types/_ActivatableSkillCastingTime" -import { +import type { + BlessingDuration, + CantripDuration, + CastingTimeDuringLovemaking, CheckResultBasedDuration, DurationForOneTime, DurationForSustained, FixedDuration, Immediate, + IndefiniteBlessingDuration, + IndefiniteBlessingDurationTranslation, IndefiniteDuration, + IndefiniteDurationTranslation, PermanentDuration, -} from "optolith-database-schema/types/_ActivatableSkillDuration" -import { BlessingDuration } from "optolith-database-schema/types/Blessing" -import { CantripDuration } from "optolith-database-schema/types/Cantrip" +} from "optolith-database-schema/gen" import { LocaleEnvironment } from "../../../../helpers/locale.js" import { getResponsiveText, @@ -40,8 +43,8 @@ const getImmediateDurationTranslation = ( return responsive( responsiveTextSize, - () => locale.translate("no more than {0}", maxText), - () => locale.translate("max. {0}", maxText), + () => locale.translate("no more than {$value}", { value: maxText }), + () => locale.translate("max. {$value}", { value: maxText }), ) }), locale.translate("Immediate"), @@ -115,12 +118,16 @@ const getCheckResultBasedDurationTranslation = ( const getIndefiniteDurationTranslation = ( locale: LocaleEnvironment, responsiveTextSize: ResponsiveTextSize, - value: IndefiniteDuration, -) => - getResponsiveText( - locale.translateMap(value.translations)?.description, - responsiveTextSize, - ) + value: IndefiniteDuration | IndefiniteBlessingDuration, +) => { + const description = locale.translateMap< + IndefiniteDurationTranslation | IndefiniteBlessingDurationTranslation + >(value.translations)?.description + + return typeof description === "string" + ? description + : getResponsiveText(description, responsiveTextSize) +} /** * Returns the text for the duration of a one-time activatable skill. @@ -130,36 +137,36 @@ export const getDurationForOneTimeTranslation = ( responsiveTextSize: ResponsiveTextSize, value: DurationForOneTime, ): string => { - switch (value.tag) { + switch (value.kind) { case "Immediate": return getImmediateDurationTranslation( locale, responsiveTextSize, - value.immediate, + value.Immediate, ) case "Permanent": return getPermanentDurationTranslation( locale, responsiveTextSize, - value.permanent, + value.Permanent, ) case "Fixed": return getFixedDurationTranslation( locale, responsiveTextSize, - value.fixed, + value.Fixed, ) case "CheckResultBased": return getCheckResultBasedDurationTranslation( locale, responsiveTextSize, - value.check_result_based, + value.CheckResultBased, ) case "Indefinite": return getIndefiniteDurationTranslation( locale, responsiveTextSize, - value.indefinite, + value.Indefinite, ) default: return assertExhaustive(value) @@ -205,30 +212,26 @@ export const getDurationTranslationForCantrip = ( responsiveTextSize: ResponsiveTextSize, value: CantripDuration, ): string => { - switch (value.tag) { + switch (value.kind) { case "Immediate": - return getImmediateDurationTranslation( - locale, - responsiveTextSize, - value.immediate, - ) + return getImmediateDurationTranslation(locale, responsiveTextSize, {}) case "Fixed": return getFixedDurationTranslation( locale, responsiveTextSize, - value.fixed, + value.Fixed, ) case "Indefinite": return getIndefiniteDurationTranslation( locale, responsiveTextSize, - value.indefinite, + value.Indefinite, ) case "DuringLovemaking": return getDurationDuringLovemakingTranslation( locale, responsiveTextSize, - value.during_lovemaking, + value.DuringLovemaking, ) default: return assertExhaustive(value) @@ -243,24 +246,20 @@ export const getDurationTranslationForBlessing = ( responsiveTextSize: ResponsiveTextSize, value: BlessingDuration, ): string => { - switch (value.tag) { + switch (value.kind) { case "Immediate": - return getImmediateDurationTranslation( - locale, - responsiveTextSize, - value.immediate, - ) + return getImmediateDurationTranslation(locale, responsiveTextSize, {}) case "Fixed": return getFixedDurationTranslation( locale, responsiveTextSize, - value.fixed, + value.Fixed, ) case "Indefinite": return getIndefiniteDurationTranslation( locale, responsiveTextSize, - value.indefinite, + value.Indefinite, ) default: return assertExhaustive(value) diff --git a/src/entities/partial/rated/activatable/effect.ts b/src/entities/partial/rated/activatable/effect.ts index cf46b14..d1168c0 100644 --- a/src/entities/partial/rated/activatable/effect.ts +++ b/src/entities/partial/rated/activatable/effect.ts @@ -1,7 +1,7 @@ import { filterNonNullable } from "@optolith/helpers/array" import { mapNullable } from "@optolith/helpers/nullable" import { assertExhaustive } from "@optolith/helpers/typeSafety" -import { ActivatableSkillEffect } from "optolith-database-schema/types/_ActivatableSkillEffect" +import type { ActivatableSkillEffect } from "optolith-database-schema/gen" import { LocaleEnvironment } from "../../../../helpers/locale.js" import { EntityDescriptionSection } from "../../../../index.js" @@ -21,7 +21,9 @@ const getContentPartsForQualityLevels = ( }, ...source.quality_levels.map((text, index) => ({ value: text, - label: locale.translate("QL {0}", getQualityLevelString(index)), + label: locale.translate("QL {$value}", { + value: getQualityLevelString(index), + }), })), mapNullable(source.text_after, textAfter => ({ value: textAfter, @@ -36,25 +38,25 @@ export const getTextForEffect = ( locale: LocaleEnvironment, effect: ActivatableSkillEffect, ): EntityDescriptionSection[] => { - switch (effect.tag) { + switch (effect.kind) { case "Plain": return [ { label: locale.translate("Effect"), - value: effect.plain.text, + value: effect.Plain.text, }, ] case "ForEachQualityLevel": return getContentPartsForQualityLevels( index => index + 1, locale, - effect.for_each_quality_level, + effect.ForEachQualityLevel, ) case "ForEachTwoQualityLevels": return getContentPartsForQualityLevels( index => `${index * 2 + 1}–${index * 2 + 2}`, locale, - effect.for_each_two_quality_levels, + effect.ForEachTwoQualityLevels, ) default: return assertExhaustive(effect) diff --git a/src/entities/partial/rated/activatable/index.ts b/src/entities/partial/rated/activatable/index.ts index 28d68b9..74b102a 100644 --- a/src/entities/partial/rated/activatable/index.ts +++ b/src/entities/partial/rated/activatable/index.ts @@ -1,10 +1,10 @@ -import { +import type { FastOneTimePerformanceParameters, FastSustainedPerformanceParameters, SlowOneTimePerformanceParameters, SlowSustainedPerformanceParameters, -} from "optolith-database-schema/types/_ActivatableSkill" -import { GetById } from "../../../../helpers/getTypes.js" +} from "optolith-database-schema/gen" +import type { GetInstanceById } from "../../../../helpers/getTypes.js" import { LocaleEnvironment } from "../../../../helpers/locale.js" import { ResponsiveTextSize } from "../../responsiveText.js" import { @@ -27,7 +27,7 @@ import { Speed } from "./speed.js" * Get the texts for all fast one-time performance parameters. */ export const getFastOneTimePerformanceParametersTranslations = ( - getSkillModificationLevelById: GetById.Static.SkillModificationLevel, + getInstanceById: GetInstanceById<"SkillModificationLevel">, locale: LocaleEnvironment, entity: Entity, responsiveTextSize: ResponsiveTextSize, @@ -39,14 +39,14 @@ export const getFastOneTimePerformanceParametersTranslations = ( duration: string } => ({ castingTime: getFastCastingTimeTranslation( - getSkillModificationLevelById, + getInstanceById, locale, entity, responsiveTextSize, value.casting_time, ), cost: getOneTimeCostTranslation( - getSkillModificationLevelById, + getInstanceById, locale, Speed.Fast, entity, @@ -54,7 +54,7 @@ export const getFastOneTimePerformanceParametersTranslations = ( value.cost, ), range: getTextForActivatableSkillRange( - getSkillModificationLevelById, + getInstanceById, locale, Speed.Fast, responsiveTextSize, @@ -72,7 +72,7 @@ export const getFastOneTimePerformanceParametersTranslations = ( * Get the texts for all fast sustained performance parameters. */ export const getFastSustainedPerformanceParametersTranslations = ( - getSkillModificationLevelById: GetById.Static.SkillModificationLevel, + getInstanceById: GetInstanceById<"SkillModificationLevel">, locale: LocaleEnvironment, entity: Entity, responsiveTextSize: ResponsiveTextSize, @@ -84,14 +84,14 @@ export const getFastSustainedPerformanceParametersTranslations = ( duration: string } => ({ castingTime: getFastCastingTimeTranslation( - getSkillModificationLevelById, + getInstanceById, locale, entity, responsiveTextSize, value.casting_time, ), cost: getSustainedCostTranslation( - getSkillModificationLevelById, + getInstanceById, locale, Speed.Fast, entity, @@ -99,7 +99,7 @@ export const getFastSustainedPerformanceParametersTranslations = ( value.cost, ), range: getTextForActivatableSkillRange( - getSkillModificationLevelById, + getInstanceById, locale, Speed.Fast, responsiveTextSize, @@ -117,7 +117,7 @@ export const getFastSustainedPerformanceParametersTranslations = ( * Get the texts for all slow one-time performance parameters. */ export const getSlowOneTimePerformanceParametersTranslations = ( - getSkillModificationLevelById: GetById.Static.SkillModificationLevel, + getInstanceById: GetInstanceById<"SkillModificationLevel">, locale: LocaleEnvironment, entity: Entity, responsiveTextSize: ResponsiveTextSize, @@ -129,14 +129,14 @@ export const getSlowOneTimePerformanceParametersTranslations = ( duration: string } => ({ castingTime: getSlowCastingTimeTranslation( - getSkillModificationLevelById, + getInstanceById, locale, entity, responsiveTextSize, value.casting_time, ), cost: getOneTimeCostTranslation( - getSkillModificationLevelById, + getInstanceById, locale, Speed.Slow, entity, @@ -144,7 +144,7 @@ export const getSlowOneTimePerformanceParametersTranslations = ( value.cost, ), range: getTextForActivatableSkillRange( - getSkillModificationLevelById, + getInstanceById, locale, Speed.Slow, responsiveTextSize, @@ -162,7 +162,7 @@ export const getSlowOneTimePerformanceParametersTranslations = ( * Get the texts for all slow sustained performance parameters. */ export const getSlowSustainedPerformanceParametersTranslations = ( - getSkillModificationLevelById: GetById.Static.SkillModificationLevel, + getInstanceById: GetInstanceById<"SkillModificationLevel">, locale: LocaleEnvironment, entity: Entity, responsiveTextSize: ResponsiveTextSize, @@ -174,14 +174,14 @@ export const getSlowSustainedPerformanceParametersTranslations = ( duration: string } => ({ castingTime: getSlowCastingTimeTranslation( - getSkillModificationLevelById, + getInstanceById, locale, entity, responsiveTextSize, value.casting_time, ), cost: getSustainedCostTranslation( - getSkillModificationLevelById, + getInstanceById, locale, Speed.Slow, entity, @@ -189,7 +189,7 @@ export const getSlowSustainedPerformanceParametersTranslations = ( value.cost, ), range: getTextForActivatableSkillRange( - getSkillModificationLevelById, + getInstanceById, locale, Speed.Slow, responsiveTextSize, diff --git a/src/entities/partial/rated/activatable/isMinimumMaximum.ts b/src/entities/partial/rated/activatable/isMinimumMaximum.ts index d33a8e7..ffa652b 100644 --- a/src/entities/partial/rated/activatable/isMinimumMaximum.ts +++ b/src/entities/partial/rated/activatable/isMinimumMaximum.ts @@ -11,8 +11,8 @@ export const wrapAsMinimum = ( ): string => responsive( responsiveTextSize, - () => locale.translate("at least {0}", text), - () => locale.translate("min. {0}", text), + () => locale.translate("at least {$value}", { value: text }), + () => locale.translate("min. {$value}", { value: text }), ) /** @@ -37,8 +37,8 @@ export const wrapAsMaximum = ( ): string => responsive( responsiveTextSize, - () => locale.translate("no more than {0}", text), - () => locale.translate("max. {0}", text), + () => locale.translate("no more than {$value}", { value: text }), + () => locale.translate("max. {$value}", { value: text }), ) /** diff --git a/src/entities/partial/rated/activatable/nonModifiableSuffix.ts b/src/entities/partial/rated/activatable/nonModifiableSuffix.ts index 3887284..4446ee2 100644 --- a/src/entities/partial/rated/activatable/nonModifiableSuffix.ts +++ b/src/entities/partial/rated/activatable/nonModifiableSuffix.ts @@ -1,7 +1,7 @@ import { mapNullable } from "@optolith/helpers/nullable" import { assertExhaustive } from "@optolith/helpers/typeSafety" -import { UI } from "optolith-database-schema/types/UI" import { LocaleEnvironment } from "../../../../helpers/locale.js" +import type { Translations } from "../../../../helpers/translate.js" import { responsive, ResponsiveTextSize } from "../../responsiveText.js" import { Entity } from "./entity.js" @@ -14,13 +14,7 @@ export enum ModifiableParameter { Range, } -const translationKeyForNonModifiableSuffix: { - [entityKey in Entity]: - | { - [paramKey in ModifiableParameter]: keyof UI - } - | undefined -} = { +const translationKeyForNonModifiableSuffix = { [Entity.Spell]: { [ModifiableParameter.CastingTime]: " (you cannot use a modification on this spell’s casting time)", @@ -55,6 +49,12 @@ const translationKeyForNonModifiableSuffix: { }, [Entity.Cantrip]: undefined, [Entity.Blessing]: undefined, +} satisfies { + [entityKey in Entity]: + | { + [paramKey in ModifiableParameter]: keyof Translations + } + | undefined } /** diff --git a/src/entities/partial/rated/activatable/range.ts b/src/entities/partial/rated/activatable/range.ts index 22cde82..311ffa5 100644 --- a/src/entities/partial/rated/activatable/range.ts +++ b/src/entities/partial/rated/activatable/range.ts @@ -1,15 +1,15 @@ import { mapNullable } from "@optolith/helpers/nullable" import { assertExhaustive } from "@optolith/helpers/typeSafety" -import { +import type { + BlessingRange, + CantripRange, CheckResultBasedRange, FixedRange, ModifiableRange, Range, RangeValue, -} from "optolith-database-schema/types/_ActivatableSkillRange" -import { BlessingRange } from "optolith-database-schema/types/Blessing" -import { CantripRange } from "optolith-database-schema/types/Cantrip" -import { GetById } from "../../../../helpers/getTypes.js" +} from "optolith-database-schema/gen" +import { type GetInstanceById } from "../../../../helpers/getTypes.js" import { LocaleEnvironment } from "../../../../helpers/locale.js" import { appendNoteIfRequested, @@ -28,14 +28,14 @@ import { import { getModifiableBySpeed, Speed } from "./speed.js" const getModifiableRangeTranslation = ( - getSkillModificationLevelById: GetById.Static.SkillModificationLevel, + getInstanceById: GetInstanceById<"SkillModificationLevel">, locale: LocaleEnvironment, speed: Speed, responsiveTextSize: ResponsiveTextSize, value: ModifiableRange, ) => mapNullable( - getSkillModificationLevelById(value.initial_modification_level), + getInstanceById("SkillModificationLevel", value.initial_modification_level), modificationLevel => { const range = getModifiableBySpeed( config => config.range, @@ -80,7 +80,7 @@ const getFixedRangeTranslation = ( responsiveTextSize: ResponsiveTextSize, value: FixedRange, ) => - formatLength(locale, responsiveTextSize, value.unit, value.value) + + formatLength(locale, responsiveTextSize, value.unit.kind, value.value) + getNonModifiableSuffixTranslation( locale, entity, @@ -103,7 +103,7 @@ const getCheckResultBasedRangeTranslation = ( const range = formatLength( locale, responsiveTextSize, - value.unit, + value.unit.kind, getCheckResultBasedValueTranslation(locale.translate, value), ) @@ -128,21 +128,21 @@ const getCheckResultBasedRangeTranslation = ( } const getRangeValueTranslation = ( - getSkillModificationLevelById: GetById.Static.SkillModificationLevel, + getInstanceById: GetInstanceById<"SkillModificationLevel">, locale: LocaleEnvironment, speed: Speed, responsiveTextSize: ResponsiveTextSize, entity: Entity, value: RangeValue, ) => { - switch (value.tag) { + switch (value.kind) { case "Modifiable": return getModifiableRangeTranslation( - getSkillModificationLevelById, + getInstanceById, locale, speed, responsiveTextSize, - value.modifiable, + value.Modifiable, ) case "Sight": return getSightTranslation(locale) @@ -157,7 +157,7 @@ const getRangeValueTranslation = ( locale, entity, responsiveTextSize, - value.fixed, + value.Fixed, ) } case "CheckResultBased": @@ -165,7 +165,7 @@ const getRangeValueTranslation = ( locale, entity, responsiveTextSize, - value.check_result_based, + value.CheckResultBased, ) default: return assertExhaustive(value) @@ -176,7 +176,7 @@ const getRangeValueTranslation = ( * Returns the text for the range of an activatable skill. */ export const getTextForActivatableSkillRange = ( - getSkillModificationLevelById: GetById.Static.SkillModificationLevel, + getInstanceById: GetInstanceById<"SkillModificationLevel">, locale: LocaleEnvironment, speed: Speed, responsiveTextSize: ResponsiveTextSize, @@ -184,7 +184,7 @@ export const getTextForActivatableSkillRange = ( value: Range, ): string => { const rangeValue = getRangeValueTranslation( - getSkillModificationLevelById, + getInstanceById, locale, speed, responsiveTextSize, @@ -209,13 +209,13 @@ export const getTextForActivatableSkillRange = ( ) } -const getTextForTinyAcitvatableRange = ( +const getTextForTinyActivatableRange = ( locale: LocaleEnvironment, responsiveTextSize: ResponsiveTextSize, entity: Entity, value: CantripRange | BlessingRange, ): string => { - switch (value.tag) { + switch (value.kind) { case "Self": return getSelfTranslation(locale) case "Touch": @@ -225,7 +225,7 @@ const getTextForTinyAcitvatableRange = ( locale, entity, responsiveTextSize, - value.fixed, + value.Fixed, ) default: return assertExhaustive(value) @@ -240,7 +240,7 @@ export const getTextForCantripRange = ( responsiveTextSize: ResponsiveTextSize, value: CantripRange, ): string => - getTextForTinyAcitvatableRange( + getTextForTinyActivatableRange( locale, responsiveTextSize, Entity.Cantrip, @@ -255,7 +255,7 @@ export const getTextForBlessingRange = ( responsiveTextSize: ResponsiveTextSize, value: BlessingRange, ): string => - getTextForTinyAcitvatableRange( + getTextForTinyActivatableRange( locale, responsiveTextSize, Entity.Blessing, diff --git a/src/entities/partial/rated/activatable/speed.ts b/src/entities/partial/rated/activatable/speed.ts index ee348c5..cf1f4db 100644 --- a/src/entities/partial/rated/activatable/speed.ts +++ b/src/entities/partial/rated/activatable/speed.ts @@ -3,7 +3,7 @@ import { FastSkillModificationLevelConfig, SkillModificationLevel, SlowSkillModificationLevelConfig, -} from "optolith-database-schema/types/SkillModificationLevel" +} from "optolith-database-schema/gen" /** * The speed of an activatable skill. diff --git a/src/entities/partial/rated/activatable/targetCategory.ts b/src/entities/partial/rated/activatable/targetCategory.ts index 9e6b2ed..ed474da 100644 --- a/src/entities/partial/rated/activatable/targetCategory.ts +++ b/src/entities/partial/rated/activatable/targetCategory.ts @@ -1,11 +1,10 @@ import { mapNullable } from "@optolith/helpers/nullable" import { assertExhaustive } from "@optolith/helpers/typeSafety" -import { +import type { AffectedTargetCategories, SpecificAffectedTargetCategoryIdentifier, -} from "optolith-database-schema/types/_ActivatableSkillTargetCategory" -import { TargetCategoryReference } from "optolith-database-schema/types/_SimpleReferences" -import { GetById } from "../../../../helpers/getTypes.js" +} from "optolith-database-schema/gen" +import { type GetInstanceById } from "../../../../helpers/getTypes.js" import { LocaleEnvironment } from "../../../../helpers/locale.js" import { EntityDescriptionSection } from "../../../../index.js" import { MISSING_VALUE } from "../../unknown.js" @@ -21,45 +20,40 @@ const getLiturgicalChantsAndCeremoniesTranslation = ( locale: LocaleEnvironment, ) => locale.translate("Liturgical Chants and Ceremonies") +const getSpellworksTranslation = (locale: LocaleEnvironment) => + locale.translate("Spellworks") + const getCantripsTranslation = (locale: LocaleEnvironment) => locale.translate("Cantrips") const getPredefinedTranslation = ( - getTargetCategoryById: GetById.Static.TargetCategory, + getInstanceById: GetInstanceById<"TargetCategory">, locale: LocaleEnvironment, - value: TargetCategoryReference, -) => { - const numericId = value.id.target_category - const specificTargetCategory = getTargetCategoryById(numericId) - - return ( - mapNullable( - locale.translateMap(specificTargetCategory?.translations), - translation => translation.name, - ) ?? MISSING_VALUE - ) -} + id: string, +) => + mapNullable( + locale.translateMap(getInstanceById("TargetCategory", id)?.translations), + translation => translation.name, + ) ?? MISSING_VALUE const getTargetCategoryTranslationByType = ( - getTargetCategoryById: GetById.Static.TargetCategory, + getInstanceById: GetInstanceById<"TargetCategory">, locale: LocaleEnvironment, id: SpecificAffectedTargetCategoryIdentifier, ) => { - switch (id.tag) { + switch (id.kind) { case "Self": return getSelfTranslation(locale) case "Zone": return getZoneTranslation(locale) case "LiturgicalChantsAndCeremonies": return getLiturgicalChantsAndCeremoniesTranslation(locale) + case "Spellworks": + return getSpellworksTranslation(locale) case "Cantrips": return getCantripsTranslation(locale) case "Predefined": - return getPredefinedTranslation( - getTargetCategoryById, - locale, - id.predefined, - ) + return getPredefinedTranslation(getInstanceById, locale, id.Predefined) default: return assertExhaustive(id) } @@ -69,7 +63,7 @@ const getTargetCategoryTranslationByType = ( * Get the text for the target category. */ export const getTargetCategoryTranslation = ( - getTargetCategoryById: GetById.Static.TargetCategory, + getInstanceById: GetInstanceById<"TargetCategory">, locale: LocaleEnvironment, values: AffectedTargetCategories, ): EntityDescriptionSection => ({ @@ -81,11 +75,7 @@ export const getTargetCategoryTranslation = ( .map(({ id, translations }) => appendInParensIfNotEmpty( locale.translateMap(translations)?.note, - getTargetCategoryTranslationByType( - getTargetCategoryById, - locale, - id, - ), + getTargetCategoryTranslationByType(getInstanceById, locale, id), ), ) .join(", "), diff --git a/src/entities/partial/rated/improvementCost.ts b/src/entities/partial/rated/improvementCost.ts index 859a0d6..8a77fd7 100644 --- a/src/entities/partial/rated/improvementCost.ts +++ b/src/entities/partial/rated/improvementCost.ts @@ -1,4 +1,4 @@ -import { ImprovementCost as RawImprovementCost } from "optolith-database-schema/types/_ImprovementCost" +import type { ImprovementCost } from "optolith-database-schema/gen" import { Translate } from "../../../helpers/translate.js" import { EntityDescriptionSection } from "../../../index.js" @@ -7,8 +7,8 @@ import { EntityDescriptionSection } from "../../../index.js" */ export const createImprovementCost = ( translate: Translate, - improvementCost: RawImprovementCost, + improvementCost: ImprovementCost, ): EntityDescriptionSection => ({ label: translate("Improvement Cost"), - value: improvementCost, + value: improvementCost.kind, }) diff --git a/src/entities/partial/rated/skillCheck.ts b/src/entities/partial/rated/skillCheck.ts index f00da39..7fd1a8f 100644 --- a/src/entities/partial/rated/skillCheck.ts +++ b/src/entities/partial/rated/skillCheck.ts @@ -1,10 +1,10 @@ import { assertExhaustive } from "@optolith/helpers/typeSafety" -import { +import type { + DerivedCharacteristic, SkillCheck, SkillCheckPenalty, -} from "optolith-database-schema/types/_SkillCheck" -import { DerivedCharacteristic } from "optolith-database-schema/types/DerivedCharacteristic" -import { GetById } from "../../../helpers/getTypes.js" +} from "optolith-database-schema/gen" +import { type GetInstanceById } from "../../../helpers/getTypes.js" import { Translate, TranslateMap } from "../../../helpers/translate.js" import { EntityDescriptionSection } from "../../../index.js" import { responsive, ResponsiveTextSize } from "../responsiveText.js" @@ -16,7 +16,7 @@ export const getTextForCheck = ( deps: { translate: Translate translateMap: TranslateMap - getAttributeById: GetById.Static.Attribute + getInstanceById: GetInstanceById<"Attribute"> }, check: SkillCheck, checkPenalty?: { @@ -30,8 +30,8 @@ export const getTextForCheck = ( value: check .map( - ({ id: { attribute: id } }) => - deps.translateMap(deps.getAttributeById(id)?.translations) + id => + deps.translateMap(deps.getInstanceById("Attribute", id)?.translations) ?.abbreviation ?? "??", ) .join("/") + @@ -53,7 +53,7 @@ export const getTextForCheck = ( getDerivedCharacteristicTranslation(checkPenalty.getToughness) const penalty = (() => { - switch (checkPenalty.value) { + switch (checkPenalty.value.kind) { case "Spirit": { const translation = getSpiritTranslation() return translation === undefined @@ -97,9 +97,11 @@ export const getTextForCheck = ( responsiveText, () => deps.translate( - "{0} or {1}, depending on which value is higher", - spiritTranslation.abbreviation, - toughnessTranslation.abbreviation, + "{$first} or {$second}, depending on which value is higher", + { + first: spiritTranslation.abbreviation, + second: toughnessTranslation.abbreviation, + }, ), () => `${spiritTranslation.abbreviation}/${toughnessTranslation.abbreviation}`, @@ -120,6 +122,9 @@ export const getTextForCheck = ( () => deps.translate("CD"), ) + case "Object": + return deps.translate("Object") + default: return assertExhaustive(checkPenalty.value) } @@ -127,8 +132,9 @@ export const getTextForCheck = ( return responsive( responsiveText, - () => deps.translate(" (modified by {0})", penalty), - () => deps.translate(" (− {0})", penalty), + () => + deps.translate(" (modified by {$modifier})", { modifier: penalty }), + () => deps.translate(" (−{$modifier})", { modifier: penalty }), ) })(), }) diff --git a/src/entities/partial/responsiveText.ts b/src/entities/partial/responsiveText.ts index 729303b..d2b4eff 100644 --- a/src/entities/partial/responsiveText.ts +++ b/src/entities/partial/responsiveText.ts @@ -1,12 +1,11 @@ import { mapNullable } from "@optolith/helpers/nullable" import { assertExhaustive } from "@optolith/helpers/typeSafety" -import { LocaleMap } from "optolith-database-schema/types/_LocaleMap" -import { +import type { ResponsiveText, ResponsiveTextOptional, ResponsiveTextReplace, -} from "optolith-database-schema/types/_ResponsiveText" -import { TranslateMap } from "../../helpers/translate.js" +} from "optolith-database-schema/gen" +import { TranslateMap, type LocaleMap } from "../../helpers/translate.js" import { appendInParensIfNotEmpty } from "./rated/activatable/parensIf.js" import { MISSING_VALUE } from "./unknown.js" diff --git a/src/entities/partial/units/energy.ts b/src/entities/partial/units/energy.ts index e45c024..ee3ce60 100644 --- a/src/entities/partial/units/energy.ts +++ b/src/entities/partial/units/energy.ts @@ -1,15 +1,15 @@ import { assertExhaustive } from "@optolith/helpers/typeSafety" -import { UI } from "optolith-database-schema/types/UI" import { LocaleEnvironment } from "../../../helpers/locale.js" +import type { Translations } from "../../../helpers/translate.js" import { Entity } from "../rated/activatable/entity.js" type EnergyUnit = "ArcaneEnergy" | "KarmaPoints" -const lengthUnitTranslationKeys: { - [key in EnergyUnit]: keyof UI -} = { - ArcaneEnergy: "{0} AE", - KarmaPoints: "{0} KP", +const lengthUnitTranslationKeys = { + ArcaneEnergy: "{$value} AE", + KarmaPoints: "{$value} KP", +} as const satisfies { + [key in EnergyUnit]: keyof Translations } /** @@ -22,7 +22,7 @@ export const formatEnergy = ( ): string => { const key = lengthUnitTranslationKeys[unit] - return locale.translate(key, value) + return locale.translate(key, { value }) } /** diff --git a/src/entities/partial/units/length.ts b/src/entities/partial/units/length.ts index 8cb5e00..9eaab93 100644 --- a/src/entities/partial/units/length.ts +++ b/src/entities/partial/units/length.ts @@ -1,14 +1,26 @@ -import { UI } from "optolith-database-schema/types/UI" import { LocaleEnvironment } from "../../../helpers/locale.js" +import type { Translations } from "../../../helpers/translate.js" import { responsive, ResponsiveTextSize } from "../responsiveText.js" type LengthUnit = "Steps" | "Miles" -const lengthUnitTranslationKeys: { - [key in LengthUnit]: [full: keyof UI, compressed: keyof UI] -} = { - Steps: ["{0} yards", "{0} yd"], - Miles: ["{0} miles", "{0} mi."], +const lengthUnitTranslationKeys = { + Steps: [ + ".input {$value :number} {{{$value} yards}}", + "{$value} yards", + "{$value} yd", + ], + Miles: [ + ".input {$value :number} {{{$value} miles}}", + "{$value} miles", + "{$value} mi.", + ], +} as const satisfies { + [key in LengthUnit]: [ + fullNumber: keyof Translations, + full: keyof Translations, + compressed: keyof Translations, + ] } /** @@ -20,11 +32,15 @@ export const formatLength = ( unit: LengthUnit, value: number | string, ) => { - const [fullKey, compressedKey] = lengthUnitTranslationKeys[unit] + const [fullNumberKey, fullKey, compressedKey] = + lengthUnitTranslationKeys[unit] return responsive( responsiveTextSize, - () => locale.translate(fullKey, value), - () => locale.translate(compressedKey, value), + () => + locale.translate(typeof value === "number" ? fullNumberKey : fullKey, { + value, + }), + () => locale.translate(compressedKey, { value }), ) } diff --git a/src/entities/partial/units/timeSpan.ts b/src/entities/partial/units/timeSpan.ts index 6cc218b..e82f2cd 100644 --- a/src/entities/partial/units/timeSpan.ts +++ b/src/entities/partial/units/timeSpan.ts @@ -1,5 +1,5 @@ -import { UI } from "optolith-database-schema/types/UI" import { LocaleEnvironment } from "../../../helpers/locale.js" +import type { Translations } from "../../../helpers/translate.js" import { ResponsiveTextSize, responsive } from "../responsiveText.js" type TimeSpanUnit = @@ -16,21 +16,26 @@ type TimeSpanUnit = | "SeductionActions" | "Rounds" -const timeSpanUnitTranslationKeys: { - [key in TimeSpanUnit]: [full: keyof UI, compressed: keyof UI] -} = { - Seconds: ["{0} seconds", "{0} s"], - Minutes: ["{0} minutes", "{0} min"], - Hours: ["{0} hours", "{0} h"], - Days: ["{0} days", "{0} d"], - Weeks: ["{0} weeks", "{0} wks."], - Months: ["{0} months", "{0} mos."], - Years: ["{0} years", "{0} yrs."], - Centuries: ["{0} centuries", "{0} cent."], - Actions: ["{0} actions", "{0} act"], - CombatRounds: ["{0} combat rounds", "{0} CR"], - SeductionActions: ["{0} seduction actions", "{0} SA"], - Rounds: ["{0} rounds", "{0} rnds"], +// prettier-ignore +const timeSpanUnitTranslationKeys = { + Seconds: [".input {$value :number} {{{$value} seconds}}", "{$value} seconds", "{$value} s"], + Minutes: [".input {$value :number} {{{$value} minutes}}", "{$value} minutes", "{$value} min"], + Hours: [".input {$value :number} {{{$value} hours}}", "{$value} hours", "{$value} h"], + Days: [".input {$value :number} {{{$value} days}}", "{$value} days", "{$value} d"], + Weeks: [".input {$value :number} {{{$value} weeks}}", "{$value} weeks", ".input {$value :number} {{{$value} wks.}}"], + Months: [".input {$value :number} {{{$value} months}}", "{$value} months", ".input {$value :number} {{{$value} mos.}}"], + Years: [".input {$value :number} {{{$value} years}}", "{$value} years", ".input {$value :number} {{{$value} yrs.}}"], + Centuries: [".input {$value :number} {{{$value} centuries}}", "{$value} centuries", "{$value} cent."], + Actions: [".input {$value :number} {{{$value} actions}}", "{$value} actions", "{$value} act"], + CombatRounds: [".input {$value :number} {{{$value} combat rounds}}", "{$value} combat rounds", "{$value} CR"], + SeductionActions: [".input {$value :number} {{{$value} seduction actions}}", "{$value} seduction actions", "{$value} SA"], + Rounds: [".input {$value :number} {{{$value} rounds}}", "{$value} rounds", "{$value} rnds"], +} as const satisfies { + [key in TimeSpanUnit]: [ + fullNumber: keyof Translations, + full: keyof Translations, + compressed: keyof Translations, + ] } /** @@ -39,14 +44,18 @@ const timeSpanUnitTranslationKeys: { export const formatTimeSpan = ( locale: LocaleEnvironment, responsiveTextSize: ResponsiveTextSize, - unit: TimeSpanUnit, + unit: { kind: TimeSpanUnit }, value: number | string, ): string => { - const [fullKey, compressedKey] = timeSpanUnitTranslationKeys[unit] + const [fullNumberKey, fullKey, compressedKey] = + timeSpanUnitTranslationKeys[unit.kind] return responsive( responsiveTextSize, - () => locale.translate(fullKey, value), - () => locale.translate(compressedKey, value), + () => + locale.translate(typeof value === "number" ? fullNumberKey : fullKey, { + value, + }), + () => locale.translate(compressedKey, { value }), ) } diff --git a/src/entities/skill.ts b/src/entities/skill.ts index a24dbb1..ad61e26 100644 --- a/src/entities/skill.ts +++ b/src/entities/skill.ts @@ -1,9 +1,12 @@ import { isNotNullish } from "@optolith/helpers/nullable" import { assertExhaustive } from "@optolith/helpers/typeSafety" -import { NewApplicationsAndUsesCache } from "optolith-database-schema/cache/newApplicationsAndUses" -import { Skill } from "optolith-database-schema/types/Skill" +import type { Skill } from "optolith-database-schema/gen" import { createEntityDescriptionCreator } from "../creator.js" -import { All, GetById } from "../helpers/getTypes.js" +import type { + GetAllChildInstancesForParent, + GetAllInstances, + GetInstanceById, +} from "../helpers/getTypes.js" import { createImprovementCost } from "./partial/rated/improvementCost.js" import { getTextForCheck } from "./partial/rated/skillCheck.js" @@ -13,17 +16,22 @@ import { getTextForCheck } from "./partial/rated/skillCheck.js" export const getSkillEntityDescription = createEntityDescriptionCreator< Skill, { - getAttributeById: GetById.Static.Attribute - blessedTraditions: All.Static.BlessedTraditions - diseases: All.Static.Diseases - regions: All.Static.Regions - cache: NewApplicationsAndUsesCache + getInstanceById: GetInstanceById<"Attribute"> + getAllInstances: GetAllInstances< + | "BlessedTradition" + | "Disease" + | "Region" + | "SkillUse" + | "NewSkillApplication" + > + getChildInstancesForInstanceId: GetAllChildInstancesForParent<"SkillApplication"> } >( ( - { getAttributeById, blessedTraditions, diseases, regions, cache }, + { getInstanceById, getAllInstances, getChildInstancesForInstanceId }, { translate, translateMap, compare: localeCompare }, entry, + id, ) => { const translation = translateMap(entry.translations) @@ -31,51 +39,47 @@ export const getSkillEntityDescription = createEntityDescriptionCreator< return undefined } - const newApplications = ( - entry === undefined ? [] : cache.newApplications[entry.id] ?? [] - ) - .map(x => translateMap(x.data.translations)?.name) + const newApplications = getAllInstances("NewSkillApplication") + .filter(application => application.skills.includes(id)) + .map(x => translateMap(x.translations)?.name) .filter(isNotNullish) .sort(localeCompare) - const uses = (entry === undefined ? [] : cache.uses[entry.id] ?? []) - .map(x => translateMap(x.data.translations)?.name) + const uses = getAllInstances("SkillUse") + .filter(use => use.skills.includes(id)) + .map(x => translateMap(x.translations)?.name) .filter(isNotNullish) .sort(localeCompare) - const applications = (() => { - switch (entry.applications.tag) { - case "Derived": - return (() => { - switch (entry.applications.derived) { - case "BlessedTraditions": - return Object.values(blessedTraditions) - .map(x => translateMap(x.translations)?.name) - .filter(isNotNullish) - .sort(localeCompare) - case "Diseases": - return Object.values(diseases) - .map(x => translateMap(x.translations)?.name) - .filter(isNotNullish) - .sort(localeCompare) - case "Regions": - return Object.values(regions) - .map(x => translateMap(x.translations)?.name) - .filter(isNotNullish) - .sort(localeCompare) - default: - return assertExhaustive(entry.applications.derived) - } - })() - case "Explicit": - return entry.applications.explicit - .map(x => translateMap(x.translations)?.name) - .filter(isNotNullish) - .sort(localeCompare) - default: - return assertExhaustive(entry.applications) - } - })() + const applications = [ + ...getChildInstancesForInstanceId("SkillApplication", id) + .map(x => translateMap(x.translations)?.name) + .filter(isNotNullish) + .sort(localeCompare), + ...(() => { + switch (entry.applications.derived?.kind) { + case "BlessedTraditions": + return getAllInstances("BlessedTradition") + .map(x => translateMap(x.translations)?.name) + .filter(isNotNullish) + .sort(localeCompare) + case "Diseases": + return getAllInstances("Disease") + .map(x => translateMap(x.translations)?.name) + .filter(isNotNullish) + .sort(localeCompare) + case "Regions": + return getAllInstances("Region") + .map(x => translateMap(x.translations)?.name) + .filter(isNotNullish) + .sort(localeCompare) + case undefined: + return [] + default: + return assertExhaustive(entry.applications.derived) + } + })(), + ] return { title: translation.name, @@ -94,7 +98,7 @@ export const getSkillEntityDescription = createEntityDescriptionCreator< value: uses.join(", "), }, getTextForCheck( - { translate, translateMap, getAttributeById }, + { translate, translateMap, getInstanceById }, entry.check, ), { @@ -104,9 +108,9 @@ export const getSkillEntityDescription = createEntityDescriptionCreator< { label: translate("Encumbrance"), value: - entry.encumbrance === "True" + entry.encumbrance.kind === "Yes" ? translate("Yes") - : entry.encumbrance === "False" + : entry.encumbrance.kind === "No" ? translate("No") : translation.encumbrance_description ?? translate("Maybe"), }, diff --git a/src/entities/spell.ts b/src/entities/spell.ts index e1db512..448585f 100644 --- a/src/entities/spell.ts +++ b/src/entities/spell.ts @@ -1,17 +1,17 @@ import { Compare } from "@optolith/helpers/compare" import { isNotNullish, mapNullable } from "@optolith/helpers/nullable" import { assertExhaustive } from "@optolith/helpers/typeSafety" -import { Cantrip } from "optolith-database-schema/types/Cantrip" -import { DerivedCharacteristic } from "optolith-database-schema/types/DerivedCharacteristic" -import { Ritual } from "optolith-database-schema/types/Ritual" -import { Spell } from "optolith-database-schema/types/Spell" -import { - MagicalTraditionReference, - PropertyReference, -} from "optolith-database-schema/types/_SimpleReferences" -import { Traditions } from "optolith-database-schema/types/_Spellwork" +import type { + Cantrip, + DerivedCharacteristic, + MagicalTradition_ID, + Property_ID, + Ritual, + Spell, + SpellworkTraditions, +} from "optolith-database-schema/gen" import { createEntityDescriptionCreator } from "../creator.js" -import { GetById } from "../helpers/getTypes.js" +import type { GetInstanceById } from "../helpers/getTypes.js" import { Translate, TranslateMap } from "../helpers/translate.js" import { EntityDescriptionSection } from "../index.js" import { getDurationTranslationForCantrip } from "./partial/rated/activatable/duration.js" @@ -34,12 +34,12 @@ const getTextForProperty = ( deps: { translate: Translate translateMap: TranslateMap - getPropertyById: GetById.Static.Property + getInstanceById: GetInstanceById<"Property"> }, - value: PropertyReference, + id: Property_ID, ): EntityDescriptionSection => { const text = (() => { - const staticEntry = deps.getPropertyById(value.id.property) + const staticEntry = deps.getInstanceById("Property", id) const staticEntryTranslation = deps.translateMap(staticEntry?.translations) if (staticEntryTranslation === undefined) { @@ -60,22 +60,20 @@ const getTextForTraditions = ( translate: Translate translateMap: TranslateMap localeCompare: Compare - getMagicalTraditionById: GetById.Static.MagicalTradition + getInstanceById: GetInstanceById<"MagicalTradition"> }, - value: Traditions, + value: SpellworkTraditions, ): EntityDescriptionSection => { const text = (() => { - switch (value.tag) { + switch (value.kind) { case "General": return deps.translate("General") case "Specific": - return value.specific - .map(trad => - deps.translateMap( - deps.getMagicalTraditionById(trad.magical_tradition) - ?.translations, - ), - ) + return value.Specific.map(trad => + deps.translateMap( + deps.getInstanceById("MagicalTradition", trad)?.translations, + ), + ) .filter(isNotNullish) .map(trad => trad.name_for_arcane_spellworks ?? trad.name) .sort(deps.localeCompare) @@ -92,12 +90,12 @@ const getTextForTraditions = ( } const getTraditionNameForArcaneSpellworksById = ( - ref: MagicalTraditionReference, - getMagicalTraditionById: GetById.Static.MagicalTradition, + id: MagicalTradition_ID, + getInstanceById: GetInstanceById<"MagicalTradition">, translateMap: TranslateMap, ) => { const translation = translateMap( - getMagicalTraditionById(ref.id.magical_tradition)?.translations, + getInstanceById("MagicalTradition", id)?.translations, ) return translation?.name_for_arcane_spellworks ?? translation?.name } @@ -108,133 +106,118 @@ const getTraditionNameForArcaneSpellworksById = ( export const getCantripEntityDescription = createEntityDescriptionCreator< Cantrip, { - getTargetCategoryById: GetById.Static.TargetCategory - getPropertyById: GetById.Static.Property - getMagicalTraditionById: GetById.Static.MagicalTradition - getCurriculumById: GetById.Static.Curriculum + getInstanceById: GetInstanceById< + "TargetCategory" | "Property" | "MagicalTradition" | "Curriculum" + > } ->( - ( - { - getTargetCategoryById, - getPropertyById, - getMagicalTraditionById, - getCurriculumById, - }, +>(({ getInstanceById }, locale, entry) => { + const { translate, translateMap, compare: localeCompare } = locale + const translation = translateMap(entry.translations) + + if (translation === undefined) { + return undefined + } + + const range = getTextForCantripRange( locale, - entry, - ) => { - const { translate, translateMap, compare: localeCompare } = locale - const translation = translateMap(entry.translations) + ResponsiveTextSize.Full, + entry.parameters.range, + ) - if (translation === undefined) { - return undefined - } + const duration = getDurationTranslationForCantrip( + locale, + ResponsiveTextSize.Full, + entry.parameters.duration, + ) - const range = getTextForCantripRange( - locale, - ResponsiveTextSize.Full, - entry.parameters.range, - ) - - const duration = getDurationTranslationForCantrip( - locale, - ResponsiveTextSize.Full, - entry.parameters.duration, - ) - - return { - title: translation.name, - className: "cantrip", - body: [ - { - label: translate("Effect"), - value: translation.effect, - }, - { - label: translate("Range"), - value: - range !== translation.range - ? `***${range}*** (${translation.range})` - : range, - }, - { - label: translate("Duration"), - value: - duration !== translation.duration - ? `***${duration}*** (${translation.duration})` - : duration, - }, - getTargetCategoryTranslation( - getTargetCategoryById, - locale, - entry.target, - ), - getTextForProperty( - { translate, translateMap, getPropertyById }, - entry.property, - ), - mapNullable(entry.note, note => ({ - label: translate("Note"), - value: (() => { - switch (note.tag) { - case "Common": - return note.common.list - .map(academyOrTradition => { - switch (academyOrTradition.tag) { - case "Academy": - return translateMap( - getCurriculumById( - academyOrTradition.academy.id.curriculum, - )?.translations, - )?.name - case "Tradition": { - return mapNullable( - getTraditionNameForArcaneSpellworksById( - academyOrTradition.tradition, - getMagicalTraditionById, - translateMap, + return { + title: translation.name, + className: "cantrip", + body: [ + { + label: translate("Effect"), + value: translation.effect, + }, + { + label: translate("Range"), + value: + range !== translation.range + ? `***${range}*** (${translation.range})` + : range, + }, + { + label: translate("Duration"), + value: + duration !== translation.duration + ? `***${duration}*** (${translation.duration})` + : duration, + }, + getTargetCategoryTranslation(getInstanceById, locale, entry.target), + getTextForProperty( + { translate, translateMap, getInstanceById }, + entry.property, + ), + mapNullable(entry.note, note => ({ + label: translate("Note"), + value: (() => { + switch (note.kind) { + case "Common": + return note.Common.list + .map(academyOrTradition => { + switch (academyOrTradition.kind) { + case "Academy": + return translateMap( + getInstanceById( + "Curriculum", + academyOrTradition.Academy, + )?.translations, + )?.name + case "Tradition": { + return mapNullable( + getTraditionNameForArcaneSpellworksById( + academyOrTradition.Tradition.id, + getInstanceById, + translateMap, + ), + name => + name + + parensIf( + translateMap( + academyOrTradition.Tradition.translations, + )?.note, ), - name => - name + - parensIf( - translateMap( - academyOrTradition.tradition.translations, - )?.note, - ), - ) - } - default: - return assertExhaustive(academyOrTradition) + ) } - }) - .filter(isNotNullish) - .sort(localeCompare) - .join(", ") + default: + return assertExhaustive(academyOrTradition) + } + }) + .filter(isNotNullish) + .sort(localeCompare) + .join(", ") - case "Exclusive": - return note.exclusive.traditions - .map(tradition => - getTraditionNameForArcaneSpellworksById( - tradition, - getMagicalTraditionById, - translateMap, - ), - ) - .filter(isNotNullish) - .sort(localeCompare) - .join(", ") + case "Exclusive": + return note.Exclusive.traditions + .map(tradition => + getTraditionNameForArcaneSpellworksById( + tradition, + getInstanceById, + translateMap, + ), + ) + .filter(isNotNullish) + .sort(localeCompare) + .join(", ") - default: - return assertExhaustive(note) - } - })(), - })), - ], - references: entry.src, - } - }, -) + default: + return assertExhaustive(note) + } + })(), + })), + ], + references: entry.src, + } +}) /** * Get a JSON representation of the rules text for a skill. @@ -242,122 +225,107 @@ export const getCantripEntityDescription = createEntityDescriptionCreator< export const getSpellEntityDescription = createEntityDescriptionCreator< Spell, { - getAttributeById: GetById.Static.Attribute + getInstanceById: GetInstanceById< + | "Attribute" + | "SkillModificationLevel" + | "TargetCategory" + | "Property" + | "MagicalTradition" + > getSpirit: () => DerivedCharacteristic | undefined getToughness: () => DerivedCharacteristic | undefined - getSkillModificationLevelById: GetById.Static.SkillModificationLevel - getTargetCategoryById: GetById.Static.TargetCategory - getPropertyById: GetById.Static.Property - getMagicalTraditionById: GetById.Static.MagicalTradition } ->( - ( - { - getAttributeById, - getSpirit, - getToughness, - getSkillModificationLevelById, - getTargetCategoryById, - getPropertyById, - getMagicalTraditionById, - }, - locale, - entry, - ) => { - const { translate, translateMap, compare: localeCompare } = locale - const translation = translateMap(entry.translations) +>(({ getInstanceById, getSpirit, getToughness }, locale, entry) => { + const { translate, translateMap, compare: localeCompare } = locale + const translation = translateMap(entry.translations) - if (translation === undefined) { - return undefined - } + if (translation === undefined) { + return undefined + } - const { castingTime, cost, range, duration } = (() => { - switch (entry.parameters.tag) { - case "OneTime": - return getFastOneTimePerformanceParametersTranslations( - getSkillModificationLevelById, - locale, - Entity.Spell, - ResponsiveTextSize.Full, - entry.parameters.one_time, - ) - - case "Sustained": - return getFastSustainedPerformanceParametersTranslations( - getSkillModificationLevelById, - locale, - Entity.Spell, - ResponsiveTextSize.Full, - entry.parameters.sustained, - ) - - default: - return assertExhaustive(entry.parameters) - } - })() - - return { - title: translation.name, - className: "spell", - body: [ - getTextForCheck( - { translate, translateMap, getAttributeById }, - entry.check, - { - value: entry.check_penalty, - responsiveText: ResponsiveTextSize.Full, - getSpirit, - getToughness, - }, - ), - ...getTextForEffect(locale, translation.effect), - { - label: translate("Casting Time"), - value: - castingTime !== translation.casting_time.full - ? `***${castingTime}*** (${translation.casting_time.full})` - : castingTime, - }, - { - label: translate("AE Cost"), - value: - cost !== translation.cost.full - ? `***${cost}*** (${translation.cost.full})` - : cost, - }, - { - label: translate("Range"), - value: - range !== translation.range.full - ? `***${range}*** (${translation.range.full})` - : range, - }, - { - label: translate("Duration"), - value: - duration !== translation.duration.full - ? `***${duration}*** (${translation.duration.full})` - : duration, - }, - getTargetCategoryTranslation( - getTargetCategoryById, + const { castingTime, cost, range, duration } = (() => { + switch (entry.parameters.kind) { + case "OneTime": + return getFastOneTimePerformanceParametersTranslations( + getInstanceById, locale, - entry.target, - ), - getTextForProperty( - { translate, translateMap, getPropertyById }, - entry.property, - ), - getTextForTraditions( - { translate, translateMap, localeCompare, getMagicalTraditionById }, - entry.traditions, - ), - createImprovementCost(translate, entry.improvement_cost), - ], - references: entry.src, + Entity.Spell, + ResponsiveTextSize.Full, + entry.parameters.OneTime, + ) + + case "Sustained": + return getFastSustainedPerformanceParametersTranslations( + getInstanceById, + locale, + Entity.Spell, + ResponsiveTextSize.Full, + entry.parameters.Sustained, + ) + + default: + return assertExhaustive(entry.parameters) } - }, -) + })() + + return { + title: translation.name, + className: "spell", + body: [ + getTextForCheck( + { translate, translateMap, getInstanceById }, + entry.check, + { + value: entry.check_penalty, + responsiveText: ResponsiveTextSize.Full, + getSpirit, + getToughness, + }, + ), + ...getTextForEffect(locale, translation.effect), + { + label: translate("Casting Time"), + value: + translation.casting_time && + castingTime !== translation.casting_time.full + ? `***${castingTime}*** (${translation.casting_time.full})` + : castingTime, + }, + { + label: translate("AE Cost"), + value: + translation.cost && cost !== translation.cost.full + ? `***${cost}*** (${translation.cost.full})` + : cost, + }, + { + label: translate("Range"), + value: + translation.range && range !== translation.range.full + ? `***${range}*** (${translation.range.full})` + : range, + }, + { + label: translate("Duration"), + value: + translation.duration && duration !== translation.duration.full + ? `***${duration}*** (${translation.duration.full})` + : duration, + }, + getTargetCategoryTranslation(getInstanceById, locale, entry.target), + getTextForProperty( + { translate, translateMap, getInstanceById }, + entry.property, + ), + getTextForTraditions( + { translate, translateMap, localeCompare, getInstanceById }, + entry.traditions, + ), + createImprovementCost(translate, entry.improvement_cost), + ], + references: entry.src, + } +}) /** * Get a JSON representation of the rules text for a ritual. @@ -365,119 +333,104 @@ export const getSpellEntityDescription = createEntityDescriptionCreator< export const getRitualEntityDescription = createEntityDescriptionCreator< Ritual, { - getAttributeById: GetById.Static.Attribute + getInstanceById: GetInstanceById< + | "Attribute" + | "SkillModificationLevel" + | "TargetCategory" + | "Property" + | "MagicalTradition" + > getSpirit: () => DerivedCharacteristic | undefined getToughness: () => DerivedCharacteristic | undefined - getSkillModificationLevelById: GetById.Static.SkillModificationLevel - getTargetCategoryById: GetById.Static.TargetCategory - getPropertyById: GetById.Static.Property - getMagicalTraditionById: GetById.Static.MagicalTradition } ->( - ( - { - getAttributeById, - getSpirit, - getToughness, - getSkillModificationLevelById, - getTargetCategoryById, - getPropertyById, - getMagicalTraditionById, - }, - locale, - entry, - ) => { - const { translate, translateMap, compare: localeCompare } = locale - const translation = translateMap(entry.translations) +>(({ getInstanceById, getSpirit, getToughness }, locale, entry) => { + const { translate, translateMap, compare: localeCompare } = locale + const translation = translateMap(entry.translations) - if (translation === undefined) { - return undefined - } + if (translation === undefined) { + return undefined + } - const { castingTime, cost, range, duration } = (() => { - switch (entry.parameters.tag) { - case "OneTime": - return getSlowOneTimePerformanceParametersTranslations( - getSkillModificationLevelById, - locale, - Entity.Ritual, - ResponsiveTextSize.Full, - entry.parameters.one_time, - ) - - case "Sustained": - return getSlowSustainedPerformanceParametersTranslations( - getSkillModificationLevelById, - locale, - Entity.Ritual, - ResponsiveTextSize.Full, - entry.parameters.sustained, - ) - - default: - return assertExhaustive(entry.parameters) - } - })() - - return { - title: translation.name, - className: "ritual", - body: [ - getTextForCheck( - { translate, translateMap, getAttributeById }, - entry.check, - { - value: entry.check_penalty, - responsiveText: ResponsiveTextSize.Full, - getSpirit, - getToughness, - }, - ), - ...getTextForEffect(locale, translation.effect), - { - label: translate("Ritual Time"), - value: - castingTime !== translation.casting_time.full - ? `***${castingTime}*** (${translation.casting_time.full})` - : castingTime, - }, - { - label: translate("AE Cost"), - value: - cost !== translation.cost.full - ? `***${cost}*** (${translation.cost.full})` - : cost, - }, - { - label: translate("Range"), - value: - range !== translation.range.full - ? `***${range}*** (${translation.range.full})` - : range, - }, - { - label: translate("Duration"), - value: - duration !== translation.duration.full - ? `***${duration}*** (${translation.duration.full})` - : duration, - }, - getTargetCategoryTranslation( - getTargetCategoryById, + const { castingTime, cost, range, duration } = (() => { + switch (entry.parameters.kind) { + case "OneTime": + return getSlowOneTimePerformanceParametersTranslations( + getInstanceById, locale, - entry.target, - ), - getTextForProperty( - { translate, translateMap, getPropertyById }, - entry.property, - ), - getTextForTraditions( - { translate, translateMap, localeCompare, getMagicalTraditionById }, - entry.traditions, - ), - createImprovementCost(translate, entry.improvement_cost), - ], - references: entry.src, + Entity.Ritual, + ResponsiveTextSize.Full, + entry.parameters.OneTime, + ) + + case "Sustained": + return getSlowSustainedPerformanceParametersTranslations( + getInstanceById, + locale, + Entity.Ritual, + ResponsiveTextSize.Full, + entry.parameters.Sustained, + ) + + default: + return assertExhaustive(entry.parameters) } - }, -) + })() + + return { + title: translation.name, + className: "ritual", + body: [ + getTextForCheck( + { translate, translateMap, getInstanceById }, + entry.check, + { + value: entry.check_penalty, + responsiveText: ResponsiveTextSize.Full, + getSpirit, + getToughness, + }, + ), + ...getTextForEffect(locale, translation.effect), + { + label: translate("Ritual Time"), + value: + translation.casting_time && + castingTime !== translation.casting_time.full + ? `***${castingTime}*** (${translation.casting_time.full})` + : castingTime, + }, + { + label: translate("AE Cost"), + value: + translation.cost && cost !== translation.cost.full + ? `***${cost}*** (${translation.cost.full})` + : cost, + }, + { + label: translate("Range"), + value: + translation.range && range !== translation.range.full + ? `***${range}*** (${translation.range.full})` + : range, + }, + { + label: translate("Duration"), + value: + translation.duration && duration !== translation.duration.full + ? `***${duration}*** (${translation.duration.full})` + : duration, + }, + getTargetCategoryTranslation(getInstanceById, locale, entry.target), + getTextForProperty( + { translate, translateMap, getInstanceById }, + entry.property, + ), + getTextForTraditions( + { translate, translateMap, localeCompare, getInstanceById }, + entry.traditions, + ), + createImprovementCost(translate, entry.improvement_cost), + ], + references: entry.src, + } +}) diff --git a/src/helpers/enums.ts b/src/helpers/enums.ts new file mode 100644 index 0000000..36c7ce1 --- /dev/null +++ b/src/helpers/enums.ts @@ -0,0 +1,20 @@ +/** + * Creates an enum case object. + */ +export const Case = (( + kind: K, + value: T, +): T extends NonNullable | null + ? { kind: K } & { [Key in K]: Extract | null> } + : { kind: K } => + (value === undefined + ? { kind } + : { kind, [kind]: value }) as T extends NonNullable | null + ? { kind: K } & { [Key in K]: Extract | null> } + : { kind: K }) as { + (kind: K): { kind: K } + | null>( + kind: K, + value: T, + ): { kind: K } & { [Key in K]: T } +} diff --git a/src/helpers/getTypes.ts b/src/helpers/getTypes.ts index 02ada6c..ae25f5d 100644 --- a/src/helpers/getTypes.ts +++ b/src/helpers/getTypes.ts @@ -1,497 +1,19 @@ /* eslint-disable jsdoc/require-jsdoc */ -/* eslint-disable @typescript-eslint/no-namespace */ -import { config as advantageConfig } from "optolith-database-schema/types/Advantage" -import { config as animalDiseaseConfig } from "optolith-database-schema/types/AnimalDisease" -import { config as animalTypeConfig } from "optolith-database-schema/types/AnimalType" -import { config as arcaneBardTraditionConfig } from "optolith-database-schema/types/ArcaneBardTradition" -import { config as arcaneDancerTraditionConfig } from "optolith-database-schema/types/ArcaneDancerTradition" -import { config as aspectConfig } from "optolith-database-schema/types/Aspect" -import { config as attributeConfig } from "optolith-database-schema/types/Attribute" -import { config as blessingConfig } from "optolith-database-schema/types/Blessing" -import { config as cantripConfig } from "optolith-database-schema/types/Cantrip" -import { config as ceremonyConfig } from "optolith-database-schema/types/Ceremony" -import { config as closeCombatTechniqueConfig } from "optolith-database-schema/types/CombatTechnique_Close" -import { config as rangedCombatTechniqueConfig } from "optolith-database-schema/types/CombatTechnique_Ranged" -import { config as conditionConfig } from "optolith-database-schema/types/Condition" -import { config as continentConfig } from "optolith-database-schema/types/Continent" -import { config as cultureConfig } from "optolith-database-schema/types/Culture" -import { config as derivedCharacteristicConfig } from "optolith-database-schema/types/DerivedCharacteristic" -import { config as disadvantageConfig } from "optolith-database-schema/types/Disadvantage" -import { config as diseaseConfig } from "optolith-database-schema/types/Disease" -import { config as elementConfig } from "optolith-database-schema/types/Element" -import { config as experienceLevelConfig } from "optolith-database-schema/types/ExperienceLevel" -import { config as eyeColorConfig } from "optolith-database-schema/types/EyeColor" -import { config as familiarsTrickConfig } from "optolith-database-schema/types/FamiliarsTrick" -import { config as hairColorConfig } from "optolith-database-schema/types/HairColor" -import { config as kirchenpraegungConfig } from "optolith-database-schema/types/Kirchenpraegung" -import { config as curriculumConfig } from "optolith-database-schema/types/Lessons_Curriculum" -import { config as guidelineConfig } from "optolith-database-schema/types/Lessons_Guideline" -import { config as liturgicalChantConfig } from "optolith-database-schema/types/LiturgicalChant" -import { config as localeConfig } from "optolith-database-schema/types/Locale" -import { config as metaConditionConfig } from "optolith-database-schema/types/MetaCondition" -import { config as pactCategoryConfig } from "optolith-database-schema/types/PactCategory" -import { config as patronConfig } from "optolith-database-schema/types/Patron" -import { config as patronCategoryConfig } from "optolith-database-schema/types/PatronCategory" -import { config as personalityTraitConfig } from "optolith-database-schema/types/PersonalityTrait" -import { config as professionConfig } from "optolith-database-schema/types/Profession" -import { config as propertyConfig } from "optolith-database-schema/types/Property" -import { config as raceConfig } from "optolith-database-schema/types/Race" -import { config as regionConfig } from "optolith-database-schema/types/Region" -import { config as ritualConfig } from "optolith-database-schema/types/Ritual" -import { config as serviceConfig } from "optolith-database-schema/types/Service" -import { config as sexPracticeConfig } from "optolith-database-schema/types/SexPractice" -import { config as skillConfig } from "optolith-database-schema/types/Skill" -import { config as skillGroupConfig } from "optolith-database-schema/types/SkillGroup" -import { config as skillModificationLevelConfig } from "optolith-database-schema/types/SkillModificationLevel" -import { config as socialStatusConfig } from "optolith-database-schema/types/SocialStatus" -import { config as spellConfig } from "optolith-database-schema/types/Spell" -import { config as stateConfig } from "optolith-database-schema/types/State" -import { config as talismanConfig } from "optolith-database-schema/types/Talisman" -import { config as targetCategoryConfig } from "optolith-database-schema/types/TargetCategory" -import { config as uIConfig } from "optolith-database-schema/types/UI" -import { config as equipmentPackageConfig } from "optolith-database-schema/types/equipment/EquipmentPackage" -import { config as ammunitionConfig } from "optolith-database-schema/types/equipment/item/Ammunition" -import { config as animalConfig } from "optolith-database-schema/types/equipment/item/Animal" -import { config as animalCareConfig } from "optolith-database-schema/types/equipment/item/AnimalCare" -import { config as armorConfig } from "optolith-database-schema/types/equipment/item/Armor" -import { config as bandageOrRemedyConfig } from "optolith-database-schema/types/equipment/item/BandageOrRemedy" -import { config as bookConfig } from "optolith-database-schema/types/equipment/item/Book" -import { config as ceremonialItemConfig } from "optolith-database-schema/types/equipment/item/CeremonialItem" -import { config as clothesConfig } from "optolith-database-schema/types/equipment/item/Clothes" -import { config as containerConfig } from "optolith-database-schema/types/equipment/item/Container" -import { config as elixirConfig } from "optolith-database-schema/types/equipment/item/Elixir" -import { config as equipmentOfBlessedOnesConfig } from "optolith-database-schema/types/equipment/item/EquipmentOfBlessedOnes" -import { config as gemOrPreciousStoneConfig } from "optolith-database-schema/types/equipment/item/GemOrPreciousStone" -import { config as illuminationLightSourceConfig } from "optolith-database-schema/types/equipment/item/IlluminationLightSource" -import { config as illuminationRefillsOrSuppliesConfig } from "optolith-database-schema/types/equipment/item/IlluminationRefillsOrSupplies" -import { config as jewelryConfig } from "optolith-database-schema/types/equipment/item/Jewelry" -import { config as liebesspielzeugConfig } from "optolith-database-schema/types/equipment/item/Liebesspielzeug" -import { config as luxuryGoodConfig } from "optolith-database-schema/types/equipment/item/LuxuryGood" -import { config as magicalArtifactConfig } from "optolith-database-schema/types/equipment/item/MagicalArtifact" -import { config as musicalInstrumentConfig } from "optolith-database-schema/types/equipment/item/MusicalInstrument" -import { config as orienteeringAidConfig } from "optolith-database-schema/types/equipment/item/OrienteeringAid" -import { config as poisonConfig } from "optolith-database-schema/types/equipment/item/Poison" -import { config as ropeOrChainConfig } from "optolith-database-schema/types/equipment/item/RopeOrChain" -import { config as stationaryConfig } from "optolith-database-schema/types/equipment/item/Stationary" -import { config as thievesToolConfig } from "optolith-database-schema/types/equipment/item/ThievesTool" -import { config as toolOfTheTradeConfig } from "optolith-database-schema/types/equipment/item/ToolOfTheTrade" -import { config as travelGearOrToolConfig } from "optolith-database-schema/types/equipment/item/TravelGearOrTool" -import { config as vehicleConfig } from "optolith-database-schema/types/equipment/item/Vehicle" -import { config as weaponConfig } from "optolith-database-schema/types/equipment/item/Weapon" -import { config as weaponAccessoryConfig } from "optolith-database-schema/types/equipment/item/WeaponAccessory" -import { config as armorTypeConfig } from "optolith-database-schema/types/equipment/item/sub/ArmorType" -import { config as reachConfig } from "optolith-database-schema/types/equipment/item/sub/Reach" -import { config as animistPowerConfig } from "optolith-database-schema/types/magicalActions/AnimistPower" -import { config as tribeConfig } from "optolith-database-schema/types/magicalActions/AnimistPower_Tribe" -import { config as curseConfig } from "optolith-database-schema/types/magicalActions/Curse" -import { config as dominationRitualConfig } from "optolith-database-schema/types/magicalActions/DominationRitual" -import { config as elvenMagicalSongConfig } from "optolith-database-schema/types/magicalActions/ElvenMagicalSong" -import { config as geodeRitualConfig } from "optolith-database-schema/types/magicalActions/GeodeRitual" -import { config as jesterTrickConfig } from "optolith-database-schema/types/magicalActions/JesterTrick" -import { config as magicalDanceConfig } from "optolith-database-schema/types/magicalActions/MagicalDance" -import { config as magicalMelodyConfig } from "optolith-database-schema/types/magicalActions/MagicalMelody" -import { config as magicalRuneConfig } from "optolith-database-schema/types/magicalActions/MagicalRune" -import { config as zibiljaRitualConfig } from "optolith-database-schema/types/magicalActions/ZibiljaRitual" -import { config as coreRuleConfig } from "optolith-database-schema/types/rule/CoreRule" -import { config as focusRuleConfig } from "optolith-database-schema/types/rule/FocusRule" -import { config as subjectConfig } from "optolith-database-schema/types/rule/FocusRule_Subject" -import { config as optionalRuleConfig } from "optolith-database-schema/types/rule/OptionalRule" -import { config as publicationConfig } from "optolith-database-schema/types/source/Publication" -import { config as advancedCombatSpecialAbilityConfig } from "optolith-database-schema/types/specialAbility/AdvancedCombatSpecialAbility" -import { config as advancedKarmaSpecialAbilityConfig } from "optolith-database-schema/types/specialAbility/AdvancedKarmaSpecialAbility" -import { config as advancedMagicalSpecialAbilityConfig } from "optolith-database-schema/types/specialAbility/AdvancedMagicalSpecialAbility" -import { config as advancedSkillSpecialAbilityConfig } from "optolith-database-schema/types/specialAbility/AdvancedSkillSpecialAbility" -import { config as ancestorGlyphConfig } from "optolith-database-schema/types/specialAbility/AncestorGlyph" -import { config as blessedTraditionConfig } from "optolith-database-schema/types/specialAbility/BlessedTradition" -import { config as brawlingSpecialAbilityConfig } from "optolith-database-schema/types/specialAbility/BrawlingSpecialAbility" -import { config as ceremonialItemSpecialAbilityConfig } from "optolith-database-schema/types/specialAbility/CeremonialItemSpecialAbility" -import { config as combatSpecialAbilityConfig } from "optolith-database-schema/types/specialAbility/CombatSpecialAbility" -import { config as combatStyleSpecialAbilityConfig } from "optolith-database-schema/types/specialAbility/CombatStyleSpecialAbility" -import { config as commandSpecialAbilityConfig } from "optolith-database-schema/types/specialAbility/CommandSpecialAbility" -import { config as familiarSpecialAbilityConfig } from "optolith-database-schema/types/specialAbility/FamiliarSpecialAbility" -import { config as fatePointSexSpecialAbilityConfig } from "optolith-database-schema/types/specialAbility/FatePointSexSpecialAbility" -import { config as fatePointSpecialAbilityConfig } from "optolith-database-schema/types/specialAbility/FatePointSpecialAbility" -import { config as generalSpecialAbilityConfig } from "optolith-database-schema/types/specialAbility/GeneralSpecialAbility" -import { config as karmaSpecialAbilityConfig } from "optolith-database-schema/types/specialAbility/KarmaSpecialAbility" -import { config as liturgicalStyleSpecialAbilityConfig } from "optolith-database-schema/types/specialAbility/LiturgicalStyleSpecialAbility" -import { config as lycantropicGiftConfig } from "optolith-database-schema/types/specialAbility/LycantropicGift" -import { config as magicStyleSpecialAbilityConfig } from "optolith-database-schema/types/specialAbility/MagicStyleSpecialAbility" -import { config as magicalSignConfig } from "optolith-database-schema/types/specialAbility/MagicalSign" -import { config as magicalSpecialAbilityConfig } from "optolith-database-schema/types/specialAbility/MagicalSpecialAbility" -import { config as magicalTraditionConfig } from "optolith-database-schema/types/specialAbility/MagicalTradition" -import { config as pactGiftConfig } from "optolith-database-schema/types/specialAbility/PactGift" -import { config as protectiveWardingCircleSpecialAbilityConfig } from "optolith-database-schema/types/specialAbility/ProtectiveWardingCircleSpecialAbility" -import { config as sermonConfig } from "optolith-database-schema/types/specialAbility/Sermon" -import { config as sexSpecialAbilityConfig } from "optolith-database-schema/types/specialAbility/SexSpecialAbility" -import { config as sikaryanDrainSpecialAbilityConfig } from "optolith-database-schema/types/specialAbility/SikaryanDrainSpecialAbility" -import { config as skillStyleSpecialAbilityConfig } from "optolith-database-schema/types/specialAbility/SkillStyleSpecialAbility" -import { config as vampiricGiftConfig } from "optolith-database-schema/types/specialAbility/VampiricGift" -import { config as visionConfig } from "optolith-database-schema/types/specialAbility/Vision" -import { config as languageConfig } from "optolith-database-schema/types/specialAbility/sub/Language" -import { config as scriptConfig } from "optolith-database-schema/types/specialAbility/sub/Script" -import { config as tradeSecretConfig } from "optolith-database-schema/types/specialAbility/sub/TradeSecret" -import { config as arcaneOrbEnchantmentConfig } from "optolith-database-schema/types/traditionArtifacts/ArcaneOrbEnchantment" -import { config as attireEnchantmentConfig } from "optolith-database-schema/types/traditionArtifacts/AttireEnchantment" -import { config as bowlEnchantmentConfig } from "optolith-database-schema/types/traditionArtifacts/BowlEnchantment" -import { config as cauldronEnchantmentConfig } from "optolith-database-schema/types/traditionArtifacts/CauldronEnchantment" -import { config as chronicleEnchantmentConfig } from "optolith-database-schema/types/traditionArtifacts/ChronicleEnchantment" -import { config as daggerRitualConfig } from "optolith-database-schema/types/traditionArtifacts/DaggerRitual" -import { config as foolsHatEnchantmentConfig } from "optolith-database-schema/types/traditionArtifacts/FoolsHatEnchantment" -import { config as instrumentEnchantmentConfig } from "optolith-database-schema/types/traditionArtifacts/InstrumentEnchantment" -import { config as krallenkettenzauberConfig } from "optolith-database-schema/types/traditionArtifacts/Krallenkettenzauber" -import { config as orbEnchantmentConfig } from "optolith-database-schema/types/traditionArtifacts/OrbEnchantment" -import { config as ringEnchantmentConfig } from "optolith-database-schema/types/traditionArtifacts/RingEnchantment" -import { config as sickleRitualConfig } from "optolith-database-schema/types/traditionArtifacts/SickleRitual" -import { config as spellSwordEnchantmentConfig } from "optolith-database-schema/types/traditionArtifacts/SpellSwordEnchantment" -import { config as staffEnchantmentConfig } from "optolith-database-schema/types/traditionArtifacts/StaffEnchantment" -import { config as toyEnchantmentConfig } from "optolith-database-schema/types/traditionArtifacts/ToyEnchantment" -import { config as trinkhornzauberConfig } from "optolith-database-schema/types/traditionArtifacts/Trinkhornzauber" -import { config as wandEnchantmentConfig } from "optolith-database-schema/types/traditionArtifacts/WandEnchantment" -import { config as weaponEnchantmentConfig } from "optolith-database-schema/types/traditionArtifacts/WeaponEnchantment" -import { config as animalShapeConfig } from "optolith-database-schema/types/traditionArtifacts/sub/AnimalShape" -import { config as animalShapePathConfig } from "optolith-database-schema/types/traditionArtifacts/sub/AnimalShapePath" -import { config as animalShapeSizeConfig } from "optolith-database-schema/types/traditionArtifacts/sub/AnimalShapeSize" -import { config as brewConfig } from "optolith-database-schema/types/traditionArtifacts/sub/Brew" -type IdFromConfig< - // eslint-disable-next-line @typescript-eslint/no-explicit-any - Config extends { id: (data: any, filePath: string) => string | number }, -> = ReturnType +import * as Database from "optolith-database-schema/gen" -type TypeFromConfig< - // eslint-disable-next-line @typescript-eslint/no-explicit-any - Config extends { id: (data: any, filePath: string) => string | number }, -> = Parameters[0] +export type GetInstanceById = ( + entity: U, + id: string, +) => Database.EntityMap[U] | undefined -type GetByIdFromConfig< - // eslint-disable-next-line @typescript-eslint/no-explicit-any - Config extends { id: (data: any, filePath: string) => string | number }, -> = (id: IdFromConfig) => TypeFromConfig | undefined +export type GetAllInstances = ( + entity: U, +) => Database.EntityMap[U][] -type AllFromConfig< - // eslint-disable-next-line @typescript-eslint/no-explicit-any - Config extends { id: (data: any, filePath: string) => string | number }, -> = TypeFromConfig[] - -// prettier-ignore -export namespace GetById { - export namespace Static { - export type AdvancedCombatSpecialAbility = GetByIdFromConfig - export type AdvancedKarmaSpecialAbility = GetByIdFromConfig - export type AdvancedMagicalSpecialAbility = GetByIdFromConfig - export type AdvancedSkillSpecialAbility = GetByIdFromConfig - export type Advantage = GetByIdFromConfig - export type Ammunition = GetByIdFromConfig - export type AncestorGlyph = GetByIdFromConfig - export type AnimalCare = GetByIdFromConfig - export type AnimalDisease = GetByIdFromConfig - export type Animal = GetByIdFromConfig - export type AnimalShapePath = GetByIdFromConfig - export type AnimalShape = GetByIdFromConfig - export type AnimalShapeSize = GetByIdFromConfig - export type AnimalType = GetByIdFromConfig - export type AnimistPower = GetByIdFromConfig - export type Tribe = GetByIdFromConfig - export type ArcaneBardTradition = GetByIdFromConfig - export type ArcaneDancerTradition = GetByIdFromConfig - export type ArcaneOrbEnchantment = GetByIdFromConfig - export type Armor = GetByIdFromConfig - export type ArmorType = GetByIdFromConfig - export type Aspect = GetByIdFromConfig - export type AttireEnchantment = GetByIdFromConfig - export type Attribute = GetByIdFromConfig - export type BandageOrRemedy = GetByIdFromConfig - export type BlessedTradition = GetByIdFromConfig - export type Blessing = GetByIdFromConfig - export type Book = GetByIdFromConfig - export type BowlEnchantment = GetByIdFromConfig - export type BrawlingSpecialAbility = GetByIdFromConfig - export type Brew = GetByIdFromConfig - export type Cantrip = GetByIdFromConfig - export type CauldronEnchantment = GetByIdFromConfig - export type CeremonialItem = GetByIdFromConfig - export type CeremonialItemSpecialAbility = GetByIdFromConfig - export type Ceremony = GetByIdFromConfig - export type ChronicleEnchantment = GetByIdFromConfig - export type CloseCombatTechnique = GetByIdFromConfig - export type Clothes = GetByIdFromConfig - export type CombatSpecialAbility = GetByIdFromConfig - export type CombatStyleSpecialAbility = GetByIdFromConfig - export type CommandSpecialAbility = GetByIdFromConfig - export type Condition = GetByIdFromConfig - export type Container = GetByIdFromConfig - export type Continent = GetByIdFromConfig - export type CoreRule = GetByIdFromConfig - export type Culture = GetByIdFromConfig - export type Curse = GetByIdFromConfig - export type DaggerRitual = GetByIdFromConfig - export type DerivedCharacteristic = GetByIdFromConfig - export type Disadvantage = GetByIdFromConfig - export type Disease = GetByIdFromConfig - export type DominationRitual = GetByIdFromConfig - export type Element = GetByIdFromConfig - export type Elixir = GetByIdFromConfig - export type ElvenMagicalSong = GetByIdFromConfig - export type EquipmentOfBlessedOnes = GetByIdFromConfig - export type EquipmentPackage = GetByIdFromConfig - export type ExperienceLevel = GetByIdFromConfig - export type EyeColor = GetByIdFromConfig - export type FamiliarSpecialAbility = GetByIdFromConfig - export type FamiliarsTrick = GetByIdFromConfig - export type FatePointSexSpecialAbility = GetByIdFromConfig - export type FatePointSpecialAbility = GetByIdFromConfig - export type FocusRule = GetByIdFromConfig - export type Subject = GetByIdFromConfig - export type FoolsHatEnchantment = GetByIdFromConfig - export type GemOrPreciousStone = GetByIdFromConfig - export type GeneralSpecialAbility = GetByIdFromConfig - export type GeodeRitual = GetByIdFromConfig - export type HairColor = GetByIdFromConfig - export type IlluminationLightSource = GetByIdFromConfig - export type IlluminationRefillsOrSupplies = GetByIdFromConfig - export type InstrumentEnchantment = GetByIdFromConfig - export type JesterTrick = GetByIdFromConfig - export type Jewelry = GetByIdFromConfig - export type KarmaSpecialAbility = GetByIdFromConfig - export type Kirchenpraegung = GetByIdFromConfig - export type Krallenkettenzauber = GetByIdFromConfig - export type Language = GetByIdFromConfig - export type Curriculum = GetByIdFromConfig - export type Guideline = GetByIdFromConfig - export type Liebesspielzeug = GetByIdFromConfig - export type LiturgicalChant = GetByIdFromConfig - export type LiturgicalStyleSpecialAbility = GetByIdFromConfig - export type Locale = GetByIdFromConfig - export type LuxuryGood = GetByIdFromConfig - export type LycantropicGift = GetByIdFromConfig - export type MagicalArtifact = GetByIdFromConfig - export type MagicalDance = GetByIdFromConfig - export type MagicalMelody = GetByIdFromConfig - export type MagicalRune = GetByIdFromConfig - export type MagicalSign = GetByIdFromConfig - export type MagicalSpecialAbility = GetByIdFromConfig - export type MagicalTradition = GetByIdFromConfig - export type MagicStyleSpecialAbility = GetByIdFromConfig - export type MetaCondition = GetByIdFromConfig - export type MusicalInstrument = GetByIdFromConfig - export type OptionalRule = GetByIdFromConfig - export type OrbEnchantment = GetByIdFromConfig - export type OrienteeringAid = GetByIdFromConfig - export type PactCategory = GetByIdFromConfig - export type PactGift = GetByIdFromConfig - export type PatronCategory = GetByIdFromConfig - export type Patron = GetByIdFromConfig - export type PersonalityTrait = GetByIdFromConfig - export type Poison = GetByIdFromConfig - export type Profession = GetByIdFromConfig - export type Property = GetByIdFromConfig - export type ProtectiveWardingCircleSpecialAbility = GetByIdFromConfig - export type Publication = GetByIdFromConfig - export type Race = GetByIdFromConfig - export type RangedCombatTechnique = GetByIdFromConfig - export type Reach = GetByIdFromConfig - export type Region = GetByIdFromConfig - export type RingEnchantment = GetByIdFromConfig - export type Ritual = GetByIdFromConfig - export type RopeOrChain = GetByIdFromConfig - export type Script = GetByIdFromConfig - export type Sermon = GetByIdFromConfig - export type Service = GetByIdFromConfig - export type SexPractice = GetByIdFromConfig - export type SexSpecialAbility = GetByIdFromConfig - export type SickleRitual = GetByIdFromConfig - export type SikaryanDrainSpecialAbility = GetByIdFromConfig - export type SkillGroup = GetByIdFromConfig - export type SkillModificationLevel = GetByIdFromConfig - export type Skill = GetByIdFromConfig - export type SkillStyleSpecialAbility = GetByIdFromConfig - export type SocialStatus = GetByIdFromConfig - export type Spell = GetByIdFromConfig - export type SpellSwordEnchantment = GetByIdFromConfig - export type StaffEnchantment = GetByIdFromConfig - export type State = GetByIdFromConfig - export type Stationary = GetByIdFromConfig - export type Talisman = GetByIdFromConfig - export type TargetCategory = GetByIdFromConfig - export type ThievesTool = GetByIdFromConfig - export type ToolOfTheTrade = GetByIdFromConfig - export type ToyEnchantment = GetByIdFromConfig - export type TradeSecret = GetByIdFromConfig - export type TravelGearOrTool = GetByIdFromConfig - export type Trinkhornzauber = GetByIdFromConfig - export type UI = GetByIdFromConfig - export type VampiricGift = GetByIdFromConfig - export type Vehicle = GetByIdFromConfig - export type Vision = GetByIdFromConfig - export type WandEnchantment = GetByIdFromConfig - export type WeaponAccessory = GetByIdFromConfig - export type WeaponEnchantment = GetByIdFromConfig - export type Weapon = GetByIdFromConfig - export type ZibiljaRitual = GetByIdFromConfig - } -} - -// prettier-ignore -export namespace Singleton { - export namespace Static { - export type ExperienceLevel = TypeFromConfig | undefined - } -} - -// prettier-ignore -export namespace All { - export namespace Static { - export type AdvancedCombatSpecialAbilities = AllFromConfig - export type AdvancedKarmaSpecialAbilities = AllFromConfig - export type AdvancedMagicalSpecialAbilities = AllFromConfig - export type AdvancedSkillSpecialAbilities = AllFromConfig - export type Advantages = AllFromConfig - export type Ammunition = AllFromConfig - export type AncestorGlyphs = AllFromConfig - export type AnimalCare = AllFromConfig - export type AnimalDiseases = AllFromConfig - export type Animals = AllFromConfig - export type AnimalShapePaths = AllFromConfig - export type AnimalShapes = AllFromConfig - export type AnimalShapeSizes = AllFromConfig - export type AnimalTypes = AllFromConfig - export type AnimistPowers = AllFromConfig - export type AnimistPowerTribes = AllFromConfig - export type ArcaneBardTraditions = AllFromConfig - export type ArcaneDancerTraditions = AllFromConfig - export type ArcaneOrbEnchantments = AllFromConfig - export type Armors = AllFromConfig - export type ArmorTypes = AllFromConfig - export type Aspects = AllFromConfig - export type AttireEnchantments = AllFromConfig - export type Attributes = AllFromConfig - export type BandagesAndRemedies = AllFromConfig - export type BlessedTraditions = AllFromConfig - export type Blessings = AllFromConfig - export type Books = AllFromConfig - export type BowlEnchantments = AllFromConfig - export type BrawlingSpecialAbilities = AllFromConfig - export type Brews = AllFromConfig - export type Cantrips = AllFromConfig - export type CauldronEnchantments = AllFromConfig - export type CeremonialItems = AllFromConfig - export type CeremonialItemSpecialAbilities = AllFromConfig - export type Ceremonies = AllFromConfig - export type ChronicleEnchantments = AllFromConfig - export type CloseCombatTechniques = AllFromConfig - export type Clothes = AllFromConfig - export type CombatSpecialAbilities = AllFromConfig - export type CombatStyleSpecialAbilities = AllFromConfig - export type CommandSpecialAbilities = AllFromConfig - export type Conditions = AllFromConfig - export type Containers = AllFromConfig - export type Continents = AllFromConfig - export type CoreRules = AllFromConfig - export type Cultures = AllFromConfig - export type Curses = AllFromConfig - export type DaggerRituals = AllFromConfig - export type DerivedCharacteristics = AllFromConfig - export type Disadvantages = AllFromConfig - export type Diseases = AllFromConfig - export type DominationRituals = AllFromConfig - export type Elements = AllFromConfig - export type Elixirs = AllFromConfig - export type ElvenMagicalSongs = AllFromConfig - export type EquipmentOfBlessedOnes = AllFromConfig - export type EquipmentPackages = AllFromConfig - export type ExperienceLevels = AllFromConfig - export type EyeColors = AllFromConfig - export type FamiliarSpecialAbilities = AllFromConfig - export type FamiliarsTricks = AllFromConfig - export type FatePointSexSpecialAbilities = AllFromConfig - export type FatePointSpecialAbilities = AllFromConfig - export type FocusRules = AllFromConfig - export type FocusRuleSubjects = AllFromConfig - export type FoolsHatEnchantments = AllFromConfig - export type GemsAndPreciousStones = AllFromConfig - export type GeneralSpecialAbilities = AllFromConfig - export type GeodeRituals = AllFromConfig - export type HairColors = AllFromConfig - export type IlluminationLightSources = AllFromConfig - export type IlluminationRefillsAndSupplies = AllFromConfig - export type InstrumentEnchantments = AllFromConfig - export type JesterTricks = AllFromConfig - export type Jewelry = AllFromConfig - export type KarmaSpecialAbilities = AllFromConfig - export type Kirchenpraegungen = AllFromConfig - export type Krallenkettenzauber = AllFromConfig - export type Languages = AllFromConfig - export type LessonsCurricula = AllFromConfig - export type LessonsGuidelines = AllFromConfig - export type Liebesspielzeug = AllFromConfig - export type LiturgicalChants = AllFromConfig - export type LiturgicalStyleSpecialAbilities = AllFromConfig - export type Locales = AllFromConfig - export type LuxuryGoods = AllFromConfig - export type LycantropicGifts = AllFromConfig - export type MagicalArtifacts = AllFromConfig - export type MagicalDances = AllFromConfig - export type MagicalMelodies = AllFromConfig - export type MagicalRunes = AllFromConfig - export type MagicalSigns = AllFromConfig - export type MagicalSpecialAbilities = AllFromConfig - export type MagicalTraditions = AllFromConfig - export type MagicStyleSpecialAbilities = AllFromConfig - export type MetaConditions = AllFromConfig - export type MusicalInstruments = AllFromConfig - export type OptionalRules = AllFromConfig - export type OrbEnchantments = AllFromConfig - export type OrienteeringAids = AllFromConfig - export type PactCategories = AllFromConfig - export type PactGifts = AllFromConfig - export type PatronCategories = AllFromConfig - export type Patrons = AllFromConfig - export type PersonalityTraits = AllFromConfig - export type Poisons = AllFromConfig - export type Professions = AllFromConfig - export type Properties = AllFromConfig - export type ProtectiveWardingCircleSpecialAbilities = AllFromConfig - export type Publications = AllFromConfig - export type Races = AllFromConfig - export type RangedCombatTechniques = AllFromConfig - export type Reaches = AllFromConfig - export type Regions = AllFromConfig - export type RingEnchantments = AllFromConfig - export type Rituals = AllFromConfig - export type RopesAndChains = AllFromConfig - export type Scripts = AllFromConfig - export type Sermons = AllFromConfig - export type Services = AllFromConfig - export type SexPractices = AllFromConfig - export type SexSpecialAbilities = AllFromConfig - export type SickleRituals = AllFromConfig - export type SikaryanDrainSpecialAbilities = AllFromConfig - export type SkillGroups = AllFromConfig - export type SkillModificationLevels = AllFromConfig - export type Skills = AllFromConfig - export type SkillStyleSpecialAbilities = AllFromConfig - export type SocialStatuses = AllFromConfig - export type Spells = AllFromConfig - export type SpellSwordEnchantments = AllFromConfig - export type StaffEnchantments = AllFromConfig - export type States = AllFromConfig - export type Stationary = AllFromConfig - export type Talismans = AllFromConfig - export type TargetCategories = AllFromConfig - export type ThievesTools = AllFromConfig - export type ToolsOfTheTrade = AllFromConfig - export type ToyEnchantments = AllFromConfig - export type TradeSecrets = AllFromConfig - export type TravelGearAndTools = AllFromConfig - export type Trinkhornzauber = AllFromConfig - export type UI = AllFromConfig - export type VampiricGifts = AllFromConfig - export type Vehicles = AllFromConfig - export type Visions = AllFromConfig - export type WandEnchantments = AllFromConfig - export type WeaponAccessories = AllFromConfig - export type WeaponEnchantments = AllFromConfig - export type Weapons = AllFromConfig - export type ZibiljaRituals = AllFromConfig - } -} +export type GetAllChildInstancesForParent< + T extends keyof Database.ChildEntityMap, +> = ( + entity: U, + parentId: Database.ChildEntityMap[U][2], +) => Database.ChildEntityMap[U][0][] diff --git a/src/helpers/identifiers.ts b/src/helpers/identifiers.ts index d5db2e3..8b025d0 100644 --- a/src/helpers/identifiers.ts +++ b/src/helpers/identifiers.ts @@ -1,18 +1,16 @@ -// TODO: Update for new identifier mappings - /** * Used identifiers of optional rules. */ export enum OptionalRuleIdentifier { - MaximumAttributeScores = 8, - HigherDefenseStats = 17, + MaximumAttributeScores = "9df3e0d5-6aed-4b90-924b-c11603c9bb73", + HigherDefenseStats = "836787b2-eaec-41c3-8fdb-51591415311b", } /** * Used identifiers of races. */ export enum RaceIdentifier { - Humans = 1, + Humans = "252841cf-f2d4-4fb9-af56-30de48531db5", } /** @@ -26,46 +24,46 @@ export enum ProfessionIdentifier { * Used identifiers of eye colors. */ export enum EyeColorIdentifier { - Red = 19, - Purple = 20, + Red = "f4990602-5605-4642-9902-5dcca7fe9bb2", + Purple = "84bfd76d-fa4c-4d21-ad27-f6a62343dc9c", } /** * Used identifiers of hair colors. */ export enum HairColorIdentifier { - White = 24, - Green = 25, + White = "af44ab84-6bec-4aa8-a97d-72bb40a5eb2a", + Green = "b4140abd-cdb4-43c8-83b1-83e6d1060fef", } /** * Used identifiers of attributes. */ export enum AttributeIdentifier { - Courage = 1, - Sagacity = 2, - Intuition = 3, - Charisma = 4, - Dexterity = 5, - Agility = 6, - Constitution = 7, - Strength = 8, + Courage = "88133847-a3ed-413a-bb67-e7b11d1e51ad", + Sagacity = "476dac00-49c1-486e-84bc-0ff669e4a003", + Intuition = "70ce45aa-66b6-4b56-bede-2a7ff6d82448", + Charisma = "f9e8d52f-985a-49c2-af75-9ae9624ad4cb", + Dexterity = "67159a5f-df4a-441f-ad2c-508e69689efb", + Agility = "b4140abd-cdb4-43c8-83b1-83e6d1060fef", + Constitution = "bc55f1aa-4204-42c9-b599-7cca65d9e463", + Strength = "6b7a5e6b-f130-4eae-a45d-a59ece45e50b", } /** * Used identifiers of derived characteristics. */ export enum DerivedCharacteristicIdentifier { - LifePoints = 1, - ArcaneEnergy = 2, - KarmaPoints = 3, - Spirit = 4, - Toughness = 5, - Dodge = 6, - Initiative = 7, - Movement = 8, - FatePoints = 9, - WoundThreshold = 10, + LifePoints = "190845e8-c2c8-40ff-8908-248f01b49f8b", + ArcaneEnergy = "f9e8d52f-985a-49c2-af75-9ae9624ad4cb", + KarmaPoints = "42dca192-1cca-4c2e-97d1-8c3599ef022d", + Spirit = "b6f98337-77b4-4f8e-9b6d-fda3a49d5c75", + Toughness = "1fa344af-3e53-4f25-b36a-7f53f51b90f5", + Dodge = "5fc7d5d3-fdf6-4073-afba-3fd511d53c78", + Initiative = "0b97b4ce-75b0-4573-add9-86621dcf52a6", + Movement = "0c634904-d238-47ee-9b0f-2d6a9d5ff63a", + FatePoints = "21beccd1-bcfb-4cfb-b544-9b5066ed242a", + WoundThreshold = "6f1eb396-051b-44c7-a69d-12aba4552891", } /** @@ -80,263 +78,263 @@ export type EnergyIdentifier = * Used identifiers of skill. */ export enum SkillIdentifier { - Flying = 1, - Gaukelei = 2, - Climbing = 3, - BodyControl = 4, - FeatOfStrength = 5, - Riding = 6, - Swimming = 7, - SelfControl = 8, - Singing = 9, - Perception = 10, - Dancing = 11, - Pickpocket = 12, - Stealth = 13, - Carousing = 14, - Persuasion = 15, - Seduction = 16, - Intimidation = 17, - Etiquette = 18, - Streetwise = 19, - Empathy = 20, - FastTalk = 21, - Disguise = 22, - Willpower = 23, - Tracking = 24, - Ropes = 25, - Fishing = 26, - Orienting = 27, - PlantLore = 28, - AnimalLore = 29, - Survival = 30, - Gambling = 31, - Geography = 32, - History = 33, - Religions = 34, - Warfare = 35, - MagicalLore = 36, - Mechanics = 37, - Math = 38, - Law = 39, - MythsAndLegends = 40, - SphereLore = 41, - Astronomy = 42, - Alchemy = 43, - Sailing = 44, - Driving = 45, - Commerce = 46, - TreatPoison = 47, - TreatDisease = 48, - TreatSoul = 49, - TreatWounds = 50, - Woodworking = 51, - PrepareFood = 52, - Leatherworking = 53, - ArtisticAbility = 54, - Metalworking = 55, - Music = 56, - PickLocks = 57, - Earthencraft = 58, - Clothworking = 59, + Flying = "71b25c38-80bc-4218-b020-6b1406c170a5", + Gaukelei = "7a9cddc3-c8ca-4d68-b520-ffd773e44646", + Climbing = "7d10acd5-579f-430a-a07c-5f2c9030c758", + BodyControl = "83c5d33b-145c-4c29-8977-0fbaa4d32666", + FeatOfStrength = "845e9434-24d4-436d-8494-349f6fc00e7a", + Riding = "aa383b7c-aa8c-4ee2-b9da-dd7cd24b8941", + Swimming = "7fc87a4d-3a3a-498b-a12a-2ea5e0c68b19", + SelfControl = "811b1cb3-befa-4c41-b78d-12d55f32dbe9", + Singing = "4d4fbc6b-eb1e-430e-b8af-6af66b5128c2", + Perception = "347ef258-5a4b-4cf1-978a-f36b12196ac3", + Dancing = "c0990597-2334-4fa4-87c5-e3df6166fa9c", + Pickpocket = "87f8f170-9aaf-4ffa-a5e0-bf4473b51458", + Stealth = "344d2656-1541-4ba0-aa5b-238dc6626287", + Carousing = "ae3ff6b5-fc27-4e8b-ac1b-483f071b805e", + Persuasion = "e72ea51a-f411-453d-8920-8aa6f4daab60", + Seduction = "e5934263-9536-4025-ad53-fac54ec9f09b", + Intimidation = "10fd08ac-8e77-4d36-b507-720d4c633222", + Etiquette = "158636a0-8bb7-42d1-8436-2872ef43b75b", + Streetwise = "091e8792-2814-4fac-8c47-82ddb55a1b94", + Empathy = "d2b46106-41ec-4195-80e3-5e19f238084a", + FastTalk = "4a2876be-9146-45d3-b2d5-6fb33cd489aa", + Disguise = "a8ed8b4f-2391-4365-8273-d367617aa800", + Willpower = "d5a8c759-9379-4250-a27f-334a1411068d", + Tracking = "50270926-e802-4f61-92cb-fdd5cb24ddf0", + Ropes = "5cbdc561-368b-4e4e-8f7f-b97e32776815", + Fishing = "a872228e-fd8c-44b4-94e0-cfbdf137633f", + Orienting = "133ea1cb-2ebb-4cfd-a594-a9948f8fb2b6", + PlantLore = "cc6f188c-e271-41fc-9d64-6910c0c6fdc5", + AnimalLore = "a4eecb40-4d3d-4088-be28-366c003911df", + Survival = "2bb0fee1-a2c2-48ba-91a0-e4c362d36335", + Gambling = "c3763aa8-be38-4e73-b738-78bd2d3ae73f", + Geography = "019cc09e-85d7-4ab4-bdb5-6c13af4bf213", + History = "bbee9852-2160-4ff1-b7b9-42bcaa89a19f", + Religions = "8993613b-3f64-4bd9-b51f-8cd0141cfaef", + Warfare = "515f24b0-e580-45f8-94e9-f3a97601d323", + MagicalLore = "322ae078-e674-44cb-a050-360a9428841c", + Mechanics = "73a5c800-8384-4704-9dfa-a242eacd3270", + Math = "89d50281-6869-4758-95d1-66fba5109feb", + Law = "cd8aa58b-6803-49bd-9c86-6a800f21f46a", + MythsAndLegends = "c301fe38-2aca-4c89-9947-c220d8407f2c", + SphereLore = "82a1a676-2230-416b-8ced-24880161d6f6", + Astronomy = "320227fe-7923-41ed-ac62-b175808a9f5e", + Alchemy = "17511b2f-4f83-4018-befc-76bb68f02c4b", + Sailing = "41bd7d7e-576d-47d7-a614-aaa30286ea7d", + Driving = "f53e3d41-4b61-4f0d-80bf-8d67d62fe180", + Commerce = "60469391-2701-4cb2-bc18-914c61cb3fe4", + TreatPoison = "a4edde4c-8784-45e6-92cf-4dd71067eff6", + TreatDisease = "4e2ec767-68ab-49db-9f82-6042c0d04eba", + TreatSoul = "d68dc494-ab63-444f-ae97-c254ae01eca9", + TreatWounds = "b3e86df6-a7d3-4887-9d19-7e899cd146cb", + Woodworking = "4df39524-ec13-45d8-aabe-7288cfe7ab81", + PrepareFood = "763d869b-969f-41d4-b8ba-c2f7aa29ae50", + Leatherworking = "25ab080a-24e4-4f45-ab16-f6bd793d8398", + ArtisticAbility = "140d0c24-e49b-43a2-95c9-77743f35c752", + Metalworking = "c2922325-224a-4941-958f-a3acb553ae0e", + Music = "284bc585-8b9c-4cc1-96f5-442a1d1c4091", + PickLocks = "248fc7cd-e65f-49d5-995f-2d87ff3ff7d6", + Earthencraft = "1e7367c0-0256-4874-a92e-a0e4197c3487", + Clothworking = "bf50f5c9-b42f-4637-8685-b2e233dd48f7", } /** * Used identifiers of skill groups. */ export enum SkillGroupIdentifier { - Physical = 1, - Social = 2, - Nature = 3, - Knowledge = 4, - Craft = 5, + Physical = "5b3b6139-bc02-4332-b092-de043c00793f", + Social = "f0a10163-221a-4a54-ae40-0bb71582262e", + Nature = "6ebc92b3-2c48-4f75-9d84-489788284835", + Knowledge = "ca6dd6da-f9ab-4120-9cb9-47f73254a6e2", + Craft = "15d0e623-6f85-4508-8921-1aa6edfd90c7", } /** * Used identifiers of advantages. */ export enum AdvantageIdentifier { - CustomAdvantage = 0, - Aptitude = 4, // Begabung - Nimble = 9, // Flink - Blessed = 12, - Luck = 14, - ExceptionalSkill = 16, - ExceptionalCombatTechnique = 17, - IncreasedAstralPower = 20, - IncreasedKarmaPoints = 21, - IncreasedLifePoints = 22, - IncreasedSpirit = 23, - IncreasedToughness = 24, - ImmunityToPoison = 25, - ImmunityToDisease = 26, - MagicalAttunement = 29, - Rich = 33, - SociallyAdaptable = 37, - InspireConfidence = 43, - WeaponAptitude = 44, - Spellcaster = 47, - Unyielding = 51, // Eisern - HatredOf = 55, - LargeSpellSelection = 66, - LeichterGang = 85, - Preacher = 91, - Visionary = 92, - ManySermons = 93, - ManyVisions = 94, - Einkommen = 129, + CustomAdvantage = "e70b85db-d437-4f0e-991e-1d95684935e2", + Aptitude = "77795e79-7db3-4e19-8ecf-e622820bae9e", // Begabung + Nimble = "03367aac-81ff-4bfc-947c-20a2e4446364", // Flink + Blessed = "e5a9bb6d-9791-4d20-bf34-52a3aaf69726", + Luck = "b677661a-8881-456c-932f-c41369a5c21f", + ExceptionalSkill = "87c50831-9f8c-455d-a6d8-5610b232e932", + ExceptionalCombatTechnique = "046adc73-d4d1-4172-886a-544fca95a31b", + IncreasedAstralPower = "cf11a805-3012-4d57-94a8-0efb33803509", + IncreasedKarmaPoints = "cf31f067-ee38-4426-a6a5-3fb6e8b31a74", + IncreasedLifePoints = "dae3e503-a253-42f7-a75c-10b74dd57116", + IncreasedSpirit = "47deca36-35de-4a0b-9894-6c24cf242db8", + IncreasedToughness = "6d9b4c7c-35bf-435c-bccf-4fcee5ba3832", + ImmunityToPoison = "7b1e3cd6-34a6-4711-9535-8cd8ed66f1cd", + ImmunityToDisease = "1f019851-2b4d-4d01-ba69-a386d91ec499", + MagicalAttunement = "0a08218c-9b38-4c3a-84cf-86a50cd2b982", + Rich = "45dd8e80-dd2b-4573-99d5-fbf0810af9ce", + SociallyAdaptable = "d9aa63c1-9ad0-467b-a0cb-51e3450e48b0", + InspireConfidence = "13bfcc91-620e-44e9-aa45-10ed3b0849a7", + WeaponAptitude = "37ff9041-234d-4570-a845-f09ab5883bc3", + Spellcaster = "9770a700-acb7-4b60-b6ea-a329a9acb26b", + Unyielding = "693237d9-d64c-4f06-b725-cc5795babae4", // Eisern + HatredOf = "93255da0-50f2-4c7f-b4f3-66586c3a7c17", + LargeSpellSelection = "a7583667-850b-4d86-be2d-28ab2216c1e9", + LeichterGang = "7ad8cc78-6037-43e3-b717-d5a1592f5d55", + Preacher = "cb371b91-564a-4ca6-8778-e45c953f3bb0", + Visionary = "c499d999-e027-478c-9580-e00c0bf89a4c", + ManySermons = "838ec345-9f88-422e-ae20-5526836b72eb", + ManyVisions = "6f0d0843-2875-4377-b3c9-db57c6eff1bc", + Einkommen = "9284815b-7c40-44db-b37e-1f966b3097cd", } /** * Used identifiers of disadvantages. */ export enum DisadvantageIdentifier { - CustomDisadvantage = 0, - AfraidOf = 1, - Poor = 2, - Slow = 4, - NoFlyingBalm = 14, - NoFamiliar = 15, - MagicalRestriction = 21, - DecreasedArcanePower = 23, - DecreasedKarmaPoints = 24, - DecreasedLifePoints = 25, - DecreasedSpirit = 26, - DecreasedToughness = 27, - BadLuck = 28, - PersonalityFlaw = 30, - Principles = 31, - BadHabit = 33, - NegativeTrait = 34, // Schlechte Eigenschaft - Stigma = 42, - Deaf = 44, // Taub - Incompetent = 45, - Obligations = 47, // Verpflichtungen - Maimed = 48, // Verstümmelt - BrittleBones = 56, // Gläsern - SmallSpellSelection = 64, - FewerSermons = 70, - FewerVisions = 71, + CustomDisadvantage = "1ba46bf8-e3ed-46b4-98e5-8e3edb6ed0a3", + AfraidOf = "652fe330-59d5-4784-9b4a-dbb527bf12c7", + Poor = "54ec1dce-32f2-44eb-b501-000dd0da1e3b", + Slow = "9229365c-6392-4896-8306-c3c7b68bb852", + NoFlyingBalm = "19d1e013-175b-4b62-859a-b8007a0bf767", + NoFamiliar = "36950e47-055b-4456-b57f-0501e4104e26", + MagicalRestriction = "efaacd60-3ed7-4693-a1bf-d69a3a3ab18c", + DecreasedArcanePower = "3629dbd4-5d0c-4683-be0c-500aed8161fb", + DecreasedKarmaPoints = "c2a66c6b-0cff-4da8-936c-b3f3ba02719d", + DecreasedLifePoints = "f0df81a0-b514-47d3-88a8-b94a52d6a329", + DecreasedSpirit = "08707e83-bff4-40a1-8a21-ca88d61384c8", + DecreasedToughness = "9bd86082-a773-4d21-b059-a6464b1d5fdc", + BadLuck = "77cde71d-c720-4be9-902c-65dca331c6d6", + PersonalityFlaw = "804fdfe2-3472-4719-8ff8-bfdb77c3e922", + Principles = "52bf0b68-316c-4ca0-abdc-e2691e779801", + BadHabit = "fe08344e-5e5e-4504-b9e0-58eb67e21743", + NegativeTrait = "19d422bd-b376-47a7-b69f-1bffde9f0361", // Schlechte Eigenschaft + Stigma = "8ef5d706-737b-4282-95aa-9549c90464cc", + Deaf = "33b1ebeb-5dae-41f9-8734-d32e9cd59e2a", // Taub + Incompetent = "5bde2e37-6a1e-4008-b75c-e9ac106e78cd", + Obligations = "a8a9aaab-1611-43d6-8803-b33a582a848f", // Verpflichtungen + Maimed = "496d8bea-35ee-4a5d-928d-8a855c882edc", // Verstümmelt + BrittleBones = "0ff139db-0a05-45ec-bcd6-42caea87d691", // Gläsern + SmallSpellSelection = "65ff9a29-ecf4-4f73-9945-7908c89e9059", + FewerSermons = "2f0a061a-fd26-492d-bff0-746b19bf2921", + FewerVisions = "bfe12f5c-a3b3-4f2d-bede-8b3f8e8513dd", } /** * Used identifiers of ranged combat techniques. */ export enum RangedCombatTechniqueIdentifier { - SpittingFire = 4, + SpittingFire = "9329e5a2-6c0f-4ab0-9536-73707b74407f", } /** * Used identifiers of advanced skill special abilities. */ export enum AdvancedSkillSpecialAbilityIdentifier { - Fachwissen = 2, + Fachwissen = "7bb1e727-f9e5-43ca-8f8a-50ae36b67951", } /** * Used identifiers of combat special abilities. */ export enum CombatSpecialAbilityIdentifier { - CombatReflexes = 12, + CombatReflexes = "0e794818-2572-4fdb-86b3-ec52e9e339c3", } /** * Used identifiers of general special abilities. */ export enum GeneralSpecialAbilityIdentifier { - SkillSpecialization = 9, - CraftInstruments = 17, - Hunter = 18, - Literacy = 27, - Language = 29, - LanguageSpecialization = 30, - FireEater = 53, + SkillSpecialization = "b2fbdf25-d44a-4d50-95a8-2501e220abdd", + CraftInstruments = "9c57c9ee-6619-4e13-b1cd-056d552d8739", + Hunter = "29239be5-984c-47b0-ba54-408e8978f3af", + Literacy = "2da6289d-6c2f-47ff-8046-5fef87dec62f", + Language = "6cfb462d-e6ab-4d91-bb4b-3d4c0dcac897", + LanguageSpecialization = "8a6d08a0-3a32-4b72-b3f7-e5aa44cda5bf", + FireEater = "05448a67-af4e-48a6-928b-5d9219b3aaf6", } /** * Used identifiers of magical special abilities. */ export enum MagicalSpecialAbilityIdentifier { - PropertyKnowledge = 3, - GrosseMeditation = 12, - Adaptation = 18, - Imitationszauberei = 51, + PropertyKnowledge = "5d9f3ba7-0fb8-48ca-aebb-baa01c67b4ab", + GrosseMeditation = "0ffd4668-9d6f-4a87-9957-f099b5e58efb", + Adaptation = "131ec19f-b950-4b3b-8a76-6100adcb227e", + Imitationszauberei = "29a948ad-3c18-4e3e-b151-e0e7b53cca02", } /** * Used identifiers of magical traditions. */ export enum MagicalTraditionIdentifier { - GuildMages = 1, - Witches = 2, - Elves = 3, - Unicorn = 4, - Druids = 5, - QabalyaMages = 6, - IntuitiveMages = 7, - Savants = 8, - Illusionists = 9, - ArcaneBards = 10, - ArcaneDancers = 11, - Schelme = 13, - Zauberalchimisten = 14, - TsatuariaAnhaengerinnen = 16, - Necker = 17, - Animisten = 18, - Geoden = 19, - Zibilijas = 20, - BrobimGeoden = 21, - Darna = 23, - Runenschoepfer = 24, + GuildMages = "d9b83dba-cf29-4243-9b85-e03672ac0f02", + Witches = "f3e5278f-8b84-4e65-9ae9-9dbab870ff32", + Elves = "7fafbac0-bd86-4c3d-b1fa-5a8b36b674dc", + Unicorn = "e427bff1-108e-4df3-acfc-0133b5e85f1d", + Druids = "fc8c24c4-3c11-4231-a866-2350bfdb0117", + QabalyaMages = "6dd001f3-506c-4c62-b0e9-facfa44435c1", + IntuitiveMages = "f5dccd70-fc77-4793-8fa2-383b31a7d96a", + Savants = "16e2ec01-eadd-45f0-93a2-d7384628dcf5", + Illusionists = "6e04db3b-1157-4d2c-af13-f7f4ca9711d0", + ArcaneBards = "0d3d1b5a-0550-4e47-9ccf-f2021c5409b6", + ArcaneDancers = "15a92260-95aa-43ee-87ed-e8083cb08897", + Schelme = "11b2d97a-632f-4bb5-a6bc-e53addff2071", + Zauberalchimisten = "a4f341a8-a62a-4d8d-af89-f490b4470f1d", + TsatuariaAnhaengerinnen = "0818d00e-e18a-4daf-bf39-daa5d5edb8b0", + Necker = "eceb1fff-7412-4371-a6f2-5fb5889cb3b2", + Animisten = "147071ec-93a2-4332-9ad4-d55dce2f2355", + Geoden = "2dd3c077-27a7-4dfd-a316-42dc1ba9b05a", + Zibilijas = "a6ee6ca5-41cd-4f5a-915a-7e775ede20af", + BrobimGeoden = "40441cf9-e503-4895-a900-5a00fc2df8bc", + Darna = "70f59d63-d862-47bc-bd07-c70c9e86d528", + Runenschoepfer = "ca29d28a-425f-4f64-a601-1c911d4446cf", } /** * Used identifiers of magical special abilities. */ export enum MagicStyleSpecialAbilityIdentifier { - ScholarDesMagierkollegsZuHoningen = 24, - MadaschwesternStil = 55, + ScholarDesMagierkollegsZuHoningen = "9cc872c9-1f2c-4bb8-97ed-e0c9135f93a3", + MadaschwesternStil = "6fdade11-f4b8-46fc-b4dc-010bac9a4f81", } /** * Used identifiers of pact gifts. */ export enum PactGiftIdentifier { - DunklesAbbildDerBuendnisgabe = 3, + DunklesAbbildDerBuendnisgabe = "98329d75-1cfe-4a4d-ad8e-0ba69c8c1be4", } /** * Used identifiers of aspects. */ export enum AspectIdentifier { - General = 1, - AllgemeinSchamanenritus = 44, + General = "b77ab574-fcb2-443f-8952-83e85f5048ab", + AllgemeinSchamanenritus = "00b4f9d9-9654-48b7-8b70-2b2e5c961552", } /** * Used identifiers of karma special abilities. */ export enum KarmaSpecialAbilityIdentifier { - AspectKnowledge = 1, - MasterOfAspect = 5, - HigherOrdination = 14, + AspectKnowledge = "a1c2c1ef-9b1a-4c0b-9bc0-51e4b944269e", + MasterOfAspect = "9174604f-70b4-4ce2-94b8-3dccd77ec7e1", + HigherOrdination = "6ff645b0-2b6f-4d7c-a718-c0493105a405", } /** * Used identifiers of liturgical style special abilities. */ export enum LiturgicalStyleSpecialAbilityIdentifier { - BirdsOfPassage = 38, // Zugvögel - HuntressesOfTheWhiteMaiden = 40, // Jägerinnen der Weißen Maid - FollowersOfTheGoldenOne = 47, // Anhänger des Güldenen + BirdsOfPassage = "fa64616e-daa2-4ea4-a9b0-001579e413c4", // Zugvögel + HuntressesOfTheWhiteMaiden = "ce21e327-a750-4312-9a1d-6ab165bbcdb2", // Jägerinnen der Weißen Maid + FollowersOfTheGoldenOne = "53dc9a31-c608-4bb4-b92b-df2a4a567486", // Anhänger des Güldenen } /** * Used identifiers of blessed traditions. */ export enum BlessedTraditionIdentifier { - Praios = 1, - Phex = 5, - Firun = 9, - Rahja = 12, + Praios = "b4b3ed0e-d4fc-4b72-ba4f-20c37e3dc7c2", + Phex = "24d3b724-3895-445b-9856-da7a3919df38", + Firun = "221d147d-ce08-402b-87d9-f59c079d0bc6", + Rahja = "84350c1e-ed9e-47e4-9fe8-d33e14df7753", } diff --git a/src/helpers/translate.ts b/src/helpers/translate.ts index e7e02d7..943bb70 100644 --- a/src/helpers/translate.ts +++ b/src/helpers/translate.ts @@ -1,14 +1,25 @@ -import { UI } from "optolith-database-schema/types/UI" -import { LocaleMap } from "optolith-database-schema/types/_LocaleMap" +import { Locale } from "optolith-database-schema/gen" + +/** + * The type of all translations + */ +export type Translations = NonNullable /** * Translates a given key into a string, optionally with parameters. */ -export type Translate = ( +export type Translate = ( key: K, - ...params: (string | number)[] + ...rest: Translations[K] extends string & { __params: infer Params } + ? [params: Params] + : [] ) => string +/** + * A dictionary of locale identifiers to other values. + */ +export type LocaleMap = Record + /** * Selects a value from a locale dictionary based on the selected locale. */ diff --git a/src/index.ts b/src/index.ts index f8589cf..3d80ce5 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,4 @@ -import { PublicationRefs } from "optolith-database-schema/types/source/_PublicationRef" +import type { PublicationRefs } from "optolith-database-schema/gen" /** * A JSON representation of the rules text for a library entry. diff --git a/src/references/index.ts b/src/references/index.ts index a4fe323..93b4fca 100644 --- a/src/references/index.ts +++ b/src/references/index.ts @@ -1,18 +1,11 @@ import { isNotNullish } from "@optolith/helpers/nullable" import { assertExhaustive } from "@optolith/helpers/typeSafety" -import { PublicationRefs } from "optolith-database-schema/types/source/_PublicationRef" -import { GetById } from "../helpers/getTypes.js" +import type { PublicationRefs } from "optolith-database-schema/gen" +import type { GetInstanceById } from "../helpers/getTypes.js" import { LocaleEnvironment } from "../helpers/locale.js" -import { - isSimpleOccurrence, - isSimpleOccurrences, - isVersionedOccurrence, -} from "./occurrence.js" import { fromRawPageRange, normalizePageRanges, - numberRangeToPageRange, - printPageRange, printPageRanges, } from "./pageRange.js" @@ -20,13 +13,13 @@ import { * Returns the translation of the references. */ export const getReferencesTranslation = ( - getPublicationById: GetById.Static.Publication, + getInstanceById: GetInstanceById<"Publication">, locale: LocaleEnvironment, references: PublicationRefs, ) => references .map(ref => { - const publication = getPublicationById(ref.id.publication) + const publication = getInstanceById("Publication", ref.id) const publicationTranslations = locale.translateMap( publication?.translations, ) @@ -40,71 +33,50 @@ export const getReferencesTranslation = ( return undefined } - if (isSimpleOccurrence(occurrences)) { - return `${publicationTranslations.name} ${printPageRange( - locale.translate, - numberRangeToPageRange(occurrences), - )}` - } + const initialPageRanges = normalizePageRanges( + occurrences.initial.pages.map(fromRawPageRange), + ) - if (isSimpleOccurrences(occurrences)) { - const ranges = normalizePageRanges( - occurrences.map(numberRangeToPageRange), - ) - return `${publicationTranslations.name} ${printPageRanges( - locale.translate, - ranges, - )}` - } + const initial = + occurrences.initial.printing === undefined + ? printPageRanges(locale.translate, initialPageRanges) + : `${printPageRanges( + locale.translate, + initialPageRanges, + )} (${locale.translate( + ".input {$printing :number} {{since the {$printing}. printing}}", + { printing: occurrences.initial.printing }, + )})` - if (isVersionedOccurrence(occurrences)) { - const initialPageRanges = normalizePageRanges( - occurrences.initial.pages.map(fromRawPageRange), - ) - - const initial = - occurrences.initial.printing === undefined - ? printPageRanges(locale.translate, initialPageRanges) - : `${printPageRanges( + const revisions = + occurrences.revisions?.map(rev => { + switch (rev.kind) { + case "Since": { + const pageRanges = normalizePageRanges( + rev.Since.pages.map(fromRawPageRange), + ) + return `${printPageRanges( locale.translate, - initialPageRanges, + pageRanges, )} (${locale.translate( - "since the {0}. printing", - occurrences.initial.printing, + ".input {$printing :number} {{since the {$printing}. printing}}", + { printing: rev.Since.printing }, )})` - - const revisions = - occurrences.revisions?.map(rev => { - switch (rev.tag) { - case "Since": { - const pageRanges = normalizePageRanges( - rev.since.pages.map(fromRawPageRange), - ) - return `${printPageRanges( - locale.translate, - pageRanges, - )} (${locale.translate( - "since the {0}. printing", - rev.since.printing, - )})` - } - case "Deprecated": { - return locale.translate( - "removed in {0}. printing", - rev.deprecated.printing, - ) - } - default: - return assertExhaustive(rev) } - }) ?? [] + case "Deprecated": { + return locale.translate( + ".input {$printing :number} {{removed in {$printing}. printing}}", + { printing: rev.Deprecated.printing }, + ) + } + default: + return assertExhaustive(rev) + } + }) ?? [] - const allPageRanges = [initial, ...revisions].join("; ") + const allPageRanges = [initial, ...revisions].join("; ") - return `${publicationTranslations.name} ${allPageRanges}` - } - - return assertExhaustive(occurrences) + return `${publicationTranslations.name} ${allPageRanges}` }) .filter(isNotNullish) .join("; ") diff --git a/src/references/occurrence.ts b/src/references/occurrence.ts deleted file mode 100644 index e4809f5..0000000 --- a/src/references/occurrence.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { - Occurrence, - SimpleOccurrence, - SimpleOccurrences, - VersionedOccurrence, -} from "optolith-database-schema/types/source/_PublicationRef" - -/** - * Checks if the occurrence is a simple occurrence. - */ -export const isSimpleOccurrence = ( - occurrence: Occurrence, -): occurrence is SimpleOccurrence => Object.hasOwn(occurrence, "first_page") - -/** - * Checks if the occurrence is simple occurrences. - */ -export const isSimpleOccurrences = ( - occurrence: Occurrence, -): occurrence is SimpleOccurrences => Array.isArray(occurrence) - -/** - * Checks if the occurrence is a versioned occurrence. - */ -export const isVersionedOccurrence = ( - occurrence: Occurrence, -): occurrence is VersionedOccurrence => Object.hasOwn(occurrence, "initial") diff --git a/src/references/page.ts b/src/references/page.ts index 1752674..694d1cb 100644 --- a/src/references/page.ts +++ b/src/references/page.ts @@ -1,21 +1,21 @@ import { Compare } from "@optolith/helpers/compare" import { assertExhaustive } from "@optolith/helpers/typeSafety" -import { Page } from "optolith-database-schema/types/source/_PublicationRef" +import { Page } from "optolith-database-schema/gen" import { Translate } from "../helpers/translate.js" /** * A comparison function for two pages. */ export const comparePage: Compare = (a, b) => { - switch (a.tag) { + switch (a.kind) { case "InsideCoverFront": - return b.tag === "InsideCoverFront" ? 0 : -1 + return b.kind === "InsideCoverFront" ? 0 : -1 case "InsideCoverBack": - return b.tag === "InsideCoverBack" ? 0 : 1 + return b.kind === "InsideCoverBack" ? 0 : 1 case "Numbered": - return b.tag === "Numbered" - ? a.numbered - b.numbered - : b.tag === "InsideCoverFront" + return b.kind === "Numbered" + ? a.Numbered - b.Numbered + : b.kind === "InsideCoverFront" ? 1 : -1 default: @@ -32,13 +32,13 @@ export const equalsPage = (a: Page, b: Page): boolean => comparePage(a, b) === 0 * Returns the successor of a page. */ export const succ = (page: Page): Page => { - switch (page.tag) { + switch (page.kind) { case "InsideCoverFront": - return { tag: "Numbered", numbered: 1 } + return { kind: "Numbered", Numbered: 1 } case "InsideCoverBack": - return { tag: "InsideCoverFront", inside_cover_front: {} } + return { kind: "InsideCoverFront" } case "Numbered": - return { tag: "Numbered", numbered: page.numbered + 1 } + return { kind: "Numbered", Numbered: page.Numbered + 1 } default: return assertExhaustive(page) } @@ -48,21 +48,21 @@ export const succ = (page: Page): Page => { * Creates a page object for a page number. */ export const numberToPage = (number: number): Page => ({ - tag: "Numbered", - numbered: number, + kind: "Numbered", + Numbered: number, }) /** * Returns a string representation of a page. */ export const printPage = (translate: Translate, page: Page) => { - switch (page.tag) { + switch (page.kind) { case "InsideCoverFront": return translate("Front Cover Inside") case "InsideCoverBack": return translate("Back Cover Inside") case "Numbered": - return page.numbered.toString() + return page.Numbered.toString() default: return assertExhaustive(page) } diff --git a/src/references/pageRange.ts b/src/references/pageRange.ts index d35aae8..dc8c3e0 100644 --- a/src/references/pageRange.ts +++ b/src/references/pageRange.ts @@ -1,17 +1,7 @@ import { range } from "@optolith/helpers/array" -import { - Page, - PageRange as RawPageRange, - SimpleOccurrence, -} from "optolith-database-schema/types/source/_PublicationRef" +import { Page, PageRange as RawPageRange } from "optolith-database-schema/gen" import { Translate } from "../helpers/translate.js" -import { - comparePage, - equalsPage, - numberToPage, - printPage, - succ, -} from "./page.js" +import { comparePage, equalsPage, printPage, succ } from "./page.js" /** * A range of pages, including the first and last page, if the range includes @@ -22,19 +12,6 @@ export type PageRange = { lastPage?: Page } -/** - * Converts a numeric range to a page object range. - */ -export const numberRangeToPageRange = ( - numberRange: SimpleOccurrence, -): PageRange => - numberRange.last_page === undefined - ? { firstPage: numberToPage(numberRange.first_page) } - : { - firstPage: numberToPage(numberRange.first_page), - lastPage: numberToPage(numberRange.last_page), - } - /** * Converts a page object range from the database to a local page object range. */ @@ -52,10 +29,10 @@ export const fromRawPageRange = (pageRange: RawPageRange): PageRange => export const normalizePageRanges = (ranges: PageRange[]): PageRange[] => ranges .flatMap(({ firstPage, lastPage = firstPage }): Page[] => { - if (firstPage.tag === "Numbered" && lastPage.tag === "Numbered") { - return range(firstPage.numbered, lastPage.numbered).map(numbered => ({ - tag: "Numbered", - numbered, + if (firstPage.kind === "Numbered" && lastPage.kind === "Numbered") { + return range(firstPage.Numbered, lastPage.Numbered).map(numbered => ({ + kind: "Numbered", + Numbered: numbered, })) } else { return [firstPage, lastPage] diff --git a/test/entities/partial/prerequisites/part.ts b/test/entities/partial/prerequisites/part.ts index 930fa30..8c9a023 100644 --- a/test/entities/partial/prerequisites/part.ts +++ b/test/entities/partial/prerequisites/part.ts @@ -4,6 +4,7 @@ import { joinPrerequisiteParts, PrerequisitePart, } from "../../../../src/entities/partial/prerequisites/part.js" +import { Case } from "../../../../src/helpers/enums.js" import { defaultLocaleEnvironment } from "../../../helpers/locale.js" describe("joinPrerequisiteParts", () => { @@ -25,11 +26,11 @@ describe("joinPrerequisiteParts", () => { it("should connect connected sentence types by semicolon", () => { const parts: PrerequisitePart[] = [ { value: "A", sentenceType: undefined, isMeta: false }, - { value: "B", sentenceType: "Connected", isMeta: false }, - { value: "C", sentenceType: "Connected", isMeta: false }, + { value: "B", sentenceType: Case("Connected"), isMeta: false }, + { value: "C", sentenceType: Case("Connected"), isMeta: false }, { value: "D", sentenceType: undefined, isMeta: false }, { value: "E", sentenceType: undefined, isMeta: false }, - { value: "F", sentenceType: "Connected", isMeta: false }, + { value: "F", sentenceType: Case("Connected"), isMeta: false }, ] const result = joinPrerequisiteParts(defaultLocaleEnvironment, parts) assert.equal(result, "A; B; C; D, E; F") @@ -38,15 +39,15 @@ describe("joinPrerequisiteParts", () => { it("should connect standalone sentence types by periods", () => { const parts: PrerequisitePart[] = [ { value: "A", sentenceType: undefined, isMeta: false }, - { value: "B", sentenceType: "Standalone", isMeta: false }, - { value: "C", sentenceType: "Standalone", isMeta: false }, + { value: "B", sentenceType: Case("Standalone"), isMeta: false }, + { value: "C", sentenceType: Case("Standalone"), isMeta: false }, { value: "D", sentenceType: undefined, isMeta: false }, { value: "E", sentenceType: undefined, isMeta: false }, - { value: "F.", sentenceType: "Standalone", isMeta: false }, - { value: "G.", sentenceType: "Standalone", isMeta: false }, + { value: "F.", sentenceType: Case("Standalone"), isMeta: false }, + { value: "G.", sentenceType: Case("Standalone"), isMeta: false }, { value: "H", sentenceType: undefined, isMeta: false }, { value: "I", sentenceType: undefined, isMeta: false }, - { value: "J", sentenceType: "Standalone", isMeta: false }, + { value: "J", sentenceType: Case("Standalone"), isMeta: false }, ] const result = joinPrerequisiteParts(defaultLocaleEnvironment, parts) assert.equal(result, "A. B. C. D, E. F. G. H, I. J.") @@ -65,7 +66,7 @@ describe("joinPrerequisiteParts", () => { it("throws an error if the sentenceType is unknown", () => { const parts: PrerequisitePart[] = [ // @ts-expect-error Testing invalid input - { value: "A", sentenceType: "any", isMeta: true }, + { value: "A", sentenceType: Case("any"), isMeta: true }, ] const block = () => joinPrerequisiteParts(defaultLocaleEnvironment, parts) assert.throws(block) diff --git a/test/entities/partial/prerequisites/single/state.ts b/test/entities/partial/prerequisites/single/state.ts index 60b8aed..b493792 100644 --- a/test/entities/partial/prerequisites/single/state.ts +++ b/test/entities/partial/prerequisites/single/state.ts @@ -1,13 +1,17 @@ import assert from "node:assert/strict" +import { randomUUID } from "node:crypto" import { describe, it } from "node:test" import { printStatePrerequisite } from "../../../../../src/entities/partial/prerequisites/single/state.js" -import { GetById } from "../../../../../src/helpers/getTypes.js" +import { Case } from "../../../../../src/helpers/enums.js" +import type { GetInstanceById } from "../../../../../src/helpers/getTypes.js" import { defaultLocaleEnvironment } from "../../../../helpers/locale.js" +const ExampleUUID = randomUUID() + describe("getStatePrerequisiteTranslation", () => { it("returns a PrerequisitePart object for the prerequisite", () => { - const getStateById: GetById.Static.State = () => ({ - id: 1, + const getInstanceById: GetInstanceById<"State"> = () => ({ + id: ExampleUUID, src: [], translations: { "en-US": { @@ -18,11 +22,8 @@ describe("getStatePrerequisiteTranslation", () => { }) assert.deepEqual( - printStatePrerequisite(getStateById, defaultLocaleEnvironment, { - id: { - tag: "State", - state: 1, - }, + printStatePrerequisite(getInstanceById, defaultLocaleEnvironment, { + id: ExampleUUID, }), { label: "State ", @@ -35,35 +36,26 @@ describe("getStatePrerequisiteTranslation", () => { assert.deepEqual( printStatePrerequisite( () => ({ - id: 1, + id: ExampleUUID, src: [], translations: {}, }), defaultLocaleEnvironment, { - id: { - tag: "State", - state: 1, - }, + id: ExampleUUID, }, ), undefined, ) assert.deepEqual( - printStatePrerequisite(getStateById, defaultLocaleEnvironment, { - id: { - tag: "State", - state: 1, - }, - display_option: { - tag: "ReplaceWith", - replace_with: { - translations: { - "en-US": "Replacement", - }, + printStatePrerequisite(getInstanceById, defaultLocaleEnvironment, { + id: ExampleUUID, + display_option: Case("ReplaceWith", { + translations: { + "en-US": { replacement: "Replacement" }, }, - }, + }), }), { value: "Replacement", diff --git a/test/entities/partial/prerequisites/single/text.ts b/test/entities/partial/prerequisites/single/text.ts index 69c4944..dba5398 100644 --- a/test/entities/partial/prerequisites/single/text.ts +++ b/test/entities/partial/prerequisites/single/text.ts @@ -2,16 +2,17 @@ import assert from "node:assert/strict" import { describe, it } from "node:test" import { printTextPrerequisite } from "../../../../../src/entities/partial/prerequisites/single/text.js" import { MISSING_VALUE } from "../../../../../src/entities/partial/unknown.js" +import { Case } from "../../../../../src/helpers/enums.js" import { defaultLocaleEnvironment } from "../../../../helpers/locale.js" describe("getTextPrerequisiteTranslation", () => { it("returns a PrerequisitePart object for the prerequisite", () => { assert.deepEqual( printTextPrerequisite(defaultLocaleEnvironment, { - verification: "Pass", + verification: Case("Pass"), sentence_type: undefined, translations: { - "en-US": "A", + "en-US": { text: "A" }, }, }), { @@ -23,14 +24,14 @@ describe("getTextPrerequisiteTranslation", () => { assert.deepEqual( printTextPrerequisite(defaultLocaleEnvironment, { - verification: "Pass", - sentence_type: "Standalone", + verification: Case("Pass"), + sentence_type: Case("Standalone"), is_meta: true, translations: {}, }), { value: MISSING_VALUE, - sentenceType: "Standalone", + sentenceType: Case("Standalone"), isMeta: true, }, ) diff --git a/test/entities/partial/rated/activatable/checkResultBased.ts b/test/entities/partial/rated/activatable/checkResultBased.ts index 011b740..f1942ee 100644 --- a/test/entities/partial/rated/activatable/checkResultBased.ts +++ b/test/entities/partial/rated/activatable/checkResultBased.ts @@ -1,33 +1,34 @@ import assert from "node:assert/strict" import { describe, it } from "node:test" import { getCheckResultBasedValueTranslation } from "../../../../../src/entities/partial/rated/activatable/checkResultBased.js" +import { Case } from "../../../../../src/helpers/enums.js" import { translateMock } from "../../../../helpers/translate.js" describe("getTextForCheckResultBased", () => { it("should return the value text for a check-result-based parameter of an activatable skill", () => { assert.equal( getCheckResultBasedValueTranslation(translateMock, { - base: "QualityLevels", + base: Case("QualityLevels"), }), "QL", ) assert.equal( getCheckResultBasedValueTranslation(translateMock, { - base: "SkillPoints", + base: Case("SkillPoints"), }), "SP", ) assert.equal( getCheckResultBasedValueTranslation(translateMock, { - base: "QualityLevels", - modifier: { arithmetic: "Divide", value: 2 }, + base: Case("QualityLevels"), + modifier: { arithmetic: Case("Divide"), value: 2 }, }), "QL / 2", ) assert.equal( getCheckResultBasedValueTranslation(translateMock, { - base: "SkillPoints", - modifier: { arithmetic: "Multiply", value: 3 }, + base: Case("SkillPoints"), + modifier: { arithmetic: Case("Multiply"), value: 3 }, }), "SP × 3", ) diff --git a/test/helpers/translate.ts b/test/helpers/translate.ts index 8d76d80..9116b40 100644 --- a/test/helpers/translate.ts +++ b/test/helpers/translate.ts @@ -1,22 +1,13 @@ -import { UI } from "optolith-database-schema/types/UI" +import { MessageFormat } from "messageformat" import { Translate, TranslateMap } from "../../src/helpers/translate.js" -const insertParams = (str: string, params: (string | number)[]): string => - str.replace( - /\{(?\d+)\}/gu, - (_match, _p1, _offset, _s, { index: rawIndex }) => { - const index = Number.parseInt(rawIndex, 10) - return params[index]?.toString() ?? `{${rawIndex}}` - }, - ) - /** * A mocked translate function. */ -export const translateMock: Translate = ( - key: K, - ...options: (string | number)[] -) => insertParams(key, options) +export const translateMock: Translate = (key, ...rest) => + new MessageFormat("en", key).format( + rest[0] as Record | undefined, + ) /** * A mocked translate map function. diff --git a/test/references/page.ts b/test/references/page.ts index 386f7ca..ebf6b9b 100644 --- a/test/references/page.ts +++ b/test/references/page.ts @@ -11,85 +11,73 @@ import { describe("comparePage", () => { it("returns 0 if the pages are equal", () => { assert.equal( - comparePage( - { tag: "InsideCoverBack", inside_cover_back: {} }, - { tag: "InsideCoverBack", inside_cover_back: {} }, - ), + comparePage({ kind: "InsideCoverBack" }, { kind: "InsideCoverBack" }), + 0, + ) + assert.equal( + comparePage({ kind: "InsideCoverFront" }, { kind: "InsideCoverFront" }), 0, ) assert.equal( comparePage( - { tag: "InsideCoverFront", inside_cover_front: {} }, - { tag: "InsideCoverFront", inside_cover_front: {} }, - ), - 0, - ) - assert.equal( - comparePage( - { tag: "Numbered", numbered: 42 }, - { tag: "Numbered", numbered: 42 }, + { kind: "Numbered", Numbered: 42 }, + { kind: "Numbered", Numbered: 42 }, ), 0, ) }) it("returns a negative number if first should be sorted before the second", () => { + assert.equal( + comparePage({ kind: "InsideCoverFront" }, { kind: "InsideCoverBack" }), + -1, + ) assert.equal( comparePage( - { tag: "InsideCoverFront", inside_cover_front: {} }, - { tag: "InsideCoverBack", inside_cover_back: {} }, + { kind: "InsideCoverFront" }, + { kind: "Numbered", Numbered: 42 }, ), -1, ) assert.equal( comparePage( - { tag: "InsideCoverFront", inside_cover_front: {} }, - { tag: "Numbered", numbered: 42 }, + { kind: "Numbered", Numbered: 42 }, + { kind: "InsideCoverBack" }, ), -1, ) assert.equal( comparePage( - { tag: "Numbered", numbered: 42 }, - { tag: "InsideCoverBack", inside_cover_back: {} }, - ), - -1, - ) - assert.equal( - comparePage( - { tag: "Numbered", numbered: 24 }, - { tag: "Numbered", numbered: 42 }, + { kind: "Numbered", Numbered: 24 }, + { kind: "Numbered", Numbered: 42 }, ), -18, ) }) it("returns a positive number if first should be sorted after the second", () => { + assert.equal( + comparePage({ kind: "InsideCoverBack" }, { kind: "InsideCoverFront" }), + 1, + ) assert.equal( comparePage( - { tag: "InsideCoverBack", inside_cover_back: {} }, - { tag: "InsideCoverFront", inside_cover_front: {} }, + { kind: "Numbered", Numbered: 42 }, + { kind: "InsideCoverFront" }, ), 1, ) assert.equal( comparePage( - { tag: "Numbered", numbered: 42 }, - { tag: "InsideCoverFront", inside_cover_front: {} }, + { kind: "InsideCoverBack" }, + { kind: "Numbered", Numbered: 42 }, ), 1, ) assert.equal( comparePage( - { tag: "InsideCoverBack", inside_cover_back: {} }, - { tag: "Numbered", numbered: 42 }, - ), - 1, - ) - assert.equal( - comparePage( - { tag: "Numbered", numbered: 42 }, - { tag: "Numbered", numbered: 24 }, + { kind: "Numbered", Numbered: 42 }, + { kind: "Numbered", Numbered: 24 }, ), 18, ) @@ -99,82 +87,70 @@ describe("comparePage", () => { describe("equalsPage", () => { it("returns true if the pages are equal", () => { assert.equal( - equalsPage( - { tag: "InsideCoverBack", inside_cover_back: {} }, - { tag: "InsideCoverBack", inside_cover_back: {} }, - ), + equalsPage({ kind: "InsideCoverBack" }, { kind: "InsideCoverBack" }), + true, + ) + assert.equal( + equalsPage({ kind: "InsideCoverFront" }, { kind: "InsideCoverFront" }), true, ) assert.equal( equalsPage( - { tag: "InsideCoverFront", inside_cover_front: {} }, - { tag: "InsideCoverFront", inside_cover_front: {} }, - ), - true, - ) - assert.equal( - equalsPage( - { tag: "Numbered", numbered: 42 }, - { tag: "Numbered", numbered: 42 }, + { kind: "Numbered", Numbered: 42 }, + { kind: "Numbered", Numbered: 42 }, ), true, ) }) it("returns false if the pages are not equal", () => { + assert.equal( + equalsPage({ kind: "InsideCoverFront" }, { kind: "InsideCoverBack" }), + false, + ) assert.equal( equalsPage( - { tag: "InsideCoverFront", inside_cover_front: {} }, - { tag: "InsideCoverBack", inside_cover_back: {} }, + { kind: "InsideCoverFront" }, + { kind: "Numbered", Numbered: 42 }, ), false, ) assert.equal( equalsPage( - { tag: "InsideCoverFront", inside_cover_front: {} }, - { tag: "Numbered", numbered: 42 }, + { kind: "Numbered", Numbered: 42 }, + { kind: "InsideCoverBack" }, ), false, ) assert.equal( equalsPage( - { tag: "Numbered", numbered: 42 }, - { tag: "InsideCoverBack", inside_cover_back: {} }, + { kind: "Numbered", Numbered: 24 }, + { kind: "Numbered", Numbered: 42 }, + ), + false, + ) + assert.equal( + equalsPage({ kind: "InsideCoverBack" }, { kind: "InsideCoverFront" }), + false, + ) + assert.equal( + equalsPage( + { kind: "Numbered", Numbered: 42 }, + { kind: "InsideCoverFront" }, ), false, ) assert.equal( equalsPage( - { tag: "Numbered", numbered: 24 }, - { tag: "Numbered", numbered: 42 }, + { kind: "InsideCoverBack" }, + { kind: "Numbered", Numbered: 42 }, ), false, ) assert.equal( equalsPage( - { tag: "InsideCoverBack", inside_cover_back: {} }, - { tag: "InsideCoverFront", inside_cover_front: {} }, - ), - false, - ) - assert.equal( - equalsPage( - { tag: "Numbered", numbered: 42 }, - { tag: "InsideCoverFront", inside_cover_front: {} }, - ), - false, - ) - assert.equal( - equalsPage( - { tag: "InsideCoverBack", inside_cover_back: {} }, - { tag: "Numbered", numbered: 42 }, - ), - false, - ) - assert.equal( - equalsPage( - { tag: "Numbered", numbered: 42 }, - { tag: "Numbered", numbered: 24 }, + { kind: "Numbered", Numbered: 42 }, + { kind: "Numbered", Numbered: 24 }, ), false, ) @@ -183,20 +159,20 @@ describe("equalsPage", () => { describe("succ", () => { it("returns the next page", () => { - assert.deepEqual( - succ({ tag: "InsideCoverFront", inside_cover_front: {} }), - { tag: "Numbered", numbered: 1 }, - ) - assert.deepEqual(succ({ tag: "Numbered", numbered: 42 }), { - tag: "Numbered", - numbered: 43, + assert.deepEqual(succ({ kind: "InsideCoverFront" }), { + kind: "Numbered", + Numbered: 1, + }) + assert.deepEqual(succ({ kind: "Numbered", Numbered: 42 }), { + kind: "Numbered", + Numbered: 43, }) }) }) describe("numberToPage", () => { it("returns a page object for the page number", () => { - assert.deepEqual(numberToPage(42), { tag: "Numbered", numbered: 42 }) + assert.deepEqual(numberToPage(42), { kind: "Numbered", Numbered: 42 }) }) }) @@ -204,20 +180,18 @@ describe("printPage", () => { it("returns a string representation of the page", () => { assert.equal( printPage(() => "Front Cover Inside", { - tag: "InsideCoverFront", - inside_cover_front: {}, + kind: "InsideCoverFront", }), "Front Cover Inside", ) assert.equal( printPage(() => "Back Cover Inside", { - tag: "InsideCoverBack", - inside_cover_back: {}, + kind: "InsideCoverBack", }), "Back Cover Inside", ) assert.equal( - printPage(() => "", { tag: "Numbered", numbered: 42 }), + printPage(() => "", { kind: "Numbered", Numbered: 42 }), "42", ) }) diff --git a/test/references/pageRange.ts b/test/references/pageRange.ts index 5b6d038..7733947 100644 --- a/test/references/pageRange.ts +++ b/test/references/pageRange.ts @@ -1,35 +1,18 @@ import assert from "assert/strict" import { describe, it } from "node:test" -import { Page } from "optolith-database-schema/types/source/_PublicationRef" -import { Translate } from "../../src/helpers/translate.js" +import { Page } from "optolith-database-schema/gen" import { fromRawPageRange, normalizePageRanges, - numberRangeToPageRange, PageRange, printPageRange, printPageRanges, } from "../../src/references/pageRange.js" +import { translateMock } from "../helpers/translate.js" -const mockTranslate: Translate = (key: string) => key - -const mockPage: Page = Object.freeze({ tag: "Numbered", numbered: 1 }) -const mockPage2: Page = Object.freeze({ tag: "Numbered", numbered: 2 }) -const mockPage3: Page = Object.freeze({ tag: "Numbered", numbered: 3 }) - -describe("numberRangeToPageRange", () => { - it("should convert a numeric range to a page object range", () => { - const input = { first_page: 1, last_page: 2 } - const expected: PageRange = { firstPage: mockPage, lastPage: mockPage2 } - assert.deepEqual(numberRangeToPageRange(input), expected) - }) - - it("should handle single page ranges", () => { - const input = { first_page: 1 } - const expected: PageRange = { firstPage: mockPage } - assert.deepEqual(numberRangeToPageRange(input), expected) - }) -}) +const mockPage: Page = Object.freeze({ kind: "Numbered", Numbered: 1 }) +const mockPage2: Page = Object.freeze({ kind: "Numbered", Numbered: 2 }) +const mockPage3: Page = Object.freeze({ kind: "Numbered", Numbered: 3 }) describe("fromRawPageRange", () => { it("should convert a raw page range to a local page object range", () => { @@ -60,13 +43,13 @@ describe("printPageRange", () => { it("should return a string representation of a page range", () => { const input: PageRange = { firstPage: mockPage, lastPage: mockPage2 } const expected = "1–2" - assert.equal(printPageRange(mockTranslate, input), expected) + assert.equal(printPageRange(translateMock, input), expected) }) it("should handle single page ranges", () => { const input: PageRange = { firstPage: mockPage } const expected = "1" - assert.equal(printPageRange(mockTranslate, input), expected) + assert.equal(printPageRange(translateMock, input), expected) }) }) @@ -77,6 +60,6 @@ describe("printPageRanges", () => { { firstPage: mockPage3 }, ] const expected = "1–2, 3" - assert.equal(printPageRanges(mockTranslate, input), expected) + assert.equal(printPageRanges(translateMock, input), expected) }) })