diff --git a/docs/Extensions/UuidGenerator/README.md b/docs/Extensions/UuidGenerator/README.md index 530468d72..269245f14 100644 --- a/docs/Extensions/UuidGenerator/README.md +++ b/docs/Extensions/UuidGenerator/README.md @@ -1,4 +1,4 @@ -# Custom Web Search Extension +# UUID / GUID Generator This extension allows to generate [Universally Unique Identifiers](https://en.wikipedia.org/wiki/Universally_unique_identifier), also known as UUID or GUID. This can be done either instantly for a single UUID or through a dedicated UI, where multiple UUIDs can be generated at once. @@ -7,20 +7,28 @@ This can be done either instantly for a single UUID or through a dedicated UI, w ![Example](example-generator.png) +This extension also allows to format the UUID to several different styles in a fast way. + +![Example](example-formatting.png) ## Settings -- **UUID Version**: The UUID version, either [v4](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_4_(random)), [v6](https://en.wikipedia.org/wiki/Universally_unique_identifier#Versions_1_and_6_(date-time_and_MAC_address)) or [v7](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_7_(timestamp_and_random)) +- **UUID Version**: The UUID version, either [v4](), [v6]() or [v7]() - **Number of UUIDs to generate**: The number of UUIDs that will be created, only applies when using the UI of the extension - **Uppercase**: Whether the characters of the UUID should be uppercase - **Hyphen**: Whether the UUID should contain hyphens (-) - **Braces**: Whether the UUID should be wrapped in braces ({}) - **Quotes**: Whether the UUID should be wrapped in quotes +- **Search result formats**: Several different formats for fast formatting in search results + +![Example](example-settings.png) ## About this extension Author: [Christopher Steiner](https://github.com/ChristopherSteiner) +Co-Author: [Marco Senn-Haag](https://github.com/MarcoSennHaag) + Supported operating systems: - Windows diff --git a/docs/Extensions/UuidGenerator/example-formatting.png b/docs/Extensions/UuidGenerator/example-formatting.png new file mode 100644 index 000000000..be344956b Binary files /dev/null and b/docs/Extensions/UuidGenerator/example-formatting.png differ diff --git a/docs/Extensions/UuidGenerator/example-settings.png b/docs/Extensions/UuidGenerator/example-settings.png new file mode 100644 index 000000000..758bc0848 Binary files /dev/null and b/docs/Extensions/UuidGenerator/example-settings.png differ diff --git a/docs/Extensions/UuidGenerator/example.png b/docs/Extensions/UuidGenerator/example.png index e1092694b..34e13d239 100644 Binary files a/docs/Extensions/UuidGenerator/example.png and b/docs/Extensions/UuidGenerator/example.png differ diff --git a/package-lock.json b/package-lock.json index b578f18d0..c082004fd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,7 +27,7 @@ "react-router": "^7.1.3", "react-router-dom": "^7.1.3", "sharp": "^0.33.5", - "uuid": "^11.0.3" + "uuid": "^11.0.5" }, "devDependencies": { "@eslint/js": "^9.9.1", @@ -778,13 +778,14 @@ "license": "MIT" }, "node_modules/@esbuild/aix-ppc64": { - "version": "0.24.0", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.24.0.tgz", - "integrity": "sha512-WtKdFM7ls47zkKHFVzMz8opM7LkcsIp9amDUBIAWirg70RM71WRSjdILPsY5Uv1D42ZpUfaPILDlfactHgsRkw==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.24.2.tgz", + "integrity": "sha512-thpVCb/rhxE/BnMLQ7GReQLLN8q9qbHmI55F4489/ByVg2aQaQ6kbcLb6FHkocZzQhxc4gx0sCk0tJkKBFzDhA==", "cpu": [ "ppc64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "aix" @@ -794,13 +795,14 @@ } }, "node_modules/@esbuild/android-arm": { - "version": "0.24.0", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.24.0.tgz", - "integrity": "sha512-arAtTPo76fJ/ICkXWetLCc9EwEHKaeya4vMrReVlEIUCAUncH7M4bhMQ+M9Vf+FFOZJdTNMXNBrWwW+OXWpSew==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.24.2.tgz", + "integrity": "sha512-tmwl4hJkCfNHwFB3nBa8z1Uy3ypZpxqxfTQOcHX+xRByyYgunVbZ9MzUUfb0RxaHIMnbHagwAxuTL+tnNM+1/Q==", "cpu": [ "arm" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "android" @@ -810,13 +812,14 @@ } }, "node_modules/@esbuild/android-arm64": { - "version": "0.24.0", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.24.0.tgz", - "integrity": "sha512-Vsm497xFM7tTIPYK9bNTYJyF/lsP590Qc1WxJdlB6ljCbdZKU9SY8i7+Iin4kyhV/KV5J2rOKsBQbB77Ab7L/w==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.24.2.tgz", + "integrity": "sha512-cNLgeqCqV8WxfcTIOeL4OAtSmL8JjcN6m09XIgro1Wi7cF4t/THaWEa7eL5CMoMBdjoHOTh/vwTO/o2TRXIyzg==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "android" @@ -826,13 +829,14 @@ } }, "node_modules/@esbuild/android-x64": { - "version": "0.24.0", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.24.0.tgz", - "integrity": "sha512-t8GrvnFkiIY7pa7mMgJd7p8p8qqYIz1NYiAoKc75Zyv73L3DZW++oYMSHPRarcotTKuSs6m3hTOa5CKHaS02TQ==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.24.2.tgz", + "integrity": "sha512-B6Q0YQDqMx9D7rvIcsXfmJfvUYLoP722bgfBlO5cGvNVb5V/+Y7nhBE3mHV9OpxBf4eAS2S68KZztiPaWq4XYw==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "android" @@ -842,13 +846,14 @@ } }, "node_modules/@esbuild/darwin-arm64": { - "version": "0.24.0", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.24.0.tgz", - "integrity": "sha512-CKyDpRbK1hXwv79soeTJNHb5EiG6ct3efd/FTPdzOWdbZZfGhpbcqIpiD0+vwmpu0wTIL97ZRPZu8vUt46nBSw==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.24.2.tgz", + "integrity": "sha512-kj3AnYWc+CekmZnS5IPu9D+HWtUI49hbnyqk0FLEJDbzCIQt7hg7ucF1SQAilhtYpIujfaHr6O0UHlzzSPdOeA==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "darwin" @@ -858,13 +863,14 @@ } }, "node_modules/@esbuild/darwin-x64": { - "version": "0.24.0", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.24.0.tgz", - "integrity": "sha512-rgtz6flkVkh58od4PwTRqxbKH9cOjaXCMZgWD905JOzjFKW+7EiUObfd/Kav+A6Gyud6WZk9w+xu6QLytdi2OA==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.24.2.tgz", + "integrity": "sha512-WeSrmwwHaPkNR5H3yYfowhZcbriGqooyu3zI/3GGpF8AyUdsrrP0X6KumITGA9WOyiJavnGZUwPGvxvwfWPHIA==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "darwin" @@ -874,13 +880,14 @@ } }, "node_modules/@esbuild/freebsd-arm64": { - "version": "0.24.0", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.24.0.tgz", - "integrity": "sha512-6Mtdq5nHggwfDNLAHkPlyLBpE5L6hwsuXZX8XNmHno9JuL2+bg2BX5tRkwjyfn6sKbxZTq68suOjgWqCicvPXA==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.24.2.tgz", + "integrity": "sha512-UN8HXjtJ0k/Mj6a9+5u6+2eZ2ERD7Edt1Q9IZiB5UZAIdPnVKDoG7mdTVGhHJIeEml60JteamR3qhsr1r8gXvg==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "freebsd" @@ -890,13 +897,14 @@ } }, "node_modules/@esbuild/freebsd-x64": { - "version": "0.24.0", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.24.0.tgz", - "integrity": "sha512-D3H+xh3/zphoX8ck4S2RxKR6gHlHDXXzOf6f/9dbFt/NRBDIE33+cVa49Kil4WUjxMGW0ZIYBYtaGCa2+OsQwQ==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.24.2.tgz", + "integrity": "sha512-TvW7wE/89PYW+IevEJXZ5sF6gJRDY/14hyIGFXdIucxCsbRmLUcjseQu1SyTko+2idmCw94TgyaEZi9HUSOe3Q==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "freebsd" @@ -906,13 +914,14 @@ } }, "node_modules/@esbuild/linux-arm": { - "version": "0.24.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.24.0.tgz", - "integrity": "sha512-gJKIi2IjRo5G6Glxb8d3DzYXlxdEj2NlkixPsqePSZMhLudqPhtZ4BUrpIuTjJYXxvF9njql+vRjB2oaC9XpBw==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.24.2.tgz", + "integrity": "sha512-n0WRM/gWIdU29J57hJyUdIsk0WarGd6To0s+Y+LwvlC55wt+GT/OgkwoXCXvIue1i1sSNWblHEig00GBWiJgfA==", "cpu": [ "arm" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" @@ -922,13 +931,14 @@ } }, "node_modules/@esbuild/linux-arm64": { - "version": "0.24.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.24.0.tgz", - "integrity": "sha512-TDijPXTOeE3eaMkRYpcy3LarIg13dS9wWHRdwYRnzlwlA370rNdZqbcp0WTyyV/k2zSxfko52+C7jU5F9Tfj1g==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.24.2.tgz", + "integrity": "sha512-7HnAD6074BW43YvvUmE/35Id9/NB7BeX5EoNkK9obndmZBUk8xmJJeU7DwmUeN7tkysslb2eSl6CTrYz6oEMQg==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" @@ -938,13 +948,14 @@ } }, "node_modules/@esbuild/linux-ia32": { - "version": "0.24.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.24.0.tgz", - "integrity": "sha512-K40ip1LAcA0byL05TbCQ4yJ4swvnbzHscRmUilrmP9Am7//0UjPreh4lpYzvThT2Quw66MhjG//20mrufm40mA==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.24.2.tgz", + "integrity": "sha512-sfv0tGPQhcZOgTKO3oBE9xpHuUqguHvSo4jl+wjnKwFpapx+vUDcawbwPNuBIAYdRAvIDBfZVvXprIj3HA+Ugw==", "cpu": [ "ia32" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" @@ -954,13 +965,14 @@ } }, "node_modules/@esbuild/linux-loong64": { - "version": "0.24.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.24.0.tgz", - "integrity": "sha512-0mswrYP/9ai+CU0BzBfPMZ8RVm3RGAN/lmOMgW4aFUSOQBjA31UP8Mr6DDhWSuMwj7jaWOT0p0WoZ6jeHhrD7g==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.24.2.tgz", + "integrity": "sha512-CN9AZr8kEndGooS35ntToZLTQLHEjtVB5n7dl8ZcTZMonJ7CCfStrYhrzF97eAecqVbVJ7APOEe18RPI4KLhwQ==", "cpu": [ "loong64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" @@ -970,13 +982,14 @@ } }, "node_modules/@esbuild/linux-mips64el": { - "version": "0.24.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.24.0.tgz", - "integrity": "sha512-hIKvXm0/3w/5+RDtCJeXqMZGkI2s4oMUGj3/jM0QzhgIASWrGO5/RlzAzm5nNh/awHE0A19h/CvHQe6FaBNrRA==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.24.2.tgz", + "integrity": "sha512-iMkk7qr/wl3exJATwkISxI7kTcmHKE+BlymIAbHO8xanq/TjHaaVThFF6ipWzPHryoFsesNQJPE/3wFJw4+huw==", "cpu": [ "mips64el" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" @@ -986,13 +999,14 @@ } }, "node_modules/@esbuild/linux-ppc64": { - "version": "0.24.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.24.0.tgz", - "integrity": "sha512-HcZh5BNq0aC52UoocJxaKORfFODWXZxtBaaZNuN3PUX3MoDsChsZqopzi5UupRhPHSEHotoiptqikjN/B77mYQ==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.24.2.tgz", + "integrity": "sha512-shsVrgCZ57Vr2L8mm39kO5PPIb+843FStGt7sGGoqiiWYconSxwTiuswC1VJZLCjNiMLAMh34jg4VSEQb+iEbw==", "cpu": [ "ppc64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" @@ -1002,13 +1016,14 @@ } }, "node_modules/@esbuild/linux-riscv64": { - "version": "0.24.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.24.0.tgz", - "integrity": "sha512-bEh7dMn/h3QxeR2KTy1DUszQjUrIHPZKyO6aN1X4BCnhfYhuQqedHaa5MxSQA/06j3GpiIlFGSsy1c7Gf9padw==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.24.2.tgz", + "integrity": "sha512-4eSFWnU9Hhd68fW16GD0TINewo1L6dRrB+oLNNbYyMUAeOD2yCK5KXGK1GH4qD/kT+bTEXjsyTCiJGHPZ3eM9Q==", "cpu": [ "riscv64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" @@ -1018,13 +1033,14 @@ } }, "node_modules/@esbuild/linux-s390x": { - "version": "0.24.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.24.0.tgz", - "integrity": "sha512-ZcQ6+qRkw1UcZGPyrCiHHkmBaj9SiCD8Oqd556HldP+QlpUIe2Wgn3ehQGVoPOvZvtHm8HPx+bH20c9pvbkX3g==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.24.2.tgz", + "integrity": "sha512-S0Bh0A53b0YHL2XEXC20bHLuGMOhFDO6GN4b3YjRLK//Ep3ql3erpNcPlEFed93hsQAjAQDNsvcK+hV90FubSw==", "cpu": [ "s390x" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" @@ -1034,13 +1050,14 @@ } }, "node_modules/@esbuild/linux-x64": { - "version": "0.24.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.24.0.tgz", - "integrity": "sha512-vbutsFqQ+foy3wSSbmjBXXIJ6PL3scghJoM8zCL142cGaZKAdCZHyf+Bpu/MmX9zT9Q0zFBVKb36Ma5Fzfa8xA==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.24.2.tgz", + "integrity": "sha512-8Qi4nQcCTbLnK9WoMjdC9NiTG6/E38RNICU6sUNqK0QFxCYgoARqVqxdFmWkdonVsvGqWhmm7MO0jyTqLqwj0Q==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" @@ -1049,14 +1066,32 @@ "node": ">=18" } }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.24.2.tgz", + "integrity": "sha512-wuLK/VztRRpMt9zyHSazyCVdCXlpHkKm34WUyinD2lzK07FAHTq0KQvZZlXikNWkDGoT6x3TD51jKQ7gMVpopw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, "node_modules/@esbuild/netbsd-x64": { - "version": "0.24.0", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.24.0.tgz", - "integrity": "sha512-hjQ0R/ulkO8fCYFsG0FZoH+pWgTTDreqpqY7UnQntnaKv95uP5iW3+dChxnx7C3trQQU40S+OgWhUVwCjVFLvg==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.24.2.tgz", + "integrity": "sha512-VefFaQUc4FMmJuAxmIHgUmfNiLXY438XrL4GDNV1Y1H/RW3qow68xTwjZKfj/+Plp9NANmzbH5R40Meudu8mmw==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "netbsd" @@ -1066,13 +1101,14 @@ } }, "node_modules/@esbuild/openbsd-arm64": { - "version": "0.24.0", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.24.0.tgz", - "integrity": "sha512-MD9uzzkPQbYehwcN583yx3Tu5M8EIoTD+tUgKF982WYL9Pf5rKy9ltgD0eUgs8pvKnmizxjXZyLt0z6DC3rRXg==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.24.2.tgz", + "integrity": "sha512-YQbi46SBct6iKnszhSvdluqDmxCJA+Pu280Av9WICNwQmMxV7nLRHZfjQzwbPs3jeWnuAhE9Jy0NrnJ12Oz+0A==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "openbsd" @@ -1082,13 +1118,14 @@ } }, "node_modules/@esbuild/openbsd-x64": { - "version": "0.24.0", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.24.0.tgz", - "integrity": "sha512-4ir0aY1NGUhIC1hdoCzr1+5b43mw99uNwVzhIq1OY3QcEwPDO3B7WNXBzaKY5Nsf1+N11i1eOfFcq+D/gOS15Q==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.24.2.tgz", + "integrity": "sha512-+iDS6zpNM6EnJyWv0bMGLWSWeXGN/HTaF/LXHXHwejGsVi+ooqDfMCCTerNFxEkM3wYVcExkeGXNqshc9iMaOA==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "openbsd" @@ -1098,13 +1135,14 @@ } }, "node_modules/@esbuild/sunos-x64": { - "version": "0.24.0", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.24.0.tgz", - "integrity": "sha512-jVzdzsbM5xrotH+W5f1s+JtUy1UWgjU0Cf4wMvffTB8m6wP5/kx0KiaLHlbJO+dMgtxKV8RQ/JvtlFcdZ1zCPA==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.24.2.tgz", + "integrity": "sha512-hTdsW27jcktEvpwNHJU4ZwWFGkz2zRJUz8pvddmXPtXDzVKTTINmlmga3ZzwcuMpUvLw7JkLy9QLKyGpD2Yxig==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "sunos" @@ -1114,13 +1152,14 @@ } }, "node_modules/@esbuild/win32-arm64": { - "version": "0.24.0", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.24.0.tgz", - "integrity": "sha512-iKc8GAslzRpBytO2/aN3d2yb2z8XTVfNV0PjGlCxKo5SgWmNXx82I/Q3aG1tFfS+A2igVCY97TJ8tnYwpUWLCA==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.24.2.tgz", + "integrity": "sha512-LihEQ2BBKVFLOC9ZItT9iFprsE9tqjDjnbulhHoFxYQtQfai7qfluVODIYxt1PgdoyQkz23+01rzwNwYfutxUQ==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "win32" @@ -1130,13 +1169,14 @@ } }, "node_modules/@esbuild/win32-ia32": { - "version": "0.24.0", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.24.0.tgz", - "integrity": "sha512-vQW36KZolfIudCcTnaTpmLQ24Ha1RjygBo39/aLkM2kmjkWmZGEJ5Gn9l5/7tzXA42QGIoWbICfg6KLLkIw6yw==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.24.2.tgz", + "integrity": "sha512-q+iGUwfs8tncmFC9pcnD5IvRHAzmbwQ3GPS5/ceCyHdjXubwQWI12MKWSNSMYLJMq23/IUCvJMS76PDqXe1fxA==", "cpu": [ "ia32" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "win32" @@ -1146,13 +1186,14 @@ } }, "node_modules/@esbuild/win32-x64": { - "version": "0.24.0", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.24.0.tgz", - "integrity": "sha512-7IAFPrjSQIJrGsK6flwg7NFmwBoSTyF3rl7If0hNUFQU4ilTsEPL6GuMuU9BfIWVVGuRnuIidkSMC+c0Otu8IA==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.24.2.tgz", + "integrity": "sha512-7VTgWzgMGvup6aSqDPLiW5zHaxYJGTO4OokMjIlrCtf+VpEL+cXKtCvg723iguPYI5oaUNdS+/V7OU2gvXVWEg==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "win32" @@ -6476,11 +6517,12 @@ "optional": true }, "node_modules/esbuild": { - "version": "0.24.0", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.24.0.tgz", - "integrity": "sha512-FuLPevChGDshgSicjisSooU0cemp/sGXR841D5LHMB7mTVOmsEHcAxaH3irL53+8YDIeVNQEySh4DaYU/iuPqQ==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.24.2.tgz", + "integrity": "sha512-+9egpBW8I3CD5XPe0n6BfT5fxLzxrlDzqydF3aviG+9ni1lDC/OvMHcxqEFV0+LANZG5R1bFMWfUrjVsdwxJvA==", "dev": true, "hasInstallScript": true, + "license": "MIT", "bin": { "esbuild": "bin/esbuild" }, @@ -6488,30 +6530,31 @@ "node": ">=18" }, "optionalDependencies": { - "@esbuild/aix-ppc64": "0.24.0", - "@esbuild/android-arm": "0.24.0", - "@esbuild/android-arm64": "0.24.0", - "@esbuild/android-x64": "0.24.0", - "@esbuild/darwin-arm64": "0.24.0", - "@esbuild/darwin-x64": "0.24.0", - "@esbuild/freebsd-arm64": "0.24.0", - "@esbuild/freebsd-x64": "0.24.0", - "@esbuild/linux-arm": "0.24.0", - "@esbuild/linux-arm64": "0.24.0", - "@esbuild/linux-ia32": "0.24.0", - "@esbuild/linux-loong64": "0.24.0", - "@esbuild/linux-mips64el": "0.24.0", - "@esbuild/linux-ppc64": "0.24.0", - "@esbuild/linux-riscv64": "0.24.0", - "@esbuild/linux-s390x": "0.24.0", - "@esbuild/linux-x64": "0.24.0", - "@esbuild/netbsd-x64": "0.24.0", - "@esbuild/openbsd-arm64": "0.24.0", - "@esbuild/openbsd-x64": "0.24.0", - "@esbuild/sunos-x64": "0.24.0", - "@esbuild/win32-arm64": "0.24.0", - "@esbuild/win32-ia32": "0.24.0", - "@esbuild/win32-x64": "0.24.0" + "@esbuild/aix-ppc64": "0.24.2", + "@esbuild/android-arm": "0.24.2", + "@esbuild/android-arm64": "0.24.2", + "@esbuild/android-x64": "0.24.2", + "@esbuild/darwin-arm64": "0.24.2", + "@esbuild/darwin-x64": "0.24.2", + "@esbuild/freebsd-arm64": "0.24.2", + "@esbuild/freebsd-x64": "0.24.2", + "@esbuild/linux-arm": "0.24.2", + "@esbuild/linux-arm64": "0.24.2", + "@esbuild/linux-ia32": "0.24.2", + "@esbuild/linux-loong64": "0.24.2", + "@esbuild/linux-mips64el": "0.24.2", + "@esbuild/linux-ppc64": "0.24.2", + "@esbuild/linux-riscv64": "0.24.2", + "@esbuild/linux-s390x": "0.24.2", + "@esbuild/linux-x64": "0.24.2", + "@esbuild/netbsd-arm64": "0.24.2", + "@esbuild/netbsd-x64": "0.24.2", + "@esbuild/openbsd-arm64": "0.24.2", + "@esbuild/openbsd-x64": "0.24.2", + "@esbuild/sunos-x64": "0.24.2", + "@esbuild/win32-arm64": "0.24.2", + "@esbuild/win32-ia32": "0.24.2", + "@esbuild/win32-x64": "0.24.2" } }, "node_modules/escalade": { @@ -11106,13 +11149,14 @@ "license": "MIT" }, "node_modules/uuid": { - "version": "11.0.3", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-11.0.3.tgz", - "integrity": "sha512-d0z310fCWv5dJwnX1Y/MncBAqGMKEzlBb1AOf7z9K8ALnd0utBX/msg/fA0+sbyN1ihbMsLhrBlnl1ak7Wa0rg==", + "version": "11.0.5", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-11.0.5.tgz", + "integrity": "sha512-508e6IcKLrhxKdBbcA2b4KQZlLVp2+J5UwQ6F7Drckkc5N9ZJwFa4TgWtsww9UG8fGHbm6gbV19TdM5pQ4GaIA==", "funding": [ "https://github.com/sponsors/broofa", "https://github.com/sponsors/ctavan" ], + "license": "MIT", "bin": { "uuid": "dist/esm/bin/uuid" } @@ -11133,12 +11177,13 @@ } }, "node_modules/vite": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/vite/-/vite-6.0.0.tgz", - "integrity": "sha512-Q2+5yQV79EdnpbNxjD3/QHVMCBaQ3Kpd4/uL51UGuh38bIIM+s4o3FqyCzRvTRwFb+cWIUeZvaWwS9y2LD2qeQ==", + "version": "6.0.11", + "resolved": "https://registry.npmjs.org/vite/-/vite-6.0.11.tgz", + "integrity": "sha512-4VL9mQPKoHy4+FE0NnRE/kbY51TOfaknxAjt3fJbGJxhIpBZiqVzlZDEesWWsuREXHwNdAoOFZ9MkPEVXczHwg==", "dev": true, + "license": "MIT", "dependencies": { - "esbuild": "^0.24.0", + "esbuild": "^0.24.2", "postcss": "^8.4.49", "rollup": "^4.23.0" }, @@ -11657,9 +11702,9 @@ } }, "node_modules/vite-node/node_modules/vite": { - "version": "5.4.11", - "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.11.tgz", - "integrity": "sha512-c7jFQRklXua0mTzneGW9QVyxFjUgwcihC4bXEtujIo2ouWCe1Ajt/amn2PCxYnhYfd5k09JX3SB7OYWFKYqj8Q==", + "version": "5.4.14", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.14.tgz", + "integrity": "sha512-EK5cY7Q1D8JNhSaPKVK4pwBFvaTmZxEnoKXLG/U9gmdDcihQGNzFlgIvaxezFR4glP1LsuiedwMBqCXH3wZccA==", "dev": true, "license": "MIT", "dependencies": { @@ -12261,9 +12306,9 @@ } }, "node_modules/vitest/node_modules/vite": { - "version": "5.4.11", - "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.11.tgz", - "integrity": "sha512-c7jFQRklXua0mTzneGW9QVyxFjUgwcihC4bXEtujIo2ouWCe1Ajt/amn2PCxYnhYfd5k09JX3SB7OYWFKYqj8Q==", + "version": "5.4.14", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.14.tgz", + "integrity": "sha512-EK5cY7Q1D8JNhSaPKVK4pwBFvaTmZxEnoKXLG/U9gmdDcihQGNzFlgIvaxezFR4glP1LsuiedwMBqCXH3wZccA==", "dev": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index e2c32a173..775c50aac 100644 --- a/package.json +++ b/package.json @@ -73,6 +73,6 @@ "react-router": "^7.1.3", "react-router-dom": "^7.1.3", "sharp": "^0.33.5", - "uuid": "^11.0.3" + "uuid": "^11.0.5" } } diff --git a/src/common/Extensions/UuidGenerator/UuidFormat.ts b/src/common/Extensions/UuidGenerator/UuidFormat.ts new file mode 100644 index 000000000..77c6e9a79 --- /dev/null +++ b/src/common/Extensions/UuidGenerator/UuidFormat.ts @@ -0,0 +1,6 @@ +export type UuidFormat = { + uppercase: boolean; + hyphens: boolean; + braces: boolean; + quotes: boolean; +}; diff --git a/src/common/Extensions/UuidGenerator/UuidGeneratorSetting.ts b/src/common/Extensions/UuidGenerator/UuidGeneratorSetting.ts index 9efd5d47b..e4650fd97 100644 --- a/src/common/Extensions/UuidGenerator/UuidGeneratorSetting.ts +++ b/src/common/Extensions/UuidGenerator/UuidGeneratorSetting.ts @@ -1,10 +1,9 @@ +import type { UuidFormat } from "./UuidFormat"; import type { UuidVersion } from "./UuidVersion"; export type UuidGeneratorSetting = { uuidVersion: UuidVersion; numberOfUuids: number; - uppercase: boolean; - hyphens: boolean; - braces: boolean; - quotes: boolean; + generatorFormat: UuidFormat; + searchResultFormats: UuidFormat[]; }; diff --git a/src/common/Extensions/UuidGenerator/index.ts b/src/common/Extensions/UuidGenerator/index.ts index 05e77e366..7fe0ecb71 100644 --- a/src/common/Extensions/UuidGenerator/index.ts +++ b/src/common/Extensions/UuidGenerator/index.ts @@ -1,2 +1,3 @@ +export * from "./UuidFormat"; export * from "./UuidGeneratorSetting"; export * from "./UuidVersion"; diff --git a/src/main/Extensions/UuidGenerator/UuidGenerator.test.ts b/src/main/Extensions/UuidGenerator/UuidGenerator.test.ts index b21088572..166bb8413 100644 --- a/src/main/Extensions/UuidGenerator/UuidGenerator.test.ts +++ b/src/main/Extensions/UuidGenerator/UuidGenerator.test.ts @@ -31,7 +31,14 @@ describe(UuidGenerator, () => { describe(UuidGenerator.format, () => { it("should throw an error if the uuid is invalid", () => { - expect(() => UuidGenerator.format("invalid-uuid", false, false, false, false)).toThrow("Invalid UUID"); + expect(() => + UuidGenerator.format("invalid-uuid", { + uppercase: false, + hyphens: false, + braces: false, + quotes: false, + }), + ).toThrow("Invalid UUID"); }); it.each([ @@ -42,7 +49,413 @@ describe(UuidGenerator, () => { ["21771a07-7dce-40b3-850e-386c1a0f5a2d", false, false, false, true, /"[0-9a-f]{32}"/], ["21771a07-7dce-40b3-850e-386c1a0f5a2d", false, false, true, true, /"\{[0-9a-f]{32}\}"/], ])("should format uuid correctly", (uuid, uppercase, hyphens, braces, quotes, expectedPattern) => { - const formattedUuid = UuidGenerator.format(uuid, uppercase, hyphens, braces, quotes); + const formattedUuid = UuidGenerator.format(uuid, { + uppercase: uppercase, + hyphens: hyphens, + braces: braces, + quotes: quotes, + }); + expect(formattedUuid).toMatch(expectedPattern); + }); + }); + + describe(UuidGenerator.validateUuid, () => { + it.each([ + ["21771a07-7dce-40b3-850e-386c1a0f5a2d", true], + ["21771a07-7dce-40b3-850e-386c1a0f5a2z", false], + ])("should validate uuid correctly", (uuid, expectedIsValid) => { + const isValid = UuidGenerator.validateUuid(uuid).toString(); + expect(isValid).toMatch(expectedIsValid.toString()); + }); + }); + + describe(UuidGenerator.reformat, () => { + it.each([ + ["21771a07-7dce-40b3-850e-386c1a0f5a2d", false, false, false, false, /21771a077dce40b3850e386c1a0f5a2d/], + ["21771a07-7dce-40b3-850e-386c1a0f5a2d", true, false, false, false, /21771A077DCE40B3850E386C1A0F5A2D/], + ["21771a07-7dce-40b3-850e-386c1a0f5a2d", false, true, false, false, /21771a07-7dce-40b3-850e-386c1a0f5a2d/], + ["21771a07-7dce-40b3-850e-386c1a0f5a2d", false, false, true, false, /{21771a077dce40b3850e386c1a0f5a2d}/], + ["21771a07-7dce-40b3-850e-386c1a0f5a2d", false, false, false, true, /"21771a077dce40b3850e386c1a0f5a2d"/], + ["21771a07-7dce-40b3-850e-386c1a0f5a2d", true, true, false, false, /21771A07-7DCE-40B3-850E-386C1A0F5A2D/], + [ + "21771a07-7dce-40b3-850e-386c1a0f5a2d", + false, + true, + true, + false, + /{21771a07-7dce-40b3-850e-386c1a0f5a2d}/, + ], + ["21771a07-7dce-40b3-850e-386c1a0f5a2d", false, false, true, true, /"{21771a077dce40b3850e386c1a0f5a2d}"/], + ["21771a07-7dce-40b3-850e-386c1a0f5a2d", true, false, false, true, /"21771A077DCE40B3850E386C1A0F5A2D"/], + ["21771a07-7dce-40b3-850e-386c1a0f5a2d", true, true, true, false, /{21771A07-7DCE-40B3-850E-386C1A0F5A2D}/], + [ + "21771a07-7dce-40b3-850e-386c1a0f5a2d", + false, + true, + true, + true, + /"{21771a07-7dce-40b3-850e-386c1a0f5a2d}"/, + ], + ["21771a07-7dce-40b3-850e-386c1a0f5a2d", true, false, true, true, /"{21771A077DCE40B3850E386C1A0F5A2D}"/], + ["21771a07-7dce-40b3-850e-386c1a0f5a2d", true, true, false, true, /"21771A07-7DCE-40B3-850E-386C1A0F5A2D"/], + [ + "21771a07-7dce-40b3-850e-386c1a0f5a2d", + true, + true, + true, + true, + /"{21771A07-7DCE-40B3-850E-386C1A0F5A2D}"/, + ], + ["21771a077dce40b3850e386c1a0f5a2d", false, false, false, false, /21771a077dce40b3850e386c1a0f5a2d/], + ["21771a077dce40b3850e386c1a0f5a2d", true, false, false, false, /21771A077DCE40B3850E386C1A0F5A2D/], + ["21771a077dce40b3850e386c1a0f5a2d", false, true, false, false, /21771a07-7dce-40b3-850e-386c1a0f5a2d/], + ["21771a077dce40b3850e386c1a0f5a2d", false, false, true, false, /{21771a077dce40b3850e386c1a0f5a2d}/], + ["21771a077dce40b3850e386c1a0f5a2d", false, false, false, true, /"21771a077dce40b3850e386c1a0f5a2d"/], + ["21771a077dce40b3850e386c1a0f5a2d", true, true, false, false, /21771A07-7DCE-40B3-850E-386C1A0F5A2D/], + ["21771a077dce40b3850e386c1a0f5a2d", false, true, true, false, /{21771a07-7dce-40b3-850e-386c1a0f5a2d}/], + ["21771a077dce40b3850e386c1a0f5a2d", false, false, true, true, /"{21771a077dce40b3850e386c1a0f5a2d}"/], + ["21771a077dce40b3850e386c1a0f5a2d", true, false, false, true, /"21771A077DCE40B3850E386C1A0F5A2D"/], + ["21771a077dce40b3850e386c1a0f5a2d", true, true, true, false, /{21771A07-7DCE-40B3-850E-386C1A0F5A2D}/], + ["21771a077dce40b3850e386c1a0f5a2d", false, true, true, true, /"{21771a07-7dce-40b3-850e-386c1a0f5a2d}"/], + ["21771a077dce40b3850e386c1a0f5a2d", true, false, true, true, /"{21771A077DCE40B3850E386C1A0F5A2D}"/], + ["21771a077dce40b3850e386c1a0f5a2d", true, true, false, true, /"21771A07-7DCE-40B3-850E-386C1A0F5A2D"/], + ["21771a077dce40b3850e386c1a0f5a2d", true, true, true, true, /"{21771A07-7DCE-40B3-850E-386C1A0F5A2D}"/], + ["{21771a07-7dce-40b3-850e-386c1a0f5a2d}", false, false, false, false, /21771a077dce40b3850e386c1a0f5a2d/], + ["{21771a07-7dce-40b3-850e-386c1a0f5a2d}", true, false, false, false, /21771A077DCE40B3850E386C1A0F5A2D/], + [ + "{21771a07-7dce-40b3-850e-386c1a0f5a2d}", + false, + true, + false, + false, + /21771a07-7dce-40b3-850e-386c1a0f5a2d/, + ], + ["{21771a07-7dce-40b3-850e-386c1a0f5a2d}", false, false, true, false, /{21771a077dce40b3850e386c1a0f5a2d}/], + ["{21771a07-7dce-40b3-850e-386c1a0f5a2d}", false, false, false, true, /"21771a077dce40b3850e386c1a0f5a2d"/], + [ + "{21771a07-7dce-40b3-850e-386c1a0f5a2d}", + true, + true, + false, + false, + /21771A07-7DCE-40B3-850E-386C1A0F5A2D/, + ], + [ + "{21771a07-7dce-40b3-850e-386c1a0f5a2d}", + false, + true, + true, + false, + /{21771a07-7dce-40b3-850e-386c1a0f5a2d}/, + ], + [ + "{21771a07-7dce-40b3-850e-386c1a0f5a2d}", + false, + false, + true, + true, + /"{21771a077dce40b3850e386c1a0f5a2d}"/, + ], + ["{21771a07-7dce-40b3-850e-386c1a0f5a2d}", true, false, false, true, /"21771A077DCE40B3850E386C1A0F5A2D"/], + [ + "{21771a07-7dce-40b3-850e-386c1a0f5a2d}", + true, + true, + true, + false, + /{21771A07-7DCE-40B3-850E-386C1A0F5A2D}/, + ], + [ + "{21771a07-7dce-40b3-850e-386c1a0f5a2d}", + false, + true, + true, + true, + /"{21771a07-7dce-40b3-850e-386c1a0f5a2d}"/, + ], + ["{21771a07-7dce-40b3-850e-386c1a0f5a2d}", true, false, true, true, /"{21771A077DCE40B3850E386C1A0F5A2D}"/], + [ + "{21771a07-7dce-40b3-850e-386c1a0f5a2d}", + true, + true, + false, + true, + /"21771A07-7DCE-40B3-850E-386C1A0F5A2D"/, + ], + [ + "{21771a07-7dce-40b3-850e-386c1a0f5a2d}", + true, + true, + true, + true, + /"{21771A07-7DCE-40B3-850E-386C1A0F5A2D}"/, + ], + ['"21771a07-7dce-40b3-850e-386c1a0f5a2d"', false, false, false, false, /21771a077dce40b3850e386c1a0f5a2d/], + ['"21771a07-7dce-40b3-850e-386c1a0f5a2d"', true, false, false, false, /21771A077DCE40B3850E386C1A0F5A2D/], + [ + '"21771a07-7dce-40b3-850e-386c1a0f5a2d"', + false, + true, + false, + false, + /21771a07-7dce-40b3-850e-386c1a0f5a2d/, + ], + ['"21771a07-7dce-40b3-850e-386c1a0f5a2d"', false, false, true, false, /{21771a077dce40b3850e386c1a0f5a2d}/], + ['"21771a07-7dce-40b3-850e-386c1a0f5a2d"', false, false, false, true, /"21771a077dce40b3850e386c1a0f5a2d"/], + [ + '"21771a07-7dce-40b3-850e-386c1a0f5a2d"', + true, + true, + false, + false, + /21771A07-7DCE-40B3-850E-386C1A0F5A2D/, + ], + [ + '"21771a07-7dce-40b3-850e-386c1a0f5a2d"', + false, + true, + true, + false, + /{21771a07-7dce-40b3-850e-386c1a0f5a2d}/, + ], + [ + '"21771a07-7dce-40b3-850e-386c1a0f5a2d"', + false, + false, + true, + true, + /"{21771a077dce40b3850e386c1a0f5a2d}"/, + ], + ['"21771a07-7dce-40b3-850e-386c1a0f5a2d"', true, false, false, true, /"21771A077DCE40B3850E386C1A0F5A2D"/], + [ + '"21771a07-7dce-40b3-850e-386c1a0f5a2d"', + true, + true, + true, + false, + /{21771A07-7DCE-40B3-850E-386C1A0F5A2D}/, + ], + [ + '"21771a07-7dce-40b3-850e-386c1a0f5a2d"', + false, + true, + true, + true, + /"{21771a07-7dce-40b3-850e-386c1a0f5a2d}"/, + ], + ['"21771a07-7dce-40b3-850e-386c1a0f5a2d"', true, false, true, true, /"{21771A077DCE40B3850E386C1A0F5A2D}"/], + [ + '"21771a07-7dce-40b3-850e-386c1a0f5a2d"', + true, + true, + false, + true, + /"21771A07-7DCE-40B3-850E-386C1A0F5A2D"/, + ], + [ + '"21771a07-7dce-40b3-850e-386c1a0f5a2d"', + true, + true, + true, + true, + /"{21771A07-7DCE-40B3-850E-386C1A0F5A2D}"/, + ], + ["21771A07-7DCE-40B3-850E-386C1A0F5A2D", false, false, false, false, /21771a077dce40b3850e386c1a0f5a2d/], + ["21771A07-7DCE-40B3-850E-386C1A0F5A2D", true, false, false, false, /21771A077DCE40B3850E386C1A0F5A2D/], + ["21771A07-7DCE-40B3-850E-386C1A0F5A2D", false, true, false, false, /21771a07-7dce-40b3-850e-386c1a0f5a2d/], + ["21771A07-7DCE-40B3-850E-386C1A0F5A2D", false, false, true, false, /{21771a077dce40b3850e386c1a0f5a2d}/], + ["21771A07-7DCE-40B3-850E-386C1A0F5A2D", false, false, false, true, /"21771a077dce40b3850e386c1a0f5a2d"/], + ["21771A07-7DCE-40B3-850E-386C1A0F5A2D", true, true, false, false, /21771A07-7DCE-40B3-850E-386C1A0F5A2D/], + [ + "21771A07-7DCE-40B3-850E-386C1A0F5A2D", + false, + true, + true, + false, + /{21771a07-7dce-40b3-850e-386c1a0f5a2d}/, + ], + ["21771A07-7DCE-40B3-850E-386C1A0F5A2D", false, false, true, true, /"{21771a077dce40b3850e386c1a0f5a2d}"/], + ["21771A07-7DCE-40B3-850E-386C1A0F5A2D", true, false, false, true, /"21771A077DCE40B3850E386C1A0F5A2D"/], + ["21771A07-7DCE-40B3-850E-386C1A0F5A2D", true, true, true, false, /{21771A07-7DCE-40B3-850E-386C1A0F5A2D}/], + [ + "21771A07-7DCE-40B3-850E-386C1A0F5A2D", + false, + true, + true, + true, + /"{21771a07-7dce-40b3-850e-386c1a0f5a2d}"/, + ], + ["21771A07-7DCE-40B3-850E-386C1A0F5A2D", true, false, true, true, /"{21771A077DCE40B3850E386C1A0F5A2D}"/], + ["21771A07-7DCE-40B3-850E-386C1A0F5A2D", true, true, false, true, /"21771A07-7DCE-40B3-850E-386C1A0F5A2D"/], + [ + "21771A07-7DCE-40B3-850E-386C1A0F5A2D", + true, + true, + true, + true, + /"{21771A07-7DCE-40B3-850E-386C1A0F5A2D}"/, + ], + ["21771A077DCE40B3850E386C1A0F5A2D", false, false, false, false, /21771a077dce40b3850e386c1a0f5a2d/], + ["21771A077DCE40B3850E386C1A0F5A2D", true, false, false, false, /21771A077DCE40B3850E386C1A0F5A2D/], + ["21771A077DCE40B3850E386C1A0F5A2D", false, true, false, false, /21771a07-7dce-40b3-850e-386c1a0f5a2d/], + ["21771A077DCE40B3850E386C1A0F5A2D", false, false, true, false, /{21771a077dce40b3850e386c1a0f5a2d}/], + ["21771A077DCE40B3850E386C1A0F5A2D", false, false, false, true, /"21771a077dce40b3850e386c1a0f5a2d"/], + ["21771A077DCE40B3850E386C1A0F5A2D", true, true, false, false, /21771A07-7DCE-40B3-850E-386C1A0F5A2D/], + ["21771A077DCE40B3850E386C1A0F5A2D", false, true, true, false, /{21771a07-7dce-40b3-850e-386c1a0f5a2d}/], + ["21771A077DCE40B3850E386C1A0F5A2D", false, false, true, true, /"{21771a077dce40b3850e386c1a0f5a2d}"/], + ["21771A077DCE40B3850E386C1A0F5A2D", true, false, false, true, /"21771A077DCE40B3850E386C1A0F5A2D"/], + ["21771A077DCE40B3850E386C1A0F5A2D", true, true, true, false, /{21771A07-7DCE-40B3-850E-386C1A0F5A2D}/], + ["21771A077DCE40B3850E386C1A0F5A2D", false, true, true, true, /"{21771a07-7dce-40b3-850e-386c1a0f5a2d}"/], + ["21771A077DCE40B3850E386C1A0F5A2D", true, false, true, true, /"{21771A077DCE40B3850E386C1A0F5A2D}"/], + ["21771A077DCE40B3850E386C1A0F5A2D", true, true, false, true, /"21771A07-7DCE-40B3-850E-386C1A0F5A2D"/], + ["21771A077DCE40B3850E386C1A0F5A2D", true, true, true, true, /"{21771A07-7DCE-40B3-850E-386C1A0F5A2D}"/], + ["{21771A07-7DCE-40B3-850E-386C1A0F5A2D}", false, false, false, false, /21771a077dce40b3850e386c1a0f5a2d/], + ["{21771A07-7DCE-40B3-850E-386C1A0F5A2D}", true, false, false, false, /21771A077DCE40B3850E386C1A0F5A2D/], + [ + "{21771A07-7DCE-40B3-850E-386C1A0F5A2D}", + false, + true, + false, + false, + /21771a07-7dce-40b3-850e-386c1a0f5a2d/, + ], + ["{21771A07-7DCE-40B3-850E-386C1A0F5A2D}", false, false, true, false, /{21771a077dce40b3850e386c1a0f5a2d}/], + ["{21771A07-7DCE-40B3-850E-386C1A0F5A2D}", false, false, false, true, /"21771a077dce40b3850e386c1a0f5a2d"/], + [ + "{21771A07-7DCE-40B3-850E-386C1A0F5A2D}", + true, + true, + false, + false, + /21771A07-7DCE-40B3-850E-386C1A0F5A2D/, + ], + [ + "{21771A07-7DCE-40B3-850E-386C1A0F5A2D}", + false, + true, + true, + false, + /{21771a07-7dce-40b3-850e-386c1a0f5a2d}/, + ], + [ + "{21771A07-7DCE-40B3-850E-386C1A0F5A2D}", + false, + false, + true, + true, + /"{21771a077dce40b3850e386c1a0f5a2d}"/, + ], + ["{21771A07-7DCE-40B3-850E-386C1A0F5A2D}", true, false, false, true, /"21771A077DCE40B3850E386C1A0F5A2D"/], + [ + "{21771A07-7DCE-40B3-850E-386C1A0F5A2D}", + true, + true, + true, + false, + /{21771A07-7DCE-40B3-850E-386C1A0F5A2D}/, + ], + [ + "{21771A07-7DCE-40B3-850E-386C1A0F5A2D}", + false, + true, + true, + true, + /"{21771a07-7dce-40b3-850e-386c1a0f5a2d}"/, + ], + ["{21771A07-7DCE-40B3-850E-386C1A0F5A2D}", true, false, true, true, /"{21771A077DCE40B3850E386C1A0F5A2D}"/], + [ + "{21771A07-7DCE-40B3-850E-386C1A0F5A2D}", + true, + true, + false, + true, + /"21771A07-7DCE-40B3-850E-386C1A0F5A2D"/, + ], + [ + "{21771A07-7DCE-40B3-850E-386C1A0F5A2D}", + true, + true, + true, + true, + /"{21771A07-7DCE-40B3-850E-386C1A0F5A2D}"/, + ], + ['"21771A07-7DCE-40B3-850E-386C1A0F5A2D"', false, false, false, false, /21771a077dce40b3850e386c1a0f5a2d/], + ['"21771A07-7DCE-40B3-850E-386C1A0F5A2D"', true, false, false, false, /21771A077DCE40B3850E386C1A0F5A2D/], + [ + '"21771A07-7DCE-40B3-850E-386C1A0F5A2D"', + false, + true, + false, + false, + /21771a07-7dce-40b3-850e-386c1a0f5a2d/, + ], + ['"21771A07-7DCE-40B3-850E-386C1A0F5A2D"', false, false, true, false, /{21771a077dce40b3850e386c1a0f5a2d}/], + ['"21771A07-7DCE-40B3-850E-386C1A0F5A2D"', false, false, false, true, /"21771a077dce40b3850e386c1a0f5a2d"/], + [ + '"21771A07-7DCE-40B3-850E-386C1A0F5A2D"', + true, + true, + false, + false, + /21771A07-7DCE-40B3-850E-386C1A0F5A2D/, + ], + [ + '"21771A07-7DCE-40B3-850E-386C1A0F5A2D"', + false, + true, + true, + false, + /{21771a07-7dce-40b3-850e-386c1a0f5a2d}/, + ], + [ + '"21771A07-7DCE-40B3-850E-386C1A0F5A2D"', + false, + false, + true, + true, + /"{21771a077dce40b3850e386c1a0f5a2d}"/, + ], + ['"21771A07-7DCE-40B3-850E-386C1A0F5A2D"', true, false, false, true, /"21771A077DCE40B3850E386C1A0F5A2D"/], + [ + '"21771A07-7DCE-40B3-850E-386C1A0F5A2D"', + true, + true, + true, + false, + /{21771A07-7DCE-40B3-850E-386C1A0F5A2D}/, + ], + [ + '"21771A07-7DCE-40B3-850E-386C1A0F5A2D"', + false, + true, + true, + true, + /"{21771a07-7dce-40b3-850e-386c1a0f5a2d}"/, + ], + ['"21771A07-7DCE-40B3-850E-386C1A0F5A2D"', true, false, true, true, /"{21771A077DCE40B3850E386C1A0F5A2D}"/], + [ + '"21771A07-7DCE-40B3-850E-386C1A0F5A2D"', + true, + true, + false, + true, + /"21771A07-7DCE-40B3-850E-386C1A0F5A2D"/, + ], + [ + '"21771A07-7DCE-40B3-850E-386C1A0F5A2D"', + true, + true, + true, + true, + /"{21771A07-7DCE-40B3-850E-386C1A0F5A2D}"/, + ], + ])("should format uuid correctly", (uuid, uppercase, hyphens, braces, quotes, expectedPattern) => { + const formattedUuid = UuidGenerator.reformat(uuid, { + uppercase: uppercase, + hyphens: hyphens, + braces: braces, + quotes: quotes, + }); expect(formattedUuid).toMatch(expectedPattern); }); }); diff --git a/src/main/Extensions/UuidGenerator/UuidGenerator.ts b/src/main/Extensions/UuidGenerator/UuidGenerator.ts index 1830e110a..a8e771af5 100644 --- a/src/main/Extensions/UuidGenerator/UuidGenerator.ts +++ b/src/main/Extensions/UuidGenerator/UuidGenerator.ts @@ -1,3 +1,4 @@ +import type { UuidFormat } from "@common/Extensions/UuidGenerator"; import { v4 as uuidv4, v6 as uuidv6, v7 as uuidv7, validate as uuidValidate } from "uuid"; export class UuidGenerator { @@ -13,24 +14,64 @@ export class UuidGenerator { return uuidv7(); } - public static format(uuid: string, uppercase: boolean, hyphens: boolean, braces: boolean, quotes: boolean): string { + public static format(uuid: string, format: UuidFormat): string { if (!uuidValidate(uuid)) { throw new Error("Invalid UUID"); } let formattedUuid = uuid; - if (uppercase) { + if (format.uppercase) { formattedUuid = formattedUuid.toUpperCase(); } - if (!hyphens) { + if (!format.hyphens) { formattedUuid = formattedUuid.replace(/-/g, ""); } - if (braces) { + if (format.braces) { formattedUuid = `{${formattedUuid}}`; } - if (quotes) { + if (format.quotes) { formattedUuid = `"${formattedUuid}"`; } return formattedUuid; } + + public static reformat(uuid: string, format: UuidFormat): string { + let formattedUuid = uuid.replace(/["{}-]/g, ""); + if (format.uppercase) { + formattedUuid = formattedUuid.toUpperCase(); + } else { + formattedUuid = formattedUuid.toLowerCase(); + } + if (format.hyphens) { + const tempUuid = formattedUuid.replace(/-/g, ""); + + formattedUuid = + tempUuid.substring(0, 8) + + "-" + + tempUuid.substring(8, 12) + + "-" + + tempUuid.substring(12, 16) + + "-" + + tempUuid.substring(16, 20) + + "-" + + tempUuid.substring(20); + } else { + formattedUuid = formattedUuid.replace(/-/g, ""); + } + if (format.braces) { + formattedUuid = `{${formattedUuid}}`; + } else { + formattedUuid = formattedUuid.replace(/[{}]/g, ""); + } + if (format.quotes) { + formattedUuid = `"${formattedUuid}"`; + } else { + formattedUuid = formattedUuid.replace(/"/g, ""); + } + return formattedUuid; + } + + public static validateUuid(uuid: string): boolean { + return uuidValidate(uuid); + } } diff --git a/src/main/Extensions/UuidGenerator/UuidGeneratorExtension.ts b/src/main/Extensions/UuidGenerator/UuidGeneratorExtension.ts index 58d9c60d7..fd0cafc1d 100644 --- a/src/main/Extensions/UuidGenerator/UuidGeneratorExtension.ts +++ b/src/main/Extensions/UuidGenerator/UuidGeneratorExtension.ts @@ -12,7 +12,7 @@ import { import { getExtensionSettingKey } from "@common/Core/Extension"; import type { Image } from "@common/Core/Image"; import type { Resources, Translations } from "@common/Core/Translator"; -import type { UuidGeneratorSetting as Settings, UuidVersion } from "@common/Extensions/UuidGenerator"; +import type { UuidGeneratorSetting as Settings, UuidFormat, UuidVersion } from "@common/Extensions/UuidGenerator"; import { UuidGenerator } from "./UuidGenerator"; export class UuidGeneratorExtension implements Extension { @@ -22,10 +22,8 @@ export class UuidGeneratorExtension implements Extension { public readonly defaultSettings: Settings = { uuidVersion: "v4", numberOfUuids: 10, - uppercase: false, - hyphens: true, - braces: false, - quotes: false, + generatorFormat: { uppercase: false, hyphens: true, braces: false, quotes: false }, + searchResultFormats: [], }; public readonly author = { @@ -40,40 +38,78 @@ export class UuidGeneratorExtension implements Extension { ) {} public getInstantSearchResultItems(searchTerm: string): InstantSearchResultItems { + const uuidFormats: UuidFormat[] = this.getSettingValue("searchResultFormats"); + + let uuidSearchTerm = searchTerm; + if (uuidSearchTerm.toLowerCase().startsWith("uuid") || uuidSearchTerm.toLowerCase().startsWith("guid")) { + uuidSearchTerm = uuidSearchTerm.substring(4); + } + + uuidSearchTerm = uuidSearchTerm.trim(); + const possibleUuid = UuidGenerator.reformat(uuidSearchTerm, { + uppercase: false, + hyphens: true, + braces: false, + quotes: false, + }); + if (this.validateUuid(possibleUuid)) { + return { + after: [], + before: uuidFormats.map((format, index) => { + const formattedUuid = UuidGenerator.format(possibleUuid, format); + + return { + name: formattedUuid, + description: "UUID Generator", + descriptionTranslation: { + key: "generatorResult", + namespace: "extension[UuidGenerator]", + }, + id: "uuidGenerator:instantResult-" + index, + image: this.getImage(), + defaultAction: createCopyToClipboardAction({ + textToCopy: formattedUuid, + description: "Copy UUID to clipboard", + descriptionTranslation: { + key: "copyUuidToClipboard", + namespace: "extension[UuidGenerator]", + }, + }), + }; + }), + }; + } + if (!["uuid", "guid"].includes(searchTerm.toLowerCase())) { return createEmptyInstantSearchResult(); } - const uuid = this.generateUuid( - this.getSettingValue("uuidVersion"), - this.getSettingValue("uppercase"), - this.getSettingValue("hyphens"), - this.getSettingValue("braces"), - this.getSettingValue("quotes"), - ); + const generatedUuid = this.generateUuid(this.getSettingValue("uuidVersion"), false, true, false, false); return { after: [], - before: [ - { - name: uuid, + before: uuidFormats.map((format, index) => { + const formattedUuid = UuidGenerator.reformat(generatedUuid, format); + + return { + name: formattedUuid, description: "UUID Generator", descriptionTranslation: { key: "generatorResult", namespace: "extension[UuidGenerator]", }, - id: "uuidGenerator:instantResult", + id: "uuidGenerator:instantResult-" + index, image: this.getImage(), defaultAction: createCopyToClipboardAction({ - textToCopy: uuid, + textToCopy: formattedUuid, description: "Copy UUID to clipboard", descriptionTranslation: { key: "copyUuidToClipboard", namespace: "extension[UuidGenerator]", }, }), - }, - ], + }; + }), }; } @@ -110,6 +146,10 @@ export class UuidGeneratorExtension implements Extension { hyphens: "Hyphens", braces: "Braces", quotes: "Quotes", + defaultGeneratorFormat: "Generator window format", + searchResultFormats: "Search result formats", + addSearchResultFormat: "Add format", + removeSearchResultFormat: "Remove format", }, "de-CH": { copyUuidToClipboard: "UUID in die Zwischenablage kopieren", @@ -122,6 +162,10 @@ export class UuidGeneratorExtension implements Extension { hyphens: "Bindestriche", braces: "Geschweifte Klammern", quotes: "Anführungszeichen", + defaultGeneratorFormat: "Format im Generator-Fenster", + searchResultFormats: "Formate der Suchresultate", + addSearchResultFormat: "Format hinzufügen", + removeSearchResultFormat: "Format entfernen", }, }; } @@ -146,10 +190,10 @@ export class UuidGeneratorExtension implements Extension { result.push( this.generateUuid( settings.uuidVersion, - settings.uppercase, - settings.hyphens, - settings.braces, - settings.quotes, + settings.generatorFormat.uppercase, + settings.generatorFormat.hyphens, + settings.generatorFormat.braces, + settings.generatorFormat.quotes, ), ); } @@ -181,7 +225,7 @@ export class UuidGeneratorExtension implements Extension { } } - return UuidGenerator.format(uuid, uppercase, hyphens, braces, quotes); + return UuidGenerator.format(uuid, { uppercase, hyphens, braces, quotes }); } private getSettingValue(key: keyof Settings): T { @@ -190,4 +234,8 @@ export class UuidGeneratorExtension implements Extension { this.getSettingDefaultValue(key), ); } + + private validateUuid(uuid: string): boolean { + return UuidGenerator.validateUuid(uuid); + } } diff --git a/src/renderer/Extensions/UuidGenerator/Generator.tsx b/src/renderer/Extensions/UuidGenerator/Generator.tsx index e7627b5a2..c19ca6581 100644 --- a/src/renderer/Extensions/UuidGenerator/Generator.tsx +++ b/src/renderer/Extensions/UuidGenerator/Generator.tsx @@ -69,12 +69,15 @@ export const Generator = ({ const generate = async () => { try { const uuids = await contextBridge.invokeExtension(extensionId, { - uuidVersion, - numberOfUuids, - uppercase, - hyphens, - braces, - quotes, + uuidVersion: uuidVersion, + numberOfUuids: numberOfUuids, + generatorFormat: { + uppercase: uppercase, + hyphens: hyphens, + braces: braces, + quotes: quotes, + }, + searchResultFormats: [], }); setGeneratedUuids(uuids.join("\n")); diff --git a/src/renderer/Extensions/UuidGenerator/UuidGeneratorSettings.tsx b/src/renderer/Extensions/UuidGenerator/UuidGeneratorSettings.tsx index 359dfaf5b..e76af0b7f 100644 --- a/src/renderer/Extensions/UuidGenerator/UuidGeneratorSettings.tsx +++ b/src/renderer/Extensions/UuidGenerator/UuidGeneratorSettings.tsx @@ -1,9 +1,27 @@ -import type { UuidVersion } from "@common/Extensions/UuidGenerator"; +import type { UuidFormat, UuidVersion } from "@common/Extensions/UuidGenerator"; import { useExtensionSetting } from "@Core/Hooks"; import { Setting } from "@Core/Settings/Setting"; import { SettingGroup } from "@Core/Settings/SettingGroup"; import { SettingGroupList } from "@Core/Settings/SettingGroupList"; -import { Checkbox, Dropdown, Input, Option } from "@fluentui/react-components"; +import { + Button, + Checkbox, + DialogTrigger, + Dropdown, + Input, + Label, + Option, + Table, + TableBody, + TableCell, + TableCellActions, + TableCellLayout, + TableHeader, + TableHeaderCell, + TableRow, + Tooltip, +} from "@fluentui/react-components"; +import { AddRegular, DismissRegular } from "@fluentui/react-icons"; import { useTranslation } from "react-i18next"; export const UuidGeneratorSettings = () => { @@ -42,6 +60,41 @@ export const UuidGeneratorSettings = () => { key: "quotes", }); + const { value: searchResultFormats, updateValue: setSearchResultFormats } = useExtensionSetting({ + extensionId, + key: "searchResultFormats", + }); + + const addSearchResultFormat = () => + setSearchResultFormats( + searchResultFormats.concat([{ uppercase: false, hyphens: false, braces: false, quotes: false }]), + ); + + const removeSearchResultFormat = (index: number) => { + const newSearchResultFormats = searchResultFormats.filter((_, loopIndex) => loopIndex !== index); + setSearchResultFormats(newSearchResultFormats); + }; + + const setSearchResultFormatUppercase = (index: number, checked: boolean) => { + searchResultFormats[index].uppercase = checked; + setSearchResultFormats(searchResultFormats); + }; + + const setSearchResultFormatHypens = (index: number, checked: boolean) => { + searchResultFormats[index].hyphens = checked; + setSearchResultFormats(searchResultFormats); + }; + + const setSearchResultFormatBraces = (index: number, checked: boolean) => { + searchResultFormats[index].braces = checked; + setSearchResultFormats(searchResultFormats); + }; + + const setSearchResultFormatQuotes = (index: number, checked: boolean) => { + searchResultFormats[index].quotes = checked; + setSearchResultFormats(searchResultFormats); + }; + return ( @@ -71,24 +124,117 @@ export const UuidGeneratorSettings = () => { /> } /> - setUppercase(checked === true)} /> - } - /> - setHyphens(checked === true)} />} - /> - setBraces(checked === true)} />} - /> - setQuotes(checked === true)} />} - /> +
+ +
+ + + + {t("uppercase")} + {t("hyphens")} + {t("braces")} + {t("quotes")} + + + + + + + setUppercase(checked === true)} + /> + + + setHyphens(checked === true)} + /> + + + setBraces(checked === true)} /> + + + setQuotes(checked === true)} /> + + + + +
+
+ +
+ + + + {t("uppercase")} + {t("hyphens")} + {t("braces")} + {t("quotes")} + + + + + {searchResultFormats.map(({ uppercase, hyphens, braces, quotes }, index) => ( + + + + setSearchResultFormatUppercase(index, checked === true) + } + /> + + + + setSearchResultFormatHypens(index, checked === true) + } + /> + + + + setSearchResultFormatBraces(index, checked === true) + } + /> + + + + setSearchResultFormatQuotes(index, checked === true) + } + /> + + + + + +
+
+ + + +
);