diff options
Diffstat (limited to 'includes/external/discord/node_modules/@sapphire')
19 files changed, 5602 insertions, 0 deletions
diff --git a/includes/external/discord/node_modules/@sapphire/async-queue/CHANGELOG.md b/includes/external/discord/node_modules/@sapphire/async-queue/CHANGELOG.md new file mode 100644 index 0000000..f2d02e0 --- /dev/null +++ b/includes/external/discord/node_modules/@sapphire/async-queue/CHANGELOG.md @@ -0,0 +1,148 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +# [@sapphire/async-queue@1.5.0](https://github.com/sapphiredev/utilities/compare/@sapphire/async-queue@1.4.0...@sapphire/async-queue@1.5.0) - (2022-08-16) + +## π Bug Fixes + +- **deps:** Update all non-major dependencies ([2308bd7](https://github.com/sapphiredev/utilities/commit/2308bd74356b6b2e0c12995b25f4d8ade4803fe9)) + +## π Features + +- Add `AsyncQueue#abortAll` (#429) ([b351e70](https://github.com/sapphiredev/utilities/commit/b351e70ebef329009daaebba89729ee84bb5704c)) + +# [@sapphire/async-queue@1.4.0](https://github.com/sapphiredev/utilities/compare/@sapphire/async-queue@1.3.1...@sapphire/async-queue@1.4.0) - (2022-08-07) + +## π Bug Fixes + +- **deps:** Update all non-major dependencies ([84af0db](https://github.com/sapphiredev/utilities/commit/84af0db2db749223b036aa99fe19a2e9af5681c6)) +- **deps:** Update all non-major dependencies ([50cd8de](https://github.com/sapphiredev/utilities/commit/50cd8dea593b6f5ae75571209456b3421e2ca59a)) + +## π Documentation + +- Add @muchnameless as a contributor ([a1221fe](https://github.com/sapphiredev/utilities/commit/a1221fea68506e99591d5d00ec552a07c26833f9)) +- Add @enxg as a contributor ([d2382f0](https://github.com/sapphiredev/utilities/commit/d2382f04e3909cb4ad11798a0a10e683f6cf5383)) +- Add @EvolutionX-10 as a contributor ([efc3a32](https://github.com/sapphiredev/utilities/commit/efc3a320a72ae258996dd62866d206c33f8d4961)) +- Add @MajesticString as a contributor ([295b3e9](https://github.com/sapphiredev/utilities/commit/295b3e9849a4b0fe64074bae02f6426378a303c3)) +- Add @Mzato0001 as a contributor ([c790ef2](https://github.com/sapphiredev/utilities/commit/c790ef25df2d7e22888fa9f8169167aa555e9e19)) +- Add @NotKaskus as a contributor ([00da8f1](https://github.com/sapphiredev/utilities/commit/00da8f199137b9277119823f322d1f2d168d928a)) +- Add @imranbarbhuiya as a contributor ([fb674c2](https://github.com/sapphiredev/utilities/commit/fb674c2c5594d41e71662263553dcb4bac9e37f4)) +- Add @axisiscool as a contributor ([ce1aa31](https://github.com/sapphiredev/utilities/commit/ce1aa316871a88d3663efbdf2a42d3d8dfe6a27f)) +- Add @dhruv-kaushikk as a contributor ([ebbf43f](https://github.com/sapphiredev/utilities/commit/ebbf43f63617daba96e72c50a234bf8b64f6ddc4)) +- Add @Commandtechno as a contributor ([f1d69fa](https://github.com/sapphiredev/utilities/commit/f1d69fabe1ee0abe4be08b19e63dbec03102f7ce)) +- Fix typedoc causing OOM crashes ([63ba41c](https://github.com/sapphiredev/utilities/commit/63ba41c4b6678554b1c7043a22d3296db4f59360)) + +## π Features + +- **AsyncQueue:** Add AbortSignal support (#417) ([c0629e7](https://github.com/sapphiredev/utilities/commit/c0629e781ebc3f48e496a0851191b32e91f62fe9)) + +## π§ͺ Testing + +- Migrate to vitest (#380) ([075ec73](https://github.com/sapphiredev/utilities/commit/075ec73c7a8e3374fad3ada612d37eb4ac36ec8d)) + +## [1.3.1](https://github.com/sapphiredev/utilities/compare/@sapphire/async-queue@1.3.0...@sapphire/async-queue@1.3.1) (2022-04-01) + +**Note:** Version bump only for package @sapphire/async-queue + +# [1.3.0](https://github.com/sapphiredev/utilities/compare/@sapphire/async-queue@1.2.0...@sapphire/async-queue@1.3.0) (2022-03-06) + +### Features + +- allow module: NodeNext ([#306](https://github.com/sapphiredev/utilities/issues/306)) ([9dc6dd6](https://github.com/sapphiredev/utilities/commit/9dc6dd619efab879bb2b0b3c9e64304e10a67ed6)) +- **ts-config:** add multi-config structure ([#281](https://github.com/sapphiredev/utilities/issues/281)) ([b5191d7](https://github.com/sapphiredev/utilities/commit/b5191d7f2416dc5838590c4ff221454925553e37)) + +# [1.2.0](https://github.com/sapphiredev/utilities/compare/@sapphire/async-queue@1.1.9...@sapphire/async-queue@1.2.0) (2022-01-28) + +### Features + +- change build system to tsup ([#270](https://github.com/sapphiredev/utilities/issues/270)) ([365a53a](https://github.com/sapphiredev/utilities/commit/365a53a5517a01a0926cf28a83c96b63f32ed9f8)) + +## [1.1.9](https://github.com/sapphiredev/utilities/compare/@sapphire/async-queue@1.1.8...@sapphire/async-queue@1.1.9) (2021-11-06) + +**Note:** Version bump only for package @sapphire/async-queue + +## [1.1.8](https://github.com/sapphiredev/utilities/compare/@sapphire/async-queue@1.1.7...@sapphire/async-queue@1.1.8) (2021-10-26) + +**Note:** Version bump only for package @sapphire/async-queue + +## [1.1.7](https://github.com/sapphiredev/utilities/compare/@sapphire/async-queue@1.1.6...@sapphire/async-queue@1.1.7) (2021-10-17) + +### Bug Fixes + +- allow more node & npm versions in engines field ([5977d2a](https://github.com/sapphiredev/utilities/commit/5977d2a30a4b2cfdf84aff3f33af03ffde1bbec5)) + +## [1.1.6](https://github.com/sapphiredev/utilities/compare/@sapphire/async-queue@1.1.5...@sapphire/async-queue@1.1.6) (2021-10-11) + +**Note:** Version bump only for package @sapphire/async-queue + +## [1.1.5](https://github.com/sapphiredev/utilities/compare/@sapphire/async-queue@1.1.4...@sapphire/async-queue@1.1.5) (2021-10-04) + +**Note:** Version bump only for package @sapphire/async-queue + +## [1.1.4](https://github.com/sapphiredev/utilities/compare/@sapphire/async-queue@1.1.3...@sapphire/async-queue@1.1.4) (2021-06-27) + +**Note:** Version bump only for package @sapphire/async-queue + +## [1.1.3](https://github.com/sapphiredev/utilities/compare/@sapphire/async-queue@1.1.2...@sapphire/async-queue@1.1.3) (2021-06-06) + +### Bug Fixes + +- remove peer deps, update dev deps, update READMEs ([#124](https://github.com/sapphiredev/utilities/issues/124)) ([67256ed](https://github.com/sapphiredev/utilities/commit/67256ed43b915b02a8b5c68230ba82d6210c5032)) + +## [1.1.2](https://github.com/sapphiredev/utilities/compare/@sapphire/async-queue@1.1.1...@sapphire/async-queue@1.1.2) (2021-05-20) + +### Bug Fixes + +- **async-queue:** mark package as side effect free ([1c4b901](https://github.com/sapphiredev/utilities/commit/1c4b901cda3d14bd085c35cc74e160f844567ba7)) + +## [1.1.1](https://github.com/sapphiredev/utilities/compare/@sapphire/async-queue@1.1.0...@sapphire/async-queue@1.1.1) (2021-05-02) + +### Bug Fixes + +- drop the `www.` from the SapphireJS URL ([494d89f](https://github.com/sapphiredev/utilities/commit/494d89ffa04f78c195b93d7905b3232884f7d7e2)) +- update all the SapphireJS URLs from `.com` to `.dev` ([f59b46d](https://github.com/sapphiredev/utilities/commit/f59b46d1a0ebd39cad17b17d71cd3b9da808d5fd)) + +# [1.1.0](https://github.com/sapphiredev/utilities/compare/@sapphire/async-queue@1.0.7...@sapphire/async-queue@1.1.0) (2021-04-21) + +### Features + +- add @sapphire/embed-jsx ([#100](https://github.com/sapphiredev/utilities/issues/100)) ([7277a23](https://github.com/sapphiredev/utilities/commit/7277a236015236ed8e81b7882875410facc4ce17)) + +## [1.0.7](https://github.com/sapphiredev/utilities/compare/@sapphire/async-queue@1.0.6...@sapphire/async-queue@1.0.7) (2021-04-19) + +### Bug Fixes + +- change all Sapphire URLs from "project"->"community" & use our domain where applicable π¨βπΎπ ([#102](https://github.com/sapphiredev/utilities/issues/102)) ([835b408](https://github.com/sapphiredev/utilities/commit/835b408e8e57130c3787aca2e32613346ff23e4d)) + +## [1.0.6](https://github.com/sapphiredev/utilities/compare/@sapphire/async-queue@1.0.5...@sapphire/async-queue@1.0.6) (2021-04-03) + +**Note:** Version bump only for package @sapphire/async-queue + +## [1.0.5](https://github.com/sapphiredev/utilities/compare/@sapphire/async-queue@1.0.4...@sapphire/async-queue@1.0.5) (2021-03-16) + +### Bug Fixes + +- remove terser from all packages ([#79](https://github.com/sapphiredev/utilities/issues/79)) ([1cfe4e7](https://github.com/sapphiredev/utilities/commit/1cfe4e7c804e62c142495686d2b83b81d0026c02)) + +## [1.0.4](https://github.com/sapphiredev/utilities/compare/@sapphire/async-queue@1.0.3...@sapphire/async-queue@1.0.4) (2021-02-16) + +**Note:** Version bump only for package @sapphire/async-queue + +## [1.0.3](https://github.com/sapphiredev/utilities/compare/@sapphire/async-queue@1.0.2...@sapphire/async-queue@1.0.3) (2021-02-13) + +**Note:** Version bump only for package @sapphire/async-queue + +## [1.0.2](https://github.com/sapphiredev/utilities/compare/@sapphire/async-queue@1.0.1...@sapphire/async-queue@1.0.2) (2021-01-25) + +**Note:** Version bump only for package @sapphire/async-queue + +## [1.0.1](https://github.com/sapphiredev/utilities/compare/@sapphire/async-queue@1.0.0...@sapphire/async-queue@1.0.1) (2021-01-16) + +**Note:** Version bump only for package @sapphire/async-queue + +# 1.0.0 (2021-01-13) + +### Features + +- **async-queue:** add async-queue package ([#56](https://github.com/sapphiredev/utilities/issues/56)) ([ba81832](https://github.com/sapphiredev/utilities/commit/ba8183287dbbc3f3d7d79af6d5a2d3dd8d62f63e)) diff --git a/includes/external/discord/node_modules/@sapphire/async-queue/README.md b/includes/external/discord/node_modules/@sapphire/async-queue/README.md new file mode 100644 index 0000000..40d1358 --- /dev/null +++ b/includes/external/discord/node_modules/@sapphire/async-queue/README.md @@ -0,0 +1,116 @@ +<div align="center"> + +![Sapphire Logo](https://cdn.skyra.pw/gh-assets/sapphire-banner.png) + +# @sapphire/async-queue + +**Sequential asynchronous lock-based queue for promises.** + +[![GitHub](https://img.shields.io/github/license/sapphiredev/utilities)](https://github.com/sapphiredev/utilities/blob/main/LICENSE.md) +[![codecov](https://codecov.io/gh/sapphiredev/utilities/branch/main/graph/badge.svg?token=OEGIV6RFDO)](https://codecov.io/gh/sapphiredev/utilities) +[![npm bundle size](https://img.shields.io/bundlephobia/min/@sapphire/async-queue?logo=webpack&style=flat-square)](https://bundlephobia.com/result?p=@sapphire/async-queue) +[![npm](https://img.shields.io/npm/v/@sapphire/async-queue?color=crimson&logo=npm&style=flat-square)](https://www.npmjs.com/package/@sapphire/async-queue) + +</div> + +## Description + +Ever needed a queue for a set of promises? This is the package for you. + +## Features + +- Written in TypeScript +- Bundled with esbuild so it can be used in NodeJS and browsers +- Offers CommonJS, ESM and UMD bundles +- Fully tested + +## Installation + +You can use the following command to install this package, or replace `npm install` with your package manager of choice. + +```sh +npm install @sapphire/async-queue +``` + +--- + +## Buy us some doughnuts + +Sapphire Community is and always will be open source, even if we don't get donations. That being said, we know there are amazing people who may still want to donate just to show their appreciation. Thank you very much in advance! + +We accept donations through Open Collective, Ko-fi, PayPal, Patreon and GitHub Sponsorships. You can use the buttons below to donate through your method of choice. + +| Donate With | Address | +| :-------------: | :-------------------------------------------------: | +| Open Collective | [Click Here](https://sapphirejs.dev/opencollective) | +| Ko-fi | [Click Here](https://sapphirejs.dev/kofi) | +| Patreon | [Click Here](https://sapphirejs.dev/patreon) | +| PayPal | [Click Here](https://sapphirejs.dev/paypal) | + +## Contributors β¨ + +Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)): + +<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --> +<!-- prettier-ignore-start --> +<!-- markdownlint-disable --> +<table> + <tr> + <td align="center"><a href="https://favware.tech/"><img src="https://avatars3.githubusercontent.com/u/4019718?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Jeroen Claassens</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=favna" title="Code">π»</a> <a href="#infra-favna" title="Infrastructure (Hosting, Build-Tools, etc)">π</a> <a href="#projectManagement-favna" title="Project Management">π</a> <a href="https://github.com/sapphiredev/utilities/commits?author=favna" title="Documentation">π</a> <a href="https://github.com/sapphiredev/utilities/commits?author=favna" title="Tests">β οΈ</a></td> + <td align="center"><a href="https://github.com/kyranet"><img src="https://avatars0.githubusercontent.com/u/24852502?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Antonio RomΓ‘n</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=kyranet" title="Code">π»</a> <a href="#projectManagement-kyranet" title="Project Management">π</a> <a href="https://github.com/sapphiredev/utilities/pulls?q=is%3Apr+reviewed-by%3Akyranet" title="Reviewed Pull Requests">π</a> <a href="https://github.com/sapphiredev/utilities/commits?author=kyranet" title="Tests">β οΈ</a></td> + <td align="center"><a href="https://github.com/PyroTechniac"><img src="https://avatars2.githubusercontent.com/u/39341355?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Gryffon Bellish</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=PyroTechniac" title="Code">π»</a> <a href="https://github.com/sapphiredev/utilities/pulls?q=is%3Apr+reviewed-by%3APyroTechniac" title="Reviewed Pull Requests">π</a> <a href="https://github.com/sapphiredev/utilities/commits?author=PyroTechniac" title="Tests">β οΈ</a></td> + <td align="center"><a href="https://github.com/vladfrangu"><img src="https://avatars3.githubusercontent.com/u/17960496?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Vlad Frangu</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=vladfrangu" title="Code">π»</a> <a href="https://github.com/sapphiredev/utilities/issues?q=author%3Avladfrangu" title="Bug reports">π</a> <a href="https://github.com/sapphiredev/utilities/pulls?q=is%3Apr+reviewed-by%3Avladfrangu" title="Reviewed Pull Requests">π</a> <a href="#userTesting-vladfrangu" title="User Testing">π</a> <a href="https://github.com/sapphiredev/utilities/commits?author=vladfrangu" title="Tests">β οΈ</a></td> + <td align="center"><a href="https://github.com/Stitch07"><img src="https://avatars0.githubusercontent.com/u/29275227?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Stitch07</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=Stitch07" title="Code">π»</a> <a href="#projectManagement-Stitch07" title="Project Management">π</a> <a href="https://github.com/sapphiredev/utilities/commits?author=Stitch07" title="Tests">β οΈ</a></td> + <td align="center"><a href="https://github.com/apps/depfu"><img src="https://avatars3.githubusercontent.com/in/715?v=4?s=100" width="100px;" alt=""/><br /><sub><b>depfu[bot]</b></sub></a><br /><a href="#maintenance-depfu[bot]" title="Maintenance">π§</a></td> + <td align="center"><a href="https://github.com/apps/allcontributors"><img src="https://avatars0.githubusercontent.com/in/23186?v=4?s=100" width="100px;" alt=""/><br /><sub><b>allcontributors[bot]</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=allcontributors[bot]" title="Documentation">π</a></td> + </tr> + <tr> + <td align="center"><a href="https://github.com/Nytelife26"><img src="https://avatars1.githubusercontent.com/u/22531310?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Tyler J Russell</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=Nytelife26" title="Documentation">π</a></td> + <td align="center"><a href="https://github.com/Alcremie"><img src="https://avatars0.githubusercontent.com/u/54785334?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ivan Lieder</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=Alcremie" title="Code">π»</a> <a href="https://github.com/sapphiredev/utilities/issues?q=author%3AAlcremie" title="Bug reports">π</a></td> + <td align="center"><a href="https://github.com/RealShadowNova"><img src="https://avatars3.githubusercontent.com/u/46537907?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Hezekiah Hendry</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=RealShadowNova" title="Code">π»</a></td> + <td align="center"><a href="https://github.com/Vetlix"><img src="https://avatars.githubusercontent.com/u/31412314?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Vetlix</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=Vetlix" title="Code">π»</a></td> + <td align="center"><a href="https://github.com/ethamitc"><img src="https://avatars.githubusercontent.com/u/27776796?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ethan Mitchell</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=ethamitc" title="Documentation">π</a></td> + <td align="center"><a href="https://github.com/noftaly"><img src="https://avatars.githubusercontent.com/u/34779161?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Elliot</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=noftaly" title="Code">π»</a></td> + <td align="center"><a href="https://jurien.dev"><img src="https://avatars.githubusercontent.com/u/5418114?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Jurien Hamaker</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=jurienhamaker" title="Code">π»</a></td> + </tr> + <tr> + <td align="center"><a href="https://fanoulis.dev/"><img src="https://avatars.githubusercontent.com/u/38255093?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Charalampos Fanoulis</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=cfanoulis" title="Documentation">π</a></td> + <td align="center"><a href="https://github.com/apps/dependabot"><img src="https://avatars.githubusercontent.com/in/29110?v=4?s=100" width="100px;" alt=""/><br /><sub><b>dependabot[bot]</b></sub></a><br /><a href="#maintenance-dependabot[bot]" title="Maintenance">π§</a></td> + <td align="center"><a href="https://kaname.netlify.app/"><img src="https://avatars.githubusercontent.com/u/56084970?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Kaname</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=kaname-png" title="Code">π»</a></td> + <td align="center"><a href="https://github.com/nandhagk"><img src="https://avatars.githubusercontent.com/u/62976649?v=4?s=100" width="100px;" alt=""/><br /><sub><b>nandhagk</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/issues?q=author%3Anandhagk" title="Bug reports">π</a></td> + <td align="center"><a href="https://megatank58.me/"><img src="https://avatars.githubusercontent.com/u/51410502?v=4?s=100" width="100px;" alt=""/><br /><sub><b>megatank58</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=megatank58" title="Code">π»</a></td> + <td align="center"><a href="https://github.com/UndiedGamer"><img src="https://avatars.githubusercontent.com/u/84702365?v=4?s=100" width="100px;" alt=""/><br /><sub><b>UndiedGamer</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=UndiedGamer" title="Code">π»</a></td> + <td align="center"><a href="https://github.com/Lioness100"><img src="https://avatars.githubusercontent.com/u/65814829?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Lioness100</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=Lioness100" title="Documentation">π</a> <a href="https://github.com/sapphiredev/utilities/commits?author=Lioness100" title="Code">π»</a></td> + </tr> + <tr> + <td align="center"><a href="https://gitlab.com/DavidPH/"><img src="https://avatars.githubusercontent.com/u/44669930?v=4?s=100" width="100px;" alt=""/><br /><sub><b>David</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=DavidPHH" title="Code">π»</a></td> + <td align="center"><a href="https://github.com/apps/renovate"><img src="https://avatars.githubusercontent.com/in/2740?v=4?s=100" width="100px;" alt=""/><br /><sub><b>renovate[bot]</b></sub></a><br /><a href="#maintenance-renovate[bot]" title="Maintenance">π§</a></td> + <td align="center"><a href="https://renovate.whitesourcesoftware.com/"><img src="https://avatars.githubusercontent.com/u/25180681?v=4?s=100" width="100px;" alt=""/><br /><sub><b>WhiteSource Renovate</b></sub></a><br /><a href="#maintenance-renovate-bot" title="Maintenance">π§</a></td> + <td align="center"><a href="https://fc5570.me/"><img src="https://avatars.githubusercontent.com/u/68158483?v=4?s=100" width="100px;" alt=""/><br /><sub><b>FC</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=FC5570" title="Code">π»</a></td> + <td align="center"><a href="https://github.com/Tokipudi"><img src="https://avatars.githubusercontent.com/u/29551076?v=4?s=100" width="100px;" alt=""/><br /><sub><b>JΓ©rΓ©my de Saint Denis</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=Tokipudi" title="Code">π»</a></td> + <td align="center"><a href="https://github.com/ItsMrCube"><img src="https://avatars.githubusercontent.com/u/25201357?v=4?s=100" width="100px;" alt=""/><br /><sub><b>MrCube</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=ItsMrCube" title="Code">π»</a></td> + <td align="center"><a href="https://github.com/bitomic"><img src="https://avatars.githubusercontent.com/u/35199700?v=4?s=100" width="100px;" alt=""/><br /><sub><b>bitomic</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=bitomic" title="Code">π»</a></td> + </tr> + <tr> + <td align="center"><a href="https://c43721.dev/"><img src="https://avatars.githubusercontent.com/u/55610086?v=4?s=100" width="100px;" alt=""/><br /><sub><b>c43721</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=c43721" title="Code">π»</a></td> + <td align="center"><a href="https://commandtechno.com/"><img src="https://avatars.githubusercontent.com/u/68407783?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Commandtechno</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=Commandtechno" title="Code">π»</a></td> + <td align="center"><a href="https://github.com/dhruv-kaushikk"><img src="https://avatars.githubusercontent.com/u/73697546?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Aura</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=dhruv-kaushikk" title="Code">π»</a></td> + <td align="center"><a href="https://axis.moe/"><img src="https://avatars.githubusercontent.com/u/54381371?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Jonathan</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=axisiscool" title="Code">π»</a></td> + <td align="center"><a href="https://github.com/imranbarbhuiya"><img src="https://avatars.githubusercontent.com/u/74945038?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Parbez</b></sub></a><br /><a href="#maintenance-imranbarbhuiya" title="Maintenance">π§</a></td> + <td align="center"><a href="https://github.com/NotKaskus"><img src="https://avatars.githubusercontent.com/u/75168528?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Paul Andrew</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=NotKaskus" title="Documentation">π</a></td> + <td align="center"><a href="https://linktr.ee/mzato0001"><img src="https://avatars.githubusercontent.com/u/62367547?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Mzato</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=Mzato0001" title="Code">π»</a> <a href="https://github.com/sapphiredev/utilities/issues?q=author%3AMzato0001" title="Bug reports">π</a></td> + </tr> + <tr> + <td align="center"><a href="https://github.com/MajesticString"><img src="https://avatars.githubusercontent.com/u/66224939?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Harry Allen</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=MajesticString" title="Documentation">π</a></td> + <td align="center"><a href="https://github.com/EvolutionX-10"><img src="https://avatars.githubusercontent.com/u/85353424?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Evo</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=EvolutionX-10" title="Code">π»</a></td> + <td align="center"><a href="https://enes.ovh/"><img src="https://avatars.githubusercontent.com/u/61084101?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Enes GenΓ§</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=enxg" title="Code">π»</a></td> + <td align="center"><a href="https://github.com/muchnameless"><img src="https://avatars.githubusercontent.com/u/12682826?v=4?s=100" width="100px;" alt=""/><br /><sub><b>muchnameless</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=muchnameless" title="Code">π»</a></td> + </tr> +</table> + +<!-- markdownlint-restore --> +<!-- prettier-ignore-end --> + +<!-- ALL-CONTRIBUTORS-LIST:END --> + +This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome! diff --git a/includes/external/discord/node_modules/@sapphire/async-queue/dist/index.d.ts b/includes/external/discord/node_modules/@sapphire/async-queue/dist/index.d.ts new file mode 100644 index 0000000..0ea062c --- /dev/null +++ b/includes/external/discord/node_modules/@sapphire/async-queue/dist/index.d.ts @@ -0,0 +1,55 @@ +/** + * The AsyncQueue class used to sequentialize burst requests + */ +declare class AsyncQueue { + /** + * The amount of entries in the queue, including the head. + * @seealso {@link queued} for the queued count. + */ + get remaining(): number; + /** + * The amount of queued entries. + * @seealso {@link remaining} for the count with the head. + */ + get queued(): number; + /** + * The promises array + */ + private promises; + /** + * Waits for last promise and queues a new one + * @example + * ```typescript + * const queue = new AsyncQueue(); + * async function request(url, options) { + * await queue.wait({ signal: options.signal }); + * try { + * const result = await fetch(url, options); + * // Do some operations with 'result' + * } finally { + * // Remove first entry from the queue and resolve for the next entry + * queue.shift(); + * } + * } + * + * request(someUrl1, someOptions1); // Will call fetch() immediately + * request(someUrl2, someOptions2); // Will call fetch() after the first finished + * request(someUrl3, someOptions3); // Will call fetch() after the second finished + * ``` + */ + wait(options?: Readonly<AsyncQueueWaitOptions>): Promise<void>; + /** + * Unlocks the head lock and transfers the next lock (if any) to the head. + */ + shift(): void; + /** + * Aborts all the pending promises. + * @note To avoid race conditions, this does **not** unlock the head lock. + */ + abortAll(): void; +} +interface AsyncQueueWaitOptions { + signal?: AbortSignal | undefined | null; +} + +export { AsyncQueue, AsyncQueueWaitOptions }; diff --git a/includes/external/discord/node_modules/@sapphire/async-queue/dist/index.mjs b/includes/external/discord/node_modules/@sapphire/async-queue/dist/index.mjs new file mode 100644 index 0000000..b1ca52d --- /dev/null +++ b/includes/external/discord/node_modules/@sapphire/async-queue/dist/index.mjs @@ -0,0 +1,102 @@ +var __defProp = Object.defineProperty; +var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; +var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); +var __publicField = (obj, key, value) => { + __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; +}; + +// src/lib/AsyncQueueEntry.ts +var AsyncQueueEntry = class { + constructor(queue) { + __publicField(this, "promise"); + __publicField(this, "resolve"); + __publicField(this, "reject"); + __publicField(this, "queue"); + __publicField(this, "signal", null); + __publicField(this, "signalListener", null); + this.queue = queue; + this.promise = new Promise((resolve, reject) => { + this.resolve = resolve; + this.reject = reject; + }); + } + setSignal(signal) { + if (signal.aborted) + return this; + this.signal = signal; + this.signalListener = () => { + const index = this.queue["promises"].indexOf(this); + if (index !== -1) + this.queue["promises"].splice(index, 1); + this.reject(new Error("Request aborted manually")); + }; + this.signal.addEventListener("abort", this.signalListener); + return this; + } + use() { + this.dispose(); + this.resolve(); + return this; + } + abort() { + this.dispose(); + this.reject(new Error("Request aborted manually")); + return this; + } + dispose() { + if (this.signal) { + this.signal.removeEventListener("abort", this.signalListener); + this.signal = null; + this.signalListener = null; + } + } +}; +__name(AsyncQueueEntry, "AsyncQueueEntry"); + +// src/lib/AsyncQueue.ts +var AsyncQueue = class { + constructor() { + __publicField(this, "promises", []); + } + get remaining() { + return this.promises.length; + } + get queued() { + return this.remaining === 0 ? 0 : this.remaining - 1; + } + wait(options) { + const entry = new AsyncQueueEntry(this); + if (this.promises.length === 0) { + this.promises.push(entry); + return Promise.resolve(); + } + this.promises.push(entry); + if (options?.signal) + entry.setSignal(options.signal); + return entry.promise; + } + shift() { + if (this.promises.length === 0) + return; + if (this.promises.length === 1) { + this.promises.shift(); + return; + } + this.promises.shift(); + this.promises[0].use(); + } + abortAll() { + if (this.queued === 0) + return; + for (let i = 1; i < this.promises.length; ++i) { + this.promises[i].abort(); + } + this.promises.length = 1; + } +}; +__name(AsyncQueue, "AsyncQueue"); +export { + AsyncQueue +}; +//# sourceMappingURL=index.mjs.map
\ No newline at end of file diff --git a/includes/external/discord/node_modules/@sapphire/async-queue/dist/index.mjs.map b/includes/external/discord/node_modules/@sapphire/async-queue/dist/index.mjs.map new file mode 100644 index 0000000..26dfb53 --- /dev/null +++ b/includes/external/discord/node_modules/@sapphire/async-queue/dist/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/lib/AsyncQueueEntry.ts","../src/lib/AsyncQueue.ts"],"sourcesContent":["import type { AsyncQueue } from './AsyncQueue';\n\n/**\n * @internal\n */\nexport class AsyncQueueEntry {\n\tpublic readonly promise: Promise<void>;\n\tprivate resolve!: () => void;\n\tprivate reject!: (error: Error) => void;\n\tprivate readonly queue: AsyncQueue;\n\tprivate signal: PolyFillAbortSignal | null = null;\n\tprivate signalListener: (() => void) | null = null;\n\n\tpublic constructor(queue: AsyncQueue) {\n\t\tthis.queue = queue;\n\t\tthis.promise = new Promise((resolve, reject) => {\n\t\t\tthis.resolve = resolve;\n\t\t\tthis.reject = reject;\n\t\t});\n\t}\n\n\tpublic setSignal(signal: AbortSignal) {\n\t\tif (signal.aborted) return this;\n\n\t\tthis.signal = signal as PolyFillAbortSignal;\n\t\tthis.signalListener = () => {\n\t\t\tconst index = this.queue['promises'].indexOf(this);\n\t\t\tif (index !== -1) this.queue['promises'].splice(index, 1);\n\n\t\t\tthis.reject(new Error('Request aborted manually'));\n\t\t};\n\t\tthis.signal.addEventListener('abort', this.signalListener);\n\t\treturn this;\n\t}\n\n\tpublic use() {\n\t\tthis.dispose();\n\t\tthis.resolve();\n\t\treturn this;\n\t}\n\n\tpublic abort() {\n\t\tthis.dispose();\n\t\tthis.reject(new Error('Request aborted manually'));\n\t\treturn this;\n\t}\n\n\tprivate dispose() {\n\t\tif (this.signal) {\n\t\t\tthis.signal.removeEventListener('abort', this.signalListener!);\n\t\t\tthis.signal = null;\n\t\t\tthis.signalListener = null;\n\t\t}\n\t}\n}\n\ninterface PolyFillAbortSignal {\n\treadonly aborted: boolean;\n\taddEventListener(type: 'abort', listener: () => void): void;\n\tremoveEventListener(type: 'abort', listener: () => void): void;\n}\n","import { AsyncQueueEntry } from './AsyncQueueEntry';\n\n/**\n * The AsyncQueue class used to sequentialize burst requests\n */\nexport class AsyncQueue {\n\t/**\n\t * The amount of entries in the queue, including the head.\n\t * @seealso {@link queued} for the queued count.\n\t */\n\tpublic get remaining(): number {\n\t\treturn this.promises.length;\n\t}\n\n\t/**\n\t * The amount of queued entries.\n\t * @seealso {@link remaining} for the count with the head.\n\t */\n\tpublic get queued(): number {\n\t\treturn this.remaining === 0 ? 0 : this.remaining - 1;\n\t}\n\n\t/**\n\t * The promises array\n\t */\n\tprivate promises: AsyncQueueEntry[] = [];\n\n\t/**\n\t * Waits for last promise and queues a new one\n\t * @example\n\t * ```typescript\n\t * const queue = new AsyncQueue();\n\t * async function request(url, options) {\n\t * await queue.wait({ signal: options.signal });\n\t * try {\n\t * const result = await fetch(url, options);\n\t * // Do some operations with 'result'\n\t * } finally {\n\t * // Remove first entry from the queue and resolve for the next entry\n\t * queue.shift();\n\t * }\n\t * }\n\t *\n\t * request(someUrl1, someOptions1); // Will call fetch() immediately\n\t * request(someUrl2, someOptions2); // Will call fetch() after the first finished\n\t * request(someUrl3, someOptions3); // Will call fetch() after the second finished\n\t * ```\n\t */\n\tpublic wait(options?: Readonly<AsyncQueueWaitOptions>): Promise<void> {\n\t\tconst entry = new AsyncQueueEntry(this);\n\n\t\tif (this.promises.length === 0) {\n\t\t\tthis.promises.push(entry);\n\t\t\treturn Promise.resolve();\n\t\t}\n\n\t\tthis.promises.push(entry);\n\t\tif (options?.signal) entry.setSignal(options.signal);\n\t\treturn entry.promise;\n\t}\n\n\t/**\n\t * Unlocks the head lock and transfers the next lock (if any) to the head.\n\t */\n\tpublic shift(): void {\n\t\tif (this.promises.length === 0) return;\n\t\tif (this.promises.length === 1) {\n\t\t\t// Remove the head entry.\n\t\t\tthis.promises.shift();\n\t\t\treturn;\n\t\t}\n\n\t\t// Remove the head entry, making the 2nd entry the new one.\n\t\t// Then use the head entry, which will unlock the promise.\n\t\tthis.promises.shift();\n\t\tthis.promises[0].use();\n\t}\n\n\t/**\n\t * Aborts all the pending promises.\n\t * @note To avoid race conditions, this does **not** unlock the head lock.\n\t */\n\tpublic abortAll(): void {\n\t\t// If there are no queued entries, skip early.\n\t\tif (this.queued === 0) return;\n\n\t\t// Abort all the entries except the head, that is why the loop starts at\n\t\t// 1 and not at 0.\n\t\tfor (let i = 1; i < this.promises.length; ++i) {\n\t\t\tthis.promises[i].abort();\n\t\t}\n\n\t\tthis.promises.length = 1;\n\t}\n}\n\nexport interface AsyncQueueWaitOptions {\n\ts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ACpD;AAAA,EA4BO,KAAK,SAA0D;AACrE,UAAM,QAAQ,IAAI,gBAAgB,IAAI;AAEtC,QAAI,KAAK,SAAS,WAAW,GAAG;AAC/B,WAAK,SAAS,KAAK,KAAK;AACxB,aAAO,QAAQ,QAAQ;AAAA,IACxB;AAEA,SAAK,SAAS,KAAK,KAAK;AACxB,QAAI,SAAS;AAAQ,YAAM,UAAU,QAAQ,MAAM;AACnD,WAAO,MAAM;AAAA,EACd;AAAA,EAKO,QAAc;AACpB,QAAI,KAAK,SAAS,WAAW;AAAG;AAChC,QAAI,KAAK,SAAS,WAAW,GAAG;AAE/B,WAAK,SAAS,MAAM;AACpB;AAAA,IACD;AAIA,SAAK,SAAS,MAAM;AACpB,SAAK,SAAS,GAAG,IAAI;AAAA,EACtB;AAAA,EAMO,WAAiB;AAEvB,QAAI,KAAK,WAAW;AAAG;AAIvB,aAAS,IAAI,GAAG,IAAI,KAAK,SAAS,QAAQ,EAAE,GAAG;AAC9C,WAAK,SAAS,GAAG,MAAM;AAAA,IACxB;AAEA,SAAK,SAAS,SAAS;AAAA,EACxB;AACD;AAzFa;","names":[]}
\ No newline at end of file diff --git a/includes/external/discord/node_modules/@sapphire/async-queue/package.json b/includes/external/discord/node_modules/@sapphire/async-queue/package.json new file mode 100644 index 0000000..b1917fd --- /dev/null +++ b/includes/external/discord/node_modules/@sapphire/async-queue/package.json @@ -0,0 +1,65 @@ +{ + "name": "@sapphire/async-queue", + "version": "1.5.0", + "description": "Sequential asynchronous lock-based queue for promises", + "author": "@sapphire", + "license": "MIT", + "main": "dist/index.js", + "module": "dist/index.mjs", + "browser": "dist/index.global.js", + "unpkg": "dist/index.global.js", + "types": "dist/index.d.ts", + "exports": { + "import": "./dist/index.mjs", + "require": "./dist/index.js", + "types": "./dist/index.d.ts" + }, + "sideEffects": false, + "homepage": "https://github.com/sapphiredev/utilities/tree/main/packages/async-queue", + "scripts": { + "test": "vitest run", + "lint": "eslint src tests --ext ts --fix -c ../../.eslintrc", + "build": "tsup", + "prepack": "yarn build", + "bump": "cliff-jumper", + "check-update": "cliff-jumper --dry-run" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/sapphiredev/utilities.git", + "directory": "packages/async-queue" + }, + "files": [ + "dist/**/*.js*", + "dist/**/*.mjs*", + "dist/**/*.d*" + ], + "engines": { + "node": ">=v14.0.0", + "npm": ">=7.0.0" + }, + "keywords": [ + "@sapphire/async-queue", + "bot", + "typescript", + "ts", + "yarn", + "discord", + "sapphire", + "standalone" + ], + "bugs": { + "url": "https://github.com/sapphiredev/utilities/issues" + }, + "publishConfig": { + "access": "public" + }, + "devDependencies": { + "@favware/cliff-jumper": "^1.8.6", + "@vitest/coverage-c8": "^0.22.0", + "c8": "^7.12.0", + "tsup": "^6.2.2", + "typescript": "^4.7.4", + "vitest": "^0.22.0" + } +}
\ No newline at end of file diff --git a/includes/external/discord/node_modules/@sapphire/shapeshift/CHANGELOG.md b/includes/external/discord/node_modules/@sapphire/shapeshift/CHANGELOG.md new file mode 100644 index 0000000..d048520 --- /dev/null +++ b/includes/external/discord/node_modules/@sapphire/shapeshift/CHANGELOG.md @@ -0,0 +1,263 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +# [3.8.1](https://github.com/sapphiredev/shapeshift/compare/v3.8.0...v3.8.1) - (2022-12-15) + +## π Bug Fixes + +- Fixed lodash esm import (#230) ([63def7b](https://github.com/sapphiredev/shapeshift/commit/63def7bcec6319b3792093945ba7ba9f871ced6f)) + +# [3.8.0](https://github.com/sapphiredev/shapeshift/compare/v3.7.1...v3.8.0) - (2022-12-11) + +## π Refactor + +- Remove `NonNullObject` (#227) ([04d3934](https://github.com/sapphiredev/shapeshift/commit/04d39343f55a4e1571f54870a84d8b95447bd682)) + +## π Features + +- Add `when` constraint (#223) ([8eade90](https://github.com/sapphiredev/shapeshift/commit/8eade90cd4c02b80746ecdcdc612829d7f765178)) + +# [3.7.1](https://github.com/sapphiredev/shapeshift/compare/v3.7.0...v3.7.1) - (2022-11-27) + +## π Bug Fixes + +- Fixed "jump to definition" for `undefinedToOptional` going to wrong symbol (#226) ([6aab6d0](https://github.com/sapphiredev/shapeshift/commit/6aab6d01450fd7abbeaa95e91fb58568240e02ff)) + +## π Documentation + +- Add @legendhimslef as a contributor ([499522a](https://github.com/sapphiredev/shapeshift/commit/499522a782c3ecd4df80978d0811df1a75d08212)) + +# [3.7.0](https://github.com/sapphiredev/shapeshift/compare/v3.6.0...v3.7.0) - (2022-10-02) + +## π Documentation + +- Add phone in readme (#203) ([4ec9b7a](https://github.com/sapphiredev/shapeshift/commit/4ec9b7ab85124d84b3404cb548b17b9221a716c5)) +- Add RealShadowNova as a contributor for tool (#185) ([6dfc442](https://github.com/sapphiredev/shapeshift/commit/6dfc442af6ef26d6bbca39078eca5727257b6dab)) + +## π Features + +- Add `s.string.phone` (#202) ([7d122d5](https://github.com/sapphiredev/shapeshift/commit/7d122d5dc0eaa63c639b9cde1514e63566a681bd)) + +# [3.6.0](https://github.com/sapphiredev/shapeshift/compare/v3.5.1...v3.6.0) - (2022-08-29) + +## π Bug Fixes + +- Typescript 4.8 compatibility (#179) ([2281535](https://github.com/sapphiredev/shapeshift/commit/2281535f7589a987510828e46bf66accc8393c34)) + +## π Features + +- Add `Validator#is` (#183) ([5114f95](https://github.com/sapphiredev/shapeshift/commit/5114f9516e5406cd1ca4a7ceb5ea5761158af1c6)) + +# [3.5.1](https://github.com/sapphiredev/shapeshift/compare/v3.5.0...v3.5.1) - (2022-07-17) + +## π Bug Fixes + +- Fast deep equal import (#155) ([5ce8ff6](https://github.com/sapphiredev/shapeshift/commit/5ce8ff6803b70624af07c3e406bc1cdc9e3cdafe)) + +# [3.5.0](https://github.com/sapphiredev/shapeshift/compare/v3.4.1...v3.5.0) - (2022-07-10) + +## π Refactor + +- Port net module (#149) ([5f26e32](https://github.com/sapphiredev/shapeshift/commit/5f26e32b0f87d2b100ca13471d5835c0067ddee8)) + +## π Bug Fixes + +- Ensure browser compatibility (#150) ([92d05d8](https://github.com/sapphiredev/shapeshift/commit/92d05d83c1fbab53f98f61219fb01d49fc031bae)) +- Fixed `s.array` type inference (#153) ([a5948dc](https://github.com/sapphiredev/shapeshift/commit/a5948dc67ce6a0ea73986d32084898a4ce0b9c3a)) +- Fixed `shape#array` types (#146) ([43016a0](https://github.com/sapphiredev/shapeshift/commit/43016a025b04a676d906758ed065d26a17231888)) + +## π Features + +- Lazy validator (#147) ([807666e](https://github.com/sapphiredev/shapeshift/commit/807666ef537c84d2e0f8bd9f4ce1a8060bfb3fb5)) +- Reshape finally (#148) ([d3751f6](https://github.com/sapphiredev/shapeshift/commit/d3751f6d3d99f415d797369f98158f932371e02c)) +- **arrays:** Add unique (#141) ([ad7af34](https://github.com/sapphiredev/shapeshift/commit/ad7af34eb811541253150b7ff0b58a6bd7200796)) + +# [3.4.1](https://github.com/sapphiredev/shapeshift/compare/v3.4.0...v3.4.1) - (2022-07-03) + +## π Refactor + +- Move all type utilities to one file (#139) ([61cab3d](https://github.com/sapphiredev/shapeshift/commit/61cab3d0e486d9dc74c8f6160ff8c75c91b595b2)) + +## π Bug Fixes + +- Return array-validator from length* methods (#140) ([75b1f9a](https://github.com/sapphiredev/shapeshift/commit/75b1f9a6efffb6c27dcfd48eb4ec6269a3614633)) + +## π§ͺ Testing + +- Typechecking for tests (#145) ([273cdc8](https://github.com/sapphiredev/shapeshift/commit/273cdc82c1cf65ba4111ca6e70b050e02cbdf485)) + +# [3.4.0](https://github.com/sapphiredev/shapeshift/compare/v3.3.2...v3.4.0) - (2022-06-29) + +## π Features + +- Add `required` in object validation (#137) ([928f7be](https://github.com/sapphiredev/shapeshift/commit/928f7beb5e727b47868e9e46f2191f2def228080)) + +# [3.3.2](https://github.com/sapphiredev/shapeshift/compare/v3.3.1...v3.3.2) - (2022-06-26) + +## π Bug Fixes + +- Make keys optional in object parsing (#134) ([57a3719](https://github.com/sapphiredev/shapeshift/commit/57a37193d64399aae1431b041012d582e8defecf)) + +# [3.3.1](https://github.com/sapphiredev/shapeshift/compare/v3.3.0...v3.3.1) - (2022-06-22) + +## π Bug Fixes + +- Add generic type to parse (#133) ([90c91aa](https://github.com/sapphiredev/shapeshift/commit/90c91aad572d51a2bfbd1ed32a51e1d4201c5d4a)) + +# [3.3.0](https://github.com/sapphiredev/shapeshift/compare/v3.2.0...v3.3.0) - (2022-06-19) + +## π Bug Fixes + +- Compile for es2020 instead of es2021 (#128) ([051344d](https://github.com/sapphiredev/shapeshift/commit/051344debe1cf423713d7fc64b8908353348f301)) + +## π Features + +- Allow passing functions in `setValidationEnabled` (#131) ([e1991cf](https://github.com/sapphiredev/shapeshift/commit/e1991cfef1ffe92f9167d11d7f2ded65379df8d2)) + +## π§ͺ Testing + +- Migrate to vitest (#126) ([4d80969](https://github.com/sapphiredev/shapeshift/commit/4d80969b714c39768499569456405a73c1444da8)) + +# [3.2.0](https://github.com/sapphiredev/shapeshift/compare/v3.1.0...v3.2.0) - (2022-06-11) + +## π Features + +- Add disabling of validators (#125) ([e17af95](https://github.com/sapphiredev/shapeshift/commit/e17af95d697be62796c57d03385b0c74b9d2d580)) + +# [3.1.0](https://github.com/sapphiredev/shapeshift/compare/v3.0.0...v3.1.0) - (2022-06-04) + +## π Bug Fixes + +- **ObjectValidator:** Fix #121 (#122) ([ecfad7e](https://github.com/sapphiredev/shapeshift/commit/ecfad7ec2cdd9e0cee0b3e227e55a91b28c29c30)) + +## π Documentation + +- **readme:** Clarify the difference between validations and schemas and add table of contents (#108) ([dc492a3](https://github.com/sapphiredev/shapeshift/commit/dc492a395349cc5bc680f313146127ea510b4ada)) + +## π Features + +- **StringValidator:** Add date string checks (#106) ([1b72907](https://github.com/sapphiredev/shapeshift/commit/1b729078be32a88aeddf574c9cff3098990d4f94)) + +# [3.0.0](https://github.com/sapphiredev/shapeshift/compare/v2.2.0...v3.0.0) - (2022-05-06) + +## π Performance + +- Speed up object validation a LOT (#101) ([817278e](https://github.com/sapphiredev/shapeshift/commit/817278e6a3ac128ca342e5ae1737f40b98788c37)) + +## π Bug Fixes + +- Expand method names (#100) ([741490f](https://github.com/sapphiredev/shapeshift/commit/741490fb6907f618fa25fe53808f7dcb5a59a96c))} + + ### π₯ Breaking Changes: + - `date.eq` has been renamed to `date.equal` + - `string.lengthLt` has been renamed to `string.lengthLessThan` + - `string.lengthLe` has been renamed to `string.lengthLessThanOrEqual` + - `string.lengthGt` has been renamed to `string.lengthGreaterThan` + - `string.lengthGe` has been renamed to `string.lengthGreaterThanOrEqual` + - `string.lengthEq` has been renamed to `string.lengthEqual` + - `string.lengthNe` has been renamed to `string.lengthNotEqual` + - `number.gt` has been renamed to `number.greaterThan` + - `number.ge` has been renamed to `number.greaterThanOrEqual` + - `number.lt` has been renamed to `number.lessThan` + - `number.le` has been renamed to `number.lessThanOrEqual` + - `number.eq` has been renamed to `number.equal` + - `number.ne` has been renamed to `number.notEqual` + - `bigint.gt` has been renamed to `bigint.greaterThan` + - `bigint.ge` has been renamed to `bigint.greaterThanOrEqual` + - `bigint.lt` has been renamed to `bigint.lessThan` + - `bigint.le` has been renamed to `bigint.lessThanOrEqual` + - `bigint.eq` has been renamed to `bigint.equal` + - `bigint.ne` has been renamed to `bigint.notEqual` + - `boolean.eq` has been renamed to `boolean.equal` + - `boolean.ne` has been renamed to `boolean.notEqual` + - `array.lengthLt` has been renamed to `array.lengthLessThan` + - `array.lengthLe` has been renamed to `array.lengthLessThanOrEqual` + - `array.lengthGt` has been renamed to `array.lengthGreaterThan` + - `array.lengthGe` has been renamed to `array.lengthGreaterThanOrEqual` + - `array.lengthEq` has been renamed to `array.lengthEqual` + - `array.lengthNe` has been renamed to `array.lengthNotEqual` + - `typedArray.lengthLt` has been renamed to `typedArray.lengthLessThan` + - `typedArray.lengthLe` has been renamed to `typedArray.lengthLessThanOrEqual` + - `typedArray.lengthGt` has been renamed to `typedArray.lengthGreaterThan` + - `typedArray.lengthGe` has been renamed to `typedArray.lengthGreaterThanOrEqual` + - `typedArray.lengthEq` has been renamed to `typedArray.lengthEqual` + - `typedArray.lengthNe` has been renamed to `typedArray.lengthNotEqual` + - `typedArray.byteLengthLt` has been renamed to `typedArray.byteLengthLessThan` + - `typedArray.byteLengthLe` has been renamed to `typedArray.byteLengthLessThanOrEqual` + - `typedArray.byteLengthGt` has been renamed to `typedArray.byteLengthGreaterThan` + - `typedArray.byteLengthGe` has been renamed to `typedArray.byteLengthGreaterThanOrEqual` + - `typedArray.byteLengthEq` has been renamed to `typedArray.byteLengthEqual` + - `typedArray.byteLengthNe` has been renamed to `typedArray.byteLengthNotEqual` + +- **ObjectValidator:** Don't run validation on arrays (#99) ([c83b3d0](https://github.com/sapphiredev/shapeshift/commit/c83b3d03a201d38cc230d9c831ca1d9b66ca533b)) + +## π Features + +- Add 2 utility types inspired by yup and co (#102) ([2fef902](https://github.com/sapphiredev/shapeshift/commit/2fef9026c30f2f1825aa55511d0ab088a3dd13ab)) + +# [2.2.0](https://github.com/sapphiredev/shapeshift/compare/v2.0.0...v2.2.0) - (2022-04-29) + +## Bug Fixes + +- Ensure `BaseError` is exported as value (#95) ([335d799](https://github.com/sapphiredev/shapeshift/commit/335d799ef7a8c1a19a12e3eeec07e6d210db113d)) + +## Documentation + +- **readme:** Add todo notice for `reshape` and `function` validations (#75) ([d5f16f6](https://github.com/sapphiredev/shapeshift/commit/d5f16f615de83503187dc834c6245fafbf138f5e)) + +## Features + +- Add Typed Array (#78) ([ca5ea5f](https://github.com/sapphiredev/shapeshift/commit/ca5ea5f568084bd5d3aa004911d4ea64329e1a89)) + +## Performance + +- Optimize `NativeEnum` (#79) ([e9ae280](https://github.com/sapphiredev/shapeshift/commit/e9ae280f73e9ea08239bd8bd22165fe0b2178f82)) + +# [@sapphire/shapeshift@2.1.0](https://github.com/sapphiredev/shapeshift/compare/v2.0.0...@sapphire/shapeshift@2.1.0) - (2022-04-24) + +## Documentation + +- **readme:** Add todo notice for `reshape` and `function` validations (#75) ([d5f16f6](https://github.com/sapphiredev/shapeshift/commit/d5f16f615de83503187dc834c6245fafbf138f5e)) + +## Performance + +- Optimize `NativeEnum` (#79) ([e9ae280](https://github.com/sapphiredev/shapeshift/commit/e9ae280f73e9ea08239bd8bd22165fe0b2178f82)) + +## [2.0.0](https://github.com/sapphiredev/shapeshift/compare/v1.0.0...v2.0.0) (2022-03-13) + +### Features + +- add `default` ([#25](https://github.com/sapphiredev/shapeshift/issues/25)) ([378c51f](https://github.com/sapphiredev/shapeshift/commit/378c51fb4ba2c501fd782387169db888d6bfe662)) +- add bigint methods ([#32](https://github.com/sapphiredev/shapeshift/issues/32)) ([4c444c1](https://github.com/sapphiredev/shapeshift/commit/4c444c15657c4610b99481b6dec9812bd136d72b)) +- add MapValidator ([#21](https://github.com/sapphiredev/shapeshift/issues/21)) ([c4d1258](https://github.com/sapphiredev/shapeshift/commit/c4d12586762d446b858454077b66635d9d11e2d6)) +- add NativeEnum validator ([#54](https://github.com/sapphiredev/shapeshift/issues/54)) ([7359042](https://github.com/sapphiredev/shapeshift/commit/7359042843d1119f396ac2c038aaff89dbd90c8e)) +- add RecordValidator ([#20](https://github.com/sapphiredev/shapeshift/issues/20)) ([8727427](https://github.com/sapphiredev/shapeshift/commit/8727427be4656792eebcdc5bddf6bcd61bc7e846)) +- add remaining string validations ([#38](https://github.com/sapphiredev/shapeshift/issues/38)) ([1c2fd7b](https://github.com/sapphiredev/shapeshift/commit/1c2fd7bbb20463f09ac461b697c312bec6ae9195)) +- add tuple ([#39](https://github.com/sapphiredev/shapeshift/issues/39)) ([b7704bf](https://github.com/sapphiredev/shapeshift/commit/b7704bf87cf5225021408cf4a6b9ceff8cba25b3)) +- added number transformers ([#17](https://github.com/sapphiredev/shapeshift/issues/17)) ([89a8ddd](https://github.com/sapphiredev/shapeshift/commit/89a8ddd8583774e68c43260c28ee1589ef44516c)) +- allow the use of module: NodeNext ([#55](https://github.com/sapphiredev/shapeshift/issues/55)) ([e6827c5](https://github.com/sapphiredev/shapeshift/commit/e6827c5a12b6a2803a137b71fe4c21bd1c35034b)) +- **array:** add array length Comparators ([#40](https://github.com/sapphiredev/shapeshift/issues/40)) ([1e564c2](https://github.com/sapphiredev/shapeshift/commit/1e564c204b6c9b0a798b3121d31dd4cc99165f60)) +- **Array:** generate tuple types with given length ([#52](https://github.com/sapphiredev/shapeshift/issues/52)) ([793648b](https://github.com/sapphiredev/shapeshift/commit/793648b4cde1f72c5b735ceebb0c48272179be06)) +- **ArrayValidator:** add length ranges ([#53](https://github.com/sapphiredev/shapeshift/issues/53)) ([e431d62](https://github.com/sapphiredev/shapeshift/commit/e431d6218b86fc1480fce14c4466cb36567cad2f)) +- display the property that errored ([#35](https://github.com/sapphiredev/shapeshift/issues/35)) ([fe188b0](https://github.com/sapphiredev/shapeshift/commit/fe188b0d17eeaa5f73b08085562903e23e91717c)) +- improve how errors are returned ([#29](https://github.com/sapphiredev/shapeshift/issues/29)) ([8bc7669](https://github.com/sapphiredev/shapeshift/commit/8bc7669a1a66a10449b321cc4447e411383977d9)) +- **s.object:** add passthrough ([#66](https://github.com/sapphiredev/shapeshift/issues/66)) ([ee9f6f3](https://github.com/sapphiredev/shapeshift/commit/ee9f6f367e513c0120a04cfafe05057c7907c327)) + +### Bug Fixes + +- copy/paste error and `ge` ([#22](https://github.com/sapphiredev/shapeshift/issues/22)) ([fe6505f](https://github.com/sapphiredev/shapeshift/commit/fe6505f8e698bcaf9f8024b2d8f012559827cbb0)) +- fix union type and add test ([#41](https://github.com/sapphiredev/shapeshift/issues/41)) ([fbcf8a9](https://github.com/sapphiredev/shapeshift/commit/fbcf8a9c617c16b33fdddb0a44aa0fe506164fd3)) +- **s.union:** fix union overrides ([#62](https://github.com/sapphiredev/shapeshift/issues/62)) ([56e9b19](https://github.com/sapphiredev/shapeshift/commit/56e9b1947d9b2b129dbed374671114b2242e6d35)) + +## 1.0.0 (2022-01-16) + +### Features + +- added more primitives ([#2](https://github.com/sapphiredev/shapeshift/issues/2)) ([16af17b](https://github.com/sapphiredev/shapeshift/commit/16af17b5d9ee40dce284ee120e0b099f7b2cc0b8)) +- added more things ([7c73d82](https://github.com/sapphiredev/shapeshift/commit/7c73d82cf3740d5b2d4eebcac7767da9d3562437)) +- added ObjectValidator ([#3](https://github.com/sapphiredev/shapeshift/issues/3)) ([abe7ead](https://github.com/sapphiredev/shapeshift/commit/abe7eaddee981ef485713ff5e7b7f32ff97c645b)) + +### Bug Fixes + +- resolved install error ([a5abe13](https://github.com/sapphiredev/shapeshift/commit/a5abe1362bb6d9ce6d6471bffa47fe8983b0d1a4)) diff --git a/includes/external/discord/node_modules/@sapphire/shapeshift/LICENSE.md b/includes/external/discord/node_modules/@sapphire/shapeshift/LICENSE.md new file mode 100644 index 0000000..95a4396 --- /dev/null +++ b/includes/external/discord/node_modules/@sapphire/shapeshift/LICENSE.md @@ -0,0 +1,24 @@ +# The MIT License (MIT) + +Copyright Β© `2021` `The Sapphire Community and its contributors` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the βSoftwareβ), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED βAS ISβ, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/includes/external/discord/node_modules/@sapphire/shapeshift/README.md b/includes/external/discord/node_modules/@sapphire/shapeshift/README.md new file mode 100644 index 0000000..f970cb1 --- /dev/null +++ b/includes/external/discord/node_modules/@sapphire/shapeshift/README.md @@ -0,0 +1,955 @@ +<div align="center"> + +![Sapphire Logo](https://cdn.skyra.pw/gh-assets/sapphire-banner.png) + +# @sapphire/shapeshift + +**Shapeshift** + +Blazing fast input validation and transformation β‘ + +[![GitHub](https://img.shields.io/github/license/sapphiredev/shapeshift)](https://github.com/sapphiredev/shapeshift/blob/main/LICENSE.md) +[![codecov](https://codecov.io/gh/sapphiredev/shapeshift/branch/main/graph/badge.svg?token=RF4mMKx6lL)](https://codecov.io/gh/sapphiredev/shapeshift) +[![npm](https://img.shields.io/npm/v/@sapphire/shapeshift?color=crimson&logo=npm&style=flat-square)](https://www.npmjs.com/package/@sapphire/shapeshift) + +</div> + +## Table of Contents + +- [@sapphire/shapeshift](#sapphireshapeshift) + - [Table of Contents](#table-of-contents) + - [Description](#description) + - [Features](#features) + - [Usage](#usage) + - [Basic usage](#basic-usage) + - [Defining validations](#defining-validations) + - [Primitives](#primitives) + - [Literals](#literals) + - [Strings](#strings) + - [Numbers](#numbers) + - [BigInts](#bigints) + - [Booleans](#booleans) + - [Arrays](#arrays) + - [Tuples](#tuples) + - [Unions](#unions) + - [Enums](#enums) + - [Maps](#maps) + - [Sets](#sets) + - [Instances](#instances) + - [Records](#records) + - [Functions // TODO](#functions--todo) + - [TypedArray](#typedarray) + - [Defining schemas (objects)](#defining-schemas-objects) + - [Utility types for TypeScript](#utility-types-for-typescript) + - [Extracting an interface from a schema](#extracting-an-interface-from-a-schema) + - [Defining the structure of a schema through an interface](#defining-the-structure-of-a-schema-through-an-interface) + - [`.extend`:](#extend) + - [`.pick` / `.omit`:](#pick--omit) + - [`.partial`](#partial) + - [`.required`](#required) + - [Handling unrecognized keys](#handling-unrecognized-keys) + - [`.strict`](#strict) + - [`.ignore`](#ignore) + - [`.passthrough`](#passthrough) + - [BaseValidator: methods and properties](#basevalidator-methods-and-properties) + - [`.run`](#rundata-unknown-resultt-error-given-a-validation-you-can-call-this-method-to-check-whether-or-not-the) + - [`.parse`](#parsedata-unknown-t-given-a-validations-you-can-call-this-method-to-check-whether-or-not-the-input-is-valid) + - [`.transform`](#transformrvalue-t--r-nopvalidatorr-adds-a-constraint-that-modifies-the-input) + - [`.reshape`](#reshapervalue-t--resultr-error--iconstraint-nopvalidatorr-adds-a-constraint-able-to-both-validate) + - [`.default`](#defaultvalue-t----t-transform-undefined-into-the-given-value-or-the-callbacks-returned-value) + - [`.optional`](#optional-a-convenience-method-that-returns-a-union-of-the-type-with-sundefined) + - [`.nullable`](#nullable-a-convenience-method-that-returns-a-union-of-the-type-with-snullable) + - [`.nullish`](#nullish-a-convenience-method-that-returns-a-union-of-the-type-with-snullish) + - [`.array`](#array-a-convenience-method-that-returns-an-arrayvalidator-with-the-type) + - [`.or`](#or-a-convenience-method-that-returns-an-unionvalidator-with-the-type-this-method-is-also-overridden-in) + - [`.when`](#when-adjust-the-schema-based-on-a-sibling-or-sinbling-children-fields) + - [Available options for providing `is`](#available-options-for-providing-is) + - [Resolving of the `key` (first) parameter](#resolving-of-the-key-first-parameter) + - [Examples](#examples) + - [Enabling and disabling validation](#enabling-and-disabling-validation) + - [Buy us some doughnuts](#buy-us-some-doughnuts) + - [Contributors](#contributors) + +## Description + +[Back to top][toc] + +A very fast and lightweight input validation and transformation library for JavaScript. + +> **Note**: Shapeshift requires Node.js v14.0.0 or higher to work. + +## Features + +[Back to top][toc] + +- TypeScript friendly +- Offers CJS, ESM and UMD builds +- API similar to [`zod`] +- Faster than β‘ + +## Usage + +[Back to top][toc] + +**_For complete usages, please dive into our [documentation]_** + +### Basic usage + +[Back to top][toc] + +Creating a simple string validation + +```typescript +import { s } from '@sapphire/shapeshift'; + +const myStringValidation = s.string; + +// Parse +myStringValidation.parse('sapphire'); // => returns 'sapphire' +myStringValidation.parse(12); // throws ValidationError +``` + +Creating an object schema + +```typescript +import { s } from '@sapphire/shapeshift'; + +const user = s.object({ + username: s.string +}); + +user.parse({ username: 'Sapphire' }); +``` + +### Defining validations + +[Back to top][toc] + +#### Primitives + +[Back to top][toc] + +```typescript +import { s } from '@sapphire/shapeshift'; + +// Primitives +s.string; +s.number; +s.bigint; +s.boolean; +s.date; + +// Empty Types +s.undefined; +s.null; +s.nullish; // Accepts undefined | null + +// Catch-all Types +s.any; +s.unknown; + +// Never Type +s.never; +``` + +#### Literals + +[Back to top][toc] + +```typescript +s.literal('sapphire'); +s.literal(12); +s.literal(420n); +s.literal(true); +s.literal(new Date(1639278160000)); // s.date.equal(1639278160000); +``` + +#### Strings + +[Back to top][toc] + +Shapeshift includes a handful of string-specific validations: + +```typescript +s.string.lengthLessThan(5); +s.string.lengthLessThanOrEqual(5); +s.string.lengthGreaterThan(5); +s.string.lengthGreaterThanOrEqual(5); +s.string.lengthEqual(5); +s.string.lengthNotEqual(5); +s.string.email; +s.string.url(); +s.string.uuid(); +s.string.regex(regex); +s.string.ip(); +s.string.ipv4; +s.string.ipv6; +s.string.phone(); +``` + +#### Numbers + +[Back to top][toc] + +Shapeshift includes a handful of number-specific validations: + +```typescript +s.number.greaterThan(5); // > 5 +s.number.greaterThanOrEqual(5); // >= 5 +s.number.lessThan(5); // < 5 +s.number.lessThanOrEqual(5); // <= 5 +s.number.equal(5); // === 5 +s.number.notEqual(5); // !== 5 + +s.number.equal(NaN); // special case: Number.isNaN +s.number.notEqual(NaN); // special case: !Number.isNaN + +s.number.int; // value must be an integer +s.number.safeInt; // value must be a safe integer +s.number.finite; // value must be finite + +s.number.positive; // .greaterThanOrEqual(0) +s.number.negative; // .lessThan(0) + +s.number.divisibleBy(5); // Divisible by 5 +``` + +And transformations: + +```typescript +s.number.abs; // Transforms the number to an absolute number +s.number.sign; // Gets the number's sign + +s.number.trunc; // Transforms the number to the result of `Math.trunc` +s.number.floor; // Transforms the number to the result of `Math.floor` +s.number.fround; // Transforms the number to the result of `Math.fround` +s.number.round; // Transforms the number to the result of `Math.round` +s.number.ceil; // Transforms the number to the result of `Math.ceil` +``` + +#### BigInts + +[Back to top][toc] + +Shapeshift includes a handful of number-specific validations: + +```typescript +s.bigint.greaterThan(5n); // > 5n +s.bigint.greaterThanOrEqual(5n); // >= 5n +s.bigint.lessThan(5n); // < 5n +s.bigint.lessThanOrEqual(5n); // <= 5n +s.bigint.equal(5n); // === 5n +s.bigint.notEqual(5n); // !== 5n + +s.bigint.positive; // .greaterThanOrEqual(0n) +s.bigint.negative; // .lessThan(0n) + +s.bigint.divisibleBy(5n); // Divisible by 5n +``` + +And transformations: + +```typescript +s.bigint.abs; // Transforms the bigint to an absolute bigint + +s.bigint.intN(5); // Clamps to a bigint to a signed bigint with 5 digits, see BigInt.asIntN +s.bigint.uintN(5); // Clamps to a bigint to an unsigned bigint with 5 digits, see BigInt.asUintN +``` + +#### Booleans + +[Back to top][toc] + +Shapeshift includes a few boolean-specific validations: + +```typescript +s.boolean.true; // value must be true +s.boolean.false; // value must be false + +s.boolean.equal(true); // s.boolean.true +s.boolean.equal(false); // s.boolean.false + +s.boolean.notEqual(true); // s.boolean.false +s.boolean.notEqual(false); // s.boolean.true +``` + +#### Arrays + +[Back to top][toc] + +```typescript +const stringArray = s.array(s.string); +const stringArray = s.string.array; +``` + +Shapeshift includes a handful of array-specific validations: + +```typescript +s.string.array.lengthLessThan(5); // Must have less than 5 elements +s.string.array.lengthLessThanOrEqual(5); // Must have 5 or less elements +s.string.array.lengthGreaterThan(5); // Must have more than 5 elements +s.string.array.lengthGreaterThanOrEqual(5); // Must have 5 or more elements +s.string.array.lengthEqual(5); // Must have exactly 5 elements +s.string.array.lengthNotEqual(5); // Must not have exactly 5 elements +s.string.array.lengthRange(0, 4); // Must have at least 0 elements and less than 4 elements (in math, that is [0, 4)) +s.string.array.lengthRangeInclusive(0, 4); // Must have at least 0 elements and at most 4 elements (in math, that is [0, 4]) +s.string.array.lengthRangeExclusive(0, 4); // Must have more than 0 element and less than 4 elements (in math, that is (0, 4)) +s.string.array.unique; // All elements must be unique. Deep equality is used to check for uniqueness. +``` + +> **Note**: All `.length` methods define tuple types with the given amount of elements. For example, +> `s.string.array.lengthGreaterThanOrEqual(2)`'s inferred type is `[string, string, ...string[]]` + +#### Tuples + +[Back to top][toc] + +Unlike arrays, tuples have a fixed number of elements and each element can have a different type: + +```typescript +const dish = s.tuple([ + s.string, // Dish's name + s.number.int, // Table's number + s.date // Date the dish was ready for delivery +]); + +dish.parse(['Iberian ham', 10, new Date()]); +``` + +#### Unions + +[Back to top][toc] + +Shapeshift includes a built-in method for composing OR types: + +```typescript +const stringOrNumber = s.union(s.string, s.number); + +stringOrNumber.parse('Sapphire'); // => 'Sapphire' +stringOrNumber.parse(42); // => 42 +stringOrNumber.parse({}); // => throws CombinedError +``` + +#### Enums + +[Back to top][toc] + +Enums are a convenience method that aliases `s.union(s.literal(a), s.literal(b), ...)`: + +```typescript +s.enum('Red', 'Green', 'Blue'); +// s.union(s.literal('Red'), s.literal('Green'), s.literal('Blue')); +``` + +#### Maps + +[Back to top][toc] + +```typescript +const map = s.map(s.string, s.number); +// Map<string, number> +``` + +#### Sets + +[Back to top][toc] + +```typescript +const set = s.set(s.number); +// Set<number> +``` + +#### Instances + +[Back to top][toc] + +You can use `s.instance(Class)` to check that the input is an instance of a class. This is useful to validate inputs +against classes: + +```typescript +class User { + public constructor(public name: string) {} +} + +const userInstanceValidation = s.instance(User); +userInstanceValidation.parse(new User('Sapphire')); // => User { name: 'Sapphire' } +userInstanceValidation.parse('oops'); // => throws ValidatorError +``` + +#### Records + +[Back to top][toc] + +Record validations are similar to objects, but validate `Record<string, T>` types. Keep in mind this does not check for +the keys, and cannot support validation for specific ones: + +```typescript +const tags = s.record(s.string); + +tags.parse({ foo: 'bar', hello: 'world' }); // => { foo: 'bar', hello: 'world' } +tags.parse({ foo: 42 }); // => throws CombinedError +tags.parse('Hello'); // => throws ValidateError +``` + +--- + +_**Function validation is not yet implemented and will be made available starting v2.1.0**_ + +#### Functions // TODO + +[Back to top][toc] + +You can define function validations. This checks for whether or not an input is a function: + +```typescript +s.function; // () => unknown +``` + +You can define arguments by passing an array as the first argument, as well as the return type as the second: + +```typescript +s.function([s.string]); // (arg0: string) => unknown +s.function([s.string, s.number], s.string); // (arg0: string, arg1: number) => string +``` + +> **Note**: Shapeshift will transform the given function into one with validation on arguments and output. You can +> access the `.raw` property of the function to get the unchecked function. + +--- + +#### TypedArray + +[Back to top][toc] + +```ts +const typedArray = s.typedArray(); +const int16Array = s.int16Array; +const uint16Array = s.uint16Array; +const uint8ClampedArray = s.uint8ClampedArray; +const int16Array = s.int16Array; +const uint16Array = s.uint16Array; +const int32Array = s.int32Array; +const uint32Array = s.uint32Array; +const float32Array = s.float32Array; +const float64Array = s.float64Array; +const bigInt64Array = s.bigInt64Array; +const bigUint64Array = s.bigUint64Array; +``` + +Shapeshift includes a handful of validations specific to typed arrays. + +```typescript +s.typedArray().lengthLessThan(5); // Length must be less than 5 +s.typedArray().lengthLessThanOrEqual(5); // Length must be 5 or less +s.typedArray().lengthGreaterThan(5); // Length must be more than 5 +s.typedArray().lengthGreaterThanOrEqual(5); // Length must be 5 or more +s.typedArray().lengthEqual(5); // Length must be exactly 5 +s.typedArray().lengthNotEqual(5); // Length must not be 5 +s.typedArray().lengthRange(0, 4); // Length L must satisfy 0 <= L < 4 +s.typedArray().lengthRangeInclusive(0, 4); // Length L must satisfy 0 <= L <= 4 +s.typedArray().lengthRangeExclusive(0, 4); // Length L must satisfy 0 < L < 4 +``` + +Note that all of these methods have analogous methods for working with the typed array's byte length, +`s.typedArray().byteLengthX()` - for instance, `s.typedArray().byteLengthLessThan(5)` is the same as +`s.typedArray().lengthLessThan(5)` but for the array's byte length. + +--- + +### Defining schemas (objects) + +[Back to top][toc] + +```typescript +// Properties are required by default: +const animal = s.object({ + name: s.string, + age: s.number +}); +``` + +#### Utility types for TypeScript + +[Back to top][toc] + +For object validation Shapeshift exports 2 utility types that can be used to extract interfaces from schemas and define +the structure of a schema as an interface beforehand respectively. + +##### Extracting an interface from a schema + +[Back to top][toc] + +You can use the `InferType` type to extract the interface from a schema, for example: + +```typescript +import { InferType, s } from '@sapphire/shapeshift'; + +const schema = s.object({ + foo: s.string, + bar: s.number, + baz: s.boolean, + qux: s.bigint, + quux: s.date +}); + +type Inferredtype = InferType<typeof schema>; + +// Expected type: +type Inferredtype = { + foo: string; + bar: number; + baz: boolean; + qux: bigint; + quux: Date; +}; +``` + +##### Defining the structure of a schema through an interface + +[Back to top][toc] + +You can use the `SchemaOf` type to define the structure of a schema before defining the actual schema, for example: + +```typescript +import { s, SchemaOf } from '@sapphire/shapeshift'; + +interface IIngredient { + ingredientId: string | undefined; + name: string | undefined; +} + +interface IInstruction { + instructionId: string | undefined; + message: string | undefined; +} + +interface IRecipe { + recipeId: string | undefined; + title: string; + description: string; + instructions: IInstruction[]; + ingredients: IIngredient[]; +} + +type InstructionSchemaType = SchemaOf<IInstruction>; +// Expected Type: ObjectValidator<IInstruction> + +type IngredientSchemaType = SchemaOf<IIngredient>; +// Expected Type: ObjectValidator<IIngredient> + +type RecipeSchemaType = SchemaOf<IRecipe>; +// Expected Type: ObjectValidator<IRecipe> + +const instructionSchema: InstructionSchemaType = s.object({ + instructionId: s.string.optional, + message: s.string +}); + +const ingredientSchema: IngredientSchemaType = s.object({ + ingredientId: s.string.optional, + name: s.string +}); + +const recipeSchema: RecipeSchemaType = s.object({ + recipeId: s.string.optional, + title: s.string, + description: s.string, + instructions: s.array(instructionSchema), + ingredients: s.array(ingredientSchema) +}); +``` + +#### `.extend`: + +[Back to top][toc] + +You can add additional fields using either an object or an ObjectValidator, in this case, you will get a new object +validator with the merged properties: + +```typescript +const animal = s.object({ + name: s.string.optional, + age: s.number +}); + +const pet = animal.extend({ + owner: s.string.nullish +}); + +const pet = animal.extend( + s.object({ + owner: s.string.nullish + }) +); +``` + +> If both schemas share keys, an error will be thrown. Please use `.omit` on the first object if you desire this +> behaviour. + +#### `.pick` / `.omit`: + +[Back to top][toc] + +Inspired by TypeScript's built-in `Pick` and `Omit` utility types, all object schemas have the aforementioned methods +that return a modifier version: + +```typescript +const pkg = s.object({ + name: s.string, + description: s.string, + dependencies: s.string.array +}); + +const justTheName = pkg.pick(['name']); +// s.object({ name: s.string }); + +const noDependencies = pkg.omit(['dependencies']); +// s.object({ name: s.string, description: s.string }); +``` + +#### `.partial` + +[Back to top][toc] + +Inspired by TypeScript's built-in `Partial` utility type, all object schemas have the aforementioned method that makes +all properties optional: + +```typescript +const user = s.object({ + username: s.string, + password: s.string +}).partial; +``` + +Which is the same as doing: + +```typescript +const user = s.object({ + username: s.string.optional, + password: s.string.optional +}); +``` + +--- + +#### `.required` + +[Back to top][toc] + +Inspired by TypeScript's built-in `Required` utility type, all object schemas have the aforementioned method that makes +all properties required: + +```typescript +const user = s.object({ + username: s.string.optional, + password: s.string.optional +}).required; +``` + +Which is the same as doing: + +```typescript +const user = s.object({ + username: s.string, + password: s.string +}); +``` + +--- + +### Handling unrecognized keys + +[Back to top][toc] + +By default, Shapeshift will not include keys that are not defined by the schema during parsing: + +```typescript +const person = s.object({ + framework: s.string +}); + +person.parse({ + framework: 'Sapphire', + awesome: true +}); +// => { name: 'Sapphire' } +``` + +#### `.strict` + +[Back to top][toc] + +You can disallow unknown keys with `.strict`. If the input includes any unknown keys, an error will be thrown. + +```typescript +const person = s.object({ + framework: s.string +}).strict; + +person.parse({ + framework: 'Sapphire', + awesome: true +}); +// => throws ValidationError +``` + +#### `.ignore` + +[Back to top][toc] + +You can use the `.ignore` getter to reset an object schema to the default behaviour (ignoring unrecognized keys). + +#### `.passthrough` + +[Back to top][toc] + +You can use the `.passthrough` getter to make the validator add the unrecognized properties the shape does not have, +from the input. + +--- + +### BaseValidator: methods and properties + +[Back to top][toc] + +All validations in Shapeshift contain certain methods. + +- #### `.run(data: unknown): Result<T, Error>`: given a validation, you can call this method to check whether or not the + + input is valid. If it is, a `Result` with `success: true` and a deep-cloned value will be returned with the given + constraints and transformations. Otherwise, a `Result` with `success: false` and an error is returned. + +- #### `.parse(data: unknown): T`: given a validations, you can call this method to check whether or not the input is valid. + + If it is, a deep-cloned value will be returned with the given constraints and transformations. Otherwise, an error is + thrown. + +- #### `.transform<R>((value: T) => R): NopValidator<R>`: adds a constraint that modifies the input: + +```typescript +import { s } from '@sapphire/shapeshift'; + +const getLength = s.string.transform((value) => value.length); +getLength.parse('Hello There'); // => 11 +``` + +> :warning: `.transform`'s functions **must not throw**. If a validation error is desired to be thrown, `.reshape` +> instead. + +- #### `.reshape<R>((value: T) => Result<R, Error> | IConstraint): NopValidator<R>`: adds a constraint able to both validate + and modify the input: + +```typescript +import { s, Result } from '@sapphire/shapeshift'; + +const getLength = s.string.reshape((value) => Result.ok(value.length)); +getLength.parse('Hello There'); // => 11 +``` + +> :warning: `.reshape`'s functions **must not throw**. If a validation error is desired to be thrown, use +> `Result.err(error)` instead. + +- #### `.default(value: T | (() => T))`: transform `undefined` into the given value or the callback's returned value: + +```typescript +const name = s.string.default('Sapphire'); +name.parse('Hello'); // => 'Hello' +name.parse(undefined); // => 'Sapphire' +``` + +```typescript +const number = s.number.default(Math.random); +number.parse(12); // => 12 +number.parse(undefined); // => 0.989911985608602 +number.parse(undefined); // => 0.3224350185068794 +``` + +> :warning: The default values are not validated. + +- #### `.optional`: a convenience method that returns a union of the type with `s.undefined`. + +```typescript +s.string.optional; // s.union(s.string, s.undefined) +``` + +- #### `.nullable`: a convenience method that returns a union of the type with `s.nullable`. + +```typescript +s.string.nullable; // s.union(s.string, s.nullable) +``` + +- #### `.nullish`: a convenience method that returns a union of the type with `s.nullish`. + +```typescript +s.string.nullish; // s.union(s.string, s.nullish) +``` + +- #### `.array`: a convenience method that returns an ArrayValidator with the type. + +```typescript +s.string.array; // s.array(s.string) +``` + +- #### `.or`: a convenience method that returns an UnionValidator with the type. This method is also overridden in + UnionValidator to just append one more entry. + +```typescript +s.string.or(s.number); +// => s.union(s.string, s.number) + +s.object({ name: s.string }).or(s.string, s.number); +// => s.union(s.object({ name: s.string }), s.string, s.number) +``` + +- #### `.when`: Adjust the schema based on a sibling or sinbling children fields. + +For using when you provide an object literal where the key `is` is undefined, a value, or a matcher function; `then` +provides the schema when `is` resolves truthy, and `otherwise` provides the schema when `is` resolves falsey. + +##### Available options for providing `is` + +When `is` is not provided (`=== undefined`) it is strictly resolved as `Boolean(value)` wherein `value` is the current +value of the referenced sibling. Note that if multiple siblings are referenced then all the values of the array need to +resolve truthy for the `is` to resolve truthy. + +When `is` is a primitive literal it is strictly compared (`===`) to the current value. + +If you want to use a different form of equality you can provide a function like: `is: (value) => value === true`. + +##### Resolving of the `key` (first) parameter + +For resolving the `key` parameter to its respective value we use [lodash/get](https://lodash.com/docs#get). This means +that every way that Lodash supports resolving a key to its respective value is also supported by Shapeshift. This +includes: + +- Simply providing a string or number like `'name'` or `1`. +- Providing a string or number with a dot notation like `'name.first'` (representative of a nested object structure of + `{ 'name': { 'first': 'Sapphire' } }` => resolves to `Sapphire`). +- Providing a string or number with a bracket notation like `'name[0]'` (representative of an array structure of + `{ 'name': ['Sapphire', 'Framework'] }` => resolves to `Sapphire`). +- Providing a string or number with a dot and bracket notation like `'name[1].first'` (representative of a nested object + structure of `{ 'name': [{ 'first': 'Sapphire' }, { 'first': 'Framework' }] }` => resolves to `Framework`). + +##### Examples + +Let's start with a basic example: + +```typescript +const whenPredicate = s.object({ + booleanLike: s.boolean, + numberLike: s.number.when('booleanLike', { + then: (schema) => schema.greaterThanOrEqual(5), + otherwise: (schema) => schema.lessThanOrEqual(5) + }) +}); + +whenPredicate.parse({ booleanLike: true, numberLike: 6 }); +// => { booleanLike: true, numberLike: 6 } + +whenPredicate.parse({ booleanLike: true, numberLike: 4 }); +// => ExpectedConstraintError('s.number.greaterThanOrEqual', 'Invalid number value', 4, 'expected >= 5') + +whenPredicate.parse({ booleanLike: false, numberLike: 4 }); +// => { booleanLike: false, numberLike: 4 } +``` + +The provided key can also be an array of sibling children: + +```typescript +const whenPredicate = s.object({ + booleanLike: s.boolean, + stringLike: s.string, + numberLike: s.number.when(['booleanLike', 'stringLike'], { + is: ([booleanLikeValue, stringLikeValue]) => booleanLikeValue === true && stringLikeValue === 'foobar', + then: (schema) => schema.greaterThanOrEqual(5), + otherwise: (schema) => schema.lessThanOrEqual(5) + }) +}); + +whenPredicate.parse({ booleanLike: true, stringLike: 'foobar', numberLike: 6 }); +// => { booleanLike: true, numberLike: 6 } + +whenPredicate.parse({ booleanLike: true, stringLike: 'barfoo', numberLike: 4 }); +// => ExpectedConstraintError('s.number.greaterThanOrEqual', 'Invalid number value', 4, 'expected >= 5') + +whenPredicate.parse({ booleanLike: false, stringLike: 'foobar' numberLike: 4 }); +// => ExpectedConstraintError('s.number.greaterThanOrEqual', 'Invalid number value', 4, 'expected >= 5') +``` + +### Enabling and disabling validation + +[Back to top][toc] + +At times, you might want to have a consistent code base with validation, but would like to keep validation to the strict +necessities instead of the in-depth constraints available in shapeshift. By calling `setGlobalValidationEnabled` you can +disable validation at a global level, and by calling `setValidationEnabled` you can disable validation on a +per-validator level. + +> When setting the validation enabled status per-validator, you can also set it to `null` to use the global setting. + +```typescript +import { setGlobalValidationEnabled } from '@sapphire/shapeshift'; + +setGlobalValidationEnabled(false); +``` + +```typescript +import { s } from '@sapphire/shapeshift'; + +const predicate = s.string.lengthGreaterThan(5).setValidationEnabled(false); +``` + +## Buy us some doughnuts + +[Back to top][toc] + +Sapphire Community is and always will be open source, even if we don't get donations. That being said, we know there are +amazing people who may still want to donate just to show their appreciation. Thank you very much in advance! + +We accept donations through Open Collective, Ko-fi, Paypal, Patreon and GitHub Sponsorships. You can use the buttons +below to donate through your method of choice. + +| Donate With | Address | +| :-------------: | :-------------------------------------------------: | +| Open Collective | [Click Here](https://sapphirejs.dev/opencollective) | +| Ko-fi | [Click Here](https://sapphirejs.dev/kofi) | +| Patreon | [Click Here](https://sapphirejs.dev/patreon) | +| PayPal | [Click Here](https://sapphirejs.dev/paypal) | + +## Contributors + +[Back to top][toc] + +Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)): + +<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --> +<!-- prettier-ignore-start --> +<!-- markdownlint-disable --> +<table> + <tr> + <td align="center"><a href="https://github.com/kyranet"><img src="https://avatars.githubusercontent.com/u/24852502?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Antonio RomΓ‘n</b></sub></a><br /><a href="https://github.com/sapphiredev/shapeshift/commits?author=kyranet" title="Code">π»</a> <a href="https://github.com/sapphiredev/shapeshift/commits?author=kyranet" title="Documentation">π</a> <a href="#ideas-kyranet" title="Ideas, Planning, & Feedback">π€</a></td> + <td align="center"><a href="https://github.com/vladfrangu"><img src="https://avatars.githubusercontent.com/u/17960496?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Vlad Frangu</b></sub></a><br /><a href="https://github.com/sapphiredev/shapeshift/commits?author=vladfrangu" title="Code">π»</a> <a href="https://github.com/sapphiredev/shapeshift/commits?author=vladfrangu" title="Documentation">π</a> <a href="#ideas-vladfrangu" title="Ideas, Planning, & Feedback">π€</a></td> + <td align="center"><a href="https://favware.tech/"><img src="https://avatars.githubusercontent.com/u/4019718?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Jeroen Claassens</b></sub></a><br /><a href="https://github.com/sapphiredev/shapeshift/commits?author=favna" title="Documentation">π</a> <a href="#maintenance-favna" title="Maintenance">π§</a> <a href="#infra-favna" title="Infrastructure (Hosting, Build-Tools, etc)">π</a></td> + <td align="center"><a href="https://github.com/apps/renovate"><img src="https://avatars.githubusercontent.com/in/2740?v=4?s=100" width="100px;" alt=""/><br /><sub><b>renovate[bot]</b></sub></a><br /><a href="#maintenance-renovate[bot]" title="Maintenance">π§</a></td> + <td align="center"><a href="https://renovate.whitesourcesoftware.com/"><img src="https://avatars.githubusercontent.com/u/25180681?v=4?s=100" width="100px;" alt=""/><br /><sub><b>WhiteSource Renovate</b></sub></a><br /><a href="#maintenance-renovate-bot" title="Maintenance">π§</a></td> + <td align="center"><a href="https://github.com/Khasms"><img src="https://avatars.githubusercontent.com/u/36800359?v=4?s=100" width="100px;" alt=""/><br /><sub><b>John</b></sub></a><br /><a href="https://github.com/sapphiredev/shapeshift/commits?author=Khasms" title="Code">π»</a></td> + <td align="center"><a href="https://github.com/imranbarbhuiya"><img src="https://avatars.githubusercontent.com/u/74945038?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Parbez</b></sub></a><br /><a href="https://github.com/sapphiredev/shapeshift/commits?author=imranbarbhuiya" title="Code">π»</a> <a href="https://github.com/sapphiredev/shapeshift/commits?author=imranbarbhuiya" title="Tests">β οΈ</a> <a href="https://github.com/sapphiredev/shapeshift/issues?q=author%3Aimranbarbhuiya" title="Bug reports">π</a> <a href="https://github.com/sapphiredev/shapeshift/commits?author=imranbarbhuiya" title="Documentation">π</a></td> + </tr> + <tr> + <td align="center"><a href="https://github.com/apps/allcontributors"><img src="https://avatars.githubusercontent.com/in/23186?v=4?s=100" width="100px;" alt=""/><br /><sub><b>allcontributors[bot]</b></sub></a><br /><a href="https://github.com/sapphiredev/shapeshift/commits?author=allcontributors[bot]" title="Documentation">π</a></td> + <td align="center"><a href="https://github.com/RealShadowNova"><img src="https://avatars.githubusercontent.com/u/46537907?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Hezekiah Hendry</b></sub></a><br /><a href="#tool-RealShadowNova" title="Tools">π§</a></td> + <td align="center"><a href="https://github.com/legendhimslef"><img src="https://avatars.githubusercontent.com/u/69213593?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Voxelli</b></sub></a><br /><a href="https://github.com/sapphiredev/shapeshift/commits?author=legendhimslef" title="Documentation">π</a></td> + </tr> +</table> + +<!-- markdownlint-restore --> +<!-- prettier-ignore-end --> + +<!-- ALL-CONTRIBUTORS-LIST:END --> + +This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. +Contributions of any kind welcome! + +[`zod`]: https://github.com/colinhacks/zod +[documentation]: https://www.sapphirejs.dev/docs/Documentation/api-shapeshift/ +[toc]: #table-of-contents diff --git a/includes/external/discord/node_modules/@sapphire/shapeshift/dist/index.d.ts b/includes/external/discord/node_modules/@sapphire/shapeshift/dist/index.d.ts new file mode 100644 index 0000000..586de82 --- /dev/null +++ b/includes/external/discord/node_modules/@sapphire/shapeshift/dist/index.d.ts @@ -0,0 +1,713 @@ +import { InspectOptionsStylized } from 'node:util'; + +declare class Result<T, E extends Error = Error> { + readonly success: boolean; + readonly value?: T; + readonly error?: E; + private constructor(); + isOk(): this is { + success: true; + value: T; + }; + isErr(): this is { + success: false; + error: E; + }; + unwrap(): T; + static ok<T, E extends Error = Error>(value: T): Result<T, E>; + static err<T, E extends Error = Error>(error: E): Result<T, E>; +} + +type ArrayConstraintName = `s.array(T).${'unique' | `length${'LessThan' | 'LessThanOrEqual' | 'GreaterThan' | 'GreaterThanOrEqual' | 'Equal' | 'NotEqual' | 'Range' | 'RangeInclusive' | 'RangeExclusive'}`}`; +declare function arrayLengthLessThan<T>(value: number): IConstraint<T[]>; +declare function arrayLengthLessThanOrEqual<T>(value: number): IConstraint<T[]>; +declare function arrayLengthGreaterThan<T>(value: number): IConstraint<T[]>; +declare function arrayLengthGreaterThanOrEqual<T>(value: number): IConstraint<T[]>; +declare function arrayLengthEqual<T>(value: number): IConstraint<T[]>; +declare function arrayLengthNotEqual<T>(value: number): IConstraint<T[]>; +declare function arrayLengthRange<T>(start: number, endBefore: number): IConstraint<T[]>; +declare function arrayLengthRangeInclusive<T>(start: number, end: number): IConstraint<T[]>; +declare function arrayLengthRangeExclusive<T>(startAfter: number, endBefore: number): IConstraint<T[]>; + +type BigIntConstraintName = `s.bigint.${'lessThan' | 'lessThanOrEqual' | 'greaterThan' | 'greaterThanOrEqual' | 'equal' | 'notEqual' | 'divisibleBy'}`; +declare function bigintLessThan(value: bigint): IConstraint<bigint>; +declare function bigintLessThanOrEqual(value: bigint): IConstraint<bigint>; +declare function bigintGreaterThan(value: bigint): IConstraint<bigint>; +declare function bigintGreaterThanOrEqual(value: bigint): IConstraint<bigint>; +declare function bigintEqual(value: bigint): IConstraint<bigint>; +declare function bigintNotEqual(value: bigint): IConstraint<bigint>; +declare function bigintDivisibleBy(divider: bigint): IConstraint<bigint>; + +type BooleanConstraintName = `s.boolean.${boolean}`; +declare const booleanTrue: IConstraint<boolean, true>; +declare const booleanFalse: IConstraint<boolean, false>; + +type DateConstraintName = `s.date.${'lessThan' | 'lessThanOrEqual' | 'greaterThan' | 'greaterThanOrEqual' | 'equal' | 'notEqual' | 'valid' | 'invalid'}`; +declare function dateLessThan(value: Date): IConstraint<Date>; +declare function dateLessThanOrEqual(value: Date): IConstraint<Date>; +declare function dateGreaterThan(value: Date): IConstraint<Date>; +declare function dateGreaterThanOrEqual(value: Date): IConstraint<Date>; +declare function dateEqual(value: Date): IConstraint<Date>; +declare function dateNotEqual(value: Date): IConstraint<Date>; +declare const dateInvalid: IConstraint<Date>; +declare const dateValid: IConstraint<Date>; + +type NumberConstraintName = `s.number.${'lessThan' | 'lessThanOrEqual' | 'greaterThan' | 'greaterThanOrEqual' | 'equal' | 'equal(NaN)' | 'notEqual' | 'notEqual(NaN)' | 'int' | 'safeInt' | 'finite' | 'divisibleBy'}`; +declare function numberLessThan(value: number): IConstraint<number>; +declare function numberLessThanOrEqual(value: number): IConstraint<number>; +declare function numberGreaterThan(value: number): IConstraint<number>; +declare function numberGreaterThanOrEqual(value: number): IConstraint<number>; +declare function numberEqual(value: number): IConstraint<number>; +declare function numberNotEqual(value: number): IConstraint<number>; +declare const numberInt: IConstraint<number>; +declare const numberSafeInt: IConstraint<number>; +declare const numberFinite: IConstraint<number>; +declare const numberNaN: IConstraint<number>; +declare const numberNotNaN: IConstraint<number>; +declare function numberDivisibleBy(divider: number): IConstraint<number>; + +declare const customInspectSymbol: unique symbol; +declare const customInspectSymbolStackLess: unique symbol; +declare abstract class BaseError extends Error { + protected [customInspectSymbol](depth: number, options: InspectOptionsStylized): string; + protected abstract [customInspectSymbolStackLess](depth: number, options: InspectOptionsStylized): string; +} + +declare class CombinedError extends BaseError { + readonly errors: readonly BaseError[]; + constructor(errors: readonly BaseError[]); + protected [customInspectSymbolStackLess](depth: number, options: InspectOptionsStylized): string; +} + +declare class ValidationError extends BaseError { + readonly validator: string; + readonly given: unknown; + constructor(validator: string, message: string, given: unknown); + toJSON(): { + name: string; + validator: string; + given: unknown; + }; + protected [customInspectSymbolStackLess](depth: number, options: InspectOptionsStylized): string; +} + +declare class ExpectedValidationError<T> extends ValidationError { + readonly expected: T; + constructor(validator: string, message: string, given: unknown, expected: T); + toJSON(): { + name: string; + validator: string; + given: unknown; + expected: T; + }; + protected [customInspectSymbolStackLess](depth: number, options: InspectOptionsStylized): string; +} + +declare class MissingPropertyError extends BaseError { + readonly property: PropertyKey; + constructor(property: PropertyKey); + toJSON(): { + name: string; + property: PropertyKey; + }; + protected [customInspectSymbolStackLess](depth: number, options: InspectOptionsStylized): string; +} + +declare class MultiplePossibilitiesConstraintError<T = unknown> extends BaseConstraintError<T> { + readonly expected: readonly string[]; + constructor(constraint: ConstraintErrorNames, message: string, given: T, expected: readonly string[]); + toJSON(): { + name: string; + constraint: ConstraintErrorNames; + given: T; + expected: readonly string[]; + }; + protected [customInspectSymbolStackLess](depth: number, options: InspectOptionsStylized): string; +} + +declare class UnknownEnumValueError extends BaseError { + readonly value: string | number; + readonly enumKeys: string[]; + readonly enumMappings: Map<string | number, string | number>; + constructor(value: string | number, keys: string[], enumMappings: Map<string | number, string | number>); + toJSON(): { + name: string; + value: string | number; + enumKeys: string[]; + enumMappings: [string | number, string | number][]; + }; + protected [customInspectSymbolStackLess](depth: number, options: InspectOptionsStylized): string; +} + +declare class UnknownPropertyError extends BaseError { + readonly property: PropertyKey; + readonly value: unknown; + constructor(property: PropertyKey, value: unknown); + toJSON(): { + name: string; + property: PropertyKey; + value: unknown; + }; + protected [customInspectSymbolStackLess](depth: number, options: InspectOptionsStylized): string; +} + +declare class BigIntValidator<T extends bigint> extends BaseValidator<T> { + lessThan(number: bigint): this; + lessThanOrEqual(number: bigint): this; + greaterThan(number: bigint): this; + greaterThanOrEqual(number: bigint): this; + equal<N extends bigint>(number: N): BigIntValidator<N>; + notEqual(number: bigint): this; + get positive(): this; + get negative(): this; + divisibleBy(number: bigint): this; + get abs(): this; + intN(bits: number): this; + uintN(bits: number): this; + protected handle(value: unknown): Result<T, ValidationError>; +} + +declare class BooleanValidator<T extends boolean = boolean> extends BaseValidator<T> { + get true(): BooleanValidator<true>; + get false(): BooleanValidator<false>; + equal<R extends true | false>(value: R): BooleanValidator<R>; + notEqual<R extends true | false>(value: R): BooleanValidator<R>; + protected handle(value: unknown): Result<T, ValidationError>; +} + +declare class DateValidator extends BaseValidator<Date> { + lessThan(date: Date | number | string): this; + lessThanOrEqual(date: Date | number | string): this; + greaterThan(date: Date | number | string): this; + greaterThanOrEqual(date: Date | number | string): this; + equal(date: Date | number | string): this; + notEqual(date: Date | number | string): this; + get valid(): this; + get invalid(): this; + protected handle(value: unknown): Result<Date, ValidationError>; +} + +declare class DefaultValidator<T> extends BaseValidator<T> { + private readonly validator; + private defaultValue; + constructor(validator: BaseValidator<T>, value: T | (() => T), constraints?: readonly IConstraint<T>[]); + default(value: Exclude<T, undefined> | (() => Exclude<T, undefined>)): DefaultValidator<Exclude<T, undefined>>; + protected handle(value: unknown): Result<T, ValidatorError>; + protected clone(): this; +} + +declare class InstanceValidator<T> extends BaseValidator<T> { + readonly expected: Constructor<T>; + constructor(expected: Constructor<T>, constraints?: readonly IConstraint<T>[]); + protected handle(value: unknown): Result<T, ExpectedValidationError<Constructor<T>>>; + protected clone(): this; +} + +declare class LiteralValidator<T> extends BaseValidator<T> { + readonly expected: T; + constructor(literal: T, constraints?: readonly IConstraint<T>[]); + protected handle(value: unknown): Result<T, ExpectedValidationError<T>>; + protected clone(): this; +} + +declare class CombinedPropertyError extends BaseError { + readonly errors: [PropertyKey, BaseError][]; + constructor(errors: [PropertyKey, BaseError][]); + protected [customInspectSymbolStackLess](depth: number, options: InspectOptionsStylized): string; + private static formatProperty; +} + +declare class MapValidator<K, V> extends BaseValidator<Map<K, V>> { + private readonly keyValidator; + private readonly valueValidator; + constructor(keyValidator: BaseValidator<K>, valueValidator: BaseValidator<V>, constraints?: readonly IConstraint<Map<K, V>>[]); + protected clone(): this; + protected handle(value: unknown): Result<Map<K, V>, ValidationError | CombinedPropertyError>; +} + +declare class NativeEnumValidator<T extends NativeEnumLike> extends BaseValidator<T[keyof T]> { + readonly enumShape: T; + readonly hasNumericElements: boolean; + private readonly enumKeys; + private readonly enumMapping; + constructor(enumShape: T); + protected handle(value: unknown): Result<T[keyof T], ValidationError | UnknownEnumValueError>; + protected clone(): this; +} +interface NativeEnumLike { + [key: string]: string | number; + [key: number]: string; +} + +declare class NeverValidator extends BaseValidator<never> { + protected handle(value: unknown): Result<never, ValidationError>; +} + +declare class NullishValidator extends BaseValidator<undefined | null> { + protected handle(value: unknown): Result<undefined | null, ValidationError>; +} + +declare class NumberValidator<T extends number> extends BaseValidator<T> { + lessThan(number: number): this; + lessThanOrEqual(number: number): this; + greaterThan(number: number): this; + greaterThanOrEqual(number: number): this; + equal<N extends number>(number: N): NumberValidator<N>; + notEqual(number: number): this; + get int(): this; + get safeInt(): this; + get finite(): this; + get positive(): this; + get negative(): this; + divisibleBy(divider: number): this; + get abs(): this; + get sign(): this; + get trunc(): this; + get floor(): this; + get fround(): this; + get round(): this; + get ceil(): this; + protected handle(value: unknown): Result<T, ValidationError>; +} + +declare class ObjectValidator<T extends object, I = UndefinedToOptional<T>> extends BaseValidator<I> { + readonly shape: MappedObjectValidator<T>; + readonly strategy: ObjectValidatorStrategy; + private readonly keys; + private readonly handleStrategy; + private readonly requiredKeys; + private readonly possiblyUndefinedKeys; + private readonly possiblyUndefinedKeysWithDefaults; + constructor(shape: MappedObjectValidator<T>, strategy?: ObjectValidatorStrategy, constraints?: readonly IConstraint<I>[]); + get strict(): this; + get ignore(): this; + get passthrough(): this; + get partial(): ObjectValidator<{ + [Key in keyof I]?: I[Key]; + }>; + get required(): ObjectValidator<{ + [Key in keyof I]-?: I[Key]; + }>; + extend<ET extends object>(schema: ObjectValidator<ET> | MappedObjectValidator<ET>): ObjectValidator<T & ET>; + pick<K extends keyof I>(keys: readonly K[]): ObjectValidator<{ + [Key in keyof Pick<I, K>]: I[Key]; + }>; + omit<K extends keyof I>(keys: readonly K[]): ObjectValidator<{ + [Key in keyof Omit<I, K>]: I[Key]; + }>; + protected handle(value: unknown): Result<I, ValidationError | CombinedPropertyError>; + protected clone(): this; + private handleIgnoreStrategy; + private handleStrictStrategy; + private handlePassthroughStrategy; +} +declare const enum ObjectValidatorStrategy { + Ignore = 0, + Strict = 1, + Passthrough = 2 +} + +declare class PassthroughValidator<T extends any | unknown> extends BaseValidator<T> { + protected handle(value: unknown): Result<T, ValidationError>; +} + +declare class RecordValidator<T> extends BaseValidator<Record<string, T>> { + private readonly validator; + constructor(validator: BaseValidator<T>, constraints?: readonly IConstraint<Record<string, T>>[]); + protected clone(): this; + protected handle(value: unknown): Result<Record<string, T>, ValidationError | CombinedPropertyError>; +} + +declare class SetValidator<T> extends BaseValidator<Set<T>> { + private readonly validator; + constructor(validator: BaseValidator<T>, constraints?: readonly IConstraint<Set<T>>[]); + protected clone(): this; + protected handle(values: unknown): Result<Set<T>, ValidationError | CombinedError>; +} + +type StringConstraintName = `s.string.${`length${'LessThan' | 'LessThanOrEqual' | 'GreaterThan' | 'GreaterThanOrEqual' | 'Equal' | 'NotEqual'}` | 'regex' | 'url' | 'uuid' | 'email' | `ip${'v4' | 'v6' | ''}` | 'date' | 'phone'}`; +type StringProtocol = `${string}:`; +type StringDomain = `${string}.${string}`; +interface UrlOptions { + allowedProtocols?: StringProtocol[]; + allowedDomains?: StringDomain[]; +} +type UUIDVersion = 1 | 3 | 4 | 5; +interface StringUuidOptions { + version?: UUIDVersion | `${UUIDVersion}-${UUIDVersion}` | null; + nullable?: boolean; +} +declare function stringLengthLessThan(length: number): IConstraint<string>; +declare function stringLengthLessThanOrEqual(length: number): IConstraint<string>; +declare function stringLengthGreaterThan(length: number): IConstraint<string>; +declare function stringLengthGreaterThanOrEqual(length: number): IConstraint<string>; +declare function stringLengthEqual(length: number): IConstraint<string>; +declare function stringLengthNotEqual(length: number): IConstraint<string>; +declare function stringEmail(): IConstraint<string>; +declare function stringUrl(options?: UrlOptions): IConstraint<string>; +declare function stringIp(version?: 4 | 6): IConstraint<string>; +declare function stringRegex(regex: RegExp): IConstraint<string, string>; +declare function stringUuid({ version, nullable }?: StringUuidOptions): IConstraint<string, string>; + +declare class StringValidator<T extends string> extends BaseValidator<T> { + lengthLessThan(length: number): this; + lengthLessThanOrEqual(length: number): this; + lengthGreaterThan(length: number): this; + lengthGreaterThanOrEqual(length: number): this; + lengthEqual(length: number): this; + lengthNotEqual(length: number): this; + get email(): this; + url(options?: UrlOptions): this; + uuid(options?: StringUuidOptions): this; + regex(regex: RegExp): this; + get date(): this; + get ipv4(): this; + get ipv6(): this; + ip(version?: 4 | 6): this; + phone(): this; + protected handle(value: unknown): Result<T, ValidationError>; +} + +declare class TupleValidator<T extends any[]> extends BaseValidator<[...T]> { + private readonly validators; + constructor(validators: BaseValidator<[...T]>[], constraints?: readonly IConstraint<[...T]>[]); + protected clone(): this; + protected handle(values: unknown): Result<[...T], ValidationError | CombinedPropertyError>; +} + +type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array; +declare const TypedArrays: { + readonly Int8Array: (x: unknown) => x is Int8Array; + readonly Uint8Array: (x: unknown) => x is Uint8Array; + readonly Uint8ClampedArray: (x: unknown) => x is Uint8ClampedArray; + readonly Int16Array: (x: unknown) => x is Int16Array; + readonly Uint16Array: (x: unknown) => x is Uint16Array; + readonly Int32Array: (x: unknown) => x is Int32Array; + readonly Uint32Array: (x: unknown) => x is Uint32Array; + readonly Float32Array: (x: unknown) => x is Float32Array; + readonly Float64Array: (x: unknown) => x is Float64Array; + readonly BigInt64Array: (x: unknown) => x is BigInt64Array; + readonly BigUint64Array: (x: unknown) => x is BigUint64Array; + readonly TypedArray: (x: unknown) => x is TypedArray; +}; +type TypedArrayName = keyof typeof TypedArrays; + +declare class TypedArrayValidator<T extends TypedArray> extends BaseValidator<T> { + private readonly type; + constructor(type: TypedArrayName, constraints?: readonly IConstraint<T>[]); + byteLengthLessThan(length: number): this; + byteLengthLessThanOrEqual(length: number): this; + byteLengthGreaterThan(length: number): this; + byteLengthGreaterThanOrEqual(length: number): this; + byteLengthEqual(length: number): this; + byteLengthNotEqual(length: number): this; + byteLengthRange(start: number, endBefore: number): this; + byteLengthRangeInclusive(startAt: number, endAt: number): this; + byteLengthRangeExclusive(startAfter: number, endBefore: number): this; + lengthLessThan(length: number): this; + lengthLessThanOrEqual(length: number): this; + lengthGreaterThan(length: number): this; + lengthGreaterThanOrEqual(length: number): this; + lengthEqual(length: number): this; + lengthNotEqual(length: number): this; + lengthRange(start: number, endBefore: number): this; + lengthRangeInclusive(startAt: number, endAt: number): this; + lengthRangeExclusive(startAfter: number, endBefore: number): this; + protected clone(): this; + protected handle(value: unknown): Result<T, ValidationError>; +} + +declare class UnionValidator<T> extends BaseValidator<T> { + private validators; + constructor(validators: readonly BaseValidator<T>[], constraints?: readonly IConstraint<T>[]); + get optional(): UnionValidator<T | undefined>; + get required(): UnionValidator<Exclude<T, undefined>>; + get nullable(): UnionValidator<T | null>; + get nullish(): UnionValidator<T | null | undefined>; + or<O>(...predicates: readonly BaseValidator<O>[]): UnionValidator<T | O>; + protected clone(): this; + protected handle(value: unknown): Result<T, ValidationError | CombinedError>; +} + +type ObjectConstraintName = `s.object(T.when)`; +type WhenKey = PropertyKey | PropertyKey[]; +interface WhenOptions<T extends BaseValidator<any>, Key extends WhenKey> { + is?: boolean | ((value: Key extends Array<any> ? any[] : any) => boolean); + then: (predicate: T) => T; + otherwise?: (predicate: T) => T; +} + +declare class ExpectedConstraintError<T = unknown> extends BaseConstraintError<T> { + readonly expected: string; + constructor(constraint: ConstraintErrorNames, message: string, given: T, expected: string); + toJSON(): { + name: string; + constraint: ConstraintErrorNames; + given: T; + expected: string; + }; + protected [customInspectSymbolStackLess](depth: number, options: InspectOptionsStylized): string; +} + +type TypedArrayConstraintName = `s.typedArray(T).${'byteLength' | 'length'}${'LessThan' | 'LessThanOrEqual' | 'GreaterThan' | 'GreaterThanOrEqual' | 'Equal' | 'NotEqual' | 'Range' | 'RangeInclusive' | 'RangeExclusive'}`; +declare function typedArrayByteLengthLessThan<T extends TypedArray>(value: number): IConstraint<T>; +declare function typedArrayByteLengthLessThanOrEqual<T extends TypedArray>(value: number): IConstraint<T>; +declare function typedArrayByteLengthGreaterThan<T extends TypedArray>(value: number): IConstraint<T>; +declare function typedArrayByteLengthGreaterThanOrEqual<T extends TypedArray>(value: number): IConstraint<T>; +declare function typedArrayByteLengthEqual<T extends TypedArray>(value: number): IConstraint<T>; +declare function typedArrayByteLengthNotEqual<T extends TypedArray>(value: number): IConstraint<T>; +declare function typedArrayByteLengthRange<T extends TypedArray>(start: number, endBefore: number): IConstraint<T>; +declare function typedArrayByteLengthRangeInclusive<T extends TypedArray>(start: number, end: number): { + run(input: T): Result<T, Error> | Result<unknown, ExpectedConstraintError<T>>; +}; +declare function typedArrayByteLengthRangeExclusive<T extends TypedArray>(startAfter: number, endBefore: number): IConstraint<T>; +declare function typedArrayLengthLessThan<T extends TypedArray>(value: number): IConstraint<T>; +declare function typedArrayLengthLessThanOrEqual<T extends TypedArray>(value: number): IConstraint<T>; +declare function typedArrayLengthGreaterThan<T extends TypedArray>(value: number): IConstraint<T>; +declare function typedArrayLengthGreaterThanOrEqual<T extends TypedArray>(value: number): IConstraint<T>; +declare function typedArrayLengthEqual<T extends TypedArray>(value: number): IConstraint<T>; +declare function typedArrayLengthNotEqual<T extends TypedArray>(value: number): IConstraint<T>; +declare function typedArrayLengthRange<T extends TypedArray>(start: number, endBefore: number): IConstraint<T>; +declare function typedArrayLengthRangeInclusive<T extends TypedArray>(start: number, end: number): IConstraint<T>; +declare function typedArrayLengthRangeExclusive<T extends TypedArray>(startAfter: number, endBefore: number): IConstraint<T>; + +type ConstraintErrorNames = TypedArrayConstraintName | ArrayConstraintName | BigIntConstraintName | BooleanConstraintName | DateConstraintName | NumberConstraintName | ObjectConstraintName | StringConstraintName; +declare abstract class BaseConstraintError<T = unknown> extends BaseError { + readonly constraint: ConstraintErrorNames; + readonly given: T; + constructor(constraint: ConstraintErrorNames, message: string, given: T); +} + +interface IConstraint<Input, Return extends Input = Input> { + run(input: Input, parent?: any): Result<Return, BaseConstraintError<Input>>; +} + +declare class ArrayValidator<T extends unknown[], I = T[number]> extends BaseValidator<T> { + private readonly validator; + constructor(validator: BaseValidator<I>, constraints?: readonly IConstraint<T>[]); + lengthLessThan<N extends number>(length: N): ArrayValidator<ExpandSmallerTuples<UnshiftTuple<[...Tuple<I, N>]>>>; + lengthLessThanOrEqual<N extends number>(length: N): ArrayValidator<ExpandSmallerTuples<[...Tuple<I, N>]>>; + lengthGreaterThan<N extends number>(length: N): ArrayValidator<[...Tuple<I, N>, I, ...T]>; + lengthGreaterThanOrEqual<N extends number>(length: N): ArrayValidator<[...Tuple<I, N>, ...T]>; + lengthEqual<N extends number>(length: N): ArrayValidator<[...Tuple<I, N>]>; + lengthNotEqual(length: number): ArrayValidator<[...T]>; + lengthRange<S extends number, E extends number>(start: S, endBefore: E): ArrayValidator<Exclude<ExpandSmallerTuples<UnshiftTuple<[...Tuple<I, E>]>>, ExpandSmallerTuples<UnshiftTuple<[...Tuple<I, S>]>>>>; + lengthRangeInclusive<S extends number, E extends number>(startAt: S, endAt: E): ArrayValidator<Exclude<ExpandSmallerTuples<[...Tuple<I, E>]>, ExpandSmallerTuples<UnshiftTuple<[...Tuple<I, S>]>>>>; + lengthRangeExclusive<S extends number, E extends number>(startAfter: S, endBefore: E): ArrayValidator<Exclude<ExpandSmallerTuples<UnshiftTuple<[...Tuple<I, E>]>>, ExpandSmallerTuples<[...Tuple<T, S>]>>>; + get unique(): this; + protected clone(): this; + protected handle(values: unknown): Result<T, ValidationError | CombinedPropertyError>; +} + +declare abstract class BaseValidator<T> { + protected parent?: object; + protected constraints: readonly IConstraint<T>[]; + protected isValidationEnabled: boolean | (() => boolean) | null; + constructor(constraints?: readonly IConstraint<T>[]); + setParent(parent: object): this; + get optional(): UnionValidator<T | undefined>; + get nullable(): UnionValidator<T | null>; + get nullish(): UnionValidator<T | null | undefined>; + get array(): ArrayValidator<T[]>; + get set(): SetValidator<T>; + or<O>(...predicates: readonly BaseValidator<O>[]): UnionValidator<T | O>; + transform(cb: (value: T) => T): this; + transform<O>(cb: (value: T) => O): BaseValidator<O>; + reshape(cb: (input: T) => Result<T>): this; + reshape<R extends Result<unknown>, O = InferResultType<R>>(cb: (input: T) => R): BaseValidator<O>; + default(value: Exclude<T, undefined> | (() => Exclude<T, undefined>)): DefaultValidator<Exclude<T, undefined>>; + when<Key extends WhenKey, This extends BaseValidator<any> = this>(key: Key, options: WhenOptions<This, Key>): this; + run(value: unknown): Result<T, BaseError>; + parse<R extends T = T>(value: unknown): R; + is<R extends T = T>(value: unknown): value is R; + /** + * Sets if the validator should also run constraints or just do basic checks. + * @param isValidationEnabled Whether this validator should be enabled or disabled. You can pass boolean or a function returning boolean which will be called just before parsing. + * Set to `null` to go off of the global configuration. + */ + setValidationEnabled(isValidationEnabled: boolean | (() => boolean) | null): this; + getValidationEnabled(): boolean | null; + protected get shouldRunConstraints(): boolean; + protected clone(): this; + protected abstract handle(value: unknown): Result<T, ValidatorError>; + protected addConstraint(constraint: IConstraint<T>): this; +} +type ValidatorError = ValidationError | CombinedError | CombinedPropertyError | UnknownEnumValueError; + +type Constructor<T> = (new (...args: readonly any[]) => T) | (abstract new (...args: readonly any[]) => T); +type Type<V> = V extends BaseValidator<infer T> ? T : never; +/** + * @deprecated Use `object` instead. + */ +type NonNullObject = {} & object; +/** + * @deprecated This type is no longer used and will be removed in the next major version. + */ +type PickDefined<T> = { + [K in keyof T as undefined extends T[K] ? never : K]: T[K]; +}; +/** + * @deprecated This type is no longer used and will be removed in the next major version. + */ +type PickUndefinedMakeOptional<T> = { + [K in keyof T as undefined extends T[K] ? K : never]+?: Exclude<T[K], undefined>; +}; +type FilterDefinedKeys<TObj extends object> = Exclude<{ + [TKey in keyof TObj]: undefined extends TObj[TKey] ? never : TKey; +}[keyof TObj], undefined>; +type UndefinedToOptional<T extends object> = Pick<T, FilterDefinedKeys<T>> & { + [k in keyof Omit<T, FilterDefinedKeys<T>>]?: Exclude<T[k], undefined>; +}; +type MappedObjectValidator<T> = { + [key in keyof T]: BaseValidator<T[key]>; +}; +/** + * An alias of {@link ObjectValidator} with a name more common among object validation libraries. + * This is the type of a schema after using `s.object({ ... })` + * @example + * ```typescript + * import { s, SchemaOf } from '@sapphire/shapeshift'; + * + * interface IIngredient { + * ingredientId: string | undefined; + * name: string | undefined; + * } + * + * interface IInstruction { + * instructionId: string | undefined; + * message: string | undefined; + * } + * + * interface IRecipe { + * recipeId: string | undefined; + * title: string; + * description: string; + * instructions: IInstruction[]; + * ingredients: IIngredient[]; + * } + * + * type InstructionSchemaType = SchemaOf<IInstruction>; + * // Expected Type: ObjectValidator<IInstruction> + * + * type IngredientSchemaType = SchemaOf<IIngredient>; + * // Expected Type: ObjectValidator<IIngredient> + * + * type RecipeSchemaType = SchemaOf<IRecipe>; + * // Expected Type: ObjectValidator<IRecipe> + * + * const instructionSchema: InstructionSchemaType = s.object({ + * instructionId: s.string.optional, + * message: s.string + * }); + * + * const ingredientSchema: IngredientSchemaType = s.object({ + * ingredientId: s.string.optional, + * name: s.string + * }); + * + * const recipeSchema: RecipeSchemaType = s.object({ + * recipeId: s.string.optional, + * title: s.string, + * description: s.string, + * instructions: s.array(instructionSchema), + * ingredients: s.array(ingredientSchema) + * }); + * ``` + */ +type SchemaOf<T extends object> = ObjectValidator<T>; +/** + * Infers the type of a schema object given `typeof schema`. + * The schema has to extend {@link ObjectValidator}. + * @example + * ```typescript + * import { InferType, s } from '@sapphire/shapeshift'; + * + * const schema = s.object({ + * foo: s.string, + * bar: s.number, + * baz: s.boolean, + * qux: s.bigint, + * quux: s.date + * }); + * + * type Inferredtype = InferType<typeof schema>; + * // Expected type: + * // type Inferredtype = { + * // foo: string; + * // bar: number; + * // baz: boolean; + * // qux: bigint; + * // quux: Date; + * // }; + * ``` + */ +type InferType<T extends ObjectValidator<any>> = T extends ObjectValidator<any, infer U> ? U : never; +type InferResultType<T extends Result<any>> = T extends Result<infer U> ? U : never; +type UnwrapTuple<T extends [...any[]]> = T extends [infer Head, ...infer Tail] ? [Unwrap<Head>, ...UnwrapTuple<Tail>] : []; +type Unwrap<T> = T extends BaseValidator<infer V> ? V : never; +type UnshiftTuple<T extends [...any[]]> = T extends [T[0], ...infer Tail] ? Tail : never; +type ExpandSmallerTuples<T extends [...any[]]> = T extends [T[0], ...infer Tail] ? T | ExpandSmallerTuples<Tail> : []; +type Shift<A extends Array<any>> = ((...args: A) => void) extends (...args: [A[0], ...infer R]) => void ? R : never; +type GrowExpRev<A extends Array<any>, N extends number, P extends Array<Array<any>>> = A['length'] extends N ? A : GrowExpRev<[...A, ...P[0]][N] extends undefined ? [...A, ...P[0]] : A, N, Shift<P>>; +type GrowExp<A extends Array<any>, N extends number, P extends Array<Array<any>>> = [...A, ...A][N] extends undefined ? GrowExp<[...A, ...A], N, [A, ...P]> : GrowExpRev<A, N, P>; +type Tuple<T, N extends number> = number extends N ? Array<T> : N extends 0 ? [] : N extends 1 ? [T] : GrowExp<[T], N, [[]]>; + +declare class LazyValidator<T extends BaseValidator<unknown>, R = Unwrap<T>> extends BaseValidator<R> { + private readonly validator; + constructor(validator: (value: unknown) => T, constraints?: readonly IConstraint<R>[]); + protected clone(): this; + protected handle(values: unknown): Result<R, ValidatorError>; +} + +declare class Shapes { + get string(): StringValidator<string>; + get number(): NumberValidator<number>; + get bigint(): BigIntValidator<bigint>; + get boolean(): BooleanValidator<boolean>; + get date(): DateValidator; + object<T extends object>(shape: MappedObjectValidator<T>): ObjectValidator<T, UndefinedToOptional<T>>; + get undefined(): BaseValidator<undefined>; + get null(): BaseValidator<null>; + get nullish(): NullishValidator; + get any(): PassthroughValidator<any>; + get unknown(): PassthroughValidator<unknown>; + get never(): NeverValidator; + enum<T>(...values: readonly T[]): UnionValidator<T>; + nativeEnum<T extends NativeEnumLike>(enumShape: T): NativeEnumValidator<T>; + literal<T>(value: T): BaseValidator<T>; + instance<T>(expected: Constructor<T>): InstanceValidator<T>; + union<T extends [...BaseValidator<any>[]]>(...validators: [...T]): UnionValidator<Unwrap<T[number]>>; + array<T>(validator: BaseValidator<T[][number]>): ArrayValidator<T[], T[][number]>; + array<T extends unknown[]>(validator: BaseValidator<T[number]>): ArrayValidator<T, T[number]>; + typedArray<T extends TypedArray>(type?: TypedArrayName): TypedArrayValidator<T>; + get int8Array(): TypedArrayValidator<Int8Array>; + get uint8Array(): TypedArrayValidator<Uint8Array>; + get uint8ClampedArray(): TypedArrayValidator<Uint8ClampedArray>; + get int16Array(): TypedArrayValidator<Int16Array>; + get uint16Array(): TypedArrayValidator<Uint16Array>; + get int32Array(): TypedArrayValidator<Int32Array>; + get uint32Array(): TypedArrayValidator<Uint32Array>; + get float32Array(): TypedArrayValidator<Float32Array>; + get float64Array(): TypedArrayValidator<Float64Array>; + get bigInt64Array(): TypedArrayValidator<BigInt64Array>; + get bigUint64Array(): TypedArrayValidator<BigUint64Array>; + tuple<T extends [...BaseValidator<any>[]]>(validators: [...T]): TupleValidator<UnwrapTuple<T>>; + set<T>(validator: BaseValidator<T>): SetValidator<T>; + record<T>(validator: BaseValidator<T>): RecordValidator<T>; + map<T, U>(keyValidator: BaseValidator<T>, valueValidator: BaseValidator<U>): MapValidator<T, U>; + lazy<T extends BaseValidator<unknown>>(validator: (value: unknown) => T): LazyValidator<T, Unwrap<T>>; +} + +/** + * Sets whether validators should run on the input, or if the input should be passed through. + * @param enabled Whether validation should be done on inputs + */ +declare function setGlobalValidationEnabled(enabled: boolean): void; +/** + * @returns Whether validation is enabled + */ +declare function getGlobalValidationEnabled(): boolean; + +declare const s: Shapes; + +export { ArrayConstraintName, ArrayValidator, BaseConstraintError, BaseError, BaseValidator, BigIntConstraintName, BigIntValidator, BooleanConstraintName, BooleanValidator, CombinedError, CombinedPropertyError, ConstraintErrorNames, Constructor, DateConstraintName, DateValidator, DefaultValidator, ExpandSmallerTuples, ExpectedConstraintError, ExpectedValidationError, GrowExp, GrowExpRev, IConstraint, InferResultType, InferType, InstanceValidator, LiteralValidator, MapValidator, MappedObjectValidator, MissingPropertyError, MultiplePossibilitiesConstraintError, NativeEnumLike, NativeEnumValidator, NeverValidator, NonNullObject, NullishValidator, NumberConstraintName, NumberValidator, ObjectValidator, ObjectValidatorStrategy, PassthroughValidator, PickDefined, PickUndefinedMakeOptional, RecordValidator, Result, SchemaOf, SetValidator, Shapes, Shift, StringConstraintName, StringDomain, StringProtocol, StringUuidOptions, StringValidator, Tuple, TupleValidator, Type, TypedArrayConstraintName, TypedArrayValidator, UUIDVersion, UndefinedToOptional, UnionValidator, UnknownEnumValueError, UnknownPropertyError, UnshiftTuple, Unwrap, UnwrapTuple, UrlOptions, ValidationError, ValidatorError, arrayLengthEqual, arrayLengthGreaterThan, arrayLengthGreaterThanOrEqual, arrayLengthLessThan, arrayLengthLessThanOrEqual, arrayLengthNotEqual, arrayLengthRange, arrayLengthRangeExclusive, arrayLengthRangeInclusive, bigintDivisibleBy, bigintEqual, bigintGreaterThan, bigintGreaterThanOrEqual, bigintLessThan, bigintLessThanOrEqual, bigintNotEqual, booleanFalse, booleanTrue, customInspectSymbol, customInspectSymbolStackLess, dateEqual, dateGreaterThan, dateGreaterThanOrEqual, dateInvalid, dateLessThan, dateLessThanOrEqual, dateNotEqual, dateValid, getGlobalValidationEnabled, numberDivisibleBy, numberEqual, numberFinite, numberGreaterThan, numberGreaterThanOrEqual, numberInt, numberLessThan, numberLessThanOrEqual, numberNaN, numberNotEqual, numberNotNaN, numberSafeInt, s, setGlobalValidationEnabled, stringEmail, stringIp, stringLengthEqual, stringLengthGreaterThan, stringLengthGreaterThanOrEqual, stringLengthLessThan, stringLengthLessThanOrEqual, stringLengthNotEqual, stringRegex, stringUrl, stringUuid, typedArrayByteLengthEqual, typedArrayByteLengthGreaterThan, typedArrayByteLengthGreaterThanOrEqual, typedArrayByteLengthLessThan, typedArrayByteLengthLessThanOrEqual, typedArrayByteLengthNotEqual, typedArrayByteLengthRange, typedArrayByteLengthRangeExclusive, typedArrayByteLengthRangeInclusive, typedArrayLengthEqual, typedArrayLengthGreaterThan, typedArrayLengthGreaterThanOrEqual, typedArrayLengthLessThan, typedArrayLengthLessThanOrEqual, typedArrayLengthNotEqual, typedArrayLengthRange, typedArrayLengthRangeExclusive, typedArrayLengthRangeInclusive }; diff --git a/includes/external/discord/node_modules/@sapphire/shapeshift/dist/index.mjs b/includes/external/discord/node_modules/@sapphire/shapeshift/dist/index.mjs new file mode 100644 index 0000000..941922e --- /dev/null +++ b/includes/external/discord/node_modules/@sapphire/shapeshift/dist/index.mjs @@ -0,0 +1,2215 @@ +import get from 'lodash/get.js'; +import { inspect } from 'node:util'; +import fastDeepEqual from 'fast-deep-equal/es6/index.js'; +import uniqWith from 'lodash/uniqWith.js'; + +var __defProp = Object.defineProperty; +var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); + +// src/lib/configs.ts +var validationEnabled = true; +function setGlobalValidationEnabled(enabled) { + validationEnabled = enabled; +} +__name(setGlobalValidationEnabled, "setGlobalValidationEnabled"); +function getGlobalValidationEnabled() { + return validationEnabled; +} +__name(getGlobalValidationEnabled, "getGlobalValidationEnabled"); + +// src/lib/Result.ts +var Result = class { + constructor(success, value, error) { + this.success = success; + if (success) { + this.value = value; + } else { + this.error = error; + } + } + isOk() { + return this.success; + } + isErr() { + return !this.success; + } + unwrap() { + if (this.isOk()) + return this.value; + throw this.error; + } + static ok(value) { + return new Result(true, value); + } + static err(error) { + return new Result(false, void 0, error); + } +}; +__name(Result, "Result"); + +// src/validators/util/getValue.ts +function getValue(valueOrFn) { + return typeof valueOrFn === "function" ? valueOrFn() : valueOrFn; +} +__name(getValue, "getValue"); + +// src/lib/errors/BaseError.ts +var customInspectSymbol = Symbol.for("nodejs.util.inspect.custom"); +var customInspectSymbolStackLess = Symbol.for("nodejs.util.inspect.custom.stack-less"); +var BaseError = class extends Error { + [customInspectSymbol](depth, options) { + return `${this[customInspectSymbolStackLess](depth, options)} +${this.stack.slice(this.stack.indexOf("\n"))}`; + } +}; +__name(BaseError, "BaseError"); + +// src/lib/errors/BaseConstraintError.ts +var BaseConstraintError = class extends BaseError { + constructor(constraint, message, given) { + super(message); + this.constraint = constraint; + this.given = given; + } +}; +__name(BaseConstraintError, "BaseConstraintError"); + +// src/lib/errors/ExpectedConstraintError.ts +var ExpectedConstraintError = class extends BaseConstraintError { + constructor(constraint, message, given, expected) { + super(constraint, message, given); + this.expected = expected; + } + toJSON() { + return { + name: this.name, + constraint: this.constraint, + given: this.given, + expected: this.expected + }; + } + [customInspectSymbolStackLess](depth, options) { + const constraint = options.stylize(this.constraint, "string"); + if (depth < 0) { + return options.stylize(`[ExpectedConstraintError: ${constraint}]`, "special"); + } + const newOptions = { ...options, depth: options.depth === null ? null : options.depth - 1 }; + const padding = ` + ${options.stylize("|", "undefined")} `; + const given = inspect(this.given, newOptions).replace(/\n/g, padding); + const header = `${options.stylize("ExpectedConstraintError", "special")} > ${constraint}`; + const message = options.stylize(this.message, "regexp"); + const expectedBlock = ` + ${options.stylize("Expected: ", "string")}${options.stylize(this.expected, "boolean")}`; + const givenBlock = ` + ${options.stylize("Received:", "regexp")}${padding}${given}`; + return `${header} + ${message} +${expectedBlock} +${givenBlock}`; + } +}; +__name(ExpectedConstraintError, "ExpectedConstraintError"); + +// src/constraints/ObjectConstrains.ts +function whenConstraint(key, options, validator) { + return { + run(input, parent) { + if (!parent) { + return Result.err(new ExpectedConstraintError("s.object(T.when)", "Validator has no parent", parent, "Validator to have a parent")); + } + const isKeyArray = Array.isArray(key); + const value = isKeyArray ? key.map((k) => get(parent, k)) : get(parent, key); + const predicate = resolveBooleanIs(options, value, isKeyArray) ? options.then : options.otherwise; + if (predicate) { + return predicate(validator).run(input); + } + return Result.ok(input); + } + }; +} +__name(whenConstraint, "whenConstraint"); +function resolveBooleanIs(options, value, isKeyArray) { + if (options.is === void 0) { + return isKeyArray ? !value.some((val) => !val) : Boolean(value); + } + if (typeof options.is === "function") { + return options.is(value); + } + return value === options.is; +} +__name(resolveBooleanIs, "resolveBooleanIs"); + +// src/validators/BaseValidator.ts +var BaseValidator = class { + constructor(constraints = []) { + this.constraints = []; + this.isValidationEnabled = null; + this.constraints = constraints; + } + setParent(parent) { + this.parent = parent; + return this; + } + get optional() { + return new UnionValidator([new LiteralValidator(void 0), this.clone()]); + } + get nullable() { + return new UnionValidator([new LiteralValidator(null), this.clone()]); + } + get nullish() { + return new UnionValidator([new NullishValidator(), this.clone()]); + } + get array() { + return new ArrayValidator(this.clone()); + } + get set() { + return new SetValidator(this.clone()); + } + or(...predicates) { + return new UnionValidator([this.clone(), ...predicates]); + } + transform(cb) { + return this.addConstraint({ run: (input) => Result.ok(cb(input)) }); + } + reshape(cb) { + return this.addConstraint({ run: cb }); + } + default(value) { + return new DefaultValidator(this.clone(), value); + } + when(key, options) { + return this.addConstraint(whenConstraint(key, options, this)); + } + run(value) { + let result = this.handle(value); + if (result.isErr()) + return result; + for (const constraint of this.constraints) { + result = constraint.run(result.value, this.parent); + if (result.isErr()) + break; + } + return result; + } + parse(value) { + if (!this.shouldRunConstraints) { + return this.handle(value).unwrap(); + } + return this.constraints.reduce((v, constraint) => constraint.run(v).unwrap(), this.handle(value).unwrap()); + } + is(value) { + return this.run(value).isOk(); + } + setValidationEnabled(isValidationEnabled) { + const clone = this.clone(); + clone.isValidationEnabled = isValidationEnabled; + return clone; + } + getValidationEnabled() { + return getValue(this.isValidationEnabled); + } + get shouldRunConstraints() { + return getValue(this.isValidationEnabled) ?? getGlobalValidationEnabled(); + } + clone() { + const clone = Reflect.construct(this.constructor, [this.constraints]); + clone.isValidationEnabled = this.isValidationEnabled; + return clone; + } + addConstraint(constraint) { + const clone = this.clone(); + clone.constraints = clone.constraints.concat(constraint); + return clone; + } +}; +__name(BaseValidator, "BaseValidator"); +function isUnique(input) { + if (input.length < 2) + return true; + const uniqueArray2 = uniqWith(input, fastDeepEqual); + return uniqueArray2.length === input.length; +} +__name(isUnique, "isUnique"); + +// src/constraints/util/operators.ts +function lessThan(a, b) { + return a < b; +} +__name(lessThan, "lessThan"); +function lessThanOrEqual(a, b) { + return a <= b; +} +__name(lessThanOrEqual, "lessThanOrEqual"); +function greaterThan(a, b) { + return a > b; +} +__name(greaterThan, "greaterThan"); +function greaterThanOrEqual(a, b) { + return a >= b; +} +__name(greaterThanOrEqual, "greaterThanOrEqual"); +function equal(a, b) { + return a === b; +} +__name(equal, "equal"); +function notEqual(a, b) { + return a !== b; +} +__name(notEqual, "notEqual"); + +// src/constraints/ArrayConstraints.ts +function arrayLengthComparator(comparator, name, expected, length) { + return { + run(input) { + return comparator(input.length, length) ? Result.ok(input) : Result.err(new ExpectedConstraintError(name, "Invalid Array length", input, expected)); + } + }; +} +__name(arrayLengthComparator, "arrayLengthComparator"); +function arrayLengthLessThan(value) { + const expected = `expected.length < ${value}`; + return arrayLengthComparator(lessThan, "s.array(T).lengthLessThan", expected, value); +} +__name(arrayLengthLessThan, "arrayLengthLessThan"); +function arrayLengthLessThanOrEqual(value) { + const expected = `expected.length <= ${value}`; + return arrayLengthComparator(lessThanOrEqual, "s.array(T).lengthLessThanOrEqual", expected, value); +} +__name(arrayLengthLessThanOrEqual, "arrayLengthLessThanOrEqual"); +function arrayLengthGreaterThan(value) { + const expected = `expected.length > ${value}`; + return arrayLengthComparator(greaterThan, "s.array(T).lengthGreaterThan", expected, value); +} +__name(arrayLengthGreaterThan, "arrayLengthGreaterThan"); +function arrayLengthGreaterThanOrEqual(value) { + const expected = `expected.length >= ${value}`; + return arrayLengthComparator(greaterThanOrEqual, "s.array(T).lengthGreaterThanOrEqual", expected, value); +} +__name(arrayLengthGreaterThanOrEqual, "arrayLengthGreaterThanOrEqual"); +function arrayLengthEqual(value) { + const expected = `expected.length === ${value}`; + return arrayLengthComparator(equal, "s.array(T).lengthEqual", expected, value); +} +__name(arrayLengthEqual, "arrayLengthEqual"); +function arrayLengthNotEqual(value) { + const expected = `expected.length !== ${value}`; + return arrayLengthComparator(notEqual, "s.array(T).lengthNotEqual", expected, value); +} +__name(arrayLengthNotEqual, "arrayLengthNotEqual"); +function arrayLengthRange(start, endBefore) { + const expected = `expected.length >= ${start} && expected.length < ${endBefore}`; + return { + run(input) { + return input.length >= start && input.length < endBefore ? Result.ok(input) : Result.err(new ExpectedConstraintError("s.array(T).lengthRange", "Invalid Array length", input, expected)); + } + }; +} +__name(arrayLengthRange, "arrayLengthRange"); +function arrayLengthRangeInclusive(start, end) { + const expected = `expected.length >= ${start} && expected.length <= ${end}`; + return { + run(input) { + return input.length >= start && input.length <= end ? Result.ok(input) : Result.err(new ExpectedConstraintError("s.array(T).lengthRangeInclusive", "Invalid Array length", input, expected)); + } + }; +} +__name(arrayLengthRangeInclusive, "arrayLengthRangeInclusive"); +function arrayLengthRangeExclusive(startAfter, endBefore) { + const expected = `expected.length > ${startAfter} && expected.length < ${endBefore}`; + return { + run(input) { + return input.length > startAfter && input.length < endBefore ? Result.ok(input) : Result.err(new ExpectedConstraintError("s.array(T).lengthRangeExclusive", "Invalid Array length", input, expected)); + } + }; +} +__name(arrayLengthRangeExclusive, "arrayLengthRangeExclusive"); +var uniqueArray = { + run(input) { + return isUnique(input) ? Result.ok(input) : Result.err(new ExpectedConstraintError("s.array(T).unique", "Array values are not unique", input, "Expected all values to be unique")); + } +}; + +// src/lib/errors/CombinedPropertyError.ts +var CombinedPropertyError = class extends BaseError { + constructor(errors) { + super("Received one or more errors"); + this.errors = errors; + } + [customInspectSymbolStackLess](depth, options) { + if (depth < 0) { + return options.stylize("[CombinedPropertyError]", "special"); + } + const newOptions = { ...options, depth: options.depth === null ? null : options.depth - 1, compact: true }; + const padding = ` + ${options.stylize("|", "undefined")} `; + const header = `${options.stylize("CombinedPropertyError", "special")} (${options.stylize(this.errors.length.toString(), "number")})`; + const message = options.stylize(this.message, "regexp"); + const errors = this.errors.map(([key, error]) => { + const property = CombinedPropertyError.formatProperty(key, options); + const body = error[customInspectSymbolStackLess](depth - 1, newOptions).replace(/\n/g, padding); + return ` input${property}${padding}${body}`; + }).join("\n\n"); + return `${header} + ${message} + +${errors}`; + } + static formatProperty(key, options) { + if (typeof key === "string") + return options.stylize(`.${key}`, "symbol"); + if (typeof key === "number") + return `[${options.stylize(key.toString(), "number")}]`; + return `[${options.stylize("Symbol", "symbol")}(${key.description})]`; + } +}; +__name(CombinedPropertyError, "CombinedPropertyError"); +var ValidationError = class extends BaseError { + constructor(validator, message, given) { + super(message); + this.validator = validator; + this.given = given; + } + toJSON() { + return { + name: this.name, + validator: this.validator, + given: this.given + }; + } + [customInspectSymbolStackLess](depth, options) { + const validator = options.stylize(this.validator, "string"); + if (depth < 0) { + return options.stylize(`[ValidationError: ${validator}]`, "special"); + } + const newOptions = { ...options, depth: options.depth === null ? null : options.depth - 1, compact: true }; + const padding = ` + ${options.stylize("|", "undefined")} `; + const given = inspect(this.given, newOptions).replace(/\n/g, padding); + const header = `${options.stylize("ValidationError", "special")} > ${validator}`; + const message = options.stylize(this.message, "regexp"); + const givenBlock = ` + ${options.stylize("Received:", "regexp")}${padding}${given}`; + return `${header} + ${message} +${givenBlock}`; + } +}; +__name(ValidationError, "ValidationError"); + +// src/validators/ArrayValidator.ts +var ArrayValidator = class extends BaseValidator { + constructor(validator, constraints = []) { + super(constraints); + this.validator = validator; + } + lengthLessThan(length) { + return this.addConstraint(arrayLengthLessThan(length)); + } + lengthLessThanOrEqual(length) { + return this.addConstraint(arrayLengthLessThanOrEqual(length)); + } + lengthGreaterThan(length) { + return this.addConstraint(arrayLengthGreaterThan(length)); + } + lengthGreaterThanOrEqual(length) { + return this.addConstraint(arrayLengthGreaterThanOrEqual(length)); + } + lengthEqual(length) { + return this.addConstraint(arrayLengthEqual(length)); + } + lengthNotEqual(length) { + return this.addConstraint(arrayLengthNotEqual(length)); + } + lengthRange(start, endBefore) { + return this.addConstraint(arrayLengthRange(start, endBefore)); + } + lengthRangeInclusive(startAt, endAt) { + return this.addConstraint(arrayLengthRangeInclusive(startAt, endAt)); + } + lengthRangeExclusive(startAfter, endBefore) { + return this.addConstraint(arrayLengthRangeExclusive(startAfter, endBefore)); + } + get unique() { + return this.addConstraint(uniqueArray); + } + clone() { + return Reflect.construct(this.constructor, [this.validator, this.constraints]); + } + handle(values) { + if (!Array.isArray(values)) { + return Result.err(new ValidationError("s.array(T)", "Expected an array", values)); + } + if (!this.shouldRunConstraints) { + return Result.ok(values); + } + const errors = []; + const transformed = []; + for (let i = 0; i < values.length; i++) { + const result = this.validator.run(values[i]); + if (result.isOk()) + transformed.push(result.value); + else + errors.push([i, result.error]); + } + return errors.length === 0 ? Result.ok(transformed) : Result.err(new CombinedPropertyError(errors)); + } +}; +__name(ArrayValidator, "ArrayValidator"); + +// src/constraints/BigIntConstraints.ts +function bigintComparator(comparator, name, expected, number) { + return { + run(input) { + return comparator(input, number) ? Result.ok(input) : Result.err(new ExpectedConstraintError(name, "Invalid bigint value", input, expected)); + } + }; +} +__name(bigintComparator, "bigintComparator"); +function bigintLessThan(value) { + const expected = `expected < ${value}n`; + return bigintComparator(lessThan, "s.bigint.lessThan", expected, value); +} +__name(bigintLessThan, "bigintLessThan"); +function bigintLessThanOrEqual(value) { + const expected = `expected <= ${value}n`; + return bigintComparator(lessThanOrEqual, "s.bigint.lessThanOrEqual", expected, value); +} +__name(bigintLessThanOrEqual, "bigintLessThanOrEqual"); +function bigintGreaterThan(value) { + const expected = `expected > ${value}n`; + return bigintComparator(greaterThan, "s.bigint.greaterThan", expected, value); +} +__name(bigintGreaterThan, "bigintGreaterThan"); +function bigintGreaterThanOrEqual(value) { + const expected = `expected >= ${value}n`; + return bigintComparator(greaterThanOrEqual, "s.bigint.greaterThanOrEqual", expected, value); +} +__name(bigintGreaterThanOrEqual, "bigintGreaterThanOrEqual"); +function bigintEqual(value) { + const expected = `expected === ${value}n`; + return bigintComparator(equal, "s.bigint.equal", expected, value); +} +__name(bigintEqual, "bigintEqual"); +function bigintNotEqual(value) { + const expected = `expected !== ${value}n`; + return bigintComparator(notEqual, "s.bigint.notEqual", expected, value); +} +__name(bigintNotEqual, "bigintNotEqual"); +function bigintDivisibleBy(divider) { + const expected = `expected % ${divider}n === 0n`; + return { + run(input) { + return input % divider === 0n ? Result.ok(input) : Result.err(new ExpectedConstraintError("s.bigint.divisibleBy", "BigInt is not divisible", input, expected)); + } + }; +} +__name(bigintDivisibleBy, "bigintDivisibleBy"); + +// src/validators/BigIntValidator.ts +var BigIntValidator = class extends BaseValidator { + lessThan(number) { + return this.addConstraint(bigintLessThan(number)); + } + lessThanOrEqual(number) { + return this.addConstraint(bigintLessThanOrEqual(number)); + } + greaterThan(number) { + return this.addConstraint(bigintGreaterThan(number)); + } + greaterThanOrEqual(number) { + return this.addConstraint(bigintGreaterThanOrEqual(number)); + } + equal(number) { + return this.addConstraint(bigintEqual(number)); + } + notEqual(number) { + return this.addConstraint(bigintNotEqual(number)); + } + get positive() { + return this.greaterThanOrEqual(0n); + } + get negative() { + return this.lessThan(0n); + } + divisibleBy(number) { + return this.addConstraint(bigintDivisibleBy(number)); + } + get abs() { + return this.transform((value) => value < 0 ? -value : value); + } + intN(bits) { + return this.transform((value) => BigInt.asIntN(bits, value)); + } + uintN(bits) { + return this.transform((value) => BigInt.asUintN(bits, value)); + } + handle(value) { + return typeof value === "bigint" ? Result.ok(value) : Result.err(new ValidationError("s.bigint", "Expected a bigint primitive", value)); + } +}; +__name(BigIntValidator, "BigIntValidator"); + +// src/constraints/BooleanConstraints.ts +var booleanTrue = { + run(input) { + return input ? Result.ok(input) : Result.err(new ExpectedConstraintError("s.boolean.true", "Invalid boolean value", input, "true")); + } +}; +var booleanFalse = { + run(input) { + return input ? Result.err(new ExpectedConstraintError("s.boolean.false", "Invalid boolean value", input, "false")) : Result.ok(input); + } +}; + +// src/validators/BooleanValidator.ts +var BooleanValidator = class extends BaseValidator { + get true() { + return this.addConstraint(booleanTrue); + } + get false() { + return this.addConstraint(booleanFalse); + } + equal(value) { + return value ? this.true : this.false; + } + notEqual(value) { + return value ? this.false : this.true; + } + handle(value) { + return typeof value === "boolean" ? Result.ok(value) : Result.err(new ValidationError("s.boolean", "Expected a boolean primitive", value)); + } +}; +__name(BooleanValidator, "BooleanValidator"); + +// src/constraints/DateConstraints.ts +function dateComparator(comparator, name, expected, number) { + return { + run(input) { + return comparator(input.getTime(), number) ? Result.ok(input) : Result.err(new ExpectedConstraintError(name, "Invalid Date value", input, expected)); + } + }; +} +__name(dateComparator, "dateComparator"); +function dateLessThan(value) { + const expected = `expected < ${value.toISOString()}`; + return dateComparator(lessThan, "s.date.lessThan", expected, value.getTime()); +} +__name(dateLessThan, "dateLessThan"); +function dateLessThanOrEqual(value) { + const expected = `expected <= ${value.toISOString()}`; + return dateComparator(lessThanOrEqual, "s.date.lessThanOrEqual", expected, value.getTime()); +} +__name(dateLessThanOrEqual, "dateLessThanOrEqual"); +function dateGreaterThan(value) { + const expected = `expected > ${value.toISOString()}`; + return dateComparator(greaterThan, "s.date.greaterThan", expected, value.getTime()); +} +__name(dateGreaterThan, "dateGreaterThan"); +function dateGreaterThanOrEqual(value) { + const expected = `expected >= ${value.toISOString()}`; + return dateComparator(greaterThanOrEqual, "s.date.greaterThanOrEqual", expected, value.getTime()); +} +__name(dateGreaterThanOrEqual, "dateGreaterThanOrEqual"); +function dateEqual(value) { + const expected = `expected === ${value.toISOString()}`; + return dateComparator(equal, "s.date.equal", expected, value.getTime()); +} +__name(dateEqual, "dateEqual"); +function dateNotEqual(value) { + const expected = `expected !== ${value.toISOString()}`; + return dateComparator(notEqual, "s.date.notEqual", expected, value.getTime()); +} +__name(dateNotEqual, "dateNotEqual"); +var dateInvalid = { + run(input) { + return Number.isNaN(input.getTime()) ? Result.ok(input) : Result.err(new ExpectedConstraintError("s.date.invalid", "Invalid Date value", input, "expected === NaN")); + } +}; +var dateValid = { + run(input) { + return Number.isNaN(input.getTime()) ? Result.err(new ExpectedConstraintError("s.date.valid", "Invalid Date value", input, "expected !== NaN")) : Result.ok(input); + } +}; + +// src/validators/DateValidator.ts +var DateValidator = class extends BaseValidator { + lessThan(date) { + return this.addConstraint(dateLessThan(new Date(date))); + } + lessThanOrEqual(date) { + return this.addConstraint(dateLessThanOrEqual(new Date(date))); + } + greaterThan(date) { + return this.addConstraint(dateGreaterThan(new Date(date))); + } + greaterThanOrEqual(date) { + return this.addConstraint(dateGreaterThanOrEqual(new Date(date))); + } + equal(date) { + const resolved = new Date(date); + return Number.isNaN(resolved.getTime()) ? this.invalid : this.addConstraint(dateEqual(resolved)); + } + notEqual(date) { + const resolved = new Date(date); + return Number.isNaN(resolved.getTime()) ? this.valid : this.addConstraint(dateNotEqual(resolved)); + } + get valid() { + return this.addConstraint(dateValid); + } + get invalid() { + return this.addConstraint(dateInvalid); + } + handle(value) { + return value instanceof Date ? Result.ok(value) : Result.err(new ValidationError("s.date", "Expected a Date", value)); + } +}; +__name(DateValidator, "DateValidator"); +var ExpectedValidationError = class extends ValidationError { + constructor(validator, message, given, expected) { + super(validator, message, given); + this.expected = expected; + } + toJSON() { + return { + name: this.name, + validator: this.validator, + given: this.given, + expected: this.expected + }; + } + [customInspectSymbolStackLess](depth, options) { + const validator = options.stylize(this.validator, "string"); + if (depth < 0) { + return options.stylize(`[ExpectedValidationError: ${validator}]`, "special"); + } + const newOptions = { ...options, depth: options.depth === null ? null : options.depth - 1 }; + const padding = ` + ${options.stylize("|", "undefined")} `; + const expected = inspect(this.expected, newOptions).replace(/\n/g, padding); + const given = inspect(this.given, newOptions).replace(/\n/g, padding); + const header = `${options.stylize("ExpectedValidationError", "special")} > ${validator}`; + const message = options.stylize(this.message, "regexp"); + const expectedBlock = ` + ${options.stylize("Expected:", "string")}${padding}${expected}`; + const givenBlock = ` + ${options.stylize("Received:", "regexp")}${padding}${given}`; + return `${header} + ${message} +${expectedBlock} +${givenBlock}`; + } +}; +__name(ExpectedValidationError, "ExpectedValidationError"); + +// src/validators/InstanceValidator.ts +var InstanceValidator = class extends BaseValidator { + constructor(expected, constraints = []) { + super(constraints); + this.expected = expected; + } + handle(value) { + return value instanceof this.expected ? Result.ok(value) : Result.err(new ExpectedValidationError("s.instance(V)", "Expected", value, this.expected)); + } + clone() { + return Reflect.construct(this.constructor, [this.expected, this.constraints]); + } +}; +__name(InstanceValidator, "InstanceValidator"); + +// src/validators/LiteralValidator.ts +var LiteralValidator = class extends BaseValidator { + constructor(literal, constraints = []) { + super(constraints); + this.expected = literal; + } + handle(value) { + return Object.is(value, this.expected) ? Result.ok(value) : Result.err(new ExpectedValidationError("s.literal(V)", "Expected values to be equals", value, this.expected)); + } + clone() { + return Reflect.construct(this.constructor, [this.expected, this.constraints]); + } +}; +__name(LiteralValidator, "LiteralValidator"); + +// src/validators/NeverValidator.ts +var NeverValidator = class extends BaseValidator { + handle(value) { + return Result.err(new ValidationError("s.never", "Expected a value to not be passed", value)); + } +}; +__name(NeverValidator, "NeverValidator"); + +// src/validators/NullishValidator.ts +var NullishValidator = class extends BaseValidator { + handle(value) { + return value === void 0 || value === null ? Result.ok(value) : Result.err(new ValidationError("s.nullish", "Expected undefined or null", value)); + } +}; +__name(NullishValidator, "NullishValidator"); + +// src/constraints/NumberConstraints.ts +function numberComparator(comparator, name, expected, number) { + return { + run(input) { + return comparator(input, number) ? Result.ok(input) : Result.err(new ExpectedConstraintError(name, "Invalid number value", input, expected)); + } + }; +} +__name(numberComparator, "numberComparator"); +function numberLessThan(value) { + const expected = `expected < ${value}`; + return numberComparator(lessThan, "s.number.lessThan", expected, value); +} +__name(numberLessThan, "numberLessThan"); +function numberLessThanOrEqual(value) { + const expected = `expected <= ${value}`; + return numberComparator(lessThanOrEqual, "s.number.lessThanOrEqual", expected, value); +} +__name(numberLessThanOrEqual, "numberLessThanOrEqual"); +function numberGreaterThan(value) { + const expected = `expected > ${value}`; + return numberComparator(greaterThan, "s.number.greaterThan", expected, value); +} +__name(numberGreaterThan, "numberGreaterThan"); +function numberGreaterThanOrEqual(value) { + const expected = `expected >= ${value}`; + return numberComparator(greaterThanOrEqual, "s.number.greaterThanOrEqual", expected, value); +} +__name(numberGreaterThanOrEqual, "numberGreaterThanOrEqual"); +function numberEqual(value) { + const expected = `expected === ${value}`; + return numberComparator(equal, "s.number.equal", expected, value); +} +__name(numberEqual, "numberEqual"); +function numberNotEqual(value) { + const expected = `expected !== ${value}`; + return numberComparator(notEqual, "s.number.notEqual", expected, value); +} +__name(numberNotEqual, "numberNotEqual"); +var numberInt = { + run(input) { + return Number.isInteger(input) ? Result.ok(input) : Result.err( + new ExpectedConstraintError("s.number.int", "Given value is not an integer", input, "Number.isInteger(expected) to be true") + ); + } +}; +var numberSafeInt = { + run(input) { + return Number.isSafeInteger(input) ? Result.ok(input) : Result.err( + new ExpectedConstraintError( + "s.number.safeInt", + "Given value is not a safe integer", + input, + "Number.isSafeInteger(expected) to be true" + ) + ); + } +}; +var numberFinite = { + run(input) { + return Number.isFinite(input) ? Result.ok(input) : Result.err(new ExpectedConstraintError("s.number.finite", "Given value is not finite", input, "Number.isFinite(expected) to be true")); + } +}; +var numberNaN = { + run(input) { + return Number.isNaN(input) ? Result.ok(input) : Result.err(new ExpectedConstraintError("s.number.equal(NaN)", "Invalid number value", input, "expected === NaN")); + } +}; +var numberNotNaN = { + run(input) { + return Number.isNaN(input) ? Result.err(new ExpectedConstraintError("s.number.notEqual(NaN)", "Invalid number value", input, "expected !== NaN")) : Result.ok(input); + } +}; +function numberDivisibleBy(divider) { + const expected = `expected % ${divider} === 0`; + return { + run(input) { + return input % divider === 0 ? Result.ok(input) : Result.err(new ExpectedConstraintError("s.number.divisibleBy", "Number is not divisible", input, expected)); + } + }; +} +__name(numberDivisibleBy, "numberDivisibleBy"); + +// src/validators/NumberValidator.ts +var NumberValidator = class extends BaseValidator { + lessThan(number) { + return this.addConstraint(numberLessThan(number)); + } + lessThanOrEqual(number) { + return this.addConstraint(numberLessThanOrEqual(number)); + } + greaterThan(number) { + return this.addConstraint(numberGreaterThan(number)); + } + greaterThanOrEqual(number) { + return this.addConstraint(numberGreaterThanOrEqual(number)); + } + equal(number) { + return Number.isNaN(number) ? this.addConstraint(numberNaN) : this.addConstraint(numberEqual(number)); + } + notEqual(number) { + return Number.isNaN(number) ? this.addConstraint(numberNotNaN) : this.addConstraint(numberNotEqual(number)); + } + get int() { + return this.addConstraint(numberInt); + } + get safeInt() { + return this.addConstraint(numberSafeInt); + } + get finite() { + return this.addConstraint(numberFinite); + } + get positive() { + return this.greaterThanOrEqual(0); + } + get negative() { + return this.lessThan(0); + } + divisibleBy(divider) { + return this.addConstraint(numberDivisibleBy(divider)); + } + get abs() { + return this.transform(Math.abs); + } + get sign() { + return this.transform(Math.sign); + } + get trunc() { + return this.transform(Math.trunc); + } + get floor() { + return this.transform(Math.floor); + } + get fround() { + return this.transform(Math.fround); + } + get round() { + return this.transform(Math.round); + } + get ceil() { + return this.transform(Math.ceil); + } + handle(value) { + return typeof value === "number" ? Result.ok(value) : Result.err(new ValidationError("s.number", "Expected a number primitive", value)); + } +}; +__name(NumberValidator, "NumberValidator"); + +// src/lib/errors/MissingPropertyError.ts +var MissingPropertyError = class extends BaseError { + constructor(property) { + super("A required property is missing"); + this.property = property; + } + toJSON() { + return { + name: this.name, + property: this.property + }; + } + [customInspectSymbolStackLess](depth, options) { + const property = options.stylize(this.property.toString(), "string"); + if (depth < 0) { + return options.stylize(`[MissingPropertyError: ${property}]`, "special"); + } + const header = `${options.stylize("MissingPropertyError", "special")} > ${property}`; + const message = options.stylize(this.message, "regexp"); + return `${header} + ${message}`; + } +}; +__name(MissingPropertyError, "MissingPropertyError"); +var UnknownPropertyError = class extends BaseError { + constructor(property, value) { + super("Received unexpected property"); + this.property = property; + this.value = value; + } + toJSON() { + return { + name: this.name, + property: this.property, + value: this.value + }; + } + [customInspectSymbolStackLess](depth, options) { + const property = options.stylize(this.property.toString(), "string"); + if (depth < 0) { + return options.stylize(`[UnknownPropertyError: ${property}]`, "special"); + } + const newOptions = { ...options, depth: options.depth === null ? null : options.depth - 1, compact: true }; + const padding = ` + ${options.stylize("|", "undefined")} `; + const given = inspect(this.value, newOptions).replace(/\n/g, padding); + const header = `${options.stylize("UnknownPropertyError", "special")} > ${property}`; + const message = options.stylize(this.message, "regexp"); + const givenBlock = ` + ${options.stylize("Received:", "regexp")}${padding}${given}`; + return `${header} + ${message} +${givenBlock}`; + } +}; +__name(UnknownPropertyError, "UnknownPropertyError"); + +// src/validators/DefaultValidator.ts +var DefaultValidator = class extends BaseValidator { + constructor(validator, value, constraints = []) { + super(constraints); + this.validator = validator; + this.defaultValue = value; + } + default(value) { + const clone = this.clone(); + clone.defaultValue = value; + return clone; + } + handle(value) { + return typeof value === "undefined" ? Result.ok(getValue(this.defaultValue)) : this.validator["handle"](value); + } + clone() { + return Reflect.construct(this.constructor, [this.validator, this.defaultValue, this.constraints]); + } +}; +__name(DefaultValidator, "DefaultValidator"); + +// src/lib/errors/CombinedError.ts +var CombinedError = class extends BaseError { + constructor(errors) { + super("Received one or more errors"); + this.errors = errors; + } + [customInspectSymbolStackLess](depth, options) { + if (depth < 0) { + return options.stylize("[CombinedError]", "special"); + } + const newOptions = { ...options, depth: options.depth === null ? null : options.depth - 1, compact: true }; + const padding = ` + ${options.stylize("|", "undefined")} `; + const header = `${options.stylize("CombinedError", "special")} (${options.stylize(this.errors.length.toString(), "number")})`; + const message = options.stylize(this.message, "regexp"); + const errors = this.errors.map((error, i) => { + const index = options.stylize((i + 1).toString(), "number"); + const body = error[customInspectSymbolStackLess](depth - 1, newOptions).replace(/\n/g, padding); + return ` ${index} ${body}`; + }).join("\n\n"); + return `${header} + ${message} + +${errors}`; + } +}; +__name(CombinedError, "CombinedError"); + +// src/validators/UnionValidator.ts +var UnionValidator = class extends BaseValidator { + constructor(validators, constraints = []) { + super(constraints); + this.validators = validators; + } + get optional() { + if (this.validators.length === 0) + return new UnionValidator([new LiteralValidator(void 0)], this.constraints); + const [validator] = this.validators; + if (validator instanceof LiteralValidator) { + if (validator.expected === void 0) + return this.clone(); + if (validator.expected === null) { + return new UnionValidator( + [new NullishValidator(), ...this.validators.slice(1)], + this.constraints + ); + } + } else if (validator instanceof NullishValidator) { + return this.clone(); + } + return new UnionValidator([new LiteralValidator(void 0), ...this.validators]); + } + get required() { + if (this.validators.length === 0) + return this.clone(); + const [validator] = this.validators; + if (validator instanceof LiteralValidator) { + if (validator.expected === void 0) + return new UnionValidator(this.validators.slice(1), this.constraints); + } else if (validator instanceof NullishValidator) { + return new UnionValidator([new LiteralValidator(null), ...this.validators.slice(1)], this.constraints); + } + return this.clone(); + } + get nullable() { + if (this.validators.length === 0) + return new UnionValidator([new LiteralValidator(null)], this.constraints); + const [validator] = this.validators; + if (validator instanceof LiteralValidator) { + if (validator.expected === null) + return this.clone(); + if (validator.expected === void 0) { + return new UnionValidator( + [new NullishValidator(), ...this.validators.slice(1)], + this.constraints + ); + } + } else if (validator instanceof NullishValidator) { + return this.clone(); + } + return new UnionValidator([new LiteralValidator(null), ...this.validators]); + } + get nullish() { + if (this.validators.length === 0) + return new UnionValidator([new NullishValidator()], this.constraints); + const [validator] = this.validators; + if (validator instanceof LiteralValidator) { + if (validator.expected === null || validator.expected === void 0) { + return new UnionValidator([new NullishValidator(), ...this.validators.slice(1)], this.constraints); + } + } else if (validator instanceof NullishValidator) { + return this.clone(); + } + return new UnionValidator([new NullishValidator(), ...this.validators]); + } + or(...predicates) { + return new UnionValidator([...this.validators, ...predicates]); + } + clone() { + return Reflect.construct(this.constructor, [this.validators, this.constraints]); + } + handle(value) { + const errors = []; + for (const validator of this.validators) { + const result = validator.run(value); + if (result.isOk()) + return result; + errors.push(result.error); + } + return Result.err(new CombinedError(errors)); + } +}; +__name(UnionValidator, "UnionValidator"); + +// src/validators/ObjectValidator.ts +var ObjectValidator = class extends BaseValidator { + constructor(shape, strategy = ObjectValidatorStrategy.Ignore, constraints = []) { + super(constraints); + this.keys = []; + this.requiredKeys = /* @__PURE__ */ new Map(); + this.possiblyUndefinedKeys = /* @__PURE__ */ new Map(); + this.possiblyUndefinedKeysWithDefaults = /* @__PURE__ */ new Map(); + this.shape = shape; + this.strategy = strategy; + switch (this.strategy) { + case ObjectValidatorStrategy.Ignore: + this.handleStrategy = (value) => this.handleIgnoreStrategy(value); + break; + case ObjectValidatorStrategy.Strict: { + this.handleStrategy = (value) => this.handleStrictStrategy(value); + break; + } + case ObjectValidatorStrategy.Passthrough: + this.handleStrategy = (value) => this.handlePassthroughStrategy(value); + break; + } + const shapeEntries = Object.entries(shape); + this.keys = shapeEntries.map(([key]) => key); + for (const [key, validator] of shapeEntries) { + if (validator instanceof UnionValidator) { + const [possiblyLiteralOrNullishPredicate] = validator["validators"]; + if (possiblyLiteralOrNullishPredicate instanceof NullishValidator) { + this.possiblyUndefinedKeys.set(key, validator); + } else if (possiblyLiteralOrNullishPredicate instanceof LiteralValidator) { + if (possiblyLiteralOrNullishPredicate.expected === void 0) { + this.possiblyUndefinedKeys.set(key, validator); + } else { + this.requiredKeys.set(key, validator); + } + } else if (validator instanceof DefaultValidator) { + this.possiblyUndefinedKeysWithDefaults.set(key, validator); + } else { + this.requiredKeys.set(key, validator); + } + } else if (validator instanceof NullishValidator) { + this.possiblyUndefinedKeys.set(key, validator); + } else if (validator instanceof LiteralValidator) { + if (validator.expected === void 0) { + this.possiblyUndefinedKeys.set(key, validator); + } else { + this.requiredKeys.set(key, validator); + } + } else if (validator instanceof DefaultValidator) { + this.possiblyUndefinedKeysWithDefaults.set(key, validator); + } else { + this.requiredKeys.set(key, validator); + } + } + } + get strict() { + return Reflect.construct(this.constructor, [this.shape, ObjectValidatorStrategy.Strict, this.constraints]); + } + get ignore() { + return Reflect.construct(this.constructor, [this.shape, ObjectValidatorStrategy.Ignore, this.constraints]); + } + get passthrough() { + return Reflect.construct(this.constructor, [this.shape, ObjectValidatorStrategy.Passthrough, this.constraints]); + } + get partial() { + const shape = Object.fromEntries(this.keys.map((key) => [key, this.shape[key].optional])); + return Reflect.construct(this.constructor, [shape, this.strategy, this.constraints]); + } + get required() { + const shape = Object.fromEntries( + this.keys.map((key) => { + let validator = this.shape[key]; + if (validator instanceof UnionValidator) + validator = validator.required; + return [key, validator]; + }) + ); + return Reflect.construct(this.constructor, [shape, this.strategy, this.constraints]); + } + extend(schema) { + const shape = { ...this.shape, ...schema instanceof ObjectValidator ? schema.shape : schema }; + return Reflect.construct(this.constructor, [shape, this.strategy, this.constraints]); + } + pick(keys) { + const shape = Object.fromEntries( + keys.filter((key) => this.keys.includes(key)).map((key) => [key, this.shape[key]]) + ); + return Reflect.construct(this.constructor, [shape, this.strategy, this.constraints]); + } + omit(keys) { + const shape = Object.fromEntries( + this.keys.filter((key) => !keys.includes(key)).map((key) => [key, this.shape[key]]) + ); + return Reflect.construct(this.constructor, [shape, this.strategy, this.constraints]); + } + handle(value) { + const typeOfValue = typeof value; + if (typeOfValue !== "object") { + return Result.err(new ValidationError("s.object(T)", `Expected the value to be an object, but received ${typeOfValue} instead`, value)); + } + if (value === null) { + return Result.err(new ValidationError("s.object(T)", "Expected the value to not be null", value)); + } + if (Array.isArray(value)) { + return Result.err(new ValidationError("s.object(T)", "Expected the value to not be an array", value)); + } + if (!this.shouldRunConstraints) { + return Result.ok(value); + } + for (const predicate of Object.values(this.shape)) { + predicate.setParent(this.parent ?? value); + } + return this.handleStrategy(value); + } + clone() { + return Reflect.construct(this.constructor, [this.shape, this.strategy, this.constraints]); + } + handleIgnoreStrategy(value) { + const errors = []; + const finalObject = {}; + const inputEntries = new Map(Object.entries(value)); + const runPredicate = /* @__PURE__ */ __name((key, predicate) => { + const result = predicate.run(value[key]); + if (result.isOk()) { + finalObject[key] = result.value; + } else { + const error = result.error; + errors.push([key, error]); + } + }, "runPredicate"); + for (const [key, predicate] of this.requiredKeys) { + if (inputEntries.delete(key)) { + runPredicate(key, predicate); + } else { + errors.push([key, new MissingPropertyError(key)]); + } + } + for (const [key, validator] of this.possiblyUndefinedKeysWithDefaults) { + inputEntries.delete(key); + runPredicate(key, validator); + } + if (inputEntries.size === 0) { + return errors.length === 0 ? Result.ok(finalObject) : Result.err(new CombinedPropertyError(errors)); + } + const checkInputEntriesInsteadOfSchemaKeys = this.possiblyUndefinedKeys.size > inputEntries.size; + if (checkInputEntriesInsteadOfSchemaKeys) { + for (const [key] of inputEntries) { + const predicate = this.possiblyUndefinedKeys.get(key); + if (predicate) { + runPredicate(key, predicate); + } + } + } else { + for (const [key, predicate] of this.possiblyUndefinedKeys) { + if (inputEntries.delete(key)) { + runPredicate(key, predicate); + } + } + } + return errors.length === 0 ? Result.ok(finalObject) : Result.err(new CombinedPropertyError(errors)); + } + handleStrictStrategy(value) { + const errors = []; + const finalResult = {}; + const inputEntries = new Map(Object.entries(value)); + const runPredicate = /* @__PURE__ */ __name((key, predicate) => { + const result = predicate.run(value[key]); + if (result.isOk()) { + finalResult[key] = result.value; + } else { + const error = result.error; + errors.push([key, error]); + } + }, "runPredicate"); + for (const [key, predicate] of this.requiredKeys) { + if (inputEntries.delete(key)) { + runPredicate(key, predicate); + } else { + errors.push([key, new MissingPropertyError(key)]); + } + } + for (const [key, validator] of this.possiblyUndefinedKeysWithDefaults) { + inputEntries.delete(key); + runPredicate(key, validator); + } + for (const [key, predicate] of this.possiblyUndefinedKeys) { + if (inputEntries.size === 0) { + break; + } + if (inputEntries.delete(key)) { + runPredicate(key, predicate); + } + } + if (inputEntries.size !== 0) { + for (const [key, value2] of inputEntries.entries()) { + errors.push([key, new UnknownPropertyError(key, value2)]); + } + } + return errors.length === 0 ? Result.ok(finalResult) : Result.err(new CombinedPropertyError(errors)); + } + handlePassthroughStrategy(value) { + const result = this.handleIgnoreStrategy(value); + return result.isErr() ? result : Result.ok({ ...value, ...result.value }); + } +}; +__name(ObjectValidator, "ObjectValidator"); +var ObjectValidatorStrategy = /* @__PURE__ */ ((ObjectValidatorStrategy2) => { + ObjectValidatorStrategy2[ObjectValidatorStrategy2["Ignore"] = 0] = "Ignore"; + ObjectValidatorStrategy2[ObjectValidatorStrategy2["Strict"] = 1] = "Strict"; + ObjectValidatorStrategy2[ObjectValidatorStrategy2["Passthrough"] = 2] = "Passthrough"; + return ObjectValidatorStrategy2; +})(ObjectValidatorStrategy || {}); + +// src/validators/PassthroughValidator.ts +var PassthroughValidator = class extends BaseValidator { + handle(value) { + return Result.ok(value); + } +}; +__name(PassthroughValidator, "PassthroughValidator"); + +// src/validators/RecordValidator.ts +var RecordValidator = class extends BaseValidator { + constructor(validator, constraints = []) { + super(constraints); + this.validator = validator; + } + clone() { + return Reflect.construct(this.constructor, [this.validator, this.constraints]); + } + handle(value) { + if (typeof value !== "object") { + return Result.err(new ValidationError("s.record(T)", "Expected an object", value)); + } + if (value === null) { + return Result.err(new ValidationError("s.record(T)", "Expected the value to not be null", value)); + } + if (Array.isArray(value)) { + return Result.err(new ValidationError("s.record(T)", "Expected the value to not be an array", value)); + } + if (!this.shouldRunConstraints) { + return Result.ok(value); + } + const errors = []; + const transformed = {}; + for (const [key, val] of Object.entries(value)) { + const result = this.validator.run(val); + if (result.isOk()) + transformed[key] = result.value; + else + errors.push([key, result.error]); + } + return errors.length === 0 ? Result.ok(transformed) : Result.err(new CombinedPropertyError(errors)); + } +}; +__name(RecordValidator, "RecordValidator"); + +// src/validators/SetValidator.ts +var SetValidator = class extends BaseValidator { + constructor(validator, constraints = []) { + super(constraints); + this.validator = validator; + } + clone() { + return Reflect.construct(this.constructor, [this.validator, this.constraints]); + } + handle(values) { + if (!(values instanceof Set)) { + return Result.err(new ValidationError("s.set(T)", "Expected a set", values)); + } + if (!this.shouldRunConstraints) { + return Result.ok(values); + } + const errors = []; + const transformed = /* @__PURE__ */ new Set(); + for (const value of values) { + const result = this.validator.run(value); + if (result.isOk()) + transformed.add(result.value); + else + errors.push(result.error); + } + return errors.length === 0 ? Result.ok(transformed) : Result.err(new CombinedError(errors)); + } +}; +__name(SetValidator, "SetValidator"); + +// src/constraints/util/emailValidator.ts +var accountRegex = /^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")$/; +function validateEmail(email) { + if (!email) + return false; + const atIndex = email.indexOf("@"); + if (atIndex === -1) + return false; + if (atIndex > 64) + return false; + const domainIndex = atIndex + 1; + if (email.includes("@", domainIndex)) + return false; + if (email.length - domainIndex > 255) + return false; + let dotIndex = email.indexOf(".", domainIndex); + if (dotIndex === -1) + return false; + let lastDotIndex = domainIndex; + do { + if (dotIndex - lastDotIndex > 63) + return false; + lastDotIndex = dotIndex + 1; + } while ((dotIndex = email.indexOf(".", lastDotIndex)) !== -1); + if (email.length - lastDotIndex > 63) + return false; + return accountRegex.test(email.slice(0, atIndex)) && validateEmailDomain(email.slice(domainIndex)); +} +__name(validateEmail, "validateEmail"); +function validateEmailDomain(domain) { + try { + return new URL(`http://${domain}`).hostname === domain; + } catch { + return false; + } +} +__name(validateEmailDomain, "validateEmailDomain"); + +// src/constraints/util/net.ts +var v4Seg = "(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])"; +var v4Str = `(${v4Seg}[.]){3}${v4Seg}`; +var IPv4Reg = new RegExp(`^${v4Str}$`); +var v6Seg = "(?:[0-9a-fA-F]{1,4})"; +var IPv6Reg = new RegExp( + `^((?:${v6Seg}:){7}(?:${v6Seg}|:)|(?:${v6Seg}:){6}(?:${v4Str}|:${v6Seg}|:)|(?:${v6Seg}:){5}(?::${v4Str}|(:${v6Seg}){1,2}|:)|(?:${v6Seg}:){4}(?:(:${v6Seg}){0,1}:${v4Str}|(:${v6Seg}){1,3}|:)|(?:${v6Seg}:){3}(?:(:${v6Seg}){0,2}:${v4Str}|(:${v6Seg}){1,4}|:)|(?:${v6Seg}:){2}(?:(:${v6Seg}){0,3}:${v4Str}|(:${v6Seg}){1,5}|:)|(?:${v6Seg}:){1}(?:(:${v6Seg}){0,4}:${v4Str}|(:${v6Seg}){1,6}|:)|(?::((?::${v6Seg}){0,5}:${v4Str}|(?::${v6Seg}){1,7}|:)))(%[0-9a-zA-Z-.:]{1,})?$` +); +function isIPv4(s2) { + return IPv4Reg.test(s2); +} +__name(isIPv4, "isIPv4"); +function isIPv6(s2) { + return IPv6Reg.test(s2); +} +__name(isIPv6, "isIPv6"); +function isIP(s2) { + if (isIPv4(s2)) + return 4; + if (isIPv6(s2)) + return 6; + return 0; +} +__name(isIP, "isIP"); + +// src/constraints/util/phoneValidator.ts +var phoneNumberRegex = /^((?:\+|0{0,2})\d{1,2}\s?)?\(?\d{3}\)?[\s.-]?\d{3}[\s.-]?\d{4}$/; +function validatePhoneNumber(input) { + return phoneNumberRegex.test(input); +} +__name(validatePhoneNumber, "validatePhoneNumber"); +var MultiplePossibilitiesConstraintError = class extends BaseConstraintError { + constructor(constraint, message, given, expected) { + super(constraint, message, given); + this.expected = expected; + } + toJSON() { + return { + name: this.name, + constraint: this.constraint, + given: this.given, + expected: this.expected + }; + } + [customInspectSymbolStackLess](depth, options) { + const constraint = options.stylize(this.constraint, "string"); + if (depth < 0) { + return options.stylize(`[MultiplePossibilitiesConstraintError: ${constraint}]`, "special"); + } + const newOptions = { ...options, depth: options.depth === null ? null : options.depth - 1 }; + const verticalLine = options.stylize("|", "undefined"); + const padding = ` + ${verticalLine} `; + const given = inspect(this.given, newOptions).replace(/\n/g, padding); + const header = `${options.stylize("MultiplePossibilitiesConstraintError", "special")} > ${constraint}`; + const message = options.stylize(this.message, "regexp"); + const expectedPadding = ` + ${verticalLine} - `; + const expectedBlock = ` + ${options.stylize("Expected any of the following:", "string")}${expectedPadding}${this.expected.map((possible) => options.stylize(possible, "boolean")).join(expectedPadding)}`; + const givenBlock = ` + ${options.stylize("Received:", "regexp")}${padding}${given}`; + return `${header} + ${message} +${expectedBlock} +${givenBlock}`; + } +}; +__name(MultiplePossibilitiesConstraintError, "MultiplePossibilitiesConstraintError"); + +// src/constraints/util/common/combinedResultFn.ts +function combinedErrorFn(...fns) { + switch (fns.length) { + case 0: + return () => null; + case 1: + return fns[0]; + case 2: { + const [fn0, fn1] = fns; + return (...params) => fn0(...params) || fn1(...params); + } + default: { + return (...params) => { + for (const fn of fns) { + const result = fn(...params); + if (result) + return result; + } + return null; + }; + } + } +} +__name(combinedErrorFn, "combinedErrorFn"); + +// src/constraints/util/urlValidators.ts +function createUrlValidators(options) { + const fns = []; + if (options?.allowedProtocols?.length) + fns.push(allowedProtocolsFn(options.allowedProtocols)); + if (options?.allowedDomains?.length) + fns.push(allowedDomainsFn(options.allowedDomains)); + return combinedErrorFn(...fns); +} +__name(createUrlValidators, "createUrlValidators"); +function allowedProtocolsFn(allowedProtocols) { + return (input, url) => allowedProtocols.includes(url.protocol) ? null : new MultiplePossibilitiesConstraintError("s.string.url", "Invalid URL protocol", input, allowedProtocols); +} +__name(allowedProtocolsFn, "allowedProtocolsFn"); +function allowedDomainsFn(allowedDomains) { + return (input, url) => allowedDomains.includes(url.hostname) ? null : new MultiplePossibilitiesConstraintError("s.string.url", "Invalid URL domain", input, allowedDomains); +} +__name(allowedDomainsFn, "allowedDomainsFn"); + +// src/constraints/StringConstraints.ts +function stringLengthComparator(comparator, name, expected, length) { + return { + run(input) { + return comparator(input.length, length) ? Result.ok(input) : Result.err(new ExpectedConstraintError(name, "Invalid string length", input, expected)); + } + }; +} +__name(stringLengthComparator, "stringLengthComparator"); +function stringLengthLessThan(length) { + const expected = `expected.length < ${length}`; + return stringLengthComparator(lessThan, "s.string.lengthLessThan", expected, length); +} +__name(stringLengthLessThan, "stringLengthLessThan"); +function stringLengthLessThanOrEqual(length) { + const expected = `expected.length <= ${length}`; + return stringLengthComparator(lessThanOrEqual, "s.string.lengthLessThanOrEqual", expected, length); +} +__name(stringLengthLessThanOrEqual, "stringLengthLessThanOrEqual"); +function stringLengthGreaterThan(length) { + const expected = `expected.length > ${length}`; + return stringLengthComparator(greaterThan, "s.string.lengthGreaterThan", expected, length); +} +__name(stringLengthGreaterThan, "stringLengthGreaterThan"); +function stringLengthGreaterThanOrEqual(length) { + const expected = `expected.length >= ${length}`; + return stringLengthComparator(greaterThanOrEqual, "s.string.lengthGreaterThanOrEqual", expected, length); +} +__name(stringLengthGreaterThanOrEqual, "stringLengthGreaterThanOrEqual"); +function stringLengthEqual(length) { + const expected = `expected.length === ${length}`; + return stringLengthComparator(equal, "s.string.lengthEqual", expected, length); +} +__name(stringLengthEqual, "stringLengthEqual"); +function stringLengthNotEqual(length) { + const expected = `expected.length !== ${length}`; + return stringLengthComparator(notEqual, "s.string.lengthNotEqual", expected, length); +} +__name(stringLengthNotEqual, "stringLengthNotEqual"); +function stringEmail() { + return { + run(input) { + return validateEmail(input) ? Result.ok(input) : Result.err(new ExpectedConstraintError("s.string.email", "Invalid email address", input, "expected to be an email address")); + } + }; +} +__name(stringEmail, "stringEmail"); +function stringRegexValidator(type, expected, regex) { + return { + run(input) { + return regex.test(input) ? Result.ok(input) : Result.err(new ExpectedConstraintError(type, "Invalid string format", input, expected)); + } + }; +} +__name(stringRegexValidator, "stringRegexValidator"); +function stringUrl(options) { + const validatorFn = createUrlValidators(options); + return { + run(input) { + let url; + try { + url = new URL(input); + } catch { + return Result.err(new ExpectedConstraintError("s.string.url", "Invalid URL", input, "expected to match an URL")); + } + const validatorFnResult = validatorFn(input, url); + if (validatorFnResult === null) + return Result.ok(input); + return Result.err(validatorFnResult); + } + }; +} +__name(stringUrl, "stringUrl"); +function stringIp(version) { + const ipVersion = version ? `v${version}` : ""; + const validatorFn = version === 4 ? isIPv4 : version === 6 ? isIPv6 : isIP; + const name = `s.string.ip${ipVersion}`; + const message = `Invalid IP${ipVersion} address`; + const expected = `expected to be an IP${ipVersion} address`; + return { + run(input) { + return validatorFn(input) ? Result.ok(input) : Result.err(new ExpectedConstraintError(name, message, input, expected)); + } + }; +} +__name(stringIp, "stringIp"); +function stringRegex(regex) { + return stringRegexValidator("s.string.regex", `expected ${regex}.test(expected) to be true`, regex); +} +__name(stringRegex, "stringRegex"); +function stringUuid({ version = 4, nullable = false } = {}) { + version ?? (version = "1-5"); + const regex = new RegExp( + `^(?:[0-9A-F]{8}-[0-9A-F]{4}-[${version}][0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}${nullable ? "|00000000-0000-0000-0000-000000000000" : ""})$`, + "i" + ); + const expected = `expected to match UUID${typeof version === "number" ? `v${version}` : ` in range of ${version}`}`; + return stringRegexValidator("s.string.uuid", expected, regex); +} +__name(stringUuid, "stringUuid"); +function stringDate() { + return { + run(input) { + const time = Date.parse(input); + return Number.isNaN(time) ? Result.err( + new ExpectedConstraintError( + "s.string.date", + "Invalid date string", + input, + "expected to be a valid date string (in the ISO 8601 or ECMA-262 format)" + ) + ) : Result.ok(input); + } + }; +} +__name(stringDate, "stringDate"); +function stringPhone() { + return { + run(input) { + return validatePhoneNumber(input) ? Result.ok(input) : Result.err(new ExpectedConstraintError("s.string.phone", "Invalid phone number", input, "expected to be a phone number")); + } + }; +} +__name(stringPhone, "stringPhone"); + +// src/validators/StringValidator.ts +var StringValidator = class extends BaseValidator { + lengthLessThan(length) { + return this.addConstraint(stringLengthLessThan(length)); + } + lengthLessThanOrEqual(length) { + return this.addConstraint(stringLengthLessThanOrEqual(length)); + } + lengthGreaterThan(length) { + return this.addConstraint(stringLengthGreaterThan(length)); + } + lengthGreaterThanOrEqual(length) { + return this.addConstraint(stringLengthGreaterThanOrEqual(length)); + } + lengthEqual(length) { + return this.addConstraint(stringLengthEqual(length)); + } + lengthNotEqual(length) { + return this.addConstraint(stringLengthNotEqual(length)); + } + get email() { + return this.addConstraint(stringEmail()); + } + url(options) { + return this.addConstraint(stringUrl(options)); + } + uuid(options) { + return this.addConstraint(stringUuid(options)); + } + regex(regex) { + return this.addConstraint(stringRegex(regex)); + } + get date() { + return this.addConstraint(stringDate()); + } + get ipv4() { + return this.ip(4); + } + get ipv6() { + return this.ip(6); + } + ip(version) { + return this.addConstraint(stringIp(version)); + } + phone() { + return this.addConstraint(stringPhone()); + } + handle(value) { + return typeof value === "string" ? Result.ok(value) : Result.err(new ValidationError("s.string", "Expected a string primitive", value)); + } +}; +__name(StringValidator, "StringValidator"); + +// src/validators/TupleValidator.ts +var TupleValidator = class extends BaseValidator { + constructor(validators, constraints = []) { + super(constraints); + this.validators = []; + this.validators = validators; + } + clone() { + return Reflect.construct(this.constructor, [this.validators, this.constraints]); + } + handle(values) { + if (!Array.isArray(values)) { + return Result.err(new ValidationError("s.tuple(T)", "Expected an array", values)); + } + if (values.length !== this.validators.length) { + return Result.err(new ValidationError("s.tuple(T)", `Expected an array of length ${this.validators.length}`, values)); + } + if (!this.shouldRunConstraints) { + return Result.ok(values); + } + const errors = []; + const transformed = []; + for (let i = 0; i < values.length; i++) { + const result = this.validators[i].run(values[i]); + if (result.isOk()) + transformed.push(result.value); + else + errors.push([i, result.error]); + } + return errors.length === 0 ? Result.ok(transformed) : Result.err(new CombinedPropertyError(errors)); + } +}; +__name(TupleValidator, "TupleValidator"); + +// src/validators/MapValidator.ts +var MapValidator = class extends BaseValidator { + constructor(keyValidator, valueValidator, constraints = []) { + super(constraints); + this.keyValidator = keyValidator; + this.valueValidator = valueValidator; + } + clone() { + return Reflect.construct(this.constructor, [this.keyValidator, this.valueValidator, this.constraints]); + } + handle(value) { + if (!(value instanceof Map)) { + return Result.err(new ValidationError("s.map(K, V)", "Expected a map", value)); + } + if (!this.shouldRunConstraints) { + return Result.ok(value); + } + const errors = []; + const transformed = /* @__PURE__ */ new Map(); + for (const [key, val] of value.entries()) { + const keyResult = this.keyValidator.run(key); + const valueResult = this.valueValidator.run(val); + const { length } = errors; + if (keyResult.isErr()) + errors.push([key, keyResult.error]); + if (valueResult.isErr()) + errors.push([key, valueResult.error]); + if (errors.length === length) + transformed.set(keyResult.value, valueResult.value); + } + return errors.length === 0 ? Result.ok(transformed) : Result.err(new CombinedPropertyError(errors)); + } +}; +__name(MapValidator, "MapValidator"); + +// src/validators/LazyValidator.ts +var LazyValidator = class extends BaseValidator { + constructor(validator, constraints = []) { + super(constraints); + this.validator = validator; + } + clone() { + return Reflect.construct(this.constructor, [this.validator, this.constraints]); + } + handle(values) { + return this.validator(values).run(values); + } +}; +__name(LazyValidator, "LazyValidator"); + +// src/lib/errors/UnknownEnumValueError.ts +var UnknownEnumValueError = class extends BaseError { + constructor(value, keys, enumMappings) { + super("Expected the value to be one of the following enum values:"); + this.value = value; + this.enumKeys = keys; + this.enumMappings = enumMappings; + } + toJSON() { + return { + name: this.name, + value: this.value, + enumKeys: this.enumKeys, + enumMappings: [...this.enumMappings.entries()] + }; + } + [customInspectSymbolStackLess](depth, options) { + const value = options.stylize(this.value.toString(), "string"); + if (depth < 0) { + return options.stylize(`[UnknownEnumValueError: ${value}]`, "special"); + } + const padding = ` + ${options.stylize("|", "undefined")} `; + const pairs = this.enumKeys.map((key) => { + const enumValue = this.enumMappings.get(key); + return `${options.stylize(key, "string")} or ${options.stylize( + enumValue.toString(), + typeof enumValue === "number" ? "number" : "string" + )}`; + }).join(padding); + const header = `${options.stylize("UnknownEnumValueError", "special")} > ${value}`; + const message = options.stylize(this.message, "regexp"); + const pairsBlock = `${padding}${pairs}`; + return `${header} + ${message} +${pairsBlock}`; + } +}; +__name(UnknownEnumValueError, "UnknownEnumValueError"); + +// src/validators/NativeEnumValidator.ts +var NativeEnumValidator = class extends BaseValidator { + constructor(enumShape) { + super(); + this.hasNumericElements = false; + this.enumMapping = /* @__PURE__ */ new Map(); + this.enumShape = enumShape; + this.enumKeys = Object.keys(enumShape).filter((key) => { + return typeof enumShape[enumShape[key]] !== "number"; + }); + for (const key of this.enumKeys) { + const enumValue = enumShape[key]; + this.enumMapping.set(key, enumValue); + this.enumMapping.set(enumValue, enumValue); + if (typeof enumValue === "number") { + this.hasNumericElements = true; + this.enumMapping.set(`${enumValue}`, enumValue); + } + } + } + handle(value) { + const typeOfValue = typeof value; + if (typeOfValue === "number") { + if (!this.hasNumericElements) { + return Result.err(new ValidationError("s.nativeEnum(T)", "Expected the value to be a string", value)); + } + } else if (typeOfValue !== "string") { + return Result.err(new ValidationError("s.nativeEnum(T)", "Expected the value to be a string or number", value)); + } + const casted = value; + const possibleEnumValue = this.enumMapping.get(casted); + return typeof possibleEnumValue === "undefined" ? Result.err(new UnknownEnumValueError(casted, this.enumKeys, this.enumMapping)) : Result.ok(possibleEnumValue); + } + clone() { + return Reflect.construct(this.constructor, [this.enumShape]); + } +}; +__name(NativeEnumValidator, "NativeEnumValidator"); + +// src/constraints/TypedArrayLengthConstraints.ts +function typedArrayByteLengthComparator(comparator, name, expected, length) { + return { + run(input) { + return comparator(input.byteLength, length) ? Result.ok(input) : Result.err(new ExpectedConstraintError(name, "Invalid Typed Array byte length", input, expected)); + } + }; +} +__name(typedArrayByteLengthComparator, "typedArrayByteLengthComparator"); +function typedArrayByteLengthLessThan(value) { + const expected = `expected.byteLength < ${value}`; + return typedArrayByteLengthComparator(lessThan, "s.typedArray(T).byteLengthLessThan", expected, value); +} +__name(typedArrayByteLengthLessThan, "typedArrayByteLengthLessThan"); +function typedArrayByteLengthLessThanOrEqual(value) { + const expected = `expected.byteLength <= ${value}`; + return typedArrayByteLengthComparator(lessThanOrEqual, "s.typedArray(T).byteLengthLessThanOrEqual", expected, value); +} +__name(typedArrayByteLengthLessThanOrEqual, "typedArrayByteLengthLessThanOrEqual"); +function typedArrayByteLengthGreaterThan(value) { + const expected = `expected.byteLength > ${value}`; + return typedArrayByteLengthComparator(greaterThan, "s.typedArray(T).byteLengthGreaterThan", expected, value); +} +__name(typedArrayByteLengthGreaterThan, "typedArrayByteLengthGreaterThan"); +function typedArrayByteLengthGreaterThanOrEqual(value) { + const expected = `expected.byteLength >= ${value}`; + return typedArrayByteLengthComparator(greaterThanOrEqual, "s.typedArray(T).byteLengthGreaterThanOrEqual", expected, value); +} +__name(typedArrayByteLengthGreaterThanOrEqual, "typedArrayByteLengthGreaterThanOrEqual"); +function typedArrayByteLengthEqual(value) { + const expected = `expected.byteLength === ${value}`; + return typedArrayByteLengthComparator(equal, "s.typedArray(T).byteLengthEqual", expected, value); +} +__name(typedArrayByteLengthEqual, "typedArrayByteLengthEqual"); +function typedArrayByteLengthNotEqual(value) { + const expected = `expected.byteLength !== ${value}`; + return typedArrayByteLengthComparator(notEqual, "s.typedArray(T).byteLengthNotEqual", expected, value); +} +__name(typedArrayByteLengthNotEqual, "typedArrayByteLengthNotEqual"); +function typedArrayByteLengthRange(start, endBefore) { + const expected = `expected.byteLength >= ${start} && expected.byteLength < ${endBefore}`; + return { + run(input) { + return input.byteLength >= start && input.byteLength < endBefore ? Result.ok(input) : Result.err(new ExpectedConstraintError("s.typedArray(T).byteLengthRange", "Invalid Typed Array byte length", input, expected)); + } + }; +} +__name(typedArrayByteLengthRange, "typedArrayByteLengthRange"); +function typedArrayByteLengthRangeInclusive(start, end) { + const expected = `expected.byteLength >= ${start} && expected.byteLength <= ${end}`; + return { + run(input) { + return input.byteLength >= start && input.byteLength <= end ? Result.ok(input) : Result.err( + new ExpectedConstraintError("s.typedArray(T).byteLengthRangeInclusive", "Invalid Typed Array byte length", input, expected) + ); + } + }; +} +__name(typedArrayByteLengthRangeInclusive, "typedArrayByteLengthRangeInclusive"); +function typedArrayByteLengthRangeExclusive(startAfter, endBefore) { + const expected = `expected.byteLength > ${startAfter} && expected.byteLength < ${endBefore}`; + return { + run(input) { + return input.byteLength > startAfter && input.byteLength < endBefore ? Result.ok(input) : Result.err( + new ExpectedConstraintError("s.typedArray(T).byteLengthRangeExclusive", "Invalid Typed Array byte length", input, expected) + ); + } + }; +} +__name(typedArrayByteLengthRangeExclusive, "typedArrayByteLengthRangeExclusive"); +function typedArrayLengthComparator(comparator, name, expected, length) { + return { + run(input) { + return comparator(input.length, length) ? Result.ok(input) : Result.err(new ExpectedConstraintError(name, "Invalid Typed Array length", input, expected)); + } + }; +} +__name(typedArrayLengthComparator, "typedArrayLengthComparator"); +function typedArrayLengthLessThan(value) { + const expected = `expected.length < ${value}`; + return typedArrayLengthComparator(lessThan, "s.typedArray(T).lengthLessThan", expected, value); +} +__name(typedArrayLengthLessThan, "typedArrayLengthLessThan"); +function typedArrayLengthLessThanOrEqual(value) { + const expected = `expected.length <= ${value}`; + return typedArrayLengthComparator(lessThanOrEqual, "s.typedArray(T).lengthLessThanOrEqual", expected, value); +} +__name(typedArrayLengthLessThanOrEqual, "typedArrayLengthLessThanOrEqual"); +function typedArrayLengthGreaterThan(value) { + const expected = `expected.length > ${value}`; + return typedArrayLengthComparator(greaterThan, "s.typedArray(T).lengthGreaterThan", expected, value); +} +__name(typedArrayLengthGreaterThan, "typedArrayLengthGreaterThan"); +function typedArrayLengthGreaterThanOrEqual(value) { + const expected = `expected.length >= ${value}`; + return typedArrayLengthComparator(greaterThanOrEqual, "s.typedArray(T).lengthGreaterThanOrEqual", expected, value); +} +__name(typedArrayLengthGreaterThanOrEqual, "typedArrayLengthGreaterThanOrEqual"); +function typedArrayLengthEqual(value) { + const expected = `expected.length === ${value}`; + return typedArrayLengthComparator(equal, "s.typedArray(T).lengthEqual", expected, value); +} +__name(typedArrayLengthEqual, "typedArrayLengthEqual"); +function typedArrayLengthNotEqual(value) { + const expected = `expected.length !== ${value}`; + return typedArrayLengthComparator(notEqual, "s.typedArray(T).lengthNotEqual", expected, value); +} +__name(typedArrayLengthNotEqual, "typedArrayLengthNotEqual"); +function typedArrayLengthRange(start, endBefore) { + const expected = `expected.length >= ${start} && expected.length < ${endBefore}`; + return { + run(input) { + return input.length >= start && input.length < endBefore ? Result.ok(input) : Result.err(new ExpectedConstraintError("s.typedArray(T).lengthRange", "Invalid Typed Array length", input, expected)); + } + }; +} +__name(typedArrayLengthRange, "typedArrayLengthRange"); +function typedArrayLengthRangeInclusive(start, end) { + const expected = `expected.length >= ${start} && expected.length <= ${end}`; + return { + run(input) { + return input.length >= start && input.length <= end ? Result.ok(input) : Result.err(new ExpectedConstraintError("s.typedArray(T).lengthRangeInclusive", "Invalid Typed Array length", input, expected)); + } + }; +} +__name(typedArrayLengthRangeInclusive, "typedArrayLengthRangeInclusive"); +function typedArrayLengthRangeExclusive(startAfter, endBefore) { + const expected = `expected.length > ${startAfter} && expected.length < ${endBefore}`; + return { + run(input) { + return input.length > startAfter && input.length < endBefore ? Result.ok(input) : Result.err(new ExpectedConstraintError("s.typedArray(T).lengthRangeExclusive", "Invalid Typed Array length", input, expected)); + } + }; +} +__name(typedArrayLengthRangeExclusive, "typedArrayLengthRangeExclusive"); + +// src/constraints/util/common/vowels.ts +var vowels = ["a", "e", "i", "o", "u"]; +var aOrAn = /* @__PURE__ */ __name((word) => { + return `${vowels.includes(word[0].toLowerCase()) ? "an" : "a"} ${word}`; +}, "aOrAn"); + +// src/constraints/util/typedArray.ts +var TypedArrays = { + Int8Array: (x) => x instanceof Int8Array, + Uint8Array: (x) => x instanceof Uint8Array, + Uint8ClampedArray: (x) => x instanceof Uint8ClampedArray, + Int16Array: (x) => x instanceof Int16Array, + Uint16Array: (x) => x instanceof Uint16Array, + Int32Array: (x) => x instanceof Int32Array, + Uint32Array: (x) => x instanceof Uint32Array, + Float32Array: (x) => x instanceof Float32Array, + Float64Array: (x) => x instanceof Float64Array, + BigInt64Array: (x) => x instanceof BigInt64Array, + BigUint64Array: (x) => x instanceof BigUint64Array, + TypedArray: (x) => ArrayBuffer.isView(x) && !(x instanceof DataView) +}; + +// src/validators/TypedArrayValidator.ts +var TypedArrayValidator = class extends BaseValidator { + constructor(type, constraints = []) { + super(constraints); + this.type = type; + } + byteLengthLessThan(length) { + return this.addConstraint(typedArrayByteLengthLessThan(length)); + } + byteLengthLessThanOrEqual(length) { + return this.addConstraint(typedArrayByteLengthLessThanOrEqual(length)); + } + byteLengthGreaterThan(length) { + return this.addConstraint(typedArrayByteLengthGreaterThan(length)); + } + byteLengthGreaterThanOrEqual(length) { + return this.addConstraint(typedArrayByteLengthGreaterThanOrEqual(length)); + } + byteLengthEqual(length) { + return this.addConstraint(typedArrayByteLengthEqual(length)); + } + byteLengthNotEqual(length) { + return this.addConstraint(typedArrayByteLengthNotEqual(length)); + } + byteLengthRange(start, endBefore) { + return this.addConstraint(typedArrayByteLengthRange(start, endBefore)); + } + byteLengthRangeInclusive(startAt, endAt) { + return this.addConstraint(typedArrayByteLengthRangeInclusive(startAt, endAt)); + } + byteLengthRangeExclusive(startAfter, endBefore) { + return this.addConstraint(typedArrayByteLengthRangeExclusive(startAfter, endBefore)); + } + lengthLessThan(length) { + return this.addConstraint(typedArrayLengthLessThan(length)); + } + lengthLessThanOrEqual(length) { + return this.addConstraint(typedArrayLengthLessThanOrEqual(length)); + } + lengthGreaterThan(length) { + return this.addConstraint(typedArrayLengthGreaterThan(length)); + } + lengthGreaterThanOrEqual(length) { + return this.addConstraint(typedArrayLengthGreaterThanOrEqual(length)); + } + lengthEqual(length) { + return this.addConstraint(typedArrayLengthEqual(length)); + } + lengthNotEqual(length) { + return this.addConstraint(typedArrayLengthNotEqual(length)); + } + lengthRange(start, endBefore) { + return this.addConstraint(typedArrayLengthRange(start, endBefore)); + } + lengthRangeInclusive(startAt, endAt) { + return this.addConstraint(typedArrayLengthRangeInclusive(startAt, endAt)); + } + lengthRangeExclusive(startAfter, endBefore) { + return this.addConstraint(typedArrayLengthRangeExclusive(startAfter, endBefore)); + } + clone() { + return Reflect.construct(this.constructor, [this.type, this.constraints]); + } + handle(value) { + return TypedArrays[this.type](value) ? Result.ok(value) : Result.err(new ValidationError("s.typedArray", `Expected ${aOrAn(this.type)}`, value)); + } +}; +__name(TypedArrayValidator, "TypedArrayValidator"); + +// src/lib/Shapes.ts +var Shapes = class { + get string() { + return new StringValidator(); + } + get number() { + return new NumberValidator(); + } + get bigint() { + return new BigIntValidator(); + } + get boolean() { + return new BooleanValidator(); + } + get date() { + return new DateValidator(); + } + object(shape) { + return new ObjectValidator(shape); + } + get undefined() { + return this.literal(void 0); + } + get null() { + return this.literal(null); + } + get nullish() { + return new NullishValidator(); + } + get any() { + return new PassthroughValidator(); + } + get unknown() { + return new PassthroughValidator(); + } + get never() { + return new NeverValidator(); + } + enum(...values) { + return this.union(...values.map((value) => this.literal(value))); + } + nativeEnum(enumShape) { + return new NativeEnumValidator(enumShape); + } + literal(value) { + if (value instanceof Date) + return this.date.equal(value); + return new LiteralValidator(value); + } + instance(expected) { + return new InstanceValidator(expected); + } + union(...validators) { + return new UnionValidator(validators); + } + array(validator) { + return new ArrayValidator(validator); + } + typedArray(type = "TypedArray") { + return new TypedArrayValidator(type); + } + get int8Array() { + return this.typedArray("Int8Array"); + } + get uint8Array() { + return this.typedArray("Uint8Array"); + } + get uint8ClampedArray() { + return this.typedArray("Uint8ClampedArray"); + } + get int16Array() { + return this.typedArray("Int16Array"); + } + get uint16Array() { + return this.typedArray("Uint16Array"); + } + get int32Array() { + return this.typedArray("Int32Array"); + } + get uint32Array() { + return this.typedArray("Uint32Array"); + } + get float32Array() { + return this.typedArray("Float32Array"); + } + get float64Array() { + return this.typedArray("Float64Array"); + } + get bigInt64Array() { + return this.typedArray("BigInt64Array"); + } + get bigUint64Array() { + return this.typedArray("BigUint64Array"); + } + tuple(validators) { + return new TupleValidator(validators); + } + set(validator) { + return new SetValidator(validator); + } + record(validator) { + return new RecordValidator(validator); + } + map(keyValidator, valueValidator) { + return new MapValidator(keyValidator, valueValidator); + } + lazy(validator) { + return new LazyValidator(validator); + } +}; +__name(Shapes, "Shapes"); + +// src/index.ts +var s = new Shapes(); + +export { BaseError, CombinedError, CombinedPropertyError, ExpectedConstraintError, ExpectedValidationError, MissingPropertyError, MultiplePossibilitiesConstraintError, Result, UnknownEnumValueError, UnknownPropertyError, ValidationError, customInspectSymbol, customInspectSymbolStackLess, getGlobalValidationEnabled, s, setGlobalValidationEnabled }; +//# sourceMappingURL=out.js.map +//# sourceMappingURL=index.mjs.map
\ No newline at end of file diff --git a/includes/external/discord/node_modules/@sapphire/shapeshift/dist/index.mjs.map b/includes/external/discord/node_modules/@sapphire/shapeshift/dist/index.mjs.map new file mode 100644 index 0000000..871f0d6 --- /dev/null +++ b/includes/external/discord/node_modules/@sapphire/shapeshift/dist/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/lib/configs.ts","../src/lib/Result.ts","../src/validators/util/getValue.ts","../src/constraints/ObjectConstrains.ts","../src/lib/errors/ExpectedConstraintError.ts","../src/lib/errors/BaseError.ts","../src/lib/errors/BaseConstraintError.ts","../src/validators/BaseValidator.ts","../src/constraints/util/isUnique.ts","../src/constraints/util/operators.ts","../src/constraints/ArrayConstraints.ts","../src/lib/errors/CombinedPropertyError.ts","../src/lib/errors/ValidationError.ts","../src/validators/ArrayValidator.ts","../src/constraints/BigIntConstraints.ts","../src/validators/BigIntValidator.ts","../src/constraints/BooleanConstraints.ts","../src/validators/BooleanValidator.ts","../src/constraints/DateConstraints.ts","../src/validators/DateValidator.ts","../src/lib/errors/ExpectedValidationError.ts","../src/validators/InstanceValidator.ts","../src/validators/LiteralValidator.ts","../src/validators/NeverValidator.ts","../src/validators/NullishValidator.ts","../src/constraints/NumberConstraints.ts","../src/validators/NumberValidator.ts","../src/lib/errors/MissingPropertyError.ts","../src/lib/errors/UnknownPropertyError.ts","../src/validators/DefaultValidator.ts","../src/lib/errors/CombinedError.ts","../src/validators/UnionValidator.ts","../src/validators/ObjectValidator.ts","../src/validators/PassthroughValidator.ts","../src/validators/RecordValidator.ts","../src/validators/SetValidator.ts","../src/constraints/util/emailValidator.ts","../src/constraints/util/net.ts","../src/constraints/util/phoneValidator.ts","../src/lib/errors/MultiplePossibilitiesConstraintError.ts","../src/constraints/util/common/combinedResultFn.ts","../src/constraints/util/urlValidators.ts","../src/constraints/StringConstraints.ts","../src/validators/StringValidator.ts","../src/validators/TupleValidator.ts","../src/validators/MapValidator.ts","../src/validators/LazyValidator.ts","../src/lib/errors/UnknownEnumValueError.ts","../src/validators/NativeEnumValidator.ts","../src/constraints/TypedArrayLengthConstraints.ts","../src/constraints/util/common/vowels.ts","../src/constraints/util/typedArray.ts","../src/validators/TypedArrayValidator.ts","../src/lib/Shapes.ts","../src/index.ts"],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ACpD;AAAA,EAEA,IAAW,eAAe;AACzB,WAAO,KAAK,WAAyB,cAAc;AAAA,EACpD;AAAA,EAEA,IAAW,gBAAgB;AAC1B,WAAO,KAAK,WAA0B,eAAe;AAAA,EACtD;AAAA,EAEA,IAAW,iBAAiB;AAC3B,WAAO,KAAK,WAA2B,gBAAgB;AAAA,EACxD;AAAA,EAEO,MAA2C,YAAoD;AACrG,WAAO,IAAI,eAAe,UAAU;AAAA,EACrC;AAAA,EAEO,IAAO,WAA6B;AAC1C,WAAO,IAAI,aAAa,SAAS;AAAA,EAClC;AAAA,EAEO,OAAU,WAA6B;AAC7C,WAAO,IAAI,gBAAgB,SAAS;AAAA,EACrC;AAAA,EAEO,IAAU,cAAgC,gBAAkC;AAClF,WAAO,IAAI,aAAa,cAAc,cAAc;AAAA,EACrD;AAAA,EAEO,KAAuC,WAAkC;AAC/E,WAAO,IAAI,cAAc,SAAS;AAAA,EACnC;AACD;AA/Ia;;;ACzBN,IAAM,IAAI,IAAI,OAAO","sourcesContent":["let validationEnabled = true;\n\n/**\n * Sets whether validators should run on the input, or if the input should be passed through.\n * @param enabled Whether validation should be done on inputs\n */\nexport function setGlobalValidationEnabled(enabled: boolean) {\n\tvalidationEnabled = enabled;\n}\n\n/**\n * @returns Whether validation is enabled\n */\nexport function getGlobalValidationEnabled() {\n\treturn validationEnabled;\n}\n","export class Result<T, E extends Error = Error> {\n\tpublic readonly success: boolean;\n\tpublic readonly value?: T;\n\tpublic readonly error?: E;\n\n\tprivate constructor(success: boolean, value?: T, error?: E) {\n\t\tthis.success = success;\n\t\tif (success) {\n\t\t\tthis.value = value;\n\t\t} else {\n\t\t\tthis.error = error;\n\t\t}\n\t}\n\n\tpublic isOk(): this is { success: true; value: T } {\n\t\treturn this.success;\n\t}\n\n\tpublic isErr(): this is { success: false; error: E } {\n\t\treturn !this.success;\n\t}\n\n\tpublic unwrap(): T {\n\t\tif (this.isOk()) return this.value;\n\t\tthrow this.error as Error;\n\t}\n\n\tpublic static ok<T, E extends Error = Error>(value: T): Result<T, E> {\n\t\treturn new Result<T, E>(true, value);\n\t}\n\n\tpublic static err<T, E extends Error = Error>(error: E): Result<T, E> {\n\t\treturn new Result<T, E>(false, undefined, error);\n\t}\n}\n","// https://github.com/microsoft/TypeScript/issues/37663\ntype Fn = (...args: unknown[]) => unknown;\n\nexport function getValue<T, U = T extends Fn ? ReturnType<T> : T>(valueOrFn: T): U {\n\treturn typeof valueOrFn === 'function' ? valueOrFn() : valueOrFn;\n}\n","import get from 'lodash/get.js';\nimport { ExpectedConstraintError } from '../lib/errors/ExpectedConstraintError';\nimport { Result } from '../lib/Result';\nimport type { BaseValidator } from '../type-exports';\nimport type { IConstraint } from './type-exports';\n\nexport type ObjectConstraintName = `s.object(T.when)`;\n\nexport type WhenKey = PropertyKey | PropertyKey[];\n\nexport interface WhenOptions<T extends BaseValidator<any>, Key extends WhenKey> {\n\tis?: boolean | ((value: Key extends Array<any> ? any[] : any) => boolean);\n\tthen: (predicate: T) => T;\n\totherwise?: (predicate: T) => T;\n}\n\nexport function whenConstraint<T extends BaseValidator<any>, I, Key extends WhenKey>(\n\tkey: Key,\n\toptions: WhenOptions<T, Key>,\n\tvalidator: T\n): IConstraint<I> {\n\treturn {\n\t\trun(input: I, parent?: any) {\n\t\t\tif (!parent) {\n\t\t\t\treturn Result.err(new ExpectedConstraintError('s.object(T.when)', 'Validator has no parent', parent, 'Validator to have a parent'));\n\t\t\t}\n\n\t\t\tconst isKeyArray = Array.isArray(key);\n\n\t\t\tconst value = isKeyArray ? key.map((k) => get(parent, k)) : get(parent, key);\n\n\t\t\tconst predicate = resolveBooleanIs<T, Key>(options, value, isKeyArray) ? options.then : options.otherwise;\n\n\t\t\tif (predicate) {\n\t\t\t\treturn predicate(validator).run(input) as Result<I, ExpectedConstraintError<I>>;\n\t\t\t}\n\n\t\t\treturn Result.ok(input);\n\t\t}\n\t};\n}\n\nfunction resolveBooleanIs<T extends BaseValidator<any>, Key extends WhenKey>(options: WhenOptions<T, Key>, value: any, isKeyArray: boolean) {\n\tif (options.is === undefined) {\n\t\treturn isKeyArray ? !value.some((val: any) => !val) : Boolean(value);\n\t}\n\n\tif (typeof options.is === 'function') {\n\t\treturn options.is(value);\n\t}\n\n\treturn value === options.is;\n}\n","import { inspect, type InspectOptionsStylized } from 'node:util';\nimport { customInspectSymbolStackLess } from './BaseError';\nimport { BaseConstraintError, type ConstraintErrorNames } from './BaseConstraintError';\n\nexport class ExpectedConstraintError<T = unknown> extends BaseConstraintError<T> {\n\tpublic readonly expected: string;\n\n\tpublic constructor(constraint: ConstraintErrorNames, message: string, given: T, expected: string) {\n\t\tsuper(constraint, message, given);\n\t\tthis.expected = expected;\n\t}\n\n\tpublic toJSON() {\n\t\treturn {\n\t\t\tname: this.name,\n\t\t\tconstraint: this.constraint,\n\t\t\tgiven: this.given,\n\t\t\texpected: this.expected\n\t\t};\n\t}\n\n\tprotected [customInspectSymbolStackLess](depth: number, options: InspectOptionsStylized): string {\n\t\tconst constraint = options.stylize(this.constraint, 'string');\n\t\tif (depth < 0) {\n\t\t\treturn options.stylize(`[ExpectedConstraintError: ${constraint}]`, 'special');\n\t\t}\n\n\t\tconst newOptions = { ...options, depth: options.depth === null ? null : options.depth! - 1 };\n\n\t\tconst padding = `\\n ${options.stylize('|', 'undefined')} `;\n\t\tconst given = inspect(this.given, newOptions).replace(/\\n/g, padding);\n\n\t\tconst header = `${options.stylize('ExpectedConstraintError', 'special')} > ${constraint}`;\n\t\tconst message = options.stylize(this.message, 'regexp');\n\t\tconst expectedBlock = `\\n ${options.stylize('Expected: ', 'string')}${options.stylize(this.expected, 'boolean')}`;\n\t\tconst givenBlock = `\\n ${options.stylize('Received:', 'regexp')}${padding}${given}`;\n\t\treturn `${header}\\n ${message}\\n${expectedBlock}\\n${givenBlock}`;\n\t}\n}\n","import type { InspectOptionsStylized } from 'node:util';\n\nexport const customInspectSymbol = Symbol.for('nodejs.util.inspect.custom');\nexport const customInspectSymbolStackLess = Symbol.for('nodejs.util.inspect.custom.stack-less');\n\nexport abstract class BaseError extends Error {\n\tprotected [customInspectSymbol](depth: number, options: InspectOptionsStylized) {\n\t\treturn `${this[customInspectSymbolStackLess](depth, options)}\\n${this.stack!.slice(this.stack!.indexOf('\\n'))}`;\n\t}\n\n\tprotected abstract [customInspectSymbolStackLess](depth: number, options: InspectOptionsStylized): string;\n}\n","import type {\n\tArrayConstraintName,\n\tBigIntConstraintName,\n\tBooleanConstraintName,\n\tDateConstraintName,\n\tNumberConstraintName,\n\tObjectConstraintName,\n\tStringConstraintName,\n\tTypedArrayConstraintName\n} from '../../constraints/type-exports';\nimport { BaseError } from './BaseError';\n\nexport type ConstraintErrorNames =\n\t| TypedArrayConstraintName\n\t| ArrayConstraintName\n\t| BigIntConstraintName\n\t| BooleanConstraintName\n\t| DateConstraintName\n\t| NumberConstraintName\n\t| ObjectConstraintName\n\t| StringConstraintName;\n\nexport abstract class BaseConstraintError<T = unknown> extends BaseError {\n\tpublic readonly constraint: ConstraintErrorNames;\n\tpublic readonly given: T;\n\n\tpublic constructor(constraint: ConstraintErrorNames, message: string, given: T) {\n\t\tsuper(message);\n\t\tthis.constraint = constraint;\n\t\tthis.given = given;\n\t}\n}\n","import { getGlobalValidationEnabled } from '../lib/configs';\nimport { Result } from '../lib/Result';\nimport { ArrayValidator, DefaultValidator, LiteralValidator, NullishValidator, SetValidator, UnionValidator } from './imports';\nimport { getValue } from './util/getValue';\nimport { whenConstraint, type WhenKey, type WhenOptions } from '../constraints/ObjectConstrains';\nimport type { CombinedError } from '../lib/errors/CombinedError';\nimport type { CombinedPropertyError } from '../lib/errors/CombinedPropertyError';\nimport type { UnknownEnumValueError } from '../lib/errors/UnknownEnumValueError';\nimport type { ValidationError } from '../lib/errors/ValidationError';\nimport type { BaseConstraintError, InferResultType } from '../type-exports';\nimport type { IConstraint } from '../constraints/base/IConstraint';\nimport type { BaseError } from '../lib/errors/BaseError';\n\nexport abstract class BaseValidator<T> {\n\tprotected parent?: object;\n\tprotected constraints: readonly IConstraint<T>[] = [];\n\tprotected isValidationEnabled: boolean | (() => boolean) | null = null;\n\n\tpublic constructor(constraints: readonly IConstraint<T>[] = []) {\n\t\tthis.constraints = constraints;\n\t}\n\n\tpublic setParent(parent: object): this {\n\t\tthis.parent = parent;\n\t\treturn this;\n\t}\n\n\tpublic get optional(): UnionValidator<T | undefined> {\n\t\treturn new UnionValidator([new LiteralValidator(undefined), this.clone()]);\n\t}\n\n\tpublic get nullable(): UnionValidator<T | null> {\n\t\treturn new UnionValidator([new LiteralValidator(null), this.clone()]);\n\t}\n\n\tpublic get nullish(): UnionValidator<T | null | undefined> {\n\t\treturn new UnionValidator([new NullishValidator(), this.clone()]);\n\t}\n\n\tpublic get array(): ArrayValidator<T[]> {\n\t\treturn new ArrayValidator<T[]>(this.clone());\n\t}\n\n\tpublic get set(): SetValidator<T> {\n\t\treturn new SetValidator<T>(this.clone());\n\t}\n\n\tpublic or<O>(...predicates: readonly BaseValidator<O>[]): UnionValidator<T | O> {\n\t\treturn new UnionValidator<T | O>([this.clone(), ...predicates]);\n\t}\n\n\tpublic transform(cb: (value: T) => T): this;\n\tpublic transform<O>(cb: (value: T) => O): BaseValidator<O>;\n\tpublic transform<O>(cb: (value: T) => O): BaseValidator<O> {\n\t\treturn this.addConstraint({ run: (input) => Result.ok(cb(input) as unknown as T) }) as unknown as BaseValidator<O>;\n\t}\n\n\tpublic reshape(cb: (input: T) => Result<T>): this;\n\tpublic reshape<R extends Result<unknown>, O = InferResultType<R>>(cb: (input: T) => R): BaseValidator<O>;\n\tpublic reshape<R extends Result<unknown>, O = InferResultType<R>>(cb: (input: T) => R): BaseValidator<O> {\n\t\treturn this.addConstraint({ run: cb as unknown as (input: T) => Result<T, BaseConstraintError<T>> }) as unknown as BaseValidator<O>;\n\t}\n\n\tpublic default(value: Exclude<T, undefined> | (() => Exclude<T, undefined>)): DefaultValidator<Exclude<T, undefined>> {\n\t\treturn new DefaultValidator(this.clone() as unknown as BaseValidator<Exclude<T, undefined>>, value);\n\t}\n\n\tpublic when<Key extends WhenKey, This extends BaseValidator<any> = this>(key: Key, options: WhenOptions<This, Key>): this {\n\t\treturn this.addConstraint(whenConstraint<This, T, Key>(key, options, this as unknown as This));\n\t}\n\n\tpublic run(value: unknown): Result<T, BaseError> {\n\t\tlet result = this.handle(value) as Result<T, BaseError>;\n\t\tif (result.isErr()) return result;\n\n\t\tfor (const constraint of this.constraints) {\n\t\t\tresult = constraint.run(result.value as T, this.parent);\n\t\t\tif (result.isErr()) break;\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tpublic parse<R extends T = T>(value: unknown): R {\n\t\t// If validation is disabled (at the validator or global level), we only run the `handle` method, which will do some basic checks\n\t\t// (like that the input is a string for a string validator)\n\t\tif (!this.shouldRunConstraints) {\n\t\t\treturn this.handle(value).unwrap() as R;\n\t\t}\n\n\t\treturn this.constraints.reduce((v, constraint) => constraint.run(v).unwrap(), this.handle(value).unwrap()) as R;\n\t}\n\n\tpublic is<R extends T = T>(value: unknown): value is R {\n\t\treturn this.run(value).isOk();\n\t}\n\n\t/**\n\t * Sets if the validator should also run constraints or just do basic checks.\n\t * @param isValidationEnabled Whether this validator should be enabled or disabled. You can pass boolean or a function returning boolean which will be called just before parsing.\n\t * Set to `null` to go off of the global configuration.\n\t */\n\tpublic setValidationEnabled(isValidationEnabled: boolean | (() => boolean) | null): this {\n\t\tconst clone = this.clone();\n\t\tclone.isValidationEnabled = isValidationEnabled;\n\t\treturn clone;\n\t}\n\n\tpublic getValidationEnabled() {\n\t\treturn getValue(this.isValidationEnabled);\n\t}\n\n\tprotected get shouldRunConstraints(): boolean {\n\t\treturn getValue(this.isValidationEnabled) ?? getGlobalValidationEnabled();\n\t}\n\n\tprotected clone(): this {\n\t\tconst clone: this = Reflect.construct(this.constructor, [this.constraints]);\n\t\tclone.isValidationEnabled = this.isValidationEnabled;\n\t\treturn clone;\n\t}\n\n\tprotected abstract handle(value: unknown): Result<T, ValidatorError>;\n\n\tprotected addConstraint(constraint: IConstraint<T>): this {\n\t\tconst clone = this.clone();\n\t\tclone.constraints = clone.constraints.concat(constraint);\n\t\treturn clone;\n\t}\n}\n\nexport type ValidatorError = ValidationError | CombinedError | CombinedPropertyError | UnknownEnumValueError;\n","import fastDeepEqual from 'fast-deep-equal/es6/index.js';\nimport uniqWith from 'lodash/uniqWith.js';\n\nexport function isUnique(input: unknown[]) {\n\tif (input.length < 2) return true;\n\tconst uniqueArray = uniqWith(input, fastDeepEqual);\n\treturn uniqueArray.length === input.length;\n}\n","export function lessThan(a: number, b: number): boolean;\nexport function lessThan(a: bigint, b: bigint): boolean;\nexport function lessThan(a: number | bigint, b: number | bigint): boolean {\n\treturn a < b;\n}\n\nexport function lessThanOrEqual(a: number, b: number): boolean;\nexport function lessThanOrEqual(a: bigint, b: bigint): boolean;\nexport function lessThanOrEqual(a: number | bigint, b: number | bigint): boolean {\n\treturn a <= b;\n}\n\nexport function greaterThan(a: number, b: number): boolean;\nexport function greaterThan(a: bigint, b: bigint): boolean;\nexport function greaterThan(a: number | bigint, b: number | bigint): boolean {\n\treturn a > b;\n}\n\nexport function greaterThanOrEqual(a: number, b: number): boolean;\nexport function greaterThanOrEqual(a: bigint, b: bigint): boolean;\nexport function greaterThanOrEqual(a: number | bigint, b: number | bigint): boolean {\n\treturn a >= b;\n}\n\nexport function equal(a: number, b: number): boolean;\nexport function equal(a: bigint, b: bigint): boolean;\nexport function equal(a: number | bigint, b: number | bigint): boolean {\n\treturn a === b;\n}\n\nexport function notEqual(a: number, b: number): boolean;\nexport function notEqual(a: bigint, b: bigint): boolean;\nexport function notEqual(a: number | bigint, b: number | bigint): boolean {\n\treturn a !== b;\n}\n\nexport interface Comparator {\n\t(a: number, b: number): boolean;\n\t(a: bigint, b: bigint): boolean;\n}\n","import { ExpectedConstraintError } from '../lib/errors/ExpectedConstraintError';\nimport { Result } from '../lib/Result';\nimport type { IConstraint } from './base/IConstraint';\nimport { isUnique } from './util/isUnique';\nimport { Comparator, equal, greaterThan, greaterThanOrEqual, lessThan, lessThanOrEqual, notEqual } from './util/operators';\n\nexport type ArrayConstraintName = `s.array(T).${\n\t| 'unique'\n\t| `length${\n\t\t\t| 'LessThan'\n\t\t\t| 'LessThanOrEqual'\n\t\t\t| 'GreaterThan'\n\t\t\t| 'GreaterThanOrEqual'\n\t\t\t| 'Equal'\n\t\t\t| 'NotEqual'\n\t\t\t| 'Range'\n\t\t\t| 'RangeInclusive'\n\t\t\t| 'RangeExclusive'}`}`;\n\nfunction arrayLengthComparator<T>(comparator: Comparator, name: ArrayConstraintName, expected: string, length: number): IConstraint<T[]> {\n\treturn {\n\t\trun(input: T[]) {\n\t\t\treturn comparator(input.length, length) //\n\t\t\t\t? Result.ok(input)\n\t\t\t\t: Result.err(new ExpectedConstraintError(name, 'Invalid Array length', input, expected));\n\t\t}\n\t};\n}\n\nexport function arrayLengthLessThan<T>(value: number): IConstraint<T[]> {\n\tconst expected = `expected.length < ${value}`;\n\treturn arrayLengthComparator(lessThan, 's.array(T).lengthLessThan', expected, value);\n}\n\nexport function arrayLengthLessThanOrEqual<T>(value: number): IConstraint<T[]> {\n\tconst expected = `expected.length <= ${value}`;\n\treturn arrayLengthComparator(lessThanOrEqual, 's.array(T).lengthLessThanOrEqual', expected, value);\n}\n\nexport function arrayLengthGreaterThan<T>(value: number): IConstraint<T[]> {\n\tconst expected = `expected.length > ${value}`;\n\treturn arrayLengthComparator(greaterThan, 's.array(T).lengthGreaterThan', expected, value);\n}\n\nexport function arrayLengthGreaterThanOrEqual<T>(value: number): IConstraint<T[]> {\n\tconst expected = `expected.length >= ${value}`;\n\treturn arrayLengthComparator(greaterThanOrEqual, 's.array(T).lengthGreaterThanOrEqual', expected, value);\n}\n\nexport function arrayLengthEqual<T>(value: number): IConstraint<T[]> {\n\tconst expected = `expected.length === ${value}`;\n\treturn arrayLengthComparator(equal, 's.array(T).lengthEqual', expected, value);\n}\n\nexport function arrayLengthNotEqual<T>(value: number): IConstraint<T[]> {\n\tconst expected = `expected.length !== ${value}`;\n\treturn arrayLengthComparator(notEqual, 's.array(T).lengthNotEqual', expected, value);\n}\n\nexport function arrayLengthRange<T>(start: number, endBefore: number): IConstraint<T[]> {\n\tconst expected = `expected.length >= ${start} && expected.length < ${endBefore}`;\n\treturn {\n\t\trun(input: T[]) {\n\t\t\treturn input.length >= start && input.length < endBefore //\n\t\t\t\t? Result.ok(input)\n\t\t\t\t: Result.err(new ExpectedConstraintError('s.array(T).lengthRange', 'Invalid Array length', input, expected));\n\t\t}\n\t};\n}\n\nexport function arrayLengthRangeInclusive<T>(start: number, end: number): IConstraint<T[]> {\n\tconst expected = `expected.length >= ${start} && expected.length <= ${end}`;\n\treturn {\n\t\trun(input: T[]) {\n\t\t\treturn input.length >= start && input.length <= end //\n\t\t\t\t? Result.ok(input)\n\t\t\t\t: Result.err(new ExpectedConstraintError('s.array(T).lengthRangeInclusive', 'Invalid Array length', input, expected));\n\t\t}\n\t};\n}\n\nexport function arrayLengthRangeExclusive<T>(startAfter: number, endBefore: number): IConstraint<T[]> {\n\tconst expected = `expected.length > ${startAfter} && expected.length < ${endBefore}`;\n\treturn {\n\t\trun(input: T[]) {\n\t\t\treturn input.length > startAfter && input.length < endBefore //\n\t\t\t\t? Result.ok(input)\n\t\t\t\t: Result.err(new ExpectedConstraintError('s.array(T).lengthRangeExclusive', 'Invalid Array length', input, expected));\n\t\t}\n\t};\n}\n\nexport const uniqueArray: IConstraint<unknown[]> = {\n\trun(input: unknown[]) {\n\t\treturn isUnique(input) //\n\t\t\t? Result.ok(input)\n\t\t\t: Result.err(new ExpectedConstraintError('s.array(T).unique', 'Array values are not unique', input, 'Expected all values to be unique'));\n\t}\n};\n","import type { InspectOptionsStylized } from 'node:util';\nimport { BaseError, customInspectSymbolStackLess } from './BaseError';\n\nexport class CombinedPropertyError extends BaseError {\n\tpublic readonly errors: [PropertyKey, BaseError][];\n\n\tpublic constructor(errors: [PropertyKey, BaseError][]) {\n\t\tsuper('Received one or more errors');\n\n\t\tthis.errors = errors;\n\t}\n\n\tprotected [customInspectSymbolStackLess](depth: number, options: InspectOptionsStylized): string {\n\t\tif (depth < 0) {\n\t\t\treturn options.stylize('[CombinedPropertyError]', 'special');\n\t\t}\n\n\t\tconst newOptions = { ...options, depth: options.depth === null ? null : options.depth! - 1, compact: true };\n\n\t\tconst padding = `\\n ${options.stylize('|', 'undefined')} `;\n\n\t\tconst header = `${options.stylize('CombinedPropertyError', 'special')} (${options.stylize(this.errors.length.toString(), 'number')})`;\n\t\tconst message = options.stylize(this.message, 'regexp');\n\t\tconst errors = this.errors\n\t\t\t.map(([key, error]) => {\n\t\t\t\tconst property = CombinedPropertyError.formatProperty(key, options);\n\t\t\t\tconst body = error[customInspectSymbolStackLess](depth - 1, newOptions).replace(/\\n/g, padding);\n\n\t\t\t\treturn ` input${property}${padding}${body}`;\n\t\t\t})\n\t\t\t.join('\\n\\n');\n\t\treturn `${header}\\n ${message}\\n\\n${errors}`;\n\t}\n\n\tprivate static formatProperty(key: PropertyKey, options: InspectOptionsStylized): string {\n\t\tif (typeof key === 'string') return options.stylize(`.${key}`, 'symbol');\n\t\tif (typeof key === 'number') return `[${options.stylize(key.toString(), 'number')}]`;\n\t\treturn `[${options.stylize('Symbol', 'symbol')}(${key.description})]`;\n\t}\n}\n","import { inspect, type InspectOptionsStylized } from 'node:util';\nimport { BaseError, customInspectSymbolStackLess } from './BaseError';\n\nexport class ValidationError extends BaseError {\n\tpublic readonly validator: string;\n\tpublic readonly given: unknown;\n\n\tpublic constructor(validator: string, message: string, given: unknown) {\n\t\tsuper(message);\n\n\t\tthis.validator = validator;\n\t\tthis.given = given;\n\t}\n\n\tpublic toJSON() {\n\t\treturn {\n\t\t\tname: this.name,\n\t\t\tvalidator: this.validator,\n\t\t\tgiven: this.given\n\t\t};\n\t}\n\n\tprotected [customInspectSymbolStackLess](depth: number, options: InspectOptionsStylized): string {\n\t\tconst validator = options.stylize(this.validator, 'string');\n\t\tif (depth < 0) {\n\t\t\treturn options.stylize(`[ValidationError: ${validator}]`, 'special');\n\t\t}\n\n\t\tconst newOptions = { ...options, depth: options.depth === null ? null : options.depth! - 1, compact: true };\n\n\t\tconst padding = `\\n ${options.stylize('|', 'undefined')} `;\n\t\tconst given = inspect(this.given, newOptions).replace(/\\n/g, padding);\n\n\t\tconst header = `${options.stylize('ValidationError', 'special')} > ${validator}`;\n\t\tconst message = options.stylize(this.message, 'regexp');\n\t\tconst givenBlock = `\\n ${options.stylize('Received:', 'regexp')}${padding}${given}`;\n\t\treturn `${header}\\n ${message}\\n${givenBlock}`;\n\t}\n}\n","import {\n\tarrayLengthEqual,\n\tarrayLengthGreaterThan,\n\tarrayLengthGreaterThanOrEqual,\n\tarrayLengthLessThan,\n\tarrayLengthLessThanOrEqual,\n\tarrayLengthNotEqual,\n\tarrayLengthRange,\n\tarrayLengthRangeExclusive,\n\tarrayLengthRangeInclusive,\n\tuniqueArray\n} from '../constraints/ArrayConstraints';\nimport type { IConstraint } from '../constraints/base/IConstraint';\nimport type { BaseError } from '../lib/errors/BaseError';\nimport { CombinedPropertyError } from '../lib/errors/CombinedPropertyError';\nimport { ValidationError } from '../lib/errors/ValidationError';\nimport { Result } from '../lib/Result';\nimport type { ExpandSmallerTuples, Tuple, UnshiftTuple } from '../lib/util-types';\nimport { BaseValidator } from './imports';\n\nexport class ArrayValidator<T extends unknown[], I = T[number]> extends BaseValidator<T> {\n\tprivate readonly validator: BaseValidator<I>;\n\n\tpublic constructor(validator: BaseValidator<I>, constraints: readonly IConstraint<T>[] = []) {\n\t\tsuper(constraints);\n\t\tthis.validator = validator;\n\t}\n\n\tpublic lengthLessThan<N extends number>(length: N): ArrayValidator<ExpandSmallerTuples<UnshiftTuple<[...Tuple<I, N>]>>> {\n\t\treturn this.addConstraint(arrayLengthLessThan(length) as IConstraint<T>) as any;\n\t}\n\n\tpublic lengthLessThanOrEqual<N extends number>(length: N): ArrayValidator<ExpandSmallerTuples<[...Tuple<I, N>]>> {\n\t\treturn this.addConstraint(arrayLengthLessThanOrEqual(length) as IConstraint<T>) as any;\n\t}\n\n\tpublic lengthGreaterThan<N extends number>(length: N): ArrayValidator<[...Tuple<I, N>, I, ...T]> {\n\t\treturn this.addConstraint(arrayLengthGreaterThan(length) as IConstraint<T>) as any;\n\t}\n\n\tpublic lengthGreaterThanOrEqual<N extends number>(length: N): ArrayValidator<[...Tuple<I, N>, ...T]> {\n\t\treturn this.addConstraint(arrayLengthGreaterThanOrEqual(length) as IConstraint<T>) as any;\n\t}\n\n\tpublic lengthEqual<N extends number>(length: N): ArrayValidator<[...Tuple<I, N>]> {\n\t\treturn this.addConstraint(arrayLengthEqual(length) as IConstraint<T>) as any;\n\t}\n\n\tpublic lengthNotEqual(length: number): ArrayValidator<[...T]> {\n\t\treturn this.addConstraint(arrayLengthNotEqual(length) as IConstraint<T>) as any;\n\t}\n\n\tpublic lengthRange<S extends number, E extends number>(\n\t\tstart: S,\n\t\tendBefore: E\n\t): ArrayValidator<Exclude<ExpandSmallerTuples<UnshiftTuple<[...Tuple<I, E>]>>, ExpandSmallerTuples<UnshiftTuple<[...Tuple<I, S>]>>>> {\n\t\treturn this.addConstraint(arrayLengthRange(start, endBefore) as IConstraint<T>) as any;\n\t}\n\n\tpublic lengthRangeInclusive<S extends number, E extends number>(\n\t\tstartAt: S,\n\t\tendAt: E\n\t): ArrayValidator<Exclude<ExpandSmallerTuples<[...Tuple<I, E>]>, ExpandSmallerTuples<UnshiftTuple<[...Tuple<I, S>]>>>> {\n\t\treturn this.addConstraint(arrayLengthRangeInclusive(startAt, endAt) as IConstraint<T>) as any;\n\t}\n\n\tpublic lengthRangeExclusive<S extends number, E extends number>(\n\t\tstartAfter: S,\n\t\tendBefore: E\n\t): ArrayValidator<Exclude<ExpandSmallerTuples<UnshiftTuple<[...Tuple<I, E>]>>, ExpandSmallerTuples<[...Tuple<T, S>]>>> {\n\t\treturn this.addConstraint(arrayLengthRangeExclusive(startAfter, endBefore) as IConstraint<T>) as any;\n\t}\n\n\tpublic get unique(): this {\n\t\treturn this.addConstraint(uniqueArray as IConstraint<T>);\n\t}\n\n\tprotected override clone(): this {\n\t\treturn Reflect.construct(this.constructor, [this.validator, this.constraints]);\n\t}\n\n\tprotected handle(values: unknown): Result<T, ValidationError | CombinedPropertyError> {\n\t\tif (!Array.isArray(values)) {\n\t\t\treturn Result.err(new ValidationError('s.array(T)', 'Expected an array', values));\n\t\t}\n\n\t\tif (!this.shouldRunConstraints) {\n\t\t\treturn Result.ok(values as T);\n\t\t}\n\n\t\tconst errors: [number, BaseError][] = [];\n\t\tconst transformed: T = [] as unknown as T;\n\n\t\tfor (let i = 0; i < values.length; i++) {\n\t\t\tconst result = this.validator.run(values[i]);\n\t\t\tif (result.isOk()) transformed.push(result.value);\n\t\t\telse errors.push([i, result.error!]);\n\t\t}\n\n\t\treturn errors.length === 0 //\n\t\t\t? Result.ok(transformed)\n\t\t\t: Result.err(new CombinedPropertyError(errors));\n\t}\n}\n","import { ExpectedConstraintError } from '../lib/errors/ExpectedConstraintError';\nimport { Result } from '../lib/Result';\nimport type { IConstraint } from './base/IConstraint';\nimport { Comparator, equal, greaterThan, greaterThanOrEqual, lessThan, lessThanOrEqual, notEqual } from './util/operators';\n\nexport type BigIntConstraintName = `s.bigint.${\n\t| 'lessThan'\n\t| 'lessThanOrEqual'\n\t| 'greaterThan'\n\t| 'greaterThanOrEqual'\n\t| 'equal'\n\t| 'notEqual'\n\t| 'divisibleBy'}`;\n\nfunction bigintComparator(comparator: Comparator, name: BigIntConstraintName, expected: string, number: bigint): IConstraint<bigint> {\n\treturn {\n\t\trun(input: bigint) {\n\t\t\treturn comparator(input, number) //\n\t\t\t\t? Result.ok(input)\n\t\t\t\t: Result.err(new ExpectedConstraintError(name, 'Invalid bigint value', input, expected));\n\t\t}\n\t};\n}\n\nexport function bigintLessThan(value: bigint): IConstraint<bigint> {\n\tconst expected = `expected < ${value}n`;\n\treturn bigintComparator(lessThan, 's.bigint.lessThan', expected, value);\n}\n\nexport function bigintLessThanOrEqual(value: bigint): IConstraint<bigint> {\n\tconst expected = `expected <= ${value}n`;\n\treturn bigintComparator(lessThanOrEqual, 's.bigint.lessThanOrEqual', expected, value);\n}\n\nexport function bigintGreaterThan(value: bigint): IConstraint<bigint> {\n\tconst expected = `expected > ${value}n`;\n\treturn bigintComparator(greaterThan, 's.bigint.greaterThan', expected, value);\n}\n\nexport function bigintGreaterThanOrEqual(value: bigint): IConstraint<bigint> {\n\tconst expected = `expected >= ${value}n`;\n\treturn bigintComparator(greaterThanOrEqual, 's.bigint.greaterThanOrEqual', expected, value);\n}\n\nexport function bigintEqual(value: bigint): IConstraint<bigint> {\n\tconst expected = `expected === ${value}n`;\n\treturn bigintComparator(equal, 's.bigint.equal', expected, value);\n}\n\nexport function bigintNotEqual(value: bigint): IConstraint<bigint> {\n\tconst expected = `expected !== ${value}n`;\n\treturn bigintComparator(notEqual, 's.bigint.notEqual', expected, value);\n}\n\nexport function bigintDivisibleBy(divider: bigint): IConstraint<bigint> {\n\tconst expected = `expected % ${divider}n === 0n`;\n\treturn {\n\t\trun(input: bigint) {\n\t\t\treturn input % divider === 0n //\n\t\t\t\t? Result.ok(input)\n\t\t\t\t: Result.err(new ExpectedConstraintError('s.bigint.divisibleBy', 'BigInt is not divisible', input, expected));\n\t\t}\n\t};\n}\n","import type { IConstraint } from '../constraints/base/IConstraint';\nimport {\n\tbigintDivisibleBy,\n\tbigintEqual,\n\tbigintGreaterThan,\n\tbigintGreaterThanOrEqual,\n\tbigintLessThan,\n\tbigintLessThanOrEqual,\n\tbigintNotEqual\n} from '../constraints/BigIntConstraints';\nimport { ValidationError } from '../lib/errors/ValidationError';\nimport { Result } from '../lib/Result';\nimport { BaseValidator } from './imports';\n\nexport class BigIntValidator<T extends bigint> extends BaseValidator<T> {\n\tpublic lessThan(number: bigint): this {\n\t\treturn this.addConstraint(bigintLessThan(number) as IConstraint<T>);\n\t}\n\n\tpublic lessThanOrEqual(number: bigint): this {\n\t\treturn this.addConstraint(bigintLessThanOrEqual(number) as IConstraint<T>);\n\t}\n\n\tpublic greaterThan(number: bigint): this {\n\t\treturn this.addConstraint(bigintGreaterThan(number) as IConstraint<T>);\n\t}\n\n\tpublic greaterThanOrEqual(number: bigint): this {\n\t\treturn this.addConstraint(bigintGreaterThanOrEqual(number) as IConstraint<T>);\n\t}\n\n\tpublic equal<N extends bigint>(number: N): BigIntValidator<N> {\n\t\treturn this.addConstraint(bigintEqual(number) as IConstraint<T>) as unknown as BigIntValidator<N>;\n\t}\n\n\tpublic notEqual(number: bigint): this {\n\t\treturn this.addConstraint(bigintNotEqual(number) as IConstraint<T>);\n\t}\n\n\tpublic get positive(): this {\n\t\treturn this.greaterThanOrEqual(0n);\n\t}\n\n\tpublic get negative(): this {\n\t\treturn this.lessThan(0n);\n\t}\n\n\tpublic divisibleBy(number: bigint): this {\n\t\treturn this.addConstraint(bigintDivisibleBy(number) as IConstraint<T>);\n\t}\n\n\tpublic get abs(): this {\n\t\treturn this.transform((value) => (value < 0 ? -value : value) as T);\n\t}\n\n\tpublic intN(bits: number): this {\n\t\treturn this.transform((value) => BigInt.asIntN(bits, value) as T);\n\t}\n\n\tpublic uintN(bits: number): this {\n\t\treturn this.transform((value) => BigInt.asUintN(bits, value) as T);\n\t}\n\n\tprotected handle(value: unknown): Result<T, ValidationError> {\n\t\treturn typeof value === 'bigint' //\n\t\t\t? Result.ok(value as T)\n\t\t\t: Result.err(new ValidationError('s.bigint', 'Expected a bigint primitive', value));\n\t}\n}\n","import { ExpectedConstraintError } from '../lib/errors/ExpectedConstraintError';\nimport { Result } from '../lib/Result';\nimport type { IConstraint } from './base/IConstraint';\n\nexport type BooleanConstraintName = `s.boolean.${boolean}`;\n\nexport const booleanTrue: IConstraint<boolean, true> = {\n\trun(input: boolean) {\n\t\treturn input //\n\t\t\t? Result.ok(input)\n\t\t\t: Result.err(new ExpectedConstraintError('s.boolean.true', 'Invalid boolean value', input, 'true'));\n\t}\n};\n\nexport const booleanFalse: IConstraint<boolean, false> = {\n\trun(input: boolean) {\n\t\treturn input //\n\t\t\t? Result.err(new ExpectedConstraintError('s.boolean.false', 'Invalid boolean value', input, 'false'))\n\t\t\t: Result.ok(input);\n\t}\n};\n","import type { IConstraint } from '../constraints/base/IConstraint';\nimport { booleanFalse, booleanTrue } from '../constraints/BooleanConstraints';\nimport { ValidationError } from '../lib/errors/ValidationError';\nimport { Result } from '../lib/Result';\nimport { BaseValidator } from './imports';\n\nexport class BooleanValidator<T extends boolean = boolean> extends BaseValidator<T> {\n\tpublic get true(): BooleanValidator<true> {\n\t\treturn this.addConstraint(booleanTrue as IConstraint<T>) as BooleanValidator<true>;\n\t}\n\n\tpublic get false(): BooleanValidator<false> {\n\t\treturn this.addConstraint(booleanFalse as IConstraint<T>) as BooleanValidator<false>;\n\t}\n\n\tpublic equal<R extends true | false>(value: R): BooleanValidator<R> {\n\t\treturn (value ? this.true : this.false) as BooleanValidator<R>;\n\t}\n\n\tpublic notEqual<R extends true | false>(value: R): BooleanValidator<R> {\n\t\treturn (value ? this.false : this.true) as BooleanValidator<R>;\n\t}\n\n\tprotected handle(value: unknown): Result<T, ValidationError> {\n\t\treturn typeof value === 'boolean' //\n\t\t\t? Result.ok(value as T)\n\t\t\t: Result.err(new ValidationError('s.boolean', 'Expected a boolean primitive', value));\n\t}\n}\n","import { ExpectedConstraintError } from '../lib/errors/ExpectedConstraintError';\nimport { Result } from '../lib/Result';\nimport type { IConstraint } from './base/IConstraint';\nimport { Comparator, equal, greaterThan, greaterThanOrEqual, lessThan, lessThanOrEqual, notEqual } from './util/operators';\n\nexport type DateConstraintName = `s.date.${\n\t| 'lessThan'\n\t| 'lessThanOrEqual'\n\t| 'greaterThan'\n\t| 'greaterThanOrEqual'\n\t| 'equal'\n\t| 'notEqual'\n\t| 'valid'\n\t| 'invalid'}`;\n\nfunction dateComparator(comparator: Comparator, name: DateConstraintName, expected: string, number: number): IConstraint<Date> {\n\treturn {\n\t\trun(input: Date) {\n\t\t\treturn comparator(input.getTime(), number) //\n\t\t\t\t? Result.ok(input)\n\t\t\t\t: Result.err(new ExpectedConstraintError(name, 'Invalid Date value', input, expected));\n\t\t}\n\t};\n}\n\nexport function dateLessThan(value: Date): IConstraint<Date> {\n\tconst expected = `expected < ${value.toISOString()}`;\n\treturn dateComparator(lessThan, 's.date.lessThan', expected, value.getTime());\n}\n\nexport function dateLessThanOrEqual(value: Date): IConstraint<Date> {\n\tconst expected = `expected <= ${value.toISOString()}`;\n\treturn dateComparator(lessThanOrEqual, 's.date.lessThanOrEqual', expected, value.getTime());\n}\n\nexport function dateGreaterThan(value: Date): IConstraint<Date> {\n\tconst expected = `expected > ${value.toISOString()}`;\n\treturn dateComparator(greaterThan, 's.date.greaterThan', expected, value.getTime());\n}\n\nexport function dateGreaterThanOrEqual(value: Date): IConstraint<Date> {\n\tconst expected = `expected >= ${value.toISOString()}`;\n\treturn dateComparator(greaterThanOrEqual, 's.date.greaterThanOrEqual', expected, value.getTime());\n}\n\nexport function dateEqual(value: Date): IConstraint<Date> {\n\tconst expected = `expected === ${value.toISOString()}`;\n\treturn dateComparator(equal, 's.date.equal', expected, value.getTime());\n}\n\nexport function dateNotEqual(value: Date): IConstraint<Date> {\n\tconst expected = `expected !== ${value.toISOString()}`;\n\treturn dateComparator(notEqual, 's.date.notEqual', expected, value.getTime());\n}\n\nexport const dateInvalid: IConstraint<Date> = {\n\trun(input: Date) {\n\t\treturn Number.isNaN(input.getTime()) //\n\t\t\t? Result.ok(input)\n\t\t\t: Result.err(new ExpectedConstraintError('s.date.invalid', 'Invalid Date value', input, 'expected === NaN'));\n\t}\n};\n\nexport const dateValid: IConstraint<Date> = {\n\trun(input: Date) {\n\t\treturn Number.isNaN(input.getTime()) //\n\t\t\t? Result.err(new ExpectedConstraintError('s.date.valid', 'Invalid Date value', input, 'expected !== NaN'))\n\t\t\t: Result.ok(input);\n\t}\n};\n","import {\n\tdateEqual,\n\tdateGreaterThan,\n\tdateGreaterThanOrEqual,\n\tdateInvalid,\n\tdateLessThan,\n\tdateLessThanOrEqual,\n\tdateNotEqual,\n\tdateValid\n} from '../constraints/DateConstraints';\nimport { ValidationError } from '../lib/errors/ValidationError';\nimport { Result } from '../lib/Result';\nimport { BaseValidator } from './imports';\n\nexport class DateValidator extends BaseValidator<Date> {\n\tpublic lessThan(date: Date | number | string): this {\n\t\treturn this.addConstraint(dateLessThan(new Date(date)));\n\t}\n\n\tpublic lessThanOrEqual(date: Date | number | string): this {\n\t\treturn this.addConstraint(dateLessThanOrEqual(new Date(date)));\n\t}\n\n\tpublic greaterThan(date: Date | number | string): this {\n\t\treturn this.addConstraint(dateGreaterThan(new Date(date)));\n\t}\n\n\tpublic greaterThanOrEqual(date: Date | number | string): this {\n\t\treturn this.addConstraint(dateGreaterThanOrEqual(new Date(date)));\n\t}\n\n\tpublic equal(date: Date | number | string): this {\n\t\tconst resolved = new Date(date);\n\t\treturn Number.isNaN(resolved.getTime()) //\n\t\t\t? this.invalid\n\t\t\t: this.addConstraint(dateEqual(resolved));\n\t}\n\n\tpublic notEqual(date: Date | number | string): this {\n\t\tconst resolved = new Date(date);\n\t\treturn Number.isNaN(resolved.getTime()) //\n\t\t\t? this.valid\n\t\t\t: this.addConstraint(dateNotEqual(resolved));\n\t}\n\n\tpublic get valid(): this {\n\t\treturn this.addConstraint(dateValid);\n\t}\n\n\tpublic get invalid(): this {\n\t\treturn this.addConstraint(dateInvalid);\n\t}\n\n\tprotected handle(value: unknown): Result<Date, ValidationError> {\n\t\treturn value instanceof Date //\n\t\t\t? Result.ok(value)\n\t\t\t: Result.err(new ValidationError('s.date', 'Expected a Date', value));\n\t}\n}\n","import { inspect, type InspectOptionsStylized } from 'node:util';\nimport { customInspectSymbolStackLess } from './BaseError';\nimport { ValidationError } from './ValidationError';\n\nexport class ExpectedValidationError<T> extends ValidationError {\n\tpublic readonly expected: T;\n\n\tpublic constructor(validator: string, message: string, given: unknown, expected: T) {\n\t\tsuper(validator, message, given);\n\t\tthis.expected = expected;\n\t}\n\n\tpublic override toJSON() {\n\t\treturn {\n\t\t\tname: this.name,\n\t\t\tvalidator: this.validator,\n\t\t\tgiven: this.given,\n\t\t\texpected: this.expected\n\t\t};\n\t}\n\n\tprotected [customInspectSymbolStackLess](depth: number, options: InspectOptionsStylized): string {\n\t\tconst validator = options.stylize(this.validator, 'string');\n\t\tif (depth < 0) {\n\t\t\treturn options.stylize(`[ExpectedValidationError: ${validator}]`, 'special');\n\t\t}\n\n\t\tconst newOptions = { ...options, depth: options.depth === null ? null : options.depth! - 1 };\n\n\t\tconst padding = `\\n ${options.stylize('|', 'undefined')} `;\n\t\tconst expected = inspect(this.expected, newOptions).replace(/\\n/g, padding);\n\t\tconst given = inspect(this.given, newOptions).replace(/\\n/g, padding);\n\n\t\tconst header = `${options.stylize('ExpectedValidationError', 'special')} > ${validator}`;\n\t\tconst message = options.stylize(this.message, 'regexp');\n\t\tconst expectedBlock = `\\n ${options.stylize('Expected:', 'string')}${padding}${expected}`;\n\t\tconst givenBlock = `\\n ${options.stylize('Received:', 'regexp')}${padding}${given}`;\n\t\treturn `${header}\\n ${message}\\n${expectedBlock}\\n${givenBlock}`;\n\t}\n}\n","import type { IConstraint } from '../constraints/base/IConstraint';\nimport { ExpectedValidationError } from '../lib/errors/ExpectedValidationError';\nimport { Result } from '../lib/Result';\nimport type { Constructor } from '../lib/util-types';\nimport { BaseValidator } from './imports';\n\nexport class InstanceValidator<T> extends BaseValidator<T> {\n\tpublic readonly expected: Constructor<T>;\n\n\tpublic constructor(expected: Constructor<T>, constraints: readonly IConstraint<T>[] = []) {\n\t\tsuper(constraints);\n\t\tthis.expected = expected;\n\t}\n\n\tprotected handle(value: unknown): Result<T, ExpectedValidationError<Constructor<T>>> {\n\t\treturn value instanceof this.expected //\n\t\t\t? Result.ok(value)\n\t\t\t: Result.err(new ExpectedValidationError('s.instance(V)', 'Expected', value, this.expected));\n\t}\n\n\tprotected override clone(): this {\n\t\treturn Reflect.construct(this.constructor, [this.expected, this.constraints]);\n\t}\n}\n","import type { IConstraint } from '../constraints/base/IConstraint';\nimport { ExpectedValidationError } from '../lib/errors/ExpectedValidationError';\nimport { Result } from '../lib/Result';\nimport { BaseValidator } from './imports';\n\nexport class LiteralValidator<T> extends BaseValidator<T> {\n\tpublic readonly expected: T;\n\n\tpublic constructor(literal: T, constraints: readonly IConstraint<T>[] = []) {\n\t\tsuper(constraints);\n\t\tthis.expected = literal;\n\t}\n\n\tprotected handle(value: unknown): Result<T, ExpectedValidationError<T>> {\n\t\treturn Object.is(value, this.expected) //\n\t\t\t? Result.ok(value as T)\n\t\t\t: Result.err(new ExpectedValidationError('s.literal(V)', 'Expected values to be equals', value, this.expected));\n\t}\n\n\tprotected override clone(): this {\n\t\treturn Reflect.construct(this.constructor, [this.expected, this.constraints]);\n\t}\n}\n","import { ValidationError } from '../lib/errors/ValidationError';\nimport { Result } from '../lib/Result';\nimport { BaseValidator } from './imports';\n\nexport class NeverValidator extends BaseValidator<never> {\n\tprotected handle(value: unknown): Result<never, ValidationError> {\n\t\treturn Result.err(new ValidationError('s.never', 'Expected a value to not be passed', value));\n\t}\n}\n","import { ValidationError } from '../lib/errors/ValidationError';\nimport { Result } from '../lib/Result';\nimport { BaseValidator } from './imports';\n\nexport class NullishValidator extends BaseValidator<undefined | null> {\n\tprotected handle(value: unknown): Result<undefined | null, ValidationError> {\n\t\treturn value === undefined || value === null //\n\t\t\t? Result.ok(value)\n\t\t\t: Result.err(new ValidationError('s.nullish', 'Expected undefined or null', value));\n\t}\n}\n","import { ExpectedConstraintError } from '../lib/errors/ExpectedConstraintError';\nimport { Result } from '../lib/Result';\nimport type { IConstraint } from './base/IConstraint';\nimport { Comparator, equal, greaterThan, greaterThanOrEqual, lessThan, lessThanOrEqual, notEqual } from './util/operators';\n\nexport type NumberConstraintName = `s.number.${\n\t| 'lessThan'\n\t| 'lessThanOrEqual'\n\t| 'greaterThan'\n\t| 'greaterThanOrEqual'\n\t| 'equal'\n\t| 'equal(NaN)'\n\t| 'notEqual'\n\t| 'notEqual(NaN)'\n\t| 'int'\n\t| 'safeInt'\n\t| 'finite'\n\t| 'divisibleBy'}`;\n\nfunction numberComparator(comparator: Comparator, name: NumberConstraintName, expected: string, number: number): IConstraint<number> {\n\treturn {\n\t\trun(input: number) {\n\t\t\treturn comparator(input, number) //\n\t\t\t\t? Result.ok(input)\n\t\t\t\t: Result.err(new ExpectedConstraintError(name, 'Invalid number value', input, expected));\n\t\t}\n\t};\n}\n\nexport function numberLessThan(value: number): IConstraint<number> {\n\tconst expected = `expected < ${value}`;\n\treturn numberComparator(lessThan, 's.number.lessThan', expected, value);\n}\n\nexport function numberLessThanOrEqual(value: number): IConstraint<number> {\n\tconst expected = `expected <= ${value}`;\n\treturn numberComparator(lessThanOrEqual, 's.number.lessThanOrEqual', expected, value);\n}\n\nexport function numberGreaterThan(value: number): IConstraint<number> {\n\tconst expected = `expected > ${value}`;\n\treturn numberComparator(greaterThan, 's.number.greaterThan', expected, value);\n}\n\nexport function numberGreaterThanOrEqual(value: number): IConstraint<number> {\n\tconst expected = `expected >= ${value}`;\n\treturn numberComparator(greaterThanOrEqual, 's.number.greaterThanOrEqual', expected, value);\n}\n\nexport function numberEqual(value: number): IConstraint<number> {\n\tconst expected = `expected === ${value}`;\n\treturn numberComparator(equal, 's.number.equal', expected, value);\n}\n\nexport function numberNotEqual(value: number): IConstraint<number> {\n\tconst expected = `expected !== ${value}`;\n\treturn numberComparator(notEqual, 's.number.notEqual', expected, value);\n}\n\nexport const numberInt: IConstraint<number> = {\n\trun(input: number) {\n\t\treturn Number.isInteger(input) //\n\t\t\t? Result.ok(input)\n\t\t\t: Result.err(\n\t\t\t\t\tnew ExpectedConstraintError('s.number.int', 'Given value is not an integer', input, 'Number.isInteger(expected) to be true')\n\t\t\t );\n\t}\n};\n\nexport const numberSafeInt: IConstraint<number> = {\n\trun(input: number) {\n\t\treturn Number.isSafeInteger(input) //\n\t\t\t? Result.ok(input)\n\t\t\t: Result.err(\n\t\t\t\t\tnew ExpectedConstraintError(\n\t\t\t\t\t\t's.number.safeInt',\n\t\t\t\t\t\t'Given value is not a safe integer',\n\t\t\t\t\t\tinput,\n\t\t\t\t\t\t'Number.isSafeInteger(expected) to be true'\n\t\t\t\t\t)\n\t\t\t );\n\t}\n};\n\nexport const numberFinite: IConstraint<number> = {\n\trun(input: number) {\n\t\treturn Number.isFinite(input) //\n\t\t\t? Result.ok(input)\n\t\t\t: Result.err(new ExpectedConstraintError('s.number.finite', 'Given value is not finite', input, 'Number.isFinite(expected) to be true'));\n\t}\n};\n\nexport const numberNaN: IConstraint<number> = {\n\trun(input: number) {\n\t\treturn Number.isNaN(input) //\n\t\t\t? Result.ok(input)\n\t\t\t: Result.err(new ExpectedConstraintError('s.number.equal(NaN)', 'Invalid number value', input, 'expected === NaN'));\n\t}\n};\n\nexport const numberNotNaN: IConstraint<number> = {\n\trun(input: number) {\n\t\treturn Number.isNaN(input) //\n\t\t\t? Result.err(new ExpectedConstraintError('s.number.notEqual(NaN)', 'Invalid number value', input, 'expected !== NaN'))\n\t\t\t: Result.ok(input);\n\t}\n};\n\nexport function numberDivisibleBy(divider: number): IConstraint<number> {\n\tconst expected = `expected % ${divider} === 0`;\n\treturn {\n\t\trun(input: number) {\n\t\t\treturn input % divider === 0 //\n\t\t\t\t? Result.ok(input)\n\t\t\t\t: Result.err(new ExpectedConstraintError('s.number.divisibleBy', 'Number is not divisible', input, expected));\n\t\t}\n\t};\n}\n","import type { IConstraint } from '../constraints/base/IConstraint';\nimport {\n\tnumberDivisibleBy,\n\tnumberEqual,\n\tnumberFinite,\n\tnumberGreaterThan,\n\tnumberGreaterThanOrEqual,\n\tnumberInt,\n\tnumberLessThan,\n\tnumberLessThanOrEqual,\n\tnumberNaN,\n\tnumberNotEqual,\n\tnumberNotNaN,\n\tnumberSafeInt\n} from '../constraints/NumberConstraints';\nimport { ValidationError } from '../lib/errors/ValidationError';\nimport { Result } from '../lib/Result';\nimport { BaseValidator } from './imports';\n\nexport class NumberValidator<T extends number> extends BaseValidator<T> {\n\tpublic lessThan(number: number): this {\n\t\treturn this.addConstraint(numberLessThan(number) as IConstraint<T>);\n\t}\n\n\tpublic lessThanOrEqual(number: number): this {\n\t\treturn this.addConstraint(numberLessThanOrEqual(number) as IConstraint<T>);\n\t}\n\n\tpublic greaterThan(number: number): this {\n\t\treturn this.addConstraint(numberGreaterThan(number) as IConstraint<T>);\n\t}\n\n\tpublic greaterThanOrEqual(number: number): this {\n\t\treturn this.addConstraint(numberGreaterThanOrEqual(number) as IConstraint<T>);\n\t}\n\n\tpublic equal<N extends number>(number: N): NumberValidator<N> {\n\t\treturn Number.isNaN(number) //\n\t\t\t? (this.addConstraint(numberNaN as IConstraint<T>) as unknown as NumberValidator<N>)\n\t\t\t: (this.addConstraint(numberEqual(number) as IConstraint<T>) as unknown as NumberValidator<N>);\n\t}\n\n\tpublic notEqual(number: number): this {\n\t\treturn Number.isNaN(number) //\n\t\t\t? this.addConstraint(numberNotNaN as IConstraint<T>)\n\t\t\t: this.addConstraint(numberNotEqual(number) as IConstraint<T>);\n\t}\n\n\tpublic get int(): this {\n\t\treturn this.addConstraint(numberInt as IConstraint<T>);\n\t}\n\n\tpublic get safeInt(): this {\n\t\treturn this.addConstraint(numberSafeInt as IConstraint<T>);\n\t}\n\n\tpublic get finite(): this {\n\t\treturn this.addConstraint(numberFinite as IConstraint<T>);\n\t}\n\n\tpublic get positive(): this {\n\t\treturn this.greaterThanOrEqual(0);\n\t}\n\n\tpublic get negative(): this {\n\t\treturn this.lessThan(0);\n\t}\n\n\tpublic divisibleBy(divider: number): this {\n\t\treturn this.addConstraint(numberDivisibleBy(divider) as IConstraint<T>);\n\t}\n\n\tpublic get abs(): this {\n\t\treturn this.transform(Math.abs as (value: number) => T);\n\t}\n\n\tpublic get sign(): this {\n\t\treturn this.transform(Math.sign as (value: number) => T);\n\t}\n\n\tpublic get trunc(): this {\n\t\treturn this.transform(Math.trunc as (value: number) => T);\n\t}\n\n\tpublic get floor(): this {\n\t\treturn this.transform(Math.floor as (value: number) => T);\n\t}\n\n\tpublic get fround(): this {\n\t\treturn this.transform(Math.fround as (value: number) => T);\n\t}\n\n\tpublic get round(): this {\n\t\treturn this.transform(Math.round as (value: number) => T);\n\t}\n\n\tpublic get ceil(): this {\n\t\treturn this.transform(Math.ceil as (value: number) => T);\n\t}\n\n\tprotected handle(value: unknown): Result<T, ValidationError> {\n\t\treturn typeof value === 'number' //\n\t\t\t? Result.ok(value as T)\n\t\t\t: Result.err(new ValidationError('s.number', 'Expected a number primitive', value));\n\t}\n}\n","import type { InspectOptionsStylized } from 'node:util';\nimport { BaseError, customInspectSymbolStackLess } from './BaseError';\n\nexport class MissingPropertyError extends BaseError {\n\tpublic readonly property: PropertyKey;\n\n\tpublic constructor(property: PropertyKey) {\n\t\tsuper('A required property is missing');\n\t\tthis.property = property;\n\t}\n\n\tpublic toJSON() {\n\t\treturn {\n\t\t\tname: this.name,\n\t\t\tproperty: this.property\n\t\t};\n\t}\n\n\tprotected [customInspectSymbolStackLess](depth: number, options: InspectOptionsStylized): string {\n\t\tconst property = options.stylize(this.property.toString(), 'string');\n\t\tif (depth < 0) {\n\t\t\treturn options.stylize(`[MissingPropertyError: ${property}]`, 'special');\n\t\t}\n\n\t\tconst header = `${options.stylize('MissingPropertyError', 'special')} > ${property}`;\n\t\tconst message = options.stylize(this.message, 'regexp');\n\t\treturn `${header}\\n ${message}`;\n\t}\n}\n","import { inspect, type InspectOptionsStylized } from 'node:util';\nimport { BaseError, customInspectSymbolStackLess } from './BaseError';\n\nexport class UnknownPropertyError extends BaseError {\n\tpublic readonly property: PropertyKey;\n\tpublic readonly value: unknown;\n\n\tpublic constructor(property: PropertyKey, value: unknown) {\n\t\tsuper('Received unexpected property');\n\n\t\tthis.property = property;\n\t\tthis.value = value;\n\t}\n\n\tpublic toJSON() {\n\t\treturn {\n\t\t\tname: this.name,\n\t\t\tproperty: this.property,\n\t\t\tvalue: this.value\n\t\t};\n\t}\n\n\tprotected [customInspectSymbolStackLess](depth: number, options: InspectOptionsStylized): string {\n\t\tconst property = options.stylize(this.property.toString(), 'string');\n\t\tif (depth < 0) {\n\t\t\treturn options.stylize(`[UnknownPropertyError: ${property}]`, 'special');\n\t\t}\n\n\t\tconst newOptions = { ...options, depth: options.depth === null ? null : options.depth! - 1, compact: true };\n\n\t\tconst padding = `\\n ${options.stylize('|', 'undefined')} `;\n\t\tconst given = inspect(this.value, newOptions).replace(/\\n/g, padding);\n\n\t\tconst header = `${options.stylize('UnknownPropertyError', 'special')} > ${property}`;\n\t\tconst message = options.stylize(this.message, 'regexp');\n\t\tconst givenBlock = `\\n ${options.stylize('Received:', 'regexp')}${padding}${given}`;\n\t\treturn `${header}\\n ${message}\\n${givenBlock}`;\n\t}\n}\n","import type { IConstraint } from '../constraints/base/IConstraint';\nimport { Result } from '../lib/Result';\nimport type { ValidatorError } from './BaseValidator';\nimport { BaseValidator } from './imports';\nimport { getValue } from './util/getValue';\n\nexport class DefaultValidator<T> extends BaseValidator<T> {\n\tprivate readonly validator: BaseValidator<T>;\n\tprivate defaultValue: T | (() => T);\n\n\tpublic constructor(validator: BaseValidator<T>, value: T | (() => T), constraints: readonly IConstraint<T>[] = []) {\n\t\tsuper(constraints);\n\t\tthis.validator = validator;\n\t\tthis.defaultValue = value;\n\t}\n\n\tpublic override default(value: Exclude<T, undefined> | (() => Exclude<T, undefined>)): DefaultValidator<Exclude<T, undefined>> {\n\t\tconst clone = this.clone() as unknown as DefaultValidator<Exclude<T, undefined>>;\n\t\tclone.defaultValue = value;\n\t\treturn clone;\n\t}\n\n\tprotected handle(value: unknown): Result<T, ValidatorError> {\n\t\treturn typeof value === 'undefined' //\n\t\t\t? Result.ok(getValue(this.defaultValue))\n\t\t\t: this.validator['handle'](value); // eslint-disable-line @typescript-eslint/dot-notation\n\t}\n\n\tprotected override clone(): this {\n\t\treturn Reflect.construct(this.constructor, [this.validator, this.defaultValue, this.constraints]);\n\t}\n}\n","import type { InspectOptionsStylized } from 'node:util';\nimport { BaseError, customInspectSymbolStackLess } from './BaseError';\n\nexport class CombinedError extends BaseError {\n\tpublic readonly errors: readonly BaseError[];\n\n\tpublic constructor(errors: readonly BaseError[]) {\n\t\tsuper('Received one or more errors');\n\n\t\tthis.errors = errors;\n\t}\n\n\tprotected [customInspectSymbolStackLess](depth: number, options: InspectOptionsStylized): string {\n\t\tif (depth < 0) {\n\t\t\treturn options.stylize('[CombinedError]', 'special');\n\t\t}\n\n\t\tconst newOptions = { ...options, depth: options.depth === null ? null : options.depth! - 1, compact: true };\n\n\t\tconst padding = `\\n ${options.stylize('|', 'undefined')} `;\n\n\t\tconst header = `${options.stylize('CombinedError', 'special')} (${options.stylize(this.errors.length.toString(), 'number')})`;\n\t\tconst message = options.stylize(this.message, 'regexp');\n\t\tconst errors = this.errors\n\t\t\t.map((error, i) => {\n\t\t\t\tconst index = options.stylize((i + 1).toString(), 'number');\n\t\t\t\tconst body = error[customInspectSymbolStackLess](depth - 1, newOptions).replace(/\\n/g, padding);\n\n\t\t\t\treturn ` ${index} ${body}`;\n\t\t\t})\n\t\t\t.join('\\n\\n');\n\t\treturn `${header}\\n ${message}\\n\\n${errors}`;\n\t}\n}\n","import type { IConstraint } from '../constraints/base/IConstraint';\nimport type { BaseError } from '../lib/errors/BaseError';\nimport { CombinedError } from '../lib/errors/CombinedError';\nimport type { ValidationError } from '../lib/errors/ValidationError';\nimport { Result } from '../lib/Result';\nimport { BaseValidator, LiteralValidator, NullishValidator } from './imports';\n\nexport class UnionValidator<T> extends BaseValidator<T> {\n\tprivate validators: readonly BaseValidator<T>[];\n\n\tpublic constructor(validators: readonly BaseValidator<T>[], constraints: readonly IConstraint<T>[] = []) {\n\t\tsuper(constraints);\n\t\tthis.validators = validators;\n\t}\n\n\tpublic override get optional(): UnionValidator<T | undefined> {\n\t\tif (this.validators.length === 0) return new UnionValidator<T | undefined>([new LiteralValidator(undefined)], this.constraints);\n\n\t\tconst [validator] = this.validators;\n\t\tif (validator instanceof LiteralValidator) {\n\t\t\t// If already optional, return a clone:\n\t\t\tif (validator.expected === undefined) return this.clone();\n\n\t\t\t// If it's nullable, convert the nullable validator into a nullish validator to optimize `null | undefined`:\n\t\t\tif (validator.expected === null) {\n\t\t\t\treturn new UnionValidator<T | null | undefined>(\n\t\t\t\t\t[new NullishValidator(), ...this.validators.slice(1)],\n\t\t\t\t\tthis.constraints\n\t\t\t\t) as UnionValidator<T | undefined>;\n\t\t\t}\n\t\t} else if (validator instanceof NullishValidator) {\n\t\t\t// If it's already nullish (which validates optional), return a clone:\n\t\t\treturn this.clone();\n\t\t}\n\n\t\treturn new UnionValidator([new LiteralValidator(undefined), ...this.validators]);\n\t}\n\n\tpublic get required(): UnionValidator<Exclude<T, undefined>> {\n\t\ttype RequiredValidator = UnionValidator<Exclude<T, undefined>>;\n\n\t\tif (this.validators.length === 0) return this.clone() as unknown as RequiredValidator;\n\n\t\tconst [validator] = this.validators;\n\t\tif (validator instanceof LiteralValidator) {\n\t\t\tif (validator.expected === undefined) return new UnionValidator(this.validators.slice(1), this.constraints) as RequiredValidator;\n\t\t} else if (validator instanceof NullishValidator) {\n\t\t\treturn new UnionValidator([new LiteralValidator(null), ...this.validators.slice(1)], this.constraints) as RequiredValidator;\n\t\t}\n\n\t\treturn this.clone() as unknown as RequiredValidator;\n\t}\n\n\tpublic override get nullable(): UnionValidator<T | null> {\n\t\tif (this.validators.length === 0) return new UnionValidator<T | null>([new LiteralValidator(null)], this.constraints);\n\n\t\tconst [validator] = this.validators;\n\t\tif (validator instanceof LiteralValidator) {\n\t\t\t// If already nullable, return a clone:\n\t\t\tif (validator.expected === null) return this.clone();\n\n\t\t\t// If it's optional, convert the optional validator into a nullish validator to optimize `null | undefined`:\n\t\t\tif (validator.expected === undefined) {\n\t\t\t\treturn new UnionValidator<T | null | undefined>(\n\t\t\t\t\t[new NullishValidator(), ...this.validators.slice(1)],\n\t\t\t\t\tthis.constraints\n\t\t\t\t) as UnionValidator<T | null>;\n\t\t\t}\n\t\t} else if (validator instanceof NullishValidator) {\n\t\t\t// If it's already nullish (which validates nullable), return a clone:\n\t\t\treturn this.clone();\n\t\t}\n\n\t\treturn new UnionValidator([new LiteralValidator(null), ...this.validators]);\n\t}\n\n\tpublic override get nullish(): UnionValidator<T | null | undefined> {\n\t\tif (this.validators.length === 0) return new UnionValidator<T | null | undefined>([new NullishValidator()], this.constraints);\n\n\t\tconst [validator] = this.validators;\n\t\tif (validator instanceof LiteralValidator) {\n\t\t\t// If already nullable or optional, promote the union to nullish:\n\t\t\tif (validator.expected === null || validator.expected === undefined) {\n\t\t\t\treturn new UnionValidator<T | null | undefined>([new NullishValidator(), ...this.validators.slice(1)], this.constraints);\n\t\t\t}\n\t\t} else if (validator instanceof NullishValidator) {\n\t\t\t// If it's already nullish, return a clone:\n\t\t\treturn this.clone();\n\t\t}\n\n\t\treturn new UnionValidator<T | null | undefined>([new NullishValidator(), ...this.validators]);\n\t}\n\n\tpublic override or<O>(...predicates: readonly BaseValidator<O>[]): UnionValidator<T | O> {\n\t\treturn new UnionValidator<T | O>([...this.validators, ...predicates]);\n\t}\n\n\tprotected override clone(): this {\n\t\treturn Reflect.construct(this.constructor, [this.validators, this.constraints]);\n\t}\n\n\tprotected handle(value: unknown): Result<T, ValidationError | CombinedError> {\n\t\tconst errors: BaseError[] = [];\n\n\t\tfor (const validator of this.validators) {\n\t\t\tconst result = validator.run(value);\n\t\t\tif (result.isOk()) return result as Result<T, CombinedError>;\n\t\t\terrors.push(result.error!);\n\t\t}\n\n\t\treturn Result.err(new CombinedError(errors));\n\t}\n}\n","import type { IConstraint } from '../constraints/base/IConstraint';\nimport type { BaseError } from '../lib/errors/BaseError';\nimport { CombinedPropertyError } from '../lib/errors/CombinedPropertyError';\nimport { MissingPropertyError } from '../lib/errors/MissingPropertyError';\nimport { UnknownPropertyError } from '../lib/errors/UnknownPropertyError';\nimport { ValidationError } from '../lib/errors/ValidationError';\nimport { Result } from '../lib/Result';\nimport type { MappedObjectValidator, UndefinedToOptional } from '../lib/util-types';\nimport { BaseValidator } from './BaseValidator';\nimport { DefaultValidator } from './DefaultValidator';\nimport { LiteralValidator } from './LiteralValidator';\nimport { NullishValidator } from './NullishValidator';\nimport { UnionValidator } from './UnionValidator';\n\nexport class ObjectValidator<T extends object, I = UndefinedToOptional<T>> extends BaseValidator<I> {\n\tpublic readonly shape: MappedObjectValidator<T>;\n\tpublic readonly strategy: ObjectValidatorStrategy;\n\tprivate readonly keys: readonly (keyof I)[] = [];\n\tprivate readonly handleStrategy: (value: object) => Result<I, CombinedPropertyError>;\n\n\tprivate readonly requiredKeys = new Map<keyof I, BaseValidator<unknown>>();\n\tprivate readonly possiblyUndefinedKeys = new Map<keyof I, BaseValidator<unknown>>();\n\tprivate readonly possiblyUndefinedKeysWithDefaults = new Map<keyof I, DefaultValidator<unknown>>();\n\n\tpublic constructor(\n\t\tshape: MappedObjectValidator<T>,\n\t\tstrategy: ObjectValidatorStrategy = ObjectValidatorStrategy.Ignore,\n\t\tconstraints: readonly IConstraint<I>[] = []\n\t) {\n\t\tsuper(constraints);\n\t\tthis.shape = shape;\n\t\tthis.strategy = strategy;\n\n\t\tswitch (this.strategy) {\n\t\t\tcase ObjectValidatorStrategy.Ignore:\n\t\t\t\tthis.handleStrategy = (value) => this.handleIgnoreStrategy(value);\n\t\t\t\tbreak;\n\t\t\tcase ObjectValidatorStrategy.Strict: {\n\t\t\t\tthis.handleStrategy = (value) => this.handleStrictStrategy(value);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase ObjectValidatorStrategy.Passthrough:\n\t\t\t\tthis.handleStrategy = (value) => this.handlePassthroughStrategy(value);\n\t\t\t\tbreak;\n\t\t}\n\n\t\tconst shapeEntries = Object.entries(shape) as [keyof I, BaseValidator<T>][];\n\t\tthis.keys = shapeEntries.map(([key]) => key);\n\n\t\tfor (const [key, validator] of shapeEntries) {\n\t\t\tif (validator instanceof UnionValidator) {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/dot-notation\n\t\t\t\tconst [possiblyLiteralOrNullishPredicate] = validator['validators'];\n\n\t\t\t\tif (possiblyLiteralOrNullishPredicate instanceof NullishValidator) {\n\t\t\t\t\tthis.possiblyUndefinedKeys.set(key, validator);\n\t\t\t\t} else if (possiblyLiteralOrNullishPredicate instanceof LiteralValidator) {\n\t\t\t\t\tif (possiblyLiteralOrNullishPredicate.expected === undefined) {\n\t\t\t\t\t\tthis.possiblyUndefinedKeys.set(key, validator);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.requiredKeys.set(key, validator);\n\t\t\t\t\t}\n\t\t\t\t} else if (validator instanceof DefaultValidator) {\n\t\t\t\t\tthis.possiblyUndefinedKeysWithDefaults.set(key, validator);\n\t\t\t\t} else {\n\t\t\t\t\tthis.requiredKeys.set(key, validator);\n\t\t\t\t}\n\t\t\t} else if (validator instanceof NullishValidator) {\n\t\t\t\tthis.possiblyUndefinedKeys.set(key, validator);\n\t\t\t} else if (validator instanceof LiteralValidator) {\n\t\t\t\tif (validator.expected === undefined) {\n\t\t\t\t\tthis.possiblyUndefinedKeys.set(key, validator);\n\t\t\t\t} else {\n\t\t\t\t\tthis.requiredKeys.set(key, validator);\n\t\t\t\t}\n\t\t\t} else if (validator instanceof DefaultValidator) {\n\t\t\t\tthis.possiblyUndefinedKeysWithDefaults.set(key, validator);\n\t\t\t} else {\n\t\t\t\tthis.requiredKeys.set(key, validator);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic get strict(): this {\n\t\treturn Reflect.construct(this.constructor, [this.shape, ObjectValidatorStrategy.Strict, this.constraints]);\n\t}\n\n\tpublic get ignore(): this {\n\t\treturn Reflect.construct(this.constructor, [this.shape, ObjectValidatorStrategy.Ignore, this.constraints]);\n\t}\n\n\tpublic get passthrough(): this {\n\t\treturn Reflect.construct(this.constructor, [this.shape, ObjectValidatorStrategy.Passthrough, this.constraints]);\n\t}\n\n\tpublic get partial(): ObjectValidator<{ [Key in keyof I]?: I[Key] }> {\n\t\tconst shape = Object.fromEntries(this.keys.map((key) => [key, this.shape[key as unknown as keyof typeof this.shape].optional]));\n\t\treturn Reflect.construct(this.constructor, [shape, this.strategy, this.constraints]);\n\t}\n\n\tpublic get required(): ObjectValidator<{ [Key in keyof I]-?: I[Key] }> {\n\t\tconst shape = Object.fromEntries(\n\t\t\tthis.keys.map((key) => {\n\t\t\t\tlet validator = this.shape[key as unknown as keyof typeof this.shape];\n\t\t\t\tif (validator instanceof UnionValidator) validator = validator.required;\n\t\t\t\treturn [key, validator];\n\t\t\t})\n\t\t);\n\t\treturn Reflect.construct(this.constructor, [shape, this.strategy, this.constraints]);\n\t}\n\n\tpublic extend<ET extends object>(schema: ObjectValidator<ET> | MappedObjectValidator<ET>): ObjectValidator<T & ET> {\n\t\tconst shape = { ...this.shape, ...(schema instanceof ObjectValidator ? schema.shape : schema) };\n\t\treturn Reflect.construct(this.constructor, [shape, this.strategy, this.constraints]);\n\t}\n\n\tpublic pick<K extends keyof I>(keys: readonly K[]): ObjectValidator<{ [Key in keyof Pick<I, K>]: I[Key] }> {\n\t\tconst shape = Object.fromEntries(\n\t\t\tkeys.filter((key) => this.keys.includes(key)).map((key) => [key, this.shape[key as unknown as keyof typeof this.shape]])\n\t\t);\n\t\treturn Reflect.construct(this.constructor, [shape, this.strategy, this.constraints]);\n\t}\n\n\tpublic omit<K extends keyof I>(keys: readonly K[]): ObjectValidator<{ [Key in keyof Omit<I, K>]: I[Key] }> {\n\t\tconst shape = Object.fromEntries(\n\t\t\tthis.keys.filter((key) => !keys.includes(key as any)).map((key) => [key, this.shape[key as unknown as keyof typeof this.shape]])\n\t\t);\n\t\treturn Reflect.construct(this.constructor, [shape, this.strategy, this.constraints]);\n\t}\n\n\tprotected override handle(value: unknown): Result<I, ValidationError | CombinedPropertyError> {\n\t\tconst typeOfValue = typeof value;\n\t\tif (typeOfValue !== 'object') {\n\t\t\treturn Result.err(new ValidationError('s.object(T)', `Expected the value to be an object, but received ${typeOfValue} instead`, value));\n\t\t}\n\n\t\tif (value === null) {\n\t\t\treturn Result.err(new ValidationError('s.object(T)', 'Expected the value to not be null', value));\n\t\t}\n\n\t\tif (Array.isArray(value)) {\n\t\t\treturn Result.err(new ValidationError('s.object(T)', 'Expected the value to not be an array', value));\n\t\t}\n\n\t\tif (!this.shouldRunConstraints) {\n\t\t\treturn Result.ok(value as I);\n\t\t}\n\n\t\tfor (const predicate of Object.values(this.shape) as BaseValidator<any>[]) {\n\t\t\tpredicate.setParent(this.parent ?? value!);\n\t\t}\n\n\t\treturn this.handleStrategy(value as object);\n\t}\n\n\tprotected override clone(): this {\n\t\treturn Reflect.construct(this.constructor, [this.shape, this.strategy, this.constraints]);\n\t}\n\n\tprivate handleIgnoreStrategy(value: object): Result<I, CombinedPropertyError> {\n\t\tconst errors: [PropertyKey, BaseError][] = [];\n\t\tconst finalObject = {} as I;\n\t\tconst inputEntries = new Map(Object.entries(value) as [keyof I, unknown][]);\n\n\t\tconst runPredicate = (key: keyof I, predicate: BaseValidator<unknown>) => {\n\t\t\tconst result = predicate.run(value[key as keyof object]);\n\n\t\t\tif (result.isOk()) {\n\t\t\t\tfinalObject[key] = result.value as I[keyof I];\n\t\t\t} else {\n\t\t\t\tconst error = result.error!;\n\t\t\t\terrors.push([key, error]);\n\t\t\t}\n\t\t};\n\n\t\tfor (const [key, predicate] of this.requiredKeys) {\n\t\t\tif (inputEntries.delete(key)) {\n\t\t\t\trunPredicate(key, predicate);\n\t\t\t} else {\n\t\t\t\terrors.push([key, new MissingPropertyError(key)]);\n\t\t\t}\n\t\t}\n\n\t\t// Run possibly undefined keys that also have defaults even if there are no more keys to process (this is necessary so we fill in those defaults)\n\t\tfor (const [key, validator] of this.possiblyUndefinedKeysWithDefaults) {\n\t\t\tinputEntries.delete(key);\n\t\t\trunPredicate(key, validator);\n\t\t}\n\n\t\t// Early exit if there are no more properties to validate in the object and there are errors to report\n\t\tif (inputEntries.size === 0) {\n\t\t\treturn errors.length === 0 //\n\t\t\t\t? Result.ok(finalObject)\n\t\t\t\t: Result.err(new CombinedPropertyError(errors));\n\t\t}\n\n\t\t// In the event the remaining keys to check are less than the number of possible undefined keys, we check those\n\t\t// as it could yield a faster execution\n\t\tconst checkInputEntriesInsteadOfSchemaKeys = this.possiblyUndefinedKeys.size > inputEntries.size;\n\n\t\tif (checkInputEntriesInsteadOfSchemaKeys) {\n\t\t\tfor (const [key] of inputEntries) {\n\t\t\t\tconst predicate = this.possiblyUndefinedKeys.get(key);\n\n\t\t\t\tif (predicate) {\n\t\t\t\t\trunPredicate(key, predicate);\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tfor (const [key, predicate] of this.possiblyUndefinedKeys) {\n\t\t\t\tif (inputEntries.delete(key)) {\n\t\t\t\t\trunPredicate(key, predicate);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn errors.length === 0 //\n\t\t\t? Result.ok(finalObject)\n\t\t\t: Result.err(new CombinedPropertyError(errors));\n\t}\n\n\tprivate handleStrictStrategy(value: object): Result<I, CombinedPropertyError> {\n\t\tconst errors: [PropertyKey, BaseError][] = [];\n\t\tconst finalResult = {} as I;\n\t\tconst inputEntries = new Map(Object.entries(value) as [keyof I, unknown][]);\n\n\t\tconst runPredicate = (key: keyof I, predicate: BaseValidator<unknown>) => {\n\t\t\tconst result = predicate.run(value[key as keyof object]);\n\n\t\t\tif (result.isOk()) {\n\t\t\t\tfinalResult[key] = result.value as I[keyof I];\n\t\t\t} else {\n\t\t\t\tconst error = result.error!;\n\t\t\t\terrors.push([key, error]);\n\t\t\t}\n\t\t};\n\n\t\tfor (const [key, predicate] of this.requiredKeys) {\n\t\t\tif (inputEntries.delete(key)) {\n\t\t\t\trunPredicate(key, predicate);\n\t\t\t} else {\n\t\t\t\terrors.push([key, new MissingPropertyError(key)]);\n\t\t\t}\n\t\t}\n\n\t\t// Run possibly undefined keys that also have defaults even if there are no more keys to process (this is necessary so we fill in those defaults)\n\t\tfor (const [key, validator] of this.possiblyUndefinedKeysWithDefaults) {\n\t\t\tinputEntries.delete(key);\n\t\t\trunPredicate(key, validator);\n\t\t}\n\n\t\tfor (const [key, predicate] of this.possiblyUndefinedKeys) {\n\t\t\t// All of these validators are assumed to be possibly undefined, so if we have gone through the entire object and there's still validators,\n\t\t\t// safe to assume we're done here\n\t\t\tif (inputEntries.size === 0) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif (inputEntries.delete(key)) {\n\t\t\t\trunPredicate(key, predicate);\n\t\t\t}\n\t\t}\n\n\t\tif (inputEntries.size !== 0) {\n\t\t\tfor (const [key, value] of inputEntries.entries()) {\n\t\t\t\terrors.push([key, new UnknownPropertyError(key, value)]);\n\t\t\t}\n\t\t}\n\n\t\treturn errors.length === 0 //\n\t\t\t? Result.ok(finalResult)\n\t\t\t: Result.err(new CombinedPropertyError(errors));\n\t}\n\n\tprivate handlePassthroughStrategy(value: object): Result<I, CombinedPropertyError> {\n\t\tconst result = this.handleIgnoreStrategy(value);\n\t\treturn result.isErr() ? result : Result.ok({ ...value, ...result.value } as I);\n\t}\n}\n\nexport const enum ObjectValidatorStrategy {\n\tIgnore,\n\tStrict,\n\tPassthrough\n}\n","import type { ValidationError } from '../lib/errors/ValidationError';\nimport { Result } from '../lib/Result';\nimport { BaseValidator } from './imports';\n\nexport class PassthroughValidator<T extends any | unknown> extends BaseValidator<T> {\n\tprotected handle(value: unknown): Result<T, ValidationError> {\n\t\treturn Result.ok(value as T);\n\t}\n}\n","import type { IConstraint } from '../constraints/base/IConstraint';\nimport type { BaseError } from '../lib/errors/BaseError';\nimport { CombinedPropertyError } from '../lib/errors/CombinedPropertyError';\nimport { ValidationError } from '../lib/errors/ValidationError';\nimport { Result } from '../lib/Result';\nimport { BaseValidator } from './imports';\n\nexport class RecordValidator<T> extends BaseValidator<Record<string, T>> {\n\tprivate readonly validator: BaseValidator<T>;\n\n\tpublic constructor(validator: BaseValidator<T>, constraints: readonly IConstraint<Record<string, T>>[] = []) {\n\t\tsuper(constraints);\n\t\tthis.validator = validator;\n\t}\n\n\tprotected override clone(): this {\n\t\treturn Reflect.construct(this.constructor, [this.validator, this.constraints]);\n\t}\n\n\tprotected handle(value: unknown): Result<Record<string, T>, ValidationError | CombinedPropertyError> {\n\t\tif (typeof value !== 'object') {\n\t\t\treturn Result.err(new ValidationError('s.record(T)', 'Expected an object', value));\n\t\t}\n\n\t\tif (value === null) {\n\t\t\treturn Result.err(new ValidationError('s.record(T)', 'Expected the value to not be null', value));\n\t\t}\n\n\t\tif (Array.isArray(value)) {\n\t\t\treturn Result.err(new ValidationError('s.record(T)', 'Expected the value to not be an array', value));\n\t\t}\n\n\t\tif (!this.shouldRunConstraints) {\n\t\t\treturn Result.ok(value as Record<string, T>);\n\t\t}\n\n\t\tconst errors: [string, BaseError][] = [];\n\t\tconst transformed: Record<string, T> = {};\n\n\t\tfor (const [key, val] of Object.entries(value!)) {\n\t\t\tconst result = this.validator.run(val);\n\t\t\tif (result.isOk()) transformed[key] = result.value;\n\t\t\telse errors.push([key, result.error!]);\n\t\t}\n\n\t\treturn errors.length === 0 //\n\t\t\t? Result.ok(transformed)\n\t\t\t: Result.err(new CombinedPropertyError(errors));\n\t}\n}\n","import type { IConstraint } from '../constraints/base/IConstraint';\nimport type { BaseError } from '../lib/errors/BaseError';\nimport { CombinedError } from '../lib/errors/CombinedError';\nimport { ValidationError } from '../lib/errors/ValidationError';\nimport { Result } from '../lib/Result';\nimport { BaseValidator } from './imports';\n\nexport class SetValidator<T> extends BaseValidator<Set<T>> {\n\tprivate readonly validator: BaseValidator<T>;\n\n\tpublic constructor(validator: BaseValidator<T>, constraints: readonly IConstraint<Set<T>>[] = []) {\n\t\tsuper(constraints);\n\t\tthis.validator = validator;\n\t}\n\n\tprotected override clone(): this {\n\t\treturn Reflect.construct(this.constructor, [this.validator, this.constraints]);\n\t}\n\n\tprotected handle(values: unknown): Result<Set<T>, ValidationError | CombinedError> {\n\t\tif (!(values instanceof Set)) {\n\t\t\treturn Result.err(new ValidationError('s.set(T)', 'Expected a set', values));\n\t\t}\n\n\t\tif (!this.shouldRunConstraints) {\n\t\t\treturn Result.ok(values);\n\t\t}\n\n\t\tconst errors: BaseError[] = [];\n\t\tconst transformed = new Set<T>();\n\n\t\tfor (const value of values) {\n\t\t\tconst result = this.validator.run(value);\n\t\t\tif (result.isOk()) transformed.add(result.value);\n\t\t\telse errors.push(result.error!);\n\t\t}\n\n\t\treturn errors.length === 0 //\n\t\t\t? Result.ok(transformed)\n\t\t\t: Result.err(new CombinedError(errors));\n\t}\n}\n","/**\n * [RFC-5322](https://datatracker.ietf.org/doc/html/rfc5322)\n * compliant {@link RegExp} to validate an email address\n *\n * @see https://stackoverflow.com/questions/201323/how-can-i-validate-an-email-address-using-a-regular-expression/201378#201378\n */\nconst accountRegex =\n\t/^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")$/;\n\n/**\n * Validates an email address string based on various checks:\n * - It must be a non nullish and non empty string\n * - It must include at least an `@` symbol`\n * - The account name may not exceed 64 characters\n * - The domain name may not exceed 255 characters\n * - The domain must include at least one `.` symbol\n * - Each part of the domain, split by `.` must not exceed 63 characters\n * - The email address must be [RFC-5322](https://datatracker.ietf.org/doc/html/rfc5322) compliant\n * @param email The email to validate\n * @returns `true` if the email is valid, `false` otherwise\n *\n * @remark Based on the following sources:\n * - `email-validator` by [manisharaan](https://github.com/manishsaraan) ([code](https://github.com/manishsaraan/email-validator/blob/master/index.js))\n * - [Comparing E-mail Address Validating Regular Expressions](http://fightingforalostcause.net/misc/2006/compare-email-regex.php)\n * - [Validating Email Addresses by Derrick Pallas](http://thedailywtf.com/Articles/Validating_Email_Addresses.aspx)\n * - [StackOverflow answer by bortzmeyer](http://stackoverflow.com/questions/201323/what-is-the-best-regular-expression-for-validating-email-addresses/201378#201378)\n * - [The wikipedia page on Email addresses](https://en.wikipedia.org/wiki/Email_address)\n */\nexport function validateEmail(email: string): boolean {\n\t// 1. Non-nullish and non-empty string check.\n\t//\n\t// If a nullish or empty email was provided then do an early exit\n\tif (!email) return false;\n\n\t// Find the location of the @ symbol:\n\tconst atIndex = email.indexOf('@');\n\n\t// 2. @ presence check.\n\t//\n\t// If the email does not have the @ symbol, it's automatically invalid:\n\tif (atIndex === -1) return false;\n\n\t// 3. <account> maximum length check.\n\t//\n\t// From <account>@<domain>, if <account> exceeds 64 characters, then the\n\t// position of the @ symbol is 64 or greater. In this case, the email is\n\t// invalid:\n\tif (atIndex > 64) return false;\n\n\tconst domainIndex = atIndex + 1;\n\n\t// 7.1. Duplicated @ symbol check.\n\t//\n\t// If there's a second @ symbol, the email is automatically invalid:\n\tif (email.includes('@', domainIndex)) return false;\n\n\t// 4. <domain> maximum length check.\n\t//\n\t// From <account>@<domain>, if <domain> exceeds 255 characters, then it\n\t// means that the amount of characters between the start of <domain> and the\n\t// end of the string is separated by 255 or more characters.\n\tif (email.length - domainIndex > 255) return false;\n\n\t// Find the location of the . symbol in <domain>:\n\tlet dotIndex = email.indexOf('.', domainIndex);\n\n\t// 5. <domain> dot (.) symbol check.\n\t//\n\t// From <account>@<domain>, if <domain> does not contain a dot (.) symbol,\n\t// then it means the domain is invalid.\n\tif (dotIndex === -1) return false;\n\n\t// 6. <domain> parts length.\n\t//\n\t// Assign a temporary variable to store the start of the last read domain\n\t// part, this would be at the start of <domain>.\n\t//\n\t// For a <domain> part to be correct, it must have at most, 63 characters.\n\t// We repeat this step for every sub-section of <domain> contained within\n\t// dot (.) symbols.\n\t//\n\t// The following step is a more optimized version of the following code:\n\t//\n\t// ```javascript\n\t// domain.split('.').some((part) => part.length > 63);\n\t// ```\n\tlet lastDotIndex = domainIndex;\n\tdo {\n\t\tif (dotIndex - lastDotIndex > 63) return false;\n\n\t\tlastDotIndex = dotIndex + 1;\n\t} while ((dotIndex = email.indexOf('.', lastDotIndex)) !== -1);\n\n\t// The loop iterates from the first to the n - 1 part, this line checks for\n\t// the last (n) part:\n\tif (email.length - lastDotIndex > 63) return false;\n\n\t// 7.2. Character checks.\n\t//\n\t// From <account>@<domain>:\n\t// - Extract the <account> part by slicing the input from start to the @\n\t// character. Validate afterwards.\n\t// - Extract the <domain> part by slicing the input from the start of\n\t// <domain>. Validate afterwards.\n\t//\n\t// Note: we inline the variables so <domain> isn't created unless the\n\t// <account> check passes.\n\treturn accountRegex.test(email.slice(0, atIndex)) && validateEmailDomain(email.slice(domainIndex));\n}\n\nfunction validateEmailDomain(domain: string): boolean {\n\ttry {\n\t\treturn new URL(`http://${domain}`).hostname === domain;\n\t} catch {\n\t\treturn false;\n\t}\n}\n","/**\n * Code ported from https://github.com/nodejs/node/blob/5fad0b93667ffc6e4def52996b9529ac99b26319/lib/internal/net.js\n */\n\n// IPv4 Segment\nconst v4Seg = '(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])';\nconst v4Str = `(${v4Seg}[.]){3}${v4Seg}`;\nconst IPv4Reg = new RegExp(`^${v4Str}$`);\n\n// IPv6 Segment\nconst v6Seg = '(?:[0-9a-fA-F]{1,4})';\nconst IPv6Reg = new RegExp(\n\t'^(' +\n\t\t`(?:${v6Seg}:){7}(?:${v6Seg}|:)|` +\n\t\t`(?:${v6Seg}:){6}(?:${v4Str}|:${v6Seg}|:)|` +\n\t\t`(?:${v6Seg}:){5}(?::${v4Str}|(:${v6Seg}){1,2}|:)|` +\n\t\t`(?:${v6Seg}:){4}(?:(:${v6Seg}){0,1}:${v4Str}|(:${v6Seg}){1,3}|:)|` +\n\t\t`(?:${v6Seg}:){3}(?:(:${v6Seg}){0,2}:${v4Str}|(:${v6Seg}){1,4}|:)|` +\n\t\t`(?:${v6Seg}:){2}(?:(:${v6Seg}){0,3}:${v4Str}|(:${v6Seg}){1,5}|:)|` +\n\t\t`(?:${v6Seg}:){1}(?:(:${v6Seg}){0,4}:${v4Str}|(:${v6Seg}){1,6}|:)|` +\n\t\t`(?::((?::${v6Seg}){0,5}:${v4Str}|(?::${v6Seg}){1,7}|:))` +\n\t\t')(%[0-9a-zA-Z-.:]{1,})?$'\n);\n\nexport function isIPv4(s: string): boolean {\n\treturn IPv4Reg.test(s);\n}\n\nexport function isIPv6(s: string): boolean {\n\treturn IPv6Reg.test(s);\n}\n\nexport function isIP(s: string): number {\n\tif (isIPv4(s)) return 4;\n\tif (isIPv6(s)) return 6;\n\treturn 0;\n}\n","export const phoneNumberRegex = /^((?:\\+|0{0,2})\\d{1,2}\\s?)?\\(?\\d{3}\\)?[\\s.-]?\\d{3}[\\s.-]?\\d{4}$/;\n\nexport function validatePhoneNumber(input: string) {\n\treturn phoneNumberRegex.test(input);\n}\n","import { inspect, type InspectOptionsStylized } from 'node:util';\nimport { customInspectSymbolStackLess } from './BaseError';\nimport { BaseConstraintError, type ConstraintErrorNames } from './BaseConstraintError';\n\nexport class MultiplePossibilitiesConstraintError<T = unknown> extends BaseConstraintError<T> {\n\tpublic readonly expected: readonly string[];\n\n\tpublic constructor(constraint: ConstraintErrorNames, message: string, given: T, expected: readonly string[]) {\n\t\tsuper(constraint, message, given);\n\t\tthis.expected = expected;\n\t}\n\n\tpublic toJSON() {\n\t\treturn {\n\t\t\tname: this.name,\n\t\t\tconstraint: this.constraint,\n\t\t\tgiven: this.given,\n\t\t\texpected: this.expected\n\t\t};\n\t}\n\n\tprotected [customInspectSymbolStackLess](depth: number, options: InspectOptionsStylized): string {\n\t\tconst constraint = options.stylize(this.constraint, 'string');\n\t\tif (depth < 0) {\n\t\t\treturn options.stylize(`[MultiplePossibilitiesConstraintError: ${constraint}]`, 'special');\n\t\t}\n\n\t\tconst newOptions = { ...options, depth: options.depth === null ? null : options.depth! - 1 };\n\n\t\tconst verticalLine = options.stylize('|', 'undefined');\n\t\tconst padding = `\\n ${verticalLine} `;\n\t\tconst given = inspect(this.given, newOptions).replace(/\\n/g, padding);\n\n\t\tconst header = `${options.stylize('MultiplePossibilitiesConstraintError', 'special')} > ${constraint}`;\n\t\tconst message = options.stylize(this.message, 'regexp');\n\n\t\tconst expectedPadding = `\\n ${verticalLine} - `;\n\t\tconst expectedBlock = `\\n ${options.stylize('Expected any of the following:', 'string')}${expectedPadding}${this.expected\n\t\t\t.map((possible) => options.stylize(possible, 'boolean'))\n\t\t\t.join(expectedPadding)}`;\n\t\tconst givenBlock = `\\n ${options.stylize('Received:', 'regexp')}${padding}${given}`;\n\t\treturn `${header}\\n ${message}\\n${expectedBlock}\\n${givenBlock}`;\n\t}\n}\n","export function combinedErrorFn<P extends [...any], E extends Error>(...fns: ErrorFn<P, E>[]): ErrorFn<P, E> {\n\tswitch (fns.length) {\n\t\tcase 0:\n\t\t\treturn () => null;\n\t\tcase 1:\n\t\t\treturn fns[0];\n\t\tcase 2: {\n\t\t\tconst [fn0, fn1] = fns;\n\t\t\treturn (...params) => fn0(...params) || fn1(...params);\n\t\t}\n\t\tdefault: {\n\t\t\treturn (...params) => {\n\t\t\t\tfor (const fn of fns) {\n\t\t\t\t\tconst result = fn(...params);\n\t\t\t\t\tif (result) return result;\n\t\t\t\t}\n\n\t\t\t\treturn null;\n\t\t\t};\n\t\t}\n\t}\n}\n\nexport type ErrorFn<P extends [...any], E extends Error> = (...params: P) => E | null;\n","import { MultiplePossibilitiesConstraintError } from '../../lib/errors/MultiplePossibilitiesConstraintError';\nimport { combinedErrorFn, ErrorFn } from './common/combinedResultFn';\n\nexport type StringProtocol = `${string}:`;\n\nexport type StringDomain = `${string}.${string}`;\n\nexport interface UrlOptions {\n\tallowedProtocols?: StringProtocol[];\n\tallowedDomains?: StringDomain[];\n}\n\nexport function createUrlValidators(options?: UrlOptions) {\n\tconst fns: ErrorFn<[input: string, url: URL], MultiplePossibilitiesConstraintError<string>>[] = [];\n\n\tif (options?.allowedProtocols?.length) fns.push(allowedProtocolsFn(options.allowedProtocols));\n\tif (options?.allowedDomains?.length) fns.push(allowedDomainsFn(options.allowedDomains));\n\n\treturn combinedErrorFn(...fns);\n}\n\nfunction allowedProtocolsFn(allowedProtocols: StringProtocol[]) {\n\treturn (input: string, url: URL) =>\n\t\tallowedProtocols.includes(url.protocol as StringProtocol)\n\t\t\t? null\n\t\t\t: new MultiplePossibilitiesConstraintError('s.string.url', 'Invalid URL protocol', input, allowedProtocols);\n}\n\nfunction allowedDomainsFn(allowedDomains: StringDomain[]) {\n\treturn (input: string, url: URL) =>\n\t\tallowedDomains.includes(url.hostname as StringDomain)\n\t\t\t? null\n\t\t\t: new MultiplePossibilitiesConstraintError('s.string.url', 'Invalid URL domain', input, allowedDomains);\n}\n","import { ExpectedConstraintError } from '../lib/errors/ExpectedConstraintError';\nimport { Result } from '../lib/Result';\nimport type { IConstraint } from './base/IConstraint';\nimport { validateEmail } from './util/emailValidator';\nimport { isIP, isIPv4, isIPv6 } from './util/net';\nimport { Comparator, equal, greaterThan, greaterThanOrEqual, lessThan, lessThanOrEqual, notEqual } from './util/operators';\nimport { validatePhoneNumber } from './util/phoneValidator';\nimport { createUrlValidators } from './util/urlValidators';\n\nexport type StringConstraintName =\n\t| `s.string.${\n\t\t\t| `length${'LessThan' | 'LessThanOrEqual' | 'GreaterThan' | 'GreaterThanOrEqual' | 'Equal' | 'NotEqual'}`\n\t\t\t| 'regex'\n\t\t\t| 'url'\n\t\t\t| 'uuid'\n\t\t\t| 'email'\n\t\t\t| `ip${'v4' | 'v6' | ''}`\n\t\t\t| 'date'\n\t\t\t| 'phone'}`;\n\nexport type StringProtocol = `${string}:`;\n\nexport type StringDomain = `${string}.${string}`;\n\nexport interface UrlOptions {\n\tallowedProtocols?: StringProtocol[];\n\tallowedDomains?: StringDomain[];\n}\n\nexport type UUIDVersion = 1 | 3 | 4 | 5;\n\nexport interface StringUuidOptions {\n\tversion?: UUIDVersion | `${UUIDVersion}-${UUIDVersion}` | null;\n\tnullable?: boolean;\n}\n\nfunction stringLengthComparator(comparator: Comparator, name: StringConstraintName, expected: string, length: number): IConstraint<string> {\n\treturn {\n\t\trun(input: string) {\n\t\t\treturn comparator(input.length, length) //\n\t\t\t\t? Result.ok(input)\n\t\t\t\t: Result.err(new ExpectedConstraintError(name, 'Invalid string length', input, expected));\n\t\t}\n\t};\n}\n\nexport function stringLengthLessThan(length: number): IConstraint<string> {\n\tconst expected = `expected.length < ${length}`;\n\treturn stringLengthComparator(lessThan, 's.string.lengthLessThan', expected, length);\n}\n\nexport function stringLengthLessThanOrEqual(length: number): IConstraint<string> {\n\tconst expected = `expected.length <= ${length}`;\n\treturn stringLengthComparator(lessThanOrEqual, 's.string.lengthLessThanOrEqual', expected, length);\n}\n\nexport function stringLengthGreaterThan(length: number): IConstraint<string> {\n\tconst expected = `expected.length > ${length}`;\n\treturn stringLengthComparator(greaterThan, 's.string.lengthGreaterThan', expected, length);\n}\n\nexport function stringLengthGreaterThanOrEqual(length: number): IConstraint<string> {\n\tconst expected = `expected.length >= ${length}`;\n\treturn stringLengthComparator(greaterThanOrEqual, 's.string.lengthGreaterThanOrEqual', expected, length);\n}\n\nexport function stringLengthEqual(length: number): IConstraint<string> {\n\tconst expected = `expected.length === ${length}`;\n\treturn stringLengthComparator(equal, 's.string.lengthEqual', expected, length);\n}\n\nexport function stringLengthNotEqual(length: number): IConstraint<string> {\n\tconst expected = `expected.length !== ${length}`;\n\treturn stringLengthComparator(notEqual, 's.string.lengthNotEqual', expected, length);\n}\n\nexport function stringEmail(): IConstraint<string> {\n\treturn {\n\t\trun(input: string) {\n\t\t\treturn validateEmail(input)\n\t\t\t\t? Result.ok(input)\n\t\t\t\t: Result.err(new ExpectedConstraintError('s.string.email', 'Invalid email address', input, 'expected to be an email address'));\n\t\t}\n\t};\n}\n\nfunction stringRegexValidator(type: StringConstraintName, expected: string, regex: RegExp): IConstraint<string> {\n\treturn {\n\t\trun(input: string) {\n\t\t\treturn regex.test(input) //\n\t\t\t\t? Result.ok(input)\n\t\t\t\t: Result.err(new ExpectedConstraintError(type, 'Invalid string format', input, expected));\n\t\t}\n\t};\n}\n\nexport function stringUrl(options?: UrlOptions): IConstraint<string> {\n\tconst validatorFn = createUrlValidators(options);\n\treturn {\n\t\trun(input: string) {\n\t\t\tlet url: URL;\n\t\t\ttry {\n\t\t\t\turl = new URL(input);\n\t\t\t} catch {\n\t\t\t\treturn Result.err(new ExpectedConstraintError('s.string.url', 'Invalid URL', input, 'expected to match an URL'));\n\t\t\t}\n\n\t\t\tconst validatorFnResult = validatorFn(input, url);\n\t\t\tif (validatorFnResult === null) return Result.ok(input);\n\t\t\treturn Result.err(validatorFnResult);\n\t\t}\n\t};\n}\n\nexport function stringIp(version?: 4 | 6): IConstraint<string> {\n\tconst ipVersion = version ? (`v${version}` as const) : '';\n\tconst validatorFn = version === 4 ? isIPv4 : version === 6 ? isIPv6 : isIP;\n\n\tconst name = `s.string.ip${ipVersion}` as const;\n\tconst message = `Invalid IP${ipVersion} address`;\n\tconst expected = `expected to be an IP${ipVersion} address`;\n\treturn {\n\t\trun(input: string) {\n\t\t\treturn validatorFn(input) ? Result.ok(input) : Result.err(new ExpectedConstraintError(name, message, input, expected));\n\t\t}\n\t};\n}\n\nexport function stringRegex(regex: RegExp) {\n\treturn stringRegexValidator('s.string.regex', `expected ${regex}.test(expected) to be true`, regex);\n}\n\nexport function stringUuid({ version = 4, nullable = false }: StringUuidOptions = {}) {\n\tversion ??= '1-5';\n\tconst regex = new RegExp(\n\t\t`^(?:[0-9A-F]{8}-[0-9A-F]{4}-[${version}][0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}${\n\t\t\tnullable ? '|00000000-0000-0000-0000-000000000000' : ''\n\t\t})$`,\n\t\t'i'\n\t);\n\tconst expected = `expected to match UUID${typeof version === 'number' ? `v${version}` : ` in range of ${version}`}`;\n\treturn stringRegexValidator('s.string.uuid', expected, regex);\n}\n\nexport function stringDate(): IConstraint<string> {\n\treturn {\n\t\trun(input: string) {\n\t\t\tconst time = Date.parse(input);\n\n\t\t\treturn Number.isNaN(time)\n\t\t\t\t? Result.err(\n\t\t\t\t\t\tnew ExpectedConstraintError(\n\t\t\t\t\t\t\t's.string.date',\n\t\t\t\t\t\t\t'Invalid date string',\n\t\t\t\t\t\t\tinput,\n\t\t\t\t\t\t\t'expected to be a valid date string (in the ISO 8601 or ECMA-262 format)'\n\t\t\t\t\t\t)\n\t\t\t\t )\n\t\t\t\t: Result.ok(input);\n\t\t}\n\t};\n}\n\nexport function stringPhone(): IConstraint<string> {\n\treturn {\n\t\trun(input: string) {\n\t\t\treturn validatePhoneNumber(input)\n\t\t\t\t? Result.ok(input)\n\t\t\t\t: Result.err(new ExpectedConstraintError('s.string.phone', 'Invalid phone number', input, 'expected to be a phone number'));\n\t\t}\n\t};\n}\n","import type { IConstraint } from '../constraints/base/IConstraint';\nimport {\n\tstringDate,\n\tstringEmail,\n\tstringIp,\n\tstringLengthEqual,\n\tstringLengthGreaterThan,\n\tstringLengthGreaterThanOrEqual,\n\tstringLengthLessThan,\n\tstringLengthLessThanOrEqual,\n\tstringLengthNotEqual,\n\tstringPhone,\n\tstringRegex,\n\tstringUrl,\n\tstringUuid,\n\tStringUuidOptions,\n\ttype UrlOptions\n} from '../constraints/StringConstraints';\nimport { ValidationError } from '../lib/errors/ValidationError';\nimport { Result } from '../lib/Result';\nimport { BaseValidator } from './imports';\n\nexport class StringValidator<T extends string> extends BaseValidator<T> {\n\tpublic lengthLessThan(length: number): this {\n\t\treturn this.addConstraint(stringLengthLessThan(length) as IConstraint<T>);\n\t}\n\n\tpublic lengthLessThanOrEqual(length: number): this {\n\t\treturn this.addConstraint(stringLengthLessThanOrEqual(length) as IConstraint<T>);\n\t}\n\n\tpublic lengthGreaterThan(length: number): this {\n\t\treturn this.addConstraint(stringLengthGreaterThan(length) as IConstraint<T>);\n\t}\n\n\tpublic lengthGreaterThanOrEqual(length: number): this {\n\t\treturn this.addConstraint(stringLengthGreaterThanOrEqual(length) as IConstraint<T>);\n\t}\n\n\tpublic lengthEqual(length: number): this {\n\t\treturn this.addConstraint(stringLengthEqual(length) as IConstraint<T>);\n\t}\n\n\tpublic lengthNotEqual(length: number): this {\n\t\treturn this.addConstraint(stringLengthNotEqual(length) as IConstraint<T>);\n\t}\n\n\tpublic get email(): this {\n\t\treturn this.addConstraint(stringEmail() as IConstraint<T>);\n\t}\n\n\tpublic url(options?: UrlOptions): this {\n\t\treturn this.addConstraint(stringUrl(options) as IConstraint<T>);\n\t}\n\n\tpublic uuid(options?: StringUuidOptions): this {\n\t\treturn this.addConstraint(stringUuid(options) as IConstraint<T>);\n\t}\n\n\tpublic regex(regex: RegExp): this {\n\t\treturn this.addConstraint(stringRegex(regex) as IConstraint<T>);\n\t}\n\n\tpublic get date() {\n\t\treturn this.addConstraint(stringDate() as IConstraint<T>);\n\t}\n\n\tpublic get ipv4(): this {\n\t\treturn this.ip(4);\n\t}\n\n\tpublic get ipv6(): this {\n\t\treturn this.ip(6);\n\t}\n\n\tpublic ip(version?: 4 | 6): this {\n\t\treturn this.addConstraint(stringIp(version) as IConstraint<T>);\n\t}\n\n\tpublic phone(): this {\n\t\treturn this.addConstraint(stringPhone() as IConstraint<T>);\n\t}\n\n\tprotected handle(value: unknown): Result<T, ValidationError> {\n\t\treturn typeof value === 'string' //\n\t\t\t? Result.ok(value as T)\n\t\t\t: Result.err(new ValidationError('s.string', 'Expected a string primitive', value));\n\t}\n}\n","import type { IConstraint } from '../constraints/base/IConstraint';\nimport type { BaseError } from '../lib/errors/BaseError';\nimport { CombinedPropertyError } from '../lib/errors/CombinedPropertyError';\nimport { ValidationError } from '../lib/errors/ValidationError';\nimport { Result } from '../lib/Result';\nimport { BaseValidator } from './imports';\n\nexport class TupleValidator<T extends any[]> extends BaseValidator<[...T]> {\n\tprivate readonly validators: BaseValidator<[...T]>[] = [];\n\n\tpublic constructor(validators: BaseValidator<[...T]>[], constraints: readonly IConstraint<[...T]>[] = []) {\n\t\tsuper(constraints);\n\t\tthis.validators = validators;\n\t}\n\n\tprotected override clone(): this {\n\t\treturn Reflect.construct(this.constructor, [this.validators, this.constraints]);\n\t}\n\n\tprotected handle(values: unknown): Result<[...T], ValidationError | CombinedPropertyError> {\n\t\tif (!Array.isArray(values)) {\n\t\t\treturn Result.err(new ValidationError('s.tuple(T)', 'Expected an array', values));\n\t\t}\n\n\t\tif (values.length !== this.validators.length) {\n\t\t\treturn Result.err(new ValidationError('s.tuple(T)', `Expected an array of length ${this.validators.length}`, values));\n\t\t}\n\n\t\tif (!this.shouldRunConstraints) {\n\t\t\treturn Result.ok(values as [...T]);\n\t\t}\n\n\t\tconst errors: [number, BaseError][] = [];\n\t\tconst transformed: T = [] as unknown as T;\n\n\t\tfor (let i = 0; i < values.length; i++) {\n\t\t\tconst result = this.validators[i].run(values[i]);\n\t\t\tif (result.isOk()) transformed.push(result.value);\n\t\t\telse errors.push([i, result.error!]);\n\t\t}\n\n\t\treturn errors.length === 0 //\n\t\t\t? Result.ok(transformed)\n\t\t\t: Result.err(new CombinedPropertyError(errors));\n\t}\n}\n","import type { IConstraint } from '../constraints/base/IConstraint';\nimport type { BaseError } from '../lib/errors/BaseError';\nimport { CombinedPropertyError } from '../lib/errors/CombinedPropertyError';\nimport { ValidationError } from '../lib/errors/ValidationError';\nimport { Result } from '../lib/Result';\nimport { BaseValidator } from './imports';\n\nexport class MapValidator<K, V> extends BaseValidator<Map<K, V>> {\n\tprivate readonly keyValidator: BaseValidator<K>;\n\tprivate readonly valueValidator: BaseValidator<V>;\n\n\tpublic constructor(keyValidator: BaseValidator<K>, valueValidator: BaseValidator<V>, constraints: readonly IConstraint<Map<K, V>>[] = []) {\n\t\tsuper(constraints);\n\t\tthis.keyValidator = keyValidator;\n\t\tthis.valueValidator = valueValidator;\n\t}\n\n\tprotected override clone(): this {\n\t\treturn Reflect.construct(this.constructor, [this.keyValidator, this.valueValidator, this.constraints]);\n\t}\n\n\tprotected handle(value: unknown): Result<Map<K, V>, ValidationError | CombinedPropertyError> {\n\t\tif (!(value instanceof Map)) {\n\t\t\treturn Result.err(new ValidationError('s.map(K, V)', 'Expected a map', value));\n\t\t}\n\n\t\tif (!this.shouldRunConstraints) {\n\t\t\treturn Result.ok(value);\n\t\t}\n\n\t\tconst errors: [string, BaseError][] = [];\n\t\tconst transformed = new Map<K, V>();\n\n\t\tfor (const [key, val] of value.entries()) {\n\t\t\tconst keyResult = this.keyValidator.run(key);\n\t\t\tconst valueResult = this.valueValidator.run(val);\n\t\t\tconst { length } = errors;\n\t\t\tif (keyResult.isErr()) errors.push([key, keyResult.error]);\n\t\t\tif (valueResult.isErr()) errors.push([key, valueResult.error]);\n\t\t\tif (errors.length === length) transformed.set(keyResult.value!, valueResult.value!);\n\t\t}\n\n\t\treturn errors.length === 0 //\n\t\t\t? Result.ok(transformed)\n\t\t\t: Result.err(new CombinedPropertyError(errors));\n\t}\n}\n","import type { Result } from '../lib/Result';\nimport type { IConstraint, Unwrap } from '../type-exports';\nimport { BaseValidator, ValidatorError } from './imports';\n\nexport class LazyValidator<T extends BaseValidator<unknown>, R = Unwrap<T>> extends BaseValidator<R> {\n\tprivate readonly validator: (value: unknown) => T;\n\n\tpublic constructor(validator: (value: unknown) => T, constraints: readonly IConstraint<R>[] = []) {\n\t\tsuper(constraints);\n\t\tthis.validator = validator;\n\t}\n\n\tprotected override clone(): this {\n\t\treturn Reflect.construct(this.constructor, [this.validator, this.constraints]);\n\t}\n\n\tprotected handle(values: unknown): Result<R, ValidatorError> {\n\t\treturn this.validator(values).run(values) as Result<R, ValidatorError>;\n\t}\n}\n","import type { InspectOptionsStylized } from 'node:util';\nimport { BaseError, customInspectSymbolStackLess } from './BaseError';\n\nexport class UnknownEnumValueError extends BaseError {\n\tpublic readonly value: string | number;\n\tpublic readonly enumKeys: string[];\n\tpublic readonly enumMappings: Map<string | number, string | number>;\n\n\tpublic constructor(value: string | number, keys: string[], enumMappings: Map<string | number, string | number>) {\n\t\tsuper('Expected the value to be one of the following enum values:');\n\n\t\tthis.value = value;\n\t\tthis.enumKeys = keys;\n\t\tthis.enumMappings = enumMappings;\n\t}\n\n\tpublic toJSON() {\n\t\treturn {\n\t\t\tname: this.name,\n\t\t\tvalue: this.value,\n\t\t\tenumKeys: this.enumKeys,\n\t\t\tenumMappings: [...this.enumMappings.entries()]\n\t\t};\n\t}\n\n\tprotected [customInspectSymbolStackLess](depth: number, options: InspectOptionsStylized): string {\n\t\tconst value = options.stylize(this.value.toString(), 'string');\n\t\tif (depth < 0) {\n\t\t\treturn options.stylize(`[UnknownEnumValueError: ${value}]`, 'special');\n\t\t}\n\n\t\tconst padding = `\\n ${options.stylize('|', 'undefined')} `;\n\t\tconst pairs = this.enumKeys\n\t\t\t.map((key) => {\n\t\t\t\tconst enumValue = this.enumMappings.get(key)!;\n\t\t\t\treturn `${options.stylize(key, 'string')} or ${options.stylize(\n\t\t\t\t\tenumValue.toString(),\n\t\t\t\t\ttypeof enumValue === 'number' ? 'number' : 'string'\n\t\t\t\t)}`;\n\t\t\t})\n\t\t\t.join(padding);\n\n\t\tconst header = `${options.stylize('UnknownEnumValueError', 'special')} > ${value}`;\n\t\tconst message = options.stylize(this.message, 'regexp');\n\t\tconst pairsBlock = `${padding}${pairs}`;\n\t\treturn `${header}\\n ${message}\\n${pairsBlock}`;\n\t}\n}\n","import { UnknownEnumValueError } from '../lib/errors/UnknownEnumValueError';\nimport { ValidationError } from '../lib/errors/ValidationError';\nimport { Result } from '../lib/Result';\nimport { BaseValidator } from './imports';\n\nexport class NativeEnumValidator<T extends NativeEnumLike> extends BaseValidator<T[keyof T]> {\n\tpublic readonly enumShape: T;\n\tpublic readonly hasNumericElements: boolean = false;\n\tprivate readonly enumKeys: string[];\n\tprivate readonly enumMapping = new Map<string | number, T[keyof T]>();\n\n\tpublic constructor(enumShape: T) {\n\t\tsuper();\n\t\tthis.enumShape = enumShape;\n\n\t\tthis.enumKeys = Object.keys(enumShape).filter((key) => {\n\t\t\treturn typeof enumShape[enumShape[key]] !== 'number';\n\t\t});\n\n\t\tfor (const key of this.enumKeys) {\n\t\t\tconst enumValue = enumShape[key] as T[keyof T];\n\n\t\t\tthis.enumMapping.set(key, enumValue);\n\t\t\tthis.enumMapping.set(enumValue, enumValue);\n\n\t\t\tif (typeof enumValue === 'number') {\n\t\t\t\tthis.hasNumericElements = true;\n\t\t\t\tthis.enumMapping.set(`${enumValue}`, enumValue);\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected override handle(value: unknown): Result<T[keyof T], ValidationError | UnknownEnumValueError> {\n\t\tconst typeOfValue = typeof value;\n\n\t\tif (typeOfValue === 'number') {\n\t\t\tif (!this.hasNumericElements) {\n\t\t\t\treturn Result.err(new ValidationError('s.nativeEnum(T)', 'Expected the value to be a string', value));\n\t\t\t}\n\t\t} else if (typeOfValue !== 'string') {\n\t\t\t// typeOfValue !== 'number' is implied here\n\t\t\treturn Result.err(new ValidationError('s.nativeEnum(T)', 'Expected the value to be a string or number', value));\n\t\t}\n\n\t\tconst casted = value as string | number;\n\n\t\tconst possibleEnumValue = this.enumMapping.get(casted);\n\n\t\treturn typeof possibleEnumValue === 'undefined'\n\t\t\t? Result.err(new UnknownEnumValueError(casted, this.enumKeys, this.enumMapping))\n\t\t\t: Result.ok(possibleEnumValue);\n\t}\n\n\tprotected override clone(): this {\n\t\treturn Reflect.construct(this.constructor, [this.enumShape]);\n\t}\n}\n\nexport interface NativeEnumLike {\n\t[key: string]: string | number;\n\t[key: number]: string;\n}\n","import { ExpectedConstraintError } from '../lib/errors/ExpectedConstraintError';\nimport { Result } from '../lib/Result';\nimport type { IConstraint } from './base/IConstraint';\nimport { Comparator, equal, greaterThan, greaterThanOrEqual, lessThan, lessThanOrEqual, notEqual } from './util/operators';\nimport type { TypedArray } from './util/typedArray';\n\nexport type TypedArrayConstraintName = `s.typedArray(T).${'byteLength' | 'length'}${\n\t| 'LessThan'\n\t| 'LessThanOrEqual'\n\t| 'GreaterThan'\n\t| 'GreaterThanOrEqual'\n\t| 'Equal'\n\t| 'NotEqual'\n\t| 'Range'\n\t| 'RangeInclusive'\n\t| 'RangeExclusive'}`;\n\nfunction typedArrayByteLengthComparator<T extends TypedArray>(\n\tcomparator: Comparator,\n\tname: TypedArrayConstraintName,\n\texpected: string,\n\tlength: number\n): IConstraint<T> {\n\treturn {\n\t\trun(input: T) {\n\t\t\treturn comparator(input.byteLength, length) //\n\t\t\t\t? Result.ok(input)\n\t\t\t\t: Result.err(new ExpectedConstraintError(name, 'Invalid Typed Array byte length', input, expected));\n\t\t}\n\t};\n}\n\nexport function typedArrayByteLengthLessThan<T extends TypedArray>(value: number): IConstraint<T> {\n\tconst expected = `expected.byteLength < ${value}`;\n\treturn typedArrayByteLengthComparator(lessThan, 's.typedArray(T).byteLengthLessThan', expected, value);\n}\n\nexport function typedArrayByteLengthLessThanOrEqual<T extends TypedArray>(value: number): IConstraint<T> {\n\tconst expected = `expected.byteLength <= ${value}`;\n\treturn typedArrayByteLengthComparator(lessThanOrEqual, 's.typedArray(T).byteLengthLessThanOrEqual', expected, value);\n}\n\nexport function typedArrayByteLengthGreaterThan<T extends TypedArray>(value: number): IConstraint<T> {\n\tconst expected = `expected.byteLength > ${value}`;\n\treturn typedArrayByteLengthComparator(greaterThan, 's.typedArray(T).byteLengthGreaterThan', expected, value);\n}\n\nexport function typedArrayByteLengthGreaterThanOrEqual<T extends TypedArray>(value: number): IConstraint<T> {\n\tconst expected = `expected.byteLength >= ${value}`;\n\treturn typedArrayByteLengthComparator(greaterThanOrEqual, 's.typedArray(T).byteLengthGreaterThanOrEqual', expected, value);\n}\n\nexport function typedArrayByteLengthEqual<T extends TypedArray>(value: number): IConstraint<T> {\n\tconst expected = `expected.byteLength === ${value}`;\n\treturn typedArrayByteLengthComparator(equal, 's.typedArray(T).byteLengthEqual', expected, value);\n}\n\nexport function typedArrayByteLengthNotEqual<T extends TypedArray>(value: number): IConstraint<T> {\n\tconst expected = `expected.byteLength !== ${value}`;\n\treturn typedArrayByteLengthComparator(notEqual, 's.typedArray(T).byteLengthNotEqual', expected, value);\n}\n\nexport function typedArrayByteLengthRange<T extends TypedArray>(start: number, endBefore: number): IConstraint<T> {\n\tconst expected = `expected.byteLength >= ${start} && expected.byteLength < ${endBefore}`;\n\treturn {\n\t\trun(input: T) {\n\t\t\treturn input.byteLength >= start && input.byteLength < endBefore //\n\t\t\t\t? Result.ok(input)\n\t\t\t\t: Result.err(new ExpectedConstraintError('s.typedArray(T).byteLengthRange', 'Invalid Typed Array byte length', input, expected));\n\t\t}\n\t};\n}\n\nexport function typedArrayByteLengthRangeInclusive<T extends TypedArray>(start: number, end: number) {\n\tconst expected = `expected.byteLength >= ${start} && expected.byteLength <= ${end}`;\n\treturn {\n\t\trun(input: T) {\n\t\t\treturn input.byteLength >= start && input.byteLength <= end //\n\t\t\t\t? Result.ok(input)\n\t\t\t\t: Result.err(\n\t\t\t\t\t\tnew ExpectedConstraintError('s.typedArray(T).byteLengthRangeInclusive', 'Invalid Typed Array byte length', input, expected)\n\t\t\t\t );\n\t\t}\n\t};\n}\n\nexport function typedArrayByteLengthRangeExclusive<T extends TypedArray>(startAfter: number, endBefore: number): IConstraint<T> {\n\tconst expected = `expected.byteLength > ${startAfter} && expected.byteLength < ${endBefore}`;\n\treturn {\n\t\trun(input: T) {\n\t\t\treturn input.byteLength > startAfter && input.byteLength < endBefore //\n\t\t\t\t? Result.ok(input)\n\t\t\t\t: Result.err(\n\t\t\t\t\t\tnew ExpectedConstraintError('s.typedArray(T).byteLengthRangeExclusive', 'Invalid Typed Array byte length', input, expected)\n\t\t\t\t );\n\t\t}\n\t};\n}\n\nfunction typedArrayLengthComparator<T extends TypedArray>(\n\tcomparator: Comparator,\n\tname: TypedArrayConstraintName,\n\texpected: string,\n\tlength: number\n): IConstraint<T> {\n\treturn {\n\t\trun(input: T) {\n\t\t\treturn comparator(input.length, length) //\n\t\t\t\t? Result.ok(input)\n\t\t\t\t: Result.err(new ExpectedConstraintError(name, 'Invalid Typed Array length', input, expected));\n\t\t}\n\t};\n}\n\nexport function typedArrayLengthLessThan<T extends TypedArray>(value: number): IConstraint<T> {\n\tconst expected = `expected.length < ${value}`;\n\treturn typedArrayLengthComparator(lessThan, 's.typedArray(T).lengthLessThan', expected, value);\n}\n\nexport function typedArrayLengthLessThanOrEqual<T extends TypedArray>(value: number): IConstraint<T> {\n\tconst expected = `expected.length <= ${value}`;\n\treturn typedArrayLengthComparator(lessThanOrEqual, 's.typedArray(T).lengthLessThanOrEqual', expected, value);\n}\n\nexport function typedArrayLengthGreaterThan<T extends TypedArray>(value: number): IConstraint<T> {\n\tconst expected = `expected.length > ${value}`;\n\treturn typedArrayLengthComparator(greaterThan, 's.typedArray(T).lengthGreaterThan', expected, value);\n}\n\nexport function typedArrayLengthGreaterThanOrEqual<T extends TypedArray>(value: number): IConstraint<T> {\n\tconst expected = `expected.length >= ${value}`;\n\treturn typedArrayLengthComparator(greaterThanOrEqual, 's.typedArray(T).lengthGreaterThanOrEqual', expected, value);\n}\n\nexport function typedArrayLengthEqual<T extends TypedArray>(value: number): IConstraint<T> {\n\tconst expected = `expected.length === ${value}`;\n\treturn typedArrayLengthComparator(equal, 's.typedArray(T).lengthEqual', expected, value);\n}\n\nexport function typedArrayLengthNotEqual<T extends TypedArray>(value: number): IConstraint<T> {\n\tconst expected = `expected.length !== ${value}`;\n\treturn typedArrayLengthComparator(notEqual, 's.typedArray(T).lengthNotEqual', expected, value);\n}\n\nexport function typedArrayLengthRange<T extends TypedArray>(start: number, endBefore: number): IConstraint<T> {\n\tconst expected = `expected.length >= ${start} && expected.length < ${endBefore}`;\n\treturn {\n\t\trun(input: T) {\n\t\t\treturn input.length >= start && input.length < endBefore //\n\t\t\t\t? Result.ok(input)\n\t\t\t\t: Result.err(new ExpectedConstraintError('s.typedArray(T).lengthRange', 'Invalid Typed Array length', input, expected));\n\t\t}\n\t};\n}\n\nexport function typedArrayLengthRangeInclusive<T extends TypedArray>(start: number, end: number): IConstraint<T> {\n\tconst expected = `expected.length >= ${start} && expected.length <= ${end}`;\n\treturn {\n\t\trun(input: T) {\n\t\t\treturn input.length >= start && input.length <= end //\n\t\t\t\t? Result.ok(input)\n\t\t\t\t: Result.err(new ExpectedConstraintError('s.typedArray(T).lengthRangeInclusive', 'Invalid Typed Array length', input, expected));\n\t\t}\n\t};\n}\n\nexport function typedArrayLengthRangeExclusive<T extends TypedArray>(startAfter: number, endBefore: number): IConstraint<T> {\n\tconst expected = `expected.length > ${startAfter} && expected.length < ${endBefore}`;\n\treturn {\n\t\trun(input: T) {\n\t\t\treturn input.length > startAfter && input.length < endBefore //\n\t\t\t\t? Result.ok(input)\n\t\t\t\t: Result.err(new ExpectedConstraintError('s.typedArray(T).lengthRangeExclusive', 'Invalid Typed Array length', input, expected));\n\t\t}\n\t};\n}\n","const vowels = ['a', 'e', 'i', 'o', 'u'];\n\nexport const aOrAn = (word: string) => {\n\treturn `${vowels.includes(word[0].toLowerCase()) ? 'an' : 'a'} ${word}`;\n};\n","export type TypedArray =\n\t| Int8Array\n\t| Uint8Array\n\t| Uint8ClampedArray\n\t| Int16Array\n\t| Uint16Array\n\t| Int32Array\n\t| Uint32Array\n\t| Float32Array\n\t| Float64Array\n\t| BigInt64Array\n\t| BigUint64Array;\n\nexport const TypedArrays = {\n\tInt8Array: (x: unknown): x is Int8Array => x instanceof Int8Array,\n\tUint8Array: (x: unknown): x is Uint8Array => x instanceof Uint8Array,\n\tUint8ClampedArray: (x: unknown): x is Uint8ClampedArray => x instanceof Uint8ClampedArray,\n\tInt16Array: (x: unknown): x is Int16Array => x instanceof Int16Array,\n\tUint16Array: (x: unknown): x is Uint16Array => x instanceof Uint16Array,\n\tInt32Array: (x: unknown): x is Int32Array => x instanceof Int32Array,\n\tUint32Array: (x: unknown): x is Uint32Array => x instanceof Uint32Array,\n\tFloat32Array: (x: unknown): x is Float32Array => x instanceof Float32Array,\n\tFloat64Array: (x: unknown): x is Float64Array => x instanceof Float64Array,\n\tBigInt64Array: (x: unknown): x is BigInt64Array => x instanceof BigInt64Array,\n\tBigUint64Array: (x: unknown): x is BigUint64Array => x instanceof BigUint64Array,\n\tTypedArray: (x: unknown): x is TypedArray => ArrayBuffer.isView(x) && !(x instanceof DataView)\n} as const;\n\nexport type TypedArrayName = keyof typeof TypedArrays;\n","import type { IConstraint } from '../constraints/base/IConstraint';\nimport {\n\ttypedArrayByteLengthEqual,\n\ttypedArrayByteLengthGreaterThan,\n\ttypedArrayByteLengthGreaterThanOrEqual,\n\ttypedArrayByteLengthLessThan,\n\ttypedArrayByteLengthLessThanOrEqual,\n\ttypedArrayByteLengthNotEqual,\n\ttypedArrayByteLengthRange,\n\ttypedArrayByteLengthRangeExclusive,\n\ttypedArrayByteLengthRangeInclusive,\n\ttypedArrayLengthEqual,\n\ttypedArrayLengthGreaterThan,\n\ttypedArrayLengthGreaterThanOrEqual,\n\ttypedArrayLengthLessThan,\n\ttypedArrayLengthLessThanOrEqual,\n\ttypedArrayLengthNotEqual,\n\ttypedArrayLengthRange,\n\ttypedArrayLengthRangeExclusive,\n\ttypedArrayLengthRangeInclusive\n} from '../constraints/TypedArrayLengthConstraints';\nimport { aOrAn } from '../constraints/util/common/vowels';\nimport { TypedArray, TypedArrayName, TypedArrays } from '../constraints/util/typedArray';\nimport { ValidationError } from '../lib/errors/ValidationError';\nimport { Result } from '../lib/Result';\nimport { BaseValidator } from './imports';\n\nexport class TypedArrayValidator<T extends TypedArray> extends BaseValidator<T> {\n\tprivate readonly type: TypedArrayName;\n\n\tpublic constructor(type: TypedArrayName, constraints: readonly IConstraint<T>[] = []) {\n\t\tsuper(constraints);\n\t\tthis.type = type;\n\t}\n\n\tpublic byteLengthLessThan(length: number) {\n\t\treturn this.addConstraint(typedArrayByteLengthLessThan(length));\n\t}\n\n\tpublic byteLengthLessThanOrEqual(length: number) {\n\t\treturn this.addConstraint(typedArrayByteLengthLessThanOrEqual(length));\n\t}\n\n\tpublic byteLengthGreaterThan(length: number) {\n\t\treturn this.addConstraint(typedArrayByteLengthGreaterThan(length));\n\t}\n\n\tpublic byteLengthGreaterThanOrEqual(length: number) {\n\t\treturn this.addConstraint(typedArrayByteLengthGreaterThanOrEqual(length));\n\t}\n\n\tpublic byteLengthEqual(length: number) {\n\t\treturn this.addConstraint(typedArrayByteLengthEqual(length));\n\t}\n\n\tpublic byteLengthNotEqual(length: number) {\n\t\treturn this.addConstraint(typedArrayByteLengthNotEqual(length));\n\t}\n\n\tpublic byteLengthRange(start: number, endBefore: number) {\n\t\treturn this.addConstraint(typedArrayByteLengthRange(start, endBefore));\n\t}\n\n\tpublic byteLengthRangeInclusive(startAt: number, endAt: number) {\n\t\treturn this.addConstraint(typedArrayByteLengthRangeInclusive(startAt, endAt) as IConstraint<T>);\n\t}\n\n\tpublic byteLengthRangeExclusive(startAfter: number, endBefore: number) {\n\t\treturn this.addConstraint(typedArrayByteLengthRangeExclusive(startAfter, endBefore));\n\t}\n\n\tpublic lengthLessThan(length: number) {\n\t\treturn this.addConstraint(typedArrayLengthLessThan(length));\n\t}\n\n\tpublic lengthLessThanOrEqual(length: number) {\n\t\treturn this.addConstraint(typedArrayLengthLessThanOrEqual(length));\n\t}\n\n\tpublic lengthGreaterThan(length: number) {\n\t\treturn this.addConstraint(typedArrayLengthGreaterThan(length));\n\t}\n\n\tpublic lengthGreaterThanOrEqual(length: number) {\n\t\treturn this.addConstraint(typedArrayLengthGreaterThanOrEqual(length));\n\t}\n\n\tpublic lengthEqual(length: number) {\n\t\treturn this.addConstraint(typedArrayLengthEqual(length));\n\t}\n\n\tpublic lengthNotEqual(length: number) {\n\t\treturn this.addConstraint(typedArrayLengthNotEqual(length));\n\t}\n\n\tpublic lengthRange(start: number, endBefore: number) {\n\t\treturn this.addConstraint(typedArrayLengthRange(start, endBefore));\n\t}\n\n\tpublic lengthRangeInclusive(startAt: number, endAt: number) {\n\t\treturn this.addConstraint(typedArrayLengthRangeInclusive(startAt, endAt));\n\t}\n\n\tpublic lengthRangeExclusive(startAfter: number, endBefore: number) {\n\t\treturn this.addConstraint(typedArrayLengthRangeExclusive(startAfter, endBefore));\n\t}\n\n\tprotected override clone(): this {\n\t\treturn Reflect.construct(this.constructor, [this.type, this.constraints]);\n\t}\n\n\tprotected handle(value: unknown): Result<T, ValidationError> {\n\t\treturn TypedArrays[this.type](value)\n\t\t\t? Result.ok(value as T)\n\t\t\t: Result.err(new ValidationError('s.typedArray', `Expected ${aOrAn(this.type)}`, value));\n\t}\n}\n","import type { TypedArray, TypedArrayName } from '../constraints/util/typedArray';\nimport type { Unwrap, UnwrapTuple } from '../lib/util-types';\nimport {\n\tArrayValidator,\n\tBaseValidator,\n\tBigIntValidator,\n\tBooleanValidator,\n\tDateValidator,\n\tInstanceValidator,\n\tLiteralValidator,\n\tMapValidator,\n\tNeverValidator,\n\tNullishValidator,\n\tNumberValidator,\n\tObjectValidator,\n\tPassthroughValidator,\n\tRecordValidator,\n\tSetValidator,\n\tStringValidator,\n\tTupleValidator,\n\tUnionValidator\n} from '../validators/imports';\nimport { LazyValidator } from '../validators/LazyValidator';\nimport { NativeEnumLike, NativeEnumValidator } from '../validators/NativeEnumValidator';\nimport { TypedArrayValidator } from '../validators/TypedArrayValidator';\nimport type { Constructor, MappedObjectValidator } from './util-types';\n\nexport class Shapes {\n\tpublic get string() {\n\t\treturn new StringValidator();\n\t}\n\n\tpublic get number() {\n\t\treturn new NumberValidator();\n\t}\n\n\tpublic get bigint() {\n\t\treturn new BigIntValidator();\n\t}\n\n\tpublic get boolean() {\n\t\treturn new BooleanValidator();\n\t}\n\n\tpublic get date() {\n\t\treturn new DateValidator();\n\t}\n\n\tpublic object<T extends object>(shape: MappedObjectValidator<T>) {\n\t\treturn new ObjectValidator<T>(shape);\n\t}\n\n\tpublic get undefined() {\n\t\treturn this.literal(undefined);\n\t}\n\n\tpublic get null() {\n\t\treturn this.literal(null);\n\t}\n\n\tpublic get nullish() {\n\t\treturn new NullishValidator();\n\t}\n\n\tpublic get any() {\n\t\treturn new PassthroughValidator<any>();\n\t}\n\n\tpublic get unknown() {\n\t\treturn new PassthroughValidator<unknown>();\n\t}\n\n\tpublic get never() {\n\t\treturn new NeverValidator();\n\t}\n\n\tpublic enum<T>(...values: readonly T[]) {\n\t\treturn this.union(...values.map((value) => this.literal(value)));\n\t}\n\n\tpublic nativeEnum<T extends NativeEnumLike>(enumShape: T): NativeEnumValidator<T> {\n\t\treturn new NativeEnumValidator(enumShape);\n\t}\n\n\tpublic literal<T>(value: T): BaseValidator<T> {\n\t\tif (value instanceof Date) return this.date.equal(value) as unknown as BaseValidator<T>;\n\t\treturn new LiteralValidator(value);\n\t}\n\n\tpublic instance<T>(expected: Constructor<T>): InstanceValidator<T> {\n\t\treturn new InstanceValidator(expected);\n\t}\n\n\tpublic union<T extends [...BaseValidator<any>[]]>(...validators: [...T]): UnionValidator<Unwrap<T[number]>> {\n\t\treturn new UnionValidator(validators);\n\t}\n\n\tpublic array<T>(validator: BaseValidator<T[][number]>): ArrayValidator<T[], T[][number]>;\n\tpublic array<T extends unknown[]>(validator: BaseValidator<T[number]>): ArrayValidator<T, T[number]>;\n\tpublic array<T extends unknown[]>(validator: BaseValidator<T[number]>) {\n\t\treturn new ArrayValidator(validator);\n\t}\n\n\tpublic typedArray<T extends TypedArray>(type: TypedArrayName = 'TypedArray') {\n\t\treturn new TypedArrayValidator<T>(type);\n\t}\n\n\tpublic get int8Array() {\n\t\treturn this.typedArray<Int8Array>('Int8Array');\n\t}\n\n\tpublic get uint8Array() {\n\t\treturn this.typedArray<Uint8Array>('Uint8Array');\n\t}\n\n\tpublic get uint8ClampedArray() {\n\t\treturn this.typedArray<Uint8ClampedArray>('Uint8ClampedArray');\n\t}\n\n\tpublic get int16Array() {\n\t\treturn this.typedArray<Int16Array>('Int16Array');\n\t}\n\n\tpublic get uint16Array() {\n\t\treturn this.typedArray<Uint16Array>('Uint16Array');\n\t}\n\n\tpublic get int32Array() {\n\t\treturn this.typedArray<Int32Array>('Int32Array');\n\t}\n\n\tpublic get uint32Array() {\n\t\treturn this.typedArray<Uint32Array>('Uint32Array');\n\t}\n\n\tpublic get float32Array() {\n\t\treturn this.typedArray<Float32Array>('Float32Array');\n\t}\n\n\tpublic get float64Array() {\n\t\treturn this.typedArray<Float64Array>('Float64Array');\n\t}\n\n\tpublic get bigInt64Array() {\n\t\treturn this.typedArray<BigInt64Array>('BigInt64Array');\n\t}\n\n\tpublic get bigUint64Array() {\n\t\treturn this.typedArray<BigUint64Array>('BigUint64Array');\n\t}\n\n\tpublic tuple<T extends [...BaseValidator<any>[]]>(validators: [...T]): TupleValidator<UnwrapTuple<T>> {\n\t\treturn new TupleValidator(validators);\n\t}\n\n\tpublic set<T>(validator: BaseValidator<T>) {\n\t\treturn new SetValidator(validator);\n\t}\n\n\tpublic record<T>(validator: BaseValidator<T>) {\n\t\treturn new RecordValidator(validator);\n\t}\n\n\tpublic map<T, U>(keyValidator: BaseValidator<T>, valueValidator: BaseValidator<U>) {\n\t\treturn new MapValidator(keyValidator, valueValidator);\n\t}\n\n\tpublic lazy<T extends BaseValidator<unknown>>(validator: (value: unknown) => T) {\n\t\treturn new LazyValidator(validator);\n\t}\n}\n","import { Shapes } from './lib/Shapes';\n\nexport const s = new Shapes();\n\nexport * from './lib/configs';\nexport * from './lib/errors/BaseError';\nexport * from './lib/errors/CombinedError';\nexport * from './lib/errors/CombinedPropertyError';\nexport * from './lib/errors/ExpectedConstraintError';\nexport * from './lib/errors/ExpectedValidationError';\nexport * from './lib/errors/MissingPropertyError';\nexport * from './lib/errors/MultiplePossibilitiesConstraintError';\nexport * from './lib/errors/UnknownEnumValueError';\nexport * from './lib/errors/UnknownPropertyError';\nexport * from './lib/errors/ValidationError';\nexport * from './lib/Result';\nexport * from './type-exports';\n"]}
\ No newline at end of file diff --git a/includes/external/discord/node_modules/@sapphire/shapeshift/package.json b/includes/external/discord/node_modules/@sapphire/shapeshift/package.json new file mode 100644 index 0000000..85012f9 --- /dev/null +++ b/includes/external/discord/node_modules/@sapphire/shapeshift/package.json @@ -0,0 +1,127 @@ +{ + "name": "@sapphire/shapeshift", + "version": "3.8.1", + "description": "Blazing fast input validation and transformation β‘", + "author": "@sapphire", + "license": "MIT", + "main": "dist/index.js", + "module": "dist/index.mjs", + "browser": "dist/index.global.js", + "unpkg": "dist/index.global.js", + "types": "dist/index.d.ts", + "exports": { + "import": "./dist/index.mjs", + "require": "./dist/index.js", + "types": "./dist/index.d.ts" + }, + "sideEffects": false, + "homepage": "https://www.sapphirejs.dev", + "scripts": { + "lint": "eslint src tests --ext ts --fix", + "format": "prettier --write \"{src,tests}/**/*.ts\"", + "docs": "typedoc-json-parser", + "test": "vitest run", + "test:watch": "vitest", + "update": "yarn upgrade-interactive", + "build": "tsup", + "clean": "node scripts/clean.mjs", + "typecheck": "tsc -p tsconfig.eslint.json", + "bump": "cliff-jumper", + "check-update": "cliff-jumper --dry-run", + "_postinstall": "husky install .github/husky", + "prepack": "yarn build && pinst --disable", + "postpack": "pinst --enable" + }, + "devDependencies": { + "@commitlint/cli": "^17.3.0", + "@commitlint/config-conventional": "^17.3.0", + "@favware/cliff-jumper": "^1.9.0", + "@favware/npm-deprecate": "^1.0.7", + "@sapphire/eslint-config": "^4.3.8", + "@sapphire/prettier-config": "^1.4.4", + "@sapphire/ts-config": "^3.3.4", + "@types/jsdom": "^20.0.1", + "@types/lodash": "^4.14.191", + "@types/node": "^18.11.13", + "@typescript-eslint/eslint-plugin": "^5.46.0", + "@typescript-eslint/parser": "^5.46.0", + "@vitest/coverage-c8": "^0.25.7", + "cz-conventional-changelog": "^3.3.0", + "esbuild-plugins-node-modules-polyfill": "^1.0.7", + "eslint": "^8.29.0", + "eslint-config-prettier": "^8.5.0", + "eslint-plugin-prettier": "^4.2.1", + "husky": "^8.0.2", + "jsdom": "^20.0.3", + "lint-staged": "^13.1.0", + "pinst": "^3.0.0", + "prettier": "^2.8.1", + "pretty-quick": "^3.1.3", + "ts-node": "^10.9.1", + "tsup": "^6.5.0", + "typedoc": "^0.23.22", + "typedoc-json-parser": "^7.0.2", + "typescript": "^4.9.4", + "vite": "^4.0.0", + "vitest": "^0.25.7" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/sapphiredev/shapeshift.git" + }, + "files": [ + "dist/**/*.js*", + "dist/**/*.mjs*", + "dist/**/*.d*" + ], + "engines": { + "node": ">=v14.0.0", + "npm": ">=7.0.0" + }, + "keywords": [ + "@sapphire/shapeshift", + "shapeshift", + "bot", + "typescript", + "ts", + "yarn", + "sapphire", + "schema", + "validation", + "type-checking", + "checking", + "input-validation", + "runtime-validation", + "ow", + "type-validation", + "zod" + ], + "bugs": { + "url": "https://github.com/sapphiredev/shapeshift/issues" + }, + "commitlint": { + "extends": [ + "@commitlint/config-conventional" + ] + }, + "lint-staged": { + "*.{mjs,js,ts}": "eslint --fix --ext mjs,js,ts" + }, + "config": { + "commitizen": { + "path": "./node_modules/cz-conventional-changelog" + } + }, + "publishConfig": { + "access": "public" + }, + "resolutions": { + "ansi-regex": "^5.0.1", + "minimist": "^1.2.7" + }, + "packageManager": "yarn@3.3.0", + "dependencies": { + "fast-deep-equal": "^3.1.3", + "lodash": "^4.17.21" + } +}
\ No newline at end of file diff --git a/includes/external/discord/node_modules/@sapphire/snowflake/CHANGELOG.md b/includes/external/discord/node_modules/@sapphire/snowflake/CHANGELOG.md new file mode 100644 index 0000000..42792aa --- /dev/null +++ b/includes/external/discord/node_modules/@sapphire/snowflake/CHANGELOG.md @@ -0,0 +1,263 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +# [@sapphire/snowflake@3.4.0](https://github.com/sapphiredev/utilities/compare/@sapphire/snowflake@3.3.0...@sapphire/snowflake@3.4.0) - (2022-12-27) + +## π Bug Fixes + +- **deps:** Update all non-major dependencies (#532) ([8033d1f](https://github.com/sapphiredev/utilities/commit/8033d1ff7a5a1974134c61f424f171cccb2915e1)) + +## π Documentation + +- Add @06000208 as a contributor ([fa3349e](https://github.com/sapphiredev/utilities/commit/fa3349e55ce4ad008785211dec7bf8e2b5d933df)) + +## π Features + +- **snowflake:** Added `Snowflake.compare` (#531) ([6accd6d](https://github.com/sapphiredev/utilities/commit/6accd6d15eab12e312034f8ef43cff032835c972)) + +# [@sapphire/snowflake@3.3.0](https://github.com/sapphiredev/utilities/compare/@sapphire/snowflake@3.2.2...@sapphire/snowflake@3.3.0) - (2022-12-03) + +## π Refactor + +- Split `@sapphire/time-utilities` into 4 sub-packages (#462) ([574299a](https://github.com/sapphiredev/utilities/commit/574299a99e658f6500a2a7efa587a0919b2d1313)) + +## π Bug Fixes + +- **snowflake:** TwitterSnowflake using incorrect epoch (#522) ([4ad4117](https://github.com/sapphiredev/utilities/commit/4ad41170488161b2998bd72da5a8b7fea10539a0)) +- **deps:** Update all non-major dependencies (#514) ([21b07d5](https://github.com/sapphiredev/utilities/commit/21b07d5db529a0d982647a60de98e46f36f1ac93)) +- **deps:** Update all non-major dependencies (#505) ([6178296](https://github.com/sapphiredev/utilities/commit/617829649e1e4deeee02b14533b5377cd5bc1fb3)) +- **deps:** Update all non-major dependencies (#466) ([dc08606](https://github.com/sapphiredev/utilities/commit/dc08606a97154e47c65536123ac5f8b1262f7bd2)) +- **deps:** Update all non-major dependencies ([e20f299](https://github.com/sapphiredev/utilities/commit/e20f29906e83cee000aaba9c6827e3bec5173d28)) +- **deps:** Update all non-major dependencies ([2308bd7](https://github.com/sapphiredev/utilities/commit/2308bd74356b6b2e0c12995b25f4d8ade4803fe9)) +- **deps:** Update all non-major dependencies ([84af0db](https://github.com/sapphiredev/utilities/commit/84af0db2db749223b036aa99fe19a2e9af5681c6)) +- **deps:** Update all non-major dependencies ([50cd8de](https://github.com/sapphiredev/utilities/commit/50cd8dea593b6f5ae75571209456b3421e2ca59a)) + +## π Documentation + +- Add @didinele as a contributor ([42ef7b6](https://github.com/sapphiredev/utilities/commit/42ef7b656c48fd0e720119db1d622c8bba2791e9)) +- Add @goestav as a contributor ([0e56a92](https://github.com/sapphiredev/utilities/commit/0e56a92a4e2d0942bfa207f81a8cb03b32312034)) +- Add @CitTheDev as a contributor ([34169ea](https://github.com/sapphiredev/utilities/commit/34169eae1dc0476ccf5a6c4f36e28602a204829e)) +- Add @legendhimslef as a contributor ([059b6f1](https://github.com/sapphiredev/utilities/commit/059b6f1ab5362d46d58624d06c1aa39192b0716f)) +- Add @r-priyam as a contributor ([fb278ba](https://github.com/sapphiredev/utilities/commit/fb278bacf627ec6fc88752eafeb12df5f3177a2c)) +- Change name of @kyranet (#451) ([df4fdef](https://github.com/sapphiredev/utilities/commit/df4fdefce18659975a4ebc224723638507d02d35)) +- Update @RealShadowNova as a contributor ([a869ba0](https://github.com/sapphiredev/utilities/commit/a869ba0abfad041610b9115187d426aebe671af6)) +- Add @muchnameless as a contributor ([a1221fe](https://github.com/sapphiredev/utilities/commit/a1221fea68506e99591d5d00ec552a07c26833f9)) +- Add @enxg as a contributor ([d2382f0](https://github.com/sapphiredev/utilities/commit/d2382f04e3909cb4ad11798a0a10e683f6cf5383)) +- Add @EvolutionX-10 as a contributor ([efc3a32](https://github.com/sapphiredev/utilities/commit/efc3a320a72ae258996dd62866d206c33f8d4961)) +- Add @MajesticString as a contributor ([295b3e9](https://github.com/sapphiredev/utilities/commit/295b3e9849a4b0fe64074bae02f6426378a303c3)) +- Add @Mzato0001 as a contributor ([c790ef2](https://github.com/sapphiredev/utilities/commit/c790ef25df2d7e22888fa9f8169167aa555e9e19)) + +## π Features + +- **utilities:** Add possibility to import single functions by appending them to the import path. (#454) ([374c145](https://github.com/sapphiredev/utilities/commit/374c145a5dd329cfc1a867ed6720abf408683a88)) + +## π§ͺ Testing + +- Migrate to vitest (#380) ([075ec73](https://github.com/sapphiredev/utilities/commit/075ec73c7a8e3374fad3ada612d37eb4ac36ec8d)) + +# [@sapphire/snowflake@3.2.2](https://github.com/sapphiredev/utilities/compare/@sapphire/snowflake@3.2.1...@sapphire/snowflake@3.2.2) - (2022-04-24) + +## Bug Fixes + +- Fix typo (#333) ([ae2f257](https://github.com/sapphiredev/utilities/commit/ae2f25766d5985735f2d9b257eebd27cdc8a7c52)) + +## Documentation + +- Add @NotKaskus as a contributor ([00da8f1](https://github.com/sapphiredev/utilities/commit/00da8f199137b9277119823f322d1f2d168d928a)) +- Add @imranbarbhuiya as a contributor ([fb674c2](https://github.com/sapphiredev/utilities/commit/fb674c2c5594d41e71662263553dcb4bac9e37f4)) +- Add @axisiscool as a contributor ([ce1aa31](https://github.com/sapphiredev/utilities/commit/ce1aa316871a88d3663efbdf2a42d3d8dfe6a27f)) +- Add @dhruv-kaushikk as a contributor ([ebbf43f](https://github.com/sapphiredev/utilities/commit/ebbf43f63617daba96e72c50a234bf8b64f6ddc4)) +- Add @Commandtechno as a contributor ([f1d69fa](https://github.com/sapphiredev/utilities/commit/f1d69fabe1ee0abe4be08b19e63dbec03102f7ce)) +- Fix typedoc causing OOM crashes ([63ba41c](https://github.com/sapphiredev/utilities/commit/63ba41c4b6678554b1c7043a22d3296db4f59360)) + +## [3.2.1](https://github.com/sapphiredev/utilities/compare/@sapphire/snowflake@3.2.0...@sapphire/snowflake@3.2.1) (2022-04-01) + +**Note:** Version bump only for package @sapphire/snowflake + +# [3.2.0](https://github.com/sapphiredev/utilities/compare/@sapphire/snowflake@3.1.0...@sapphire/snowflake@3.2.0) (2022-03-06) + +### Bug Fixes + +- **snowflake:** fixed the examples for `DiscordSnowflake` and `TwitterSnowflake` ([#282](https://github.com/sapphiredev/utilities/issues/282)) ([2e5ed7f](https://github.com/sapphiredev/utilities/commit/2e5ed7fdadccf261967c45f73d0dc78e2497eed3)) + +### Features + +- allow module: NodeNext ([#306](https://github.com/sapphiredev/utilities/issues/306)) ([9dc6dd6](https://github.com/sapphiredev/utilities/commit/9dc6dd619efab879bb2b0b3c9e64304e10a67ed6)) +- **ts-config:** add multi-config structure ([#281](https://github.com/sapphiredev/utilities/issues/281)) ([b5191d7](https://github.com/sapphiredev/utilities/commit/b5191d7f2416dc5838590c4ff221454925553e37)) + +# [3.1.0](https://github.com/sapphiredev/utilities/compare/@sapphire/snowflake@3.0.1...@sapphire/snowflake@3.1.0) (2022-01-28) + +### Features + +- change build system to tsup ([#270](https://github.com/sapphiredev/utilities/issues/270)) ([365a53a](https://github.com/sapphiredev/utilities/commit/365a53a5517a01a0926cf28a83c96b63f32ed9f8)) + +## [3.0.1](https://github.com/sapphiredev/utilities/compare/@sapphire/snowflake@3.0.0...@sapphire/snowflake@3.0.1) (2022-01-10) + +**Note:** Version bump only for package @sapphire/snowflake + +# [3.0.0](https://github.com/sapphiredev/utilities/compare/@sapphire/snowflake@2.1.4...@sapphire/snowflake@3.0.0) (2021-12-08) + +### Bug Fixes + +- **snowflake:** remove env-based defaults ([#232](https://github.com/sapphiredev/utilities/issues/232)) ([10408e4](https://github.com/sapphiredev/utilities/commit/10408e4d3677e91490d967c3d89bf9575946090b)) + +### Features + +- **Snowflake:** rework entire package ([#231](https://github.com/sapphiredev/utilities/issues/231)) ([1d02f1a](https://github.com/sapphiredev/utilities/commit/1d02f1a2f520efcbc194c3992af593d0e493873b)) + +### BREAKING CHANGES + +- **Snowflake:** Renamed `processID` to `processId` +- **Snowflake:** Renamed `workerID` to `workerId` +- **Snowflake:** `workerId` now defaults to 0n instead of 1n +- **Snowflake:** `DiscordSnowflake` is not longer a class, but a constructed Snowflake +- **Snowflake:** `TwitterSnowflake` is not longer a class, but a constructed Snowflake + +## [2.1.4](https://github.com/sapphiredev/utilities/compare/@sapphire/snowflake@2.1.3...@sapphire/snowflake@2.1.4) (2021-11-06) + +**Note:** Version bump only for package @sapphire/snowflake + +## [2.1.3](https://github.com/sapphiredev/utilities/compare/@sapphire/snowflake@2.1.2...@sapphire/snowflake@2.1.3) (2021-10-26) + +**Note:** Version bump only for package @sapphire/snowflake + +## [2.1.2](https://github.com/sapphiredev/utilities/compare/@sapphire/snowflake@2.1.1...@sapphire/snowflake@2.1.2) (2021-10-17) + +### Bug Fixes + +- allow more node & npm versions in engines field ([5977d2a](https://github.com/sapphiredev/utilities/commit/5977d2a30a4b2cfdf84aff3f33af03ffde1bbec5)) + +## [2.1.1](https://github.com/sapphiredev/utilities/compare/@sapphire/snowflake@2.1.0...@sapphire/snowflake@2.1.1) (2021-10-11) + +**Note:** Version bump only for package @sapphire/snowflake + +# [2.1.0](https://github.com/sapphiredev/utilities/compare/@sapphire/snowflake@2.0.0...@sapphire/snowflake@2.1.0) (2021-10-04) + +### Bug Fixes + +- **snowflake:** fixed snowflake generating duplicate IDs ([#166](https://github.com/sapphiredev/utilities/issues/166)) ([f0cf4ad](https://github.com/sapphiredev/utilities/commit/f0cf4ad6bc0b8b2447499ca36581d2b453e52715)) + +### Features + +- **snowflake:** set minimum NodeJS to v14 ([11a61c7](https://github.com/sapphiredev/utilities/commit/11a61c72bc29e683f9a4492815db3db094103bbc)) + +# [2.0.0](https://github.com/sapphiredev/utilities/compare/@sapphire/snowflake@1.3.6...@sapphire/snowflake@2.0.0) (2021-07-17) + +### Code Refactoring + +- **rateLimits:** rewrite all of it ([#130](https://github.com/sapphiredev/utilities/issues/130)) ([320778c](https://github.com/sapphiredev/utilities/commit/320778ca65cbf3591bd1ce0b1f2eb430693eef9a)) + +### BREAKING CHANGES + +- **rateLimits:** Removed `Bucket` + +## [1.3.6](https://github.com/sapphiredev/utilities/compare/@sapphire/snowflake@1.3.5...@sapphire/snowflake@1.3.6) (2021-07-11) + +**Note:** Version bump only for package @sapphire/snowflake + +## [1.3.5](https://github.com/sapphiredev/utilities/compare/@sapphire/snowflake@1.3.4...@sapphire/snowflake@1.3.5) (2021-06-27) + +**Note:** Version bump only for package @sapphire/snowflake + +## [1.3.4](https://github.com/sapphiredev/utilities/compare/@sapphire/snowflake@1.3.3...@sapphire/snowflake@1.3.4) (2021-06-19) + +### Bug Fixes + +- **doc:** change `[@link](https://github.com/link)` to `[@linkplain](https://github.com/linkplain)` for support in VSCode IntelliSense ([703d460](https://github.com/sapphiredev/utilities/commit/703d4605b547a8787aff62d6f1054ea26dfd9d1c)) +- **docs:** update-tsdoc-for-vscode-may-2021 ([#126](https://github.com/sapphiredev/utilities/issues/126)) ([f8581bf](https://github.com/sapphiredev/utilities/commit/f8581bfe97a1b2f8aac3a3d3ed342d8ba92d730b)) + +## [1.3.3](https://github.com/sapphiredev/utilities/compare/@sapphire/snowflake@1.3.2...@sapphire/snowflake@1.3.3) (2021-06-06) + +### Bug Fixes + +- remove peer deps, update dev deps, update READMEs ([#124](https://github.com/sapphiredev/utilities/issues/124)) ([67256ed](https://github.com/sapphiredev/utilities/commit/67256ed43b915b02a8b5c68230ba82d6210c5032)) +- **snowflake:** fixed parsing for timestamps as Date objects ([c17a515](https://github.com/sapphiredev/utilities/commit/c17a515b02931cf778ca69913132e8d4558504a1)) + +## [1.3.2](https://github.com/sapphiredev/utilities/compare/@sapphire/snowflake@1.3.1...@sapphire/snowflake@1.3.2) (2021-05-20) + +### Bug Fixes + +- **snowflake:** mark package as side effect free ([6a9bafc](https://github.com/sapphiredev/utilities/commit/6a9bafc24caba4b0ebbdd6896ac245ae6d60dede)) + +## [1.3.1](https://github.com/sapphiredev/utilities/compare/@sapphire/snowflake@1.3.0...@sapphire/snowflake@1.3.1) (2021-05-02) + +### Bug Fixes + +- drop the `www.` from the SapphireJS URL ([494d89f](https://github.com/sapphiredev/utilities/commit/494d89ffa04f78c195b93d7905b3232884f7d7e2)) +- update all the SapphireJS URLs from `.com` to `.dev` ([f59b46d](https://github.com/sapphiredev/utilities/commit/f59b46d1a0ebd39cad17b17d71cd3b9da808d5fd)) + +# [1.3.0](https://github.com/sapphiredev/utilities/compare/@sapphire/snowflake@1.2.8...@sapphire/snowflake@1.3.0) (2021-04-21) + +### Features + +- add @sapphire/embed-jsx ([#100](https://github.com/sapphiredev/utilities/issues/100)) ([7277a23](https://github.com/sapphiredev/utilities/commit/7277a236015236ed8e81b7882875410facc4ce17)) + +## [1.2.8](https://github.com/sapphiredev/utilities/compare/@sapphire/snowflake@1.2.7...@sapphire/snowflake@1.2.8) (2021-04-19) + +### Bug Fixes + +- change all Sapphire URLs from "project"->"community" & use our domain where applicable π¨βπΎπ ([#102](https://github.com/sapphiredev/utilities/issues/102)) ([835b408](https://github.com/sapphiredev/utilities/commit/835b408e8e57130c3787aca2e32613346ff23e4d)) + +## [1.2.7](https://github.com/sapphiredev/utilities/compare/@sapphire/snowflake@1.2.6...@sapphire/snowflake@1.2.7) (2021-04-03) + +**Note:** Version bump only for package @sapphire/snowflake + +## [1.2.6](https://github.com/sapphiredev/utilities/compare/@sapphire/snowflake@1.2.5...@sapphire/snowflake@1.2.6) (2021-03-16) + +### Bug Fixes + +- remove terser from all packages ([#79](https://github.com/sapphiredev/utilities/issues/79)) ([1cfe4e7](https://github.com/sapphiredev/utilities/commit/1cfe4e7c804e62c142495686d2b83b81d0026c02)) + +## [1.2.5](https://github.com/sapphiredev/utilities/compare/@sapphire/snowflake@1.2.4...@sapphire/snowflake@1.2.5) (2021-02-16) + +**Note:** Version bump only for package @sapphire/snowflake + +## [1.2.4](https://github.com/sapphiredev/utilities/compare/@sapphire/snowflake@1.2.3...@sapphire/snowflake@1.2.4) (2021-01-16) + +**Note:** Version bump only for package @sapphire/snowflake + +## [1.2.3](https://github.com/sapphiredev/utilities/compare/@sapphire/snowflake@1.2.2...@sapphire/snowflake@1.2.3) (2021-01-01) + +**Note:** Version bump only for package @sapphire/snowflake + +## [1.2.2](https://github.com/sapphiredev/utilities/compare/@sapphire/snowflake@1.2.1...@sapphire/snowflake@1.2.2) (2020-12-26) + +**Note:** Version bump only for package @sapphire/snowflake + +## [1.2.1](https://github.com/sapphiredev/utilities/compare/@sapphire/snowflake@1.2.0...@sapphire/snowflake@1.2.1) (2020-12-22) + +**Note:** Version bump only for package @sapphire/snowflake + +# [1.2.0](https://github.com/sapphiredev/utilities/compare/@sapphire/snowflake@1.1.0...@sapphire/snowflake@1.2.0) (2020-11-15) + +### Bug Fixes + +- **snowflake:** pass keep_classnames to terser ([76ea062](https://github.com/sapphiredev/utilities/commit/76ea062d07000b169d9781f1a199b85ad3db0ba6)) +- **snowflake:** pass keep_fnames to terser ([b52aa76](https://github.com/sapphiredev/utilities/commit/b52aa764d8b02535496e0ceea3204a37552ce3d1)) + +### Features + +- added time-utilities package ([#26](https://github.com/sapphiredev/utilities/issues/26)) ([f17a333](https://github.com/sapphiredev/utilities/commit/f17a3339667a452e8745fad7884272176e5d65e8)) + +# [1.1.0](https://github.com/sapphiredev/utilities/compare/@sapphire/snowflake@1.0.1...@sapphire/snowflake@1.1.0) (2020-11-04) + +### Bug Fixes + +- **ratelimits,snowflake,utilities:** fixed esm output target ([9fdab3f](https://github.com/sapphiredev/utilities/commit/9fdab3fca283c8c0b47cc32661c5cf8e0a5e583c)) +- **snowflake:** properly specify ESM and CommonJS exports ([e3278e6](https://github.com/sapphiredev/utilities/commit/e3278e6868a4f31d5b2a100710bcbce2b79bc218)) + +### Features + +- added ratelimits package ([#15](https://github.com/sapphiredev/utilities/issues/15)) ([e0ae18c](https://github.com/sapphiredev/utilities/commit/e0ae18c5e1d0ae4e68a982829f1cf251fddfc80d)) + +## [1.0.1](https://github.com/sapphiredev/utilities/compare/@sapphire/snowflake@1.0.0...@sapphire/snowflake@1.0.1) (2020-09-20) + +**Note:** Version bump only for package @sapphire/snowflake + +# 1.0.0 (2020-09-05) + +### Features + +- implement snowflake ([5ba4e2d](https://github.com/sapphiredev/utilities/commit/5ba4e2d82557dd4ff60ffe891a7b46e46373bea2)) +- **decorators:** add decorators package ([#4](https://github.com/sapphiredev/utilities/issues/4)) ([677b3e5](https://github.com/sapphiredev/utilities/commit/677b3e59d5c6160cbe6fb410821cadd7c0f00e3c)) diff --git a/includes/external/discord/node_modules/@sapphire/snowflake/README.md b/includes/external/discord/node_modules/@sapphire/snowflake/README.md new file mode 100644 index 0000000..e8d3089 --- /dev/null +++ b/includes/external/discord/node_modules/@sapphire/snowflake/README.md @@ -0,0 +1,234 @@ +<div align="center"> + +![Sapphire Logo](https://cdn.skyra.pw/gh-assets/sapphire-banner.png) + +# @sapphire/snowflake + +**Deconstruct and generate snowflake IDs using BigInts.** + +[![GitHub](https://img.shields.io/github/license/sapphiredev/utilities)](https://github.com/sapphiredev/utilities/blob/main/LICENSE.md) +[![codecov](https://codecov.io/gh/sapphiredev/utilities/branch/main/graph/badge.svg?token=OEGIV6RFDO)](https://codecov.io/gh/sapphiredev/utilities) +[![npm bundle size](https://img.shields.io/bundlephobia/min/@sapphire/snowflake?logo=webpack&style=flat-square)](https://bundlephobia.com/result?p=@sapphire/snowflake) +[![npm](https://img.shields.io/npm/v/@sapphire/snowflake?color=crimson&logo=npm&style=flat-square)](https://www.npmjs.com/package/@sapphire/snowflake) + +</div> + +**Table of Contents** + +- [Description](#description) +- [Features](#features) +- [Installation](#installation) +- [Usage](#usage) + - [Constructing snowflakes](#constructing-snowflakes) + - [Snowflakes with custom epoch](#snowflakes-with-custom-epoch) + - [Snowflake with Discord epoch constant](#snowflake-with-discord-epoch-constant) + - [Snowflake with Twitter epoch constant](#snowflake-with-twitter-epoch-constant) + - [Deconstructing snowflakes](#deconstructing-snowflakes) + - [Snowflakes with custom epoch](#snowflakes-with-custom-epoch-1) + - [Snowflake with Discord epoch constant](#snowflake-with-discord-epoch-constant-1) + - [Snowflake with Twitter epoch constant](#snowflake-with-twitter-epoch-constant-1) +- [Buy us some doughnuts](#buy-us-some-doughnuts) +- [Contributors β¨](#contributors-%E2%9C%A8) + +## Description + +There is often a need to get a unique ID for entities, be that for Discord messages/channels/servers, keys in a database or many other similar examples. There are many ways to get such a unique ID, and one of those is using a so-called "snowflake". You can read more about snowflake IDs in [this Medium article](https://medium.com/better-programming/uuid-generation-snowflake-identifiers-unique-2aed8b1771bc). + +## Features + +- Written in TypeScript +- Bundled with esbuild so it can be used in NodeJS and browsers +- Offers CommonJS, ESM and UMD bundles +- Offers predefined epochs for Discord and Twitter +- Fully tested + +## Installation + +You can use the following command to install this package, or replace `npm install` with your package manager of choice. + +```sh +npm install @sapphire/snowflake +``` + +## Usage + +**Note:** While this section uses `require`, the imports match 1:1 with ESM imports. For example `const { Snowflake } = require('@sapphire/snowflake')` equals `import { Snowflake } from '@sapphire/snowflake'`. + +### Constructing snowflakes + +#### Snowflakes with custom epoch + +```typescript +// Import the Snowflake class +const { Snowflake } = require('@sapphire/snowflake'); + +// Define a custom epoch +const epoch = new Date('2000-01-01T00:00:00.000Z'); + +// Create an instance of Snowflake +const snowflake = new Snowflake(epoch); + +// Generate a snowflake with the given epoch +const uniqueId = snowflake.generate(); +``` + +#### Snowflake with Discord epoch constant + +```typescript +// Import the Snowflake class +const { DiscordSnowflake } = require('@sapphire/snowflake'); + +// Generate a snowflake with Discord's epoch +const uniqueId = DiscordSnowflake.generate(); + +// Alternatively, you can use the method directly +const uniqueId = DiscordSnowflake.generate(); +``` + +#### Snowflake with Twitter epoch constant + +```typescript +// Import the Snowflake class +const { TwitterSnowflake } = require('@sapphire/snowflake'); + +// Generate a snowflake with Twitter's epoch +const uniqueId = TwitterSnowflake.generate(); + +// Alternatively, you can use the method directly +const uniqueId = TwitterSnowflake.generate(); +``` + +### Deconstructing snowflakes + +#### Snowflakes with custom epoch + +```typescript +// Import the Snowflake class +const { Snowflake } = require('@sapphire/snowflake'); + +// Define a custom epoch +const epoch = new Date('2000-01-01T00:00:00.000Z'); + +// Create an instance of Snowflake +const snowflake = new Snowflake(epoch); + +// Deconstruct a snowflake with the given epoch +const uniqueId = snowflake.deconstruct('3971046231244935168'); +``` + +#### Snowflake with Discord epoch constant + +```typescript +// Import the Snowflake class +const { DiscordSnowflake } = require('@sapphire/snowflake'); + +// Deconstruct a snowflake with Discord's epoch +const uniqueId = DiscordSnowflake.deconstruct('3971046231244935168'); + +// Alternatively, you can use the method directly +const uniqueId = DiscordSnowflake.deconstruct('3971046231244935168'); +``` + +#### Snowflake with Twitter epoch constant + +```typescript +// Import the Snowflake class +const { TwitterSnowflake } = require('@sapphire/snowflake'); + +// Deconstruct a snowflake with Twitter's epoch +const uniqueId = TwitterSnowflake.deconstruct('3971046231244935168'); + +// Alternatively, you can use the method directly +const uniqueId = TwitterSnowflake.deconstruct('3971046231244935168'); +``` + +--- + +## Buy us some doughnuts + +Sapphire Community is and always will be open source, even if we don't get donations. That being said, we know there are amazing people who may still want to donate just to show their appreciation. Thank you very much in advance! + +We accept donations through Open Collective, Ko-fi, PayPal, Patreon and GitHub Sponsorships. You can use the buttons below to donate through your method of choice. + +| Donate With | Address | +| :-------------: | :-------------------------------------------------: | +| Open Collective | [Click Here](https://sapphirejs.dev/opencollective) | +| Ko-fi | [Click Here](https://sapphirejs.dev/kofi) | +| Patreon | [Click Here](https://sapphirejs.dev/patreon) | +| PayPal | [Click Here](https://sapphirejs.dev/paypal) | + +## Contributors β¨ + +Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)): + +<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --> +<!-- prettier-ignore-start --> +<!-- markdownlint-disable --> +<table> + <tr> + <td align="center"><a href="https://favware.tech/"><img src="https://avatars3.githubusercontent.com/u/4019718?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Jeroen Claassens</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=favna" title="Code">π»</a> <a href="#infra-favna" title="Infrastructure (Hosting, Build-Tools, etc)">π</a> <a href="#projectManagement-favna" title="Project Management">π</a> <a href="https://github.com/sapphiredev/utilities/commits?author=favna" title="Documentation">π</a> <a href="https://github.com/sapphiredev/utilities/commits?author=favna" title="Tests">β οΈ</a></td> + <td align="center"><a href="https://github.com/kyranet"><img src="https://avatars0.githubusercontent.com/u/24852502?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Aura RomΓ‘n</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=kyranet" title="Code">π»</a> <a href="#projectManagement-kyranet" title="Project Management">π</a> <a href="https://github.com/sapphiredev/utilities/pulls?q=is%3Apr+reviewed-by%3Akyranet" title="Reviewed Pull Requests">π</a> <a href="https://github.com/sapphiredev/utilities/commits?author=kyranet" title="Tests">β οΈ</a></td> + <td align="center"><a href="https://github.com/PyroTechniac"><img src="https://avatars2.githubusercontent.com/u/39341355?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Gryffon Bellish</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=PyroTechniac" title="Code">π»</a> <a href="https://github.com/sapphiredev/utilities/pulls?q=is%3Apr+reviewed-by%3APyroTechniac" title="Reviewed Pull Requests">π</a> <a href="https://github.com/sapphiredev/utilities/commits?author=PyroTechniac" title="Tests">β οΈ</a></td> + <td align="center"><a href="https://github.com/vladfrangu"><img src="https://avatars3.githubusercontent.com/u/17960496?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Vlad Frangu</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=vladfrangu" title="Code">π»</a> <a href="https://github.com/sapphiredev/utilities/issues?q=author%3Avladfrangu" title="Bug reports">π</a> <a href="https://github.com/sapphiredev/utilities/pulls?q=is%3Apr+reviewed-by%3Avladfrangu" title="Reviewed Pull Requests">π</a> <a href="#userTesting-vladfrangu" title="User Testing">π</a> <a href="https://github.com/sapphiredev/utilities/commits?author=vladfrangu" title="Tests">β οΈ</a></td> + <td align="center"><a href="https://github.com/Stitch07"><img src="https://avatars0.githubusercontent.com/u/29275227?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Stitch07</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=Stitch07" title="Code">π»</a> <a href="#projectManagement-Stitch07" title="Project Management">π</a> <a href="https://github.com/sapphiredev/utilities/commits?author=Stitch07" title="Tests">β οΈ</a></td> + <td align="center"><a href="https://github.com/apps/depfu"><img src="https://avatars3.githubusercontent.com/in/715?v=4?s=100" width="100px;" alt=""/><br /><sub><b>depfu[bot]</b></sub></a><br /><a href="#maintenance-depfu[bot]" title="Maintenance">π§</a></td> + <td align="center"><a href="https://github.com/apps/allcontributors"><img src="https://avatars0.githubusercontent.com/in/23186?v=4?s=100" width="100px;" alt=""/><br /><sub><b>allcontributors[bot]</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=allcontributors[bot]" title="Documentation">π</a></td> + </tr> + <tr> + <td align="center"><a href="https://github.com/Nytelife26"><img src="https://avatars1.githubusercontent.com/u/22531310?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Tyler J Russell</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=Nytelife26" title="Documentation">π</a></td> + <td align="center"><a href="https://github.com/Alcremie"><img src="https://avatars0.githubusercontent.com/u/54785334?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ivan Lieder</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=Alcremie" title="Code">π»</a> <a href="https://github.com/sapphiredev/utilities/issues?q=author%3AAlcremie" title="Bug reports">π</a></td> + <td align="center"><a href="https://github.com/RealShadowNova"><img src="https://avatars3.githubusercontent.com/u/46537907?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Hezekiah Hendry</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=RealShadowNova" title="Code">π»</a> <a href="#tool-RealShadowNova" title="Tools">π§</a></td> + <td align="center"><a href="https://github.com/Vetlix"><img src="https://avatars.githubusercontent.com/u/31412314?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Vetlix</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=Vetlix" title="Code">π»</a></td> + <td align="center"><a href="https://github.com/ethamitc"><img src="https://avatars.githubusercontent.com/u/27776796?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ethan Mitchell</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=ethamitc" title="Documentation">π</a></td> + <td align="center"><a href="https://github.com/noftaly"><img src="https://avatars.githubusercontent.com/u/34779161?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Elliot</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=noftaly" title="Code">π»</a></td> + <td align="center"><a href="https://jurien.dev"><img src="https://avatars.githubusercontent.com/u/5418114?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Jurien Hamaker</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=jurienhamaker" title="Code">π»</a></td> + </tr> + <tr> + <td align="center"><a href="https://fanoulis.dev/"><img src="https://avatars.githubusercontent.com/u/38255093?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Charalampos Fanoulis</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=cfanoulis" title="Documentation">π</a></td> + <td align="center"><a href="https://github.com/apps/dependabot"><img src="https://avatars.githubusercontent.com/in/29110?v=4?s=100" width="100px;" alt=""/><br /><sub><b>dependabot[bot]</b></sub></a><br /><a href="#maintenance-dependabot[bot]" title="Maintenance">π§</a></td> + <td align="center"><a href="https://kaname.netlify.app/"><img src="https://avatars.githubusercontent.com/u/56084970?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Kaname</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=kaname-png" title="Code">π»</a></td> + <td align="center"><a href="https://github.com/nandhagk"><img src="https://avatars.githubusercontent.com/u/62976649?v=4?s=100" width="100px;" alt=""/><br /><sub><b>nandhagk</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/issues?q=author%3Anandhagk" title="Bug reports">π</a></td> + <td align="center"><a href="https://megatank58.me/"><img src="https://avatars.githubusercontent.com/u/51410502?v=4?s=100" width="100px;" alt=""/><br /><sub><b>megatank58</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=megatank58" title="Code">π»</a></td> + <td align="center"><a href="https://github.com/UndiedGamer"><img src="https://avatars.githubusercontent.com/u/84702365?v=4?s=100" width="100px;" alt=""/><br /><sub><b>UndiedGamer</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=UndiedGamer" title="Code">π»</a></td> + <td align="center"><a href="https://github.com/Lioness100"><img src="https://avatars.githubusercontent.com/u/65814829?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Lioness100</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=Lioness100" title="Documentation">π</a> <a href="https://github.com/sapphiredev/utilities/commits?author=Lioness100" title="Code">π»</a></td> + </tr> + <tr> + <td align="center"><a href="https://gitlab.com/DavidPH/"><img src="https://avatars.githubusercontent.com/u/44669930?v=4?s=100" width="100px;" alt=""/><br /><sub><b>David</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=DavidPHH" title="Code">π»</a></td> + <td align="center"><a href="https://github.com/apps/renovate"><img src="https://avatars.githubusercontent.com/in/2740?v=4?s=100" width="100px;" alt=""/><br /><sub><b>renovate[bot]</b></sub></a><br /><a href="#maintenance-renovate[bot]" title="Maintenance">π§</a></td> + <td align="center"><a href="https://renovate.whitesourcesoftware.com/"><img src="https://avatars.githubusercontent.com/u/25180681?v=4?s=100" width="100px;" alt=""/><br /><sub><b>WhiteSource Renovate</b></sub></a><br /><a href="#maintenance-renovate-bot" title="Maintenance">π§</a></td> + <td align="center"><a href="https://fc5570.me/"><img src="https://avatars.githubusercontent.com/u/68158483?v=4?s=100" width="100px;" alt=""/><br /><sub><b>FC</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=FC5570" title="Code">π»</a></td> + <td align="center"><a href="https://github.com/Tokipudi"><img src="https://avatars.githubusercontent.com/u/29551076?v=4?s=100" width="100px;" alt=""/><br /><sub><b>JΓ©rΓ©my de Saint Denis</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=Tokipudi" title="Code">π»</a></td> + <td align="center"><a href="https://github.com/ItsMrCube"><img src="https://avatars.githubusercontent.com/u/25201357?v=4?s=100" width="100px;" alt=""/><br /><sub><b>MrCube</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=ItsMrCube" title="Code">π»</a></td> + <td align="center"><a href="https://github.com/bitomic"><img src="https://avatars.githubusercontent.com/u/35199700?v=4?s=100" width="100px;" alt=""/><br /><sub><b>bitomic</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=bitomic" title="Code">π»</a></td> + </tr> + <tr> + <td align="center"><a href="https://c43721.dev/"><img src="https://avatars.githubusercontent.com/u/55610086?v=4?s=100" width="100px;" alt=""/><br /><sub><b>c43721</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=c43721" title="Code">π»</a></td> + <td align="center"><a href="https://commandtechno.com/"><img src="https://avatars.githubusercontent.com/u/68407783?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Commandtechno</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=Commandtechno" title="Code">π»</a></td> + <td align="center"><a href="https://github.com/dhruv-kaushikk"><img src="https://avatars.githubusercontent.com/u/73697546?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Aura</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=dhruv-kaushikk" title="Code">π»</a></td> + <td align="center"><a href="https://axis.moe/"><img src="https://avatars.githubusercontent.com/u/54381371?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Jonathan</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=axisiscool" title="Code">π»</a></td> + <td align="center"><a href="https://github.com/imranbarbhuiya"><img src="https://avatars.githubusercontent.com/u/74945038?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Parbez</b></sub></a><br /><a href="#maintenance-imranbarbhuiya" title="Maintenance">π§</a></td> + <td align="center"><a href="https://github.com/NotKaskus"><img src="https://avatars.githubusercontent.com/u/75168528?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Paul Andrew</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=NotKaskus" title="Documentation">π</a></td> + <td align="center"><a href="https://linktr.ee/mzato0001"><img src="https://avatars.githubusercontent.com/u/62367547?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Mzato</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=Mzato0001" title="Code">π»</a> <a href="https://github.com/sapphiredev/utilities/issues?q=author%3AMzato0001" title="Bug reports">π</a></td> + </tr> + <tr> + <td align="center"><a href="https://github.com/MajesticString"><img src="https://avatars.githubusercontent.com/u/66224939?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Harry Allen</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=MajesticString" title="Documentation">π</a></td> + <td align="center"><a href="https://github.com/EvolutionX-10"><img src="https://avatars.githubusercontent.com/u/85353424?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Evo</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=EvolutionX-10" title="Code">π»</a></td> + <td align="center"><a href="https://enes.ovh/"><img src="https://avatars.githubusercontent.com/u/61084101?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Enes GenΓ§</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=enxg" title="Code">π»</a></td> + <td align="center"><a href="https://github.com/muchnameless"><img src="https://avatars.githubusercontent.com/u/12682826?v=4?s=100" width="100px;" alt=""/><br /><sub><b>muchnameless</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=muchnameless" title="Code">π»</a></td> + <td align="center"><a href="https://github.com/r-priyam"><img src="https://avatars.githubusercontent.com/u/50884372?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Priyam</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=r-priyam" title="Code">π»</a></td> + <td align="center"><a href="https://github.com/legendhimslef"><img src="https://avatars.githubusercontent.com/u/69213593?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Voxelli</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=legendhimslef" title="Code">π»</a></td> + <td align="center"><a href="https://github.com/CitTheDev"><img src="https://avatars.githubusercontent.com/u/94020875?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Cit The Dev</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=CitTheDev" title="Code">π»</a></td> + </tr> + <tr> + <td align="center"><a href="https://www.goestav.com/"><img src="https://avatars.githubusercontent.com/u/27970303?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Goestav</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=goestav" title="Code">π»</a></td> + <td align="center"><a href="https://github.com/didinele"><img src="https://avatars.githubusercontent.com/u/27137376?v=4?s=100" width="100px;" alt=""/><br /><sub><b>DD</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=didinele" title="Code">π»</a></td> + <td align="center"><a href="https://steamcommunity.com/id/06000208"><img src="https://avatars.githubusercontent.com/u/52764066?v=4?s=100" width="100px;" alt=""/><br /><sub><b>amber</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=06000208" title="Code">π»</a></td> + </tr> +</table> + +<!-- markdownlint-restore --> +<!-- prettier-ignore-end --> + +<!-- ALL-CONTRIBUTORS-LIST:END --> + +This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome! diff --git a/includes/external/discord/node_modules/@sapphire/snowflake/dist/index.d.ts b/includes/external/discord/node_modules/@sapphire/snowflake/dist/index.d.ts new file mode 100644 index 0000000..398d957 --- /dev/null +++ b/includes/external/discord/node_modules/@sapphire/snowflake/dist/index.d.ts @@ -0,0 +1,149 @@ +/** + * A class for generating and deconstructing Twitter snowflakes. + * + * A {@link https://developer.twitter.com/en/docs/twitter-ids Twitter snowflake} + * is a 64-bit unsigned integer with 4 fields that have a fixed epoch value. + * + * If we have a snowflake `266241948824764416` we can represent it as binary: + * ``` + * 64 22 17 12 0 + * 000000111011000111100001101001000101000000 00001 00000 000000000000 + * number of ms since epoch worker pid increment + * ``` + */ +declare class Snowflake { + #private; + /** + * Alias for {@link deconstruct} + */ + decode: (id: string | bigint) => DeconstructedSnowflake; + /** + * @param epoch the epoch to use + */ + constructor(epoch: number | bigint | Date); + /** + * The epoch for this snowflake. + */ + get epoch(): bigint; + /** + * Generates a snowflake given an epoch and optionally a timestamp + * @param options options to pass into the generator, see {@link SnowflakeGenerateOptions} + * + * **note** when `increment` is not provided it defaults to the private `increment` of the instance + * @example + * ```typescript + * const epoch = new Date('2000-01-01T00:00:00.000Z'); + * const snowflake = new Snowflake(epoch).generate(); + * ``` + * @returns A unique snowflake + */ + generate({ increment, timestamp, workerId, processId }?: SnowflakeGenerateOptions): bigint; + /** + * Deconstructs a snowflake given a snowflake ID + * @param id the snowflake to deconstruct + * @returns a deconstructed snowflake + * @example + * ```typescript + * const epoch = new Date('2000-01-01T00:00:00.000Z'); + * const snowflake = new Snowflake(epoch).deconstruct('3971046231244935168'); + * ``` + */ + deconstruct(id: string | bigint): DeconstructedSnowflake; + /** + * Retrieves the timestamp field's value from a snowflake. + * @param id The snowflake to get the timestamp value from. + * @returns The UNIX timestamp that is stored in `id`. + */ + timestampFrom(id: string | bigint): number; + /** + * Returns a number indicating whether a reference snowflake comes before, or after, or is same as the given + * snowflake in sort order. + * @param a The first snowflake to compare. + * @param b The second snowflake to compare. + * @returns `-1` if `a` is older than `b`, `0` if `a` and `b` are equals, `1` if `a` is newer than `b`. + * @example Sort snowflakes in ascending order + * ```typescript + * const ids = ['737141877803057244', '1056191128120082432', '254360814063058944']; + * console.log(ids.sort((a, b) => Snowflake.compare(a, b))); + * // β ['254360814063058944', '737141877803057244', '1056191128120082432']; + * ``` + * @example Sort snowflakes in descending order + * ```typescript + * const ids = ['737141877803057244', '1056191128120082432', '254360814063058944']; + * console.log(ids.sort((a, b) => -Snowflake.compare(a, b))); + * // β ['1056191128120082432', '737141877803057244', '254360814063058944']; + * ``` + */ + static compare(a: string | bigint, b: string | bigint): -1 | 0 | 1; +} +/** + * Options for Snowflake#generate + */ +interface SnowflakeGenerateOptions { + /** + * Timestamp or date of the snowflake to generate + * @default Date.now() + */ + timestamp?: number | bigint | Date; + /** + * The increment to use + * @default 0n + * @remark keep in mind that this bigint is auto-incremented between generate calls + */ + increment?: bigint; + /** + * The worker ID to use, will be truncated to 5 bits (0-31) + * @default 0n + */ + workerId?: bigint; + /** + * The process ID to use, will be truncated to 5 bits (0-31) + * @default 1n + */ + processId?: bigint; +} +/** + * Object returned by Snowflake#deconstruct + */ +interface DeconstructedSnowflake { + /** + * The id in BigInt form + */ + id: bigint; + /** + * The timestamp stored in the snowflake + */ + timestamp: bigint; + /** + * The worker id stored in the snowflake + */ + workerId: bigint; + /** + * The process id stored in the snowflake + */ + processId: bigint; + /** + * The increment stored in the snowflake + */ + increment: bigint; + /** + * The epoch to use in the snowflake + */ + epoch: bigint; +} + +/** + * A class for parsing snowflake ids using Discord's snowflake epoch + * + * Which is 2015-01-01 at 00:00:00.000 UTC+0, {@linkplain https://discord.com/developers/docs/reference#snowflakes} + */ +declare const DiscordSnowflake: Snowflake; + +/** + * A class for parsing snowflake ids using Twitter's snowflake epoch + * + * Which is 2010-11-04 at 01:42:54.657 UTC+0, found in the archived snowflake repository {@linkplain https://github.com/twitter-archive/snowflake/blob/b3f6a3c6ca8e1b6847baa6ff42bf72201e2c2231/src/main/scala/com/twitter/service/snowflake/IdWorker.scala#L25} + */ +declare const TwitterSnowflake: Snowflake; + +export { DeconstructedSnowflake, DiscordSnowflake, Snowflake, SnowflakeGenerateOptions, TwitterSnowflake }; diff --git a/includes/external/discord/node_modules/@sapphire/snowflake/dist/index.mjs b/includes/external/discord/node_modules/@sapphire/snowflake/dist/index.mjs new file mode 100644 index 0000000..cdef2f9 --- /dev/null +++ b/includes/external/discord/node_modules/@sapphire/snowflake/dist/index.mjs @@ -0,0 +1,103 @@ +var __defProp = Object.defineProperty; +var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; +var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); +var __publicField = (obj, key, value) => { + __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; +}; +var __accessCheck = (obj, member, msg) => { + if (!member.has(obj)) + throw TypeError("Cannot " + msg); +}; +var __privateGet = (obj, member, getter) => { + __accessCheck(obj, member, "read from private field"); + return getter ? getter.call(obj) : member.get(obj); +}; +var __privateAdd = (obj, member, value) => { + if (member.has(obj)) + throw TypeError("Cannot add the same private member more than once"); + member instanceof WeakSet ? member.add(obj) : member.set(obj, value); +}; +var __privateSet = (obj, member, value, setter) => { + __accessCheck(obj, member, "write to private field"); + setter ? setter.call(obj, value) : member.set(obj, value); + return value; +}; +var __privateWrapper = (obj, member, setter, getter) => ({ + set _(value) { + __privateSet(obj, member, value, setter); + }, + get _() { + return __privateGet(obj, member, getter); + } +}); + +// src/lib/Snowflake.ts +var ProcessId = 1n; +var WorkerId = 0n; +var _increment, _epoch; +var Snowflake = class { + constructor(epoch) { + __publicField(this, "decode", this.deconstruct); + __privateAdd(this, _increment, 0n); + __privateAdd(this, _epoch, void 0); + __privateSet(this, _epoch, BigInt(epoch instanceof Date ? epoch.getTime() : epoch)); + } + get epoch() { + return __privateGet(this, _epoch); + } + generate({ increment, timestamp = Date.now(), workerId = WorkerId, processId = ProcessId } = {}) { + if (timestamp instanceof Date) + timestamp = BigInt(timestamp.getTime()); + else if (typeof timestamp === "number") + timestamp = BigInt(timestamp); + else if (typeof timestamp !== "bigint") { + throw new TypeError(`"timestamp" argument must be a number, bigint, or Date (received ${typeof timestamp})`); + } + if (typeof increment === "bigint" && increment >= 4095n) + increment = 0n; + else { + increment = __privateWrapper(this, _increment)._++; + if (__privateGet(this, _increment) >= 4095n) + __privateSet(this, _increment, 0n); + } + return timestamp - __privateGet(this, _epoch) << 22n | (workerId & 0b11111n) << 17n | (processId & 0b11111n) << 12n | increment; + } + deconstruct(id) { + const bigIntId = BigInt(id); + return { + id: bigIntId, + timestamp: (bigIntId >> 22n) + __privateGet(this, _epoch), + workerId: bigIntId >> 17n & 0b11111n, + processId: bigIntId >> 12n & 0b11111n, + increment: bigIntId & 0b111111111111n, + epoch: __privateGet(this, _epoch) + }; + } + timestampFrom(id) { + return Number((BigInt(id) >> 22n) + __privateGet(this, _epoch)); + } + static compare(a, b) { + if (typeof a === "bigint" || typeof b === "bigint") { + if (typeof a === "string") + a = BigInt(a); + else if (typeof b === "string") + b = BigInt(b); + return a === b ? 0 : a < b ? -1 : 1; + } + return a === b ? 0 : a.length < b.length ? -1 : a.length > b.length ? 1 : a < b ? -1 : 1; + } +}; +__name(Snowflake, "Snowflake"); +_increment = new WeakMap(); +_epoch = new WeakMap(); + +// src/lib/DiscordSnowflake.ts +var DiscordSnowflake = new Snowflake(1420070400000n); + +// src/lib/TwitterSnowflake.ts +var TwitterSnowflake = new Snowflake(1288834974657n); + +export { DiscordSnowflake, Snowflake, TwitterSnowflake }; +//# sourceMappingURL=out.js.map +//# sourceMappingURL=index.mjs.map
\ No newline at end of file diff --git a/includes/external/discord/node_modules/@sapphire/snowflake/dist/index.mjs.map b/includes/external/discord/node_modules/@sapphire/snowflake/dist/index.mjs.map new file mode 100644 index 0000000..3a05a29 --- /dev/null +++ b/includes/external/discord/node_modules/@sapphire/snowflake/dist/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/lib/Snowflake.ts","../src/lib/DiscordSnowflake.ts","../src/lib/TwitterSnowflake.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAM,YAAY;AAClB,IAAM,WAAW;AADjB;AAgBO,IAAM,YAAN,MAAgB;AAAA,EAsBf,YAAY,OAA+B;AAjBlD,wBAAO,UAAS,KAAK;AAMrB,mCAAa;AAMb;AAMC,uBAAK,QAAS,OAAO,iBAAiB,OAAO,MAAM,QAAQ,IAAI,KAAK;AAAA,EACrE;AAAA,EAKA,IAAW,QAAgB;AAC1B,WAAO,mBAAK;AAAA,EACb;AAAA,EAcO,SAAS,EAAE,WAAW,YAAY,KAAK,IAAI,GAAG,WAAW,UAAU,YAAY,UAAU,IAA8B,CAAC,GAAG;AACjI,QAAI,qBAAqB;AAAM,kBAAY,OAAO,UAAU,QAAQ,CAAC;AAAA,aAC5D,OAAO,cAAc;AAAU,kBAAY,OAAO,SAAS;AAAA,aAC3D,OAAO,cAAc,UAAU;AACvC,YAAM,IAAI,UAAU,oEAAoE,OAAO,YAAY;AAAA,IAC5G;AAEA,QAAI,OAAO,cAAc,YAAY,aAAa;AAAO,kBAAY;AAAA,SAChE;AACJ,kBAAY,uBAAK,YAAL;AACZ,UAAI,mBAAK,eAAc;AAAO,2BAAK,YAAa;AAAA,IACjD;AAGA,WAAS,YAAY,mBAAK,WAAW,OAAS,WAAW,aAAa,OAAS,YAAY,aAAa,MAAO;AAAA,EAChH;AAAA,EAYO,YAAY,IAA6C;AAC/D,UAAM,WAAW,OAAO,EAAE;AAC1B,WAAO;AAAA,MACN,IAAI;AAAA,MACJ,YAAY,YAAY,OAAO,mBAAK;AAAA,MACpC,UAAW,YAAY,MAAO;AAAA,MAC9B,WAAY,YAAY,MAAO;AAAA,MAC/B,WAAW,WAAW;AAAA,MACtB,OAAO,mBAAK;AAAA,IACb;AAAA,EACD;AAAA,EAOO,cAAc,IAA6B;AACjD,WAAO,QAAQ,OAAO,EAAE,KAAK,OAAO,mBAAK,OAAM;AAAA,EAChD;AAAA,EAqBA,OAAc,QAAQ,GAAoB,GAAgC;AACzE,QAAI,OAAO,MAAM,YAAY,OAAO,MAAM,UAAU;AACnD,UAAI,OAAO,MAAM;AAAU,YAAI,OAAO,CAAC;AAAA,eAC9B,OAAO,MAAM;AAAU,YAAI,OAAO,CAAC;AAC5C,aAAO,MAAM,IAAI,IAAI,IAAI,IAAI,KAAK;AAAA,IACnC;AAEA,WAAO,MAAM,IAAI,IAAI,EAAE,SAAS,EAAE,SAAS,KAAK,EAAE,SAAS,EAAE,SAAS,IAAI,IAAI,IAAI,KAAK;AAAA,EACxF;AACD;AAzHa;AAWZ;AAMA;;;AC1BM,IAAM,mBAAmB,IAAI,UAAU,cAAc;;;ACArD,IAAM,mBAAmB,IAAI,UAAU,cAAc","sourcesContent":["const ProcessId = 1n;\nconst WorkerId = 0n;\n\n/**\n * A class for generating and deconstructing Twitter snowflakes.\n *\n * A {@link https://developer.twitter.com/en/docs/twitter-ids Twitter snowflake}\n * is a 64-bit unsigned integer with 4 fields that have a fixed epoch value.\n *\n * If we have a snowflake `266241948824764416` we can represent it as binary:\n * ```\n * 64 22 17 12 0\n * 000000111011000111100001101001000101000000 00001 00000 000000000000\n * number of ms since epoch worker pid increment\n * ```\n */\nexport class Snowflake {\n\t/**\n\t * Alias for {@link deconstruct}\n\t */\n\t// eslint-disable-next-line @typescript-eslint/unbound-method\n\tpublic decode = this.deconstruct;\n\n\t/**\n\t * Internal incrementor for generating snowflakes\n\t * @internal\n\t */\n\t#increment = 0n;\n\n\t/**\n\t * Internal reference of the epoch passed in the constructor\n\t * @internal\n\t */\n\t#epoch: bigint;\n\n\t/**\n\t * @param epoch the epoch to use\n\t */\n\tpublic constructor(epoch: number | bigint | Date) {\n\t\tthis.#epoch = BigInt(epoch instanceof Date ? epoch.getTime() : epoch);\n\t}\n\n\t/**\n\t * The epoch for this snowflake.\n\t */\n\tpublic get epoch(): bigint {\n\t\treturn this.#epoch;\n\t}\n\n\t/**\n\t * Generates a snowflake given an epoch and optionally a timestamp\n\t * @param options options to pass into the generator, see {@link SnowflakeGenerateOptions}\n\t *\n\t * **note** when `increment` is not provided it defaults to the private `increment` of the instance\n\t * @example\n\t * ```typescript\n\t * const epoch = new Date('2000-01-01T00:00:00.000Z');\n\t * const snowflake = new Snowflake(epoch).generate();\n\t * ```\n\t * @returns A unique snowflake\n\t */\n\tpublic generate({ increment, timestamp = Date.now(), workerId = WorkerId, processId = ProcessId }: SnowflakeGenerateOptions = {}) {\n\t\tif (timestamp instanceof Date) timestamp = BigInt(timestamp.getTime());\n\t\telse if (typeof timestamp === 'number') timestamp = BigInt(timestamp);\n\t\telse if (typeof timestamp !== 'bigint') {\n\t\t\tthrow new TypeError(`\"timestamp\" argument must be a number, bigint, or Date (received ${typeof timestamp})`);\n\t\t}\n\n\t\tif (typeof increment === 'bigint' && increment >= 4095n) increment = 0n;\n\t\telse {\n\t\t\tincrement = this.#increment++;\n\t\t\tif (this.#increment >= 4095n) this.#increment = 0n;\n\t\t}\n\n\t\t// timestamp, workerId, processId, increment\n\t\treturn ((timestamp - this.#epoch) << 22n) | ((workerId & 0b11111n) << 17n) | ((processId & 0b11111n) << 12n) | increment;\n\t}\n\n\t/**\n\t * Deconstructs a snowflake given a snowflake ID\n\t * @param id the snowflake to deconstruct\n\t * @returns a deconstructed snowflake\n\t * @example\n\t * ```typescript\n\t * const epoch = new Date('2000-01-01T00:00:00.000Z');\n\t * const snowflake = new Snowflake(epoch).deconstruct('3971046231244935168');\n\t * ```\n\t */\n\tpublic deconstruct(id: string | bigint): DeconstructedSnowflake {\n\t\tconst bigIntId = BigInt(id);\n\t\treturn {\n\t\t\tid: bigIntId,\n\t\t\ttimestamp: (bigIntId >> 22n) + this.#epoch,\n\t\t\tworkerId: (bigIntId >> 17n) & 0b11111n,\n\t\t\tprocessId: (bigIntId >> 12n) & 0b11111n,\n\t\t\tincrement: bigIntId & 0b111111111111n,\n\t\t\tepoch: this.#epoch\n\t\t};\n\t}\n\n\t/**\n\t * Retrieves the timestamp field's value from a snowflake.\n\t * @param id The snowflake to get the timestamp value from.\n\t * @returns The UNIX timestamp that is stored in `id`.\n\t */\n\tpublic timestampFrom(id: string | bigint): number {\n\t\treturn Number((BigInt(id) >> 22n) + this.#epoch);\n\t}\n\n\t/**\n\t * Returns a number indicating whether a reference snowflake comes before, or after, or is same as the given\n\t * snowflake in sort order.\n\t * @param a The first snowflake to compare.\n\t * @param b The second snowflake to compare.\n\t * @returns `-1` if `a` is older than `b`, `0` if `a` and `b` are equals, `1` if `a` is newer than `b`.\n\t * @example Sort snowflakes in ascending order\n\t * ```typescript\n\t * const ids = ['737141877803057244', '1056191128120082432', '254360814063058944'];\n\t * console.log(ids.sort((a, b) => Snowflake.compare(a, b)));\n\t * // β ['254360814063058944', '737141877803057244', '1056191128120082432'];\n\t * ```\n\t * @example Sort snowflakes in descending order\n\t * ```typescript\n\t * const ids = ['737141877803057244', '1056191128120082432', '254360814063058944'];\n\t * console.log(ids.sort((a, b) => -Snowflake.compare(a, b)));\n\t * // β ['1056191128120082432', '737141877803057244', '254360814063058944'];\n\t * ```\n\t */\n\tpublic static compare(a: string | bigint, b: string | bigint): -1 | 0 | 1 {\n\t\tif (typeof a === 'bigint' || typeof b === 'bigint') {\n\t\t\tif (typeof a === 'string') a = BigInt(a);\n\t\t\telse if (typeof b === 'string') b = BigInt(b);\n\t\t\treturn a === b ? 0 : a < b ? -1 : 1;\n\t\t}\n\n\t\treturn a === b ? 0 : a.length < b.length ? -1 : a.length > b.length ? 1 : a < b ? -1 : 1;\n\t}\n}\n\n/**\n * Options for Snowflake#generate\n */\nexport interface SnowflakeGenerateOptions {\n\t/**\n\t * Timestamp or date of the snowflake to generate\n\t * @default Date.now()\n\t */\n\ttimestamp?: number | bigint | Date;\n\n\t/**\n\t * The increment to use\n\t * @default 0n\n\t * @remark keep in mind that this bigint is auto-incremented between generate calls\n\t */\n\tincrement?: bigint;\n\n\t/**\n\t * The worker ID to use, will be truncated to 5 bits (0-31)\n\t * @default 0n\n\t */\n\tworkerId?: bigint;\n\n\t/**\n\t * The process ID to use, will be truncated to 5 bits (0-31)\n\t * @default 1n\n\t */\n\tprocessId?: bigint;\n}\n\n/**\n * Object returned by Snowflake#deconstruct\n */\nexport interface DeconstructedSnowflake {\n\t/**\n\t * The id in BigInt form\n\t */\n\tid: bigint;\n\n\t/**\n\t * The timestamp stored in the snowflake\n\t */\n\ttimestamp: bigint;\n\n\t/**\n\t * The worker id stored in the snowflake\n\t */\n\tworkerId: bigint;\n\n\t/**\n\t * The process id stored in the snowflake\n\t */\n\tprocessId: bigint;\n\n\t/**\n\t * The increment stored in the snowflake\n\t */\n\tincrement: bigint;\n\n\t/**\n\t * The epoch to use in the snowflake\n\t */\n\tepoch: bigint;\n}\n","import { Snowflake } from './Snowflake';\n\n/**\n * A class for parsing snowflake ids using Discord's snowflake epoch\n *\n * Which is 2015-01-01 at 00:00:00.000 UTC+0, {@linkplain https://discord.com/developers/docs/reference#snowflakes}\n */\nexport const DiscordSnowflake = new Snowflake(1420070400000n);\n","import { Snowflake } from './Snowflake';\n\n/**\n * A class for parsing snowflake ids using Twitter's snowflake epoch\n *\n * Which is 2010-11-04 at 01:42:54.657 UTC+0, found in the archived snowflake repository {@linkplain https://github.com/twitter-archive/snowflake/blob/b3f6a3c6ca8e1b6847baa6ff42bf72201e2c2231/src/main/scala/com/twitter/service/snowflake/IdWorker.scala#L25}\n */\nexport const TwitterSnowflake = new Snowflake(1288834974657n);\n"]}
\ No newline at end of file diff --git a/includes/external/discord/node_modules/@sapphire/snowflake/package.json b/includes/external/discord/node_modules/@sapphire/snowflake/package.json new file mode 100644 index 0000000..de47d22 --- /dev/null +++ b/includes/external/discord/node_modules/@sapphire/snowflake/package.json @@ -0,0 +1,67 @@ +{ + "name": "@sapphire/snowflake", + "version": "3.4.0", + "description": "Deconstructs and generates snowflake IDs using BigInts", + "author": "@sapphire", + "license": "MIT", + "main": "dist/index.js", + "module": "dist/index.mjs", + "browser": "dist/index.global.js", + "unpkg": "dist/index.global.js", + "types": "dist/index.d.ts", + "exports": { + "import": "./dist/index.mjs", + "require": "./dist/index.js", + "types": "./dist/index.d.ts" + }, + "sideEffects": false, + "homepage": "https://github.com/sapphiredev/utilities/tree/main/packages/snowflake", + "scripts": { + "test": "vitest run", + "lint": "eslint src tests --ext ts --fix -c ../../.eslintrc", + "build": "tsup", + "docs": "typedoc-json-parser", + "prepack": "yarn build", + "bump": "cliff-jumper", + "check-update": "cliff-jumper --dry-run" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/sapphiredev/utilities.git", + "directory": "packages/snowflake" + }, + "files": [ + "dist/**/*.js*", + "dist/**/*.mjs*", + "dist/**/*.d*" + ], + "engines": { + "node": ">=v14.0.0", + "npm": ">=7.0.0" + }, + "keywords": [ + "@sapphire/snowflake", + "bot", + "typescript", + "ts", + "yarn", + "discord", + "sapphire", + "standalone" + ], + "bugs": { + "url": "https://github.com/sapphiredev/utilities/issues" + }, + "publishConfig": { + "access": "public" + }, + "devDependencies": { + "@favware/cliff-jumper": "^1.9.0", + "@vitest/coverage-c8": "^0.26.2", + "tsup": "^6.5.0", + "typedoc": "^0.23.23", + "typedoc-json-parser": "^7.0.2", + "typescript": "^4.9.4", + "vitest": "^0.26.2" + } +}
\ No newline at end of file |