This is a big one. 🔥
**Changes:**
- Targets next major release (v4.0.0)
- Switch runtimes from NodeJS to BunJS (bun.sh)
- Typescript library support moved to `ESNext`
- Typescript compile option `verbatimModuleSyntax` enabled
- Updated all interfaces to be imported explicitly as types
- Strict mode enabled
- Reduces the number of tsconfig files
- Pins all dep packages to specific patch versions
- Includes Bun lock file in repo (doesn't cause issues like the
package-lock did)
- Replaces Gulp with a new Typescript based build system
- Adds `core-js` as a workaround for Bun not playing nice with
`reflect-metadata`
- Removes `pkg` and `swc` (Yay Bun!)
- Updated package scripts and entry point system to be more intuitive
- Updated VSCode workspace configurations
- Updated `.gitignore` to align with updated project structure
- Updated Biome configuration to align with updated project structure
- `Program.ts` - Removes call to set encoding on the process
- `global.d.ts` - Added underscores to build globals to match other
global names
- `JsonUtil.ts` - Replaced old `fixJson` package with newer `jsonrepair`
package
- `HashUtil.ts` - Replaced old `buffer-crc32` package with built-in
`node:zlib` package
- `DatabaseImporter.ts` - Updates database validation object to be flat,
where the keys are the relative path to the file
- `BunTimer.ts` - Adds an easy to use timer class that's compatible with
nanoseconds.
**TODO:**
- Look into mod loading. I think we use a TS transpiler for mods and I
believe that can be removed now.
- Bun includes a number of APIs that can be used in place of Node's
packages (built-in or otherwise); HTTP server, WebSocket server, File
IO, Hashing, File Globing, Testing... Each of these should be utilized
where ever possible.
- Update in-repo documentation to reference BunJS instead of NodeJS.
Here's a jumping off point for the profile backup feature. Included some
basic configuration options. Currently backup runs on server start-up
(before the profiles are loaded into memory) and on a configurable
interval.
I think it still needs work.
- [x] The folder name dates should be used to detect which old backups
should be removed
- [x] Not sure about the interval implementation...
- [x] Could make the clean method thinner
- [x] Remove VFS; I don't believe it's needed for copy operations
- [x] Save a list of active mods used by the backed up profiles
---------
Co-authored-by: Chomp <27521899+chompDev@users.noreply.github.com>
Co-authored-by: Chomp <dev@dev.sp-tarkov.com>
This commit implements basic friends list functionality including
adding, auto accepting, and removing friends. As well as storing the
list in the profile and providing the friends list back to the client on
login. This is a one-way implementation, the target profile will not
have the source account added to its friends list.
This is primarily useful in combination with the recent favorites fixes,
to allow users to inspect favorited weapons on other profiles to "copy"
weapon builds between their profiles
This commit implements basic friends list functionality including adding, auto accepting, and removing friends. As well as storing the list in the profile and providing the friends list back to the client on login.
This is a one-way implementation, the target profile will not have the source account added to its friends list.
This is primarily useful in combination with the recent favorites fixes, to allow users to inspect favorited weapons on other profiles to "copy" weapon builds between their profiles
This pull request introduces several enhancements and fixes to the
`RandomUtil` class in the `project/src/utils/RandomUtil.ts` file, as
well as corresponding updates to the test suite in
`project/tests/utils/RandomUtil.test.ts`. The primary changes include
the addition of new methods for determining number precision and
generating random numbers with specified precision, as well as
improvements to existing methods to handle edge cases and log warnings
appropriately.
Enhancements to `RandomUtil` class:
* Added `MAX_SIGNIFICANT_DIGITS` constant to define the safe upper bound
for significant digits in floating-point numbers.
* Introduced `getNumberPrecision` method to determine the number of
decimal places in a number, addressing floating-point precision issues.
* Enhanced `randInt` method to handle float inputs by logging a warning
and rounding to the nearest integer.
* Added `randNum` method to generate random numbers between two values
with optional precision, including validation for precision and handling
of edge cases.
Updates to test suite:
* Added tests for the new `getNumberPrecision` method to verify correct
handling of various numeric inputs.
* Expanded tests for `randInt` to cover scenarios with equal low and
high values, float inputs, and logging of debug messages.
* Added comprehensive tests for the new `randNum` method to ensure
correct functionality across different ranges, precision levels, and
edge cases.
Adds a public `randNum` method to the `RandomUtil` class which can be seen as a "superseeded" version of the `randInt` method. It can handle generating random numbers, including both integers or floating-point numbers with support for providing a precision.
Adds a private `getNumberPrecision` method to the `RandomUtil` class which simply counts the number of fractional digits in a number.
Changes `randInt` to log a debug message saying that the ability to pass it a floating-point number is deprecated.
Better handle rewards not fitting (they shouldn't just poof) by instead
trimming the rewards amount until they fit.
(cherry picked from commit 8d05bf0069b22968d7e4fcdc4901ae0babd948c3)
Reworked Cultist circle code to pass blacklist around as a set rather than array
Removed cultist circle use of `itemRewardBlacklist` to store item parent ids, feature is handled by new config property