@sv443-network/coreutils 2.0.2 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +38 -0
- package/README.md +4 -3
- package/dist/CoreUtils.cjs +188 -114
- package/dist/CoreUtils.min.cjs +5 -3
- package/dist/CoreUtils.min.mjs +5 -3
- package/dist/CoreUtils.min.umd.js +5 -3
- package/dist/CoreUtils.mjs +188 -114
- package/dist/CoreUtils.umd.js +196 -120
- package/dist/lib/DataStore.d.ts +23 -9
- package/dist/lib/DataStoreEngine.d.ts +10 -10
- package/dist/lib/DataStoreSerializer.d.ts +3 -1
- package/dist/lib/Debouncer.d.ts +1 -1
- package/dist/lib/Errors.d.ts +15 -3
- package/dist/lib/NanoEmitter.d.ts +7 -6
- package/dist/lib/TieredCache.d.ts +4 -4
- package/dist/lib/Translate.d.ts +1 -1
- package/dist/lib/crypto.d.ts +1 -1
- package/dist/lib/index.d.ts +13 -13
- package/dist/lib/math.d.ts +2 -2
- package/dist/lib/misc.d.ts +7 -1
- package/dist/lib/{TestDataStore.d.ts → test/DirectAccessDataStore.d.ts} +4 -3
- package/dist/lib/test/softExpect.d.ts +11 -0
- package/dist/lib/text.d.ts +1 -1
- package/dist/lib/types.d.ts +7 -0
- package/package.json +18 -18
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,43 @@
|
|
|
1
1
|
# @sv443-network/coreutils
|
|
2
2
|
|
|
3
|
+
## 3.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- 7718855: **Changed `DataStoreEngine` instances to allow storing original values instead of only strings.**
|
|
8
|
+
|
|
9
|
+
The previous behavior of explicit serialization was prone to errors and made it hard to implement certain features, such as data migration from UserUtils.
|
|
10
|
+
If you have created a custom `DataStoreEngine`, please ensure it supports storing and retrieving all values supported by JSON, i.e. `string`, `number`, `boolean`, `null`, `object` and `array`. Values like `undefined`, `Symbol`, `Function` etc. are still not supported and will lead to errors.
|
|
11
|
+
|
|
12
|
+
- 46570f4: **`NanoEmitter` multi methods' `oneOf` and `allOf` properties now behave like an AND condition instead of an OR.**
|
|
13
|
+
|
|
14
|
+
### Minor Changes
|
|
15
|
+
|
|
16
|
+
- 1124d2e: Added DataStoreSerializer property `remapIds` to support deserializing from stores with outdated IDs.
|
|
17
|
+
- 240f83e: Added DataStore prop `memoryCache` to turn off the memory cache in data-intensive, non-latency-sensitive scenarios.
|
|
18
|
+
- 7718855: Made DataStore able to migrate data from [UserUtils <=v9 DataStore](https://github.com/Sv443-Network/UserUtils/blob/v9.4.4/docs.md#datastore) instances.
|
|
19
|
+
|
|
20
|
+
In order to trigger the migration:
|
|
21
|
+
|
|
22
|
+
1. Switch the DataStore import from UserUtils to CoreUtils and keep the same DataStore ID.
|
|
23
|
+
2. Update the options object in the DataStore constructor. (You may also want to refer to the [new DataStore documentation](https://github.com/Sv443-Network/CoreUtils/blob/main/docs.md#class-datastore).)
|
|
24
|
+
- The constructor now needs an `engine` property that is an instance of a [UserUtils `GMStorageEngine`.](https://github.com/Sv443-Network/UserUtils/blob/main/docs.md#class-gmstorageengine)
|
|
25
|
+
- Encoding with `deflate-raw` will now be enabled by default. Set `compressionFormat: null` to disable compression if it wasn't enabled in the UserUtils DataStore.
|
|
26
|
+
- Added shorthand property `compressionFormat` as an alternative to the properties `encodeData` and `decodeData`
|
|
27
|
+
- `encodeData` and `decodeData` are now a tuple array, consisting of a format identifier string and the function which was previously the only value of these properties.
|
|
28
|
+
3. The next call to `loadData()` will then migrate the data automatically and transparently.
|
|
29
|
+
|
|
30
|
+
### Patch Changes
|
|
31
|
+
|
|
32
|
+
- 99a797f: `secsToTimeStr()` now supports negative time and will only throw if the number is `NaN` or not finite.
|
|
33
|
+
- 38e7813: Implemented `DatedError`, `CustomError` and new classes `ScriptContextError` and `NetworkError` throughout the library.
|
|
34
|
+
|
|
35
|
+
## 2.0.3
|
|
36
|
+
|
|
37
|
+
### Patch Changes
|
|
38
|
+
|
|
39
|
+
- d4a043d: Fixed DataStore defaultData initialization
|
|
40
|
+
|
|
3
41
|
## 2.0.2
|
|
4
42
|
|
|
5
43
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<div align="center" style="text-align: center;">
|
|
2
2
|
|
|
3
3
|
# CoreUtils
|
|
4
|
-
Cross-platform, general-purpose, JavaScript core library for Node, Deno and the browser.
|
|
4
|
+
Cross-platform, general-purpose, JavaScript core library for Node, Deno and the browser with tons of various utility functions and classes.
|
|
5
5
|
Intended to be used in conjunction with [`@sv443-network/userutils`](https://github.com/Sv443-Network/UserUtils) and [`@sv443-network/djsutils`](https://github.com/Sv443-Network/DJSUtils), but can be used independently as well.
|
|
6
6
|
|
|
7
7
|
### [Documentation](./docs.md#readme) • [Features](#features) • [Installation](#installation) • [License](./LICENSE.txt) • [Changelog](./CHANGELOG.md)
|
|
@@ -56,6 +56,7 @@ Intended to be used in conjunction with [`@sv443-network/userutils`](https://git
|
|
|
56
56
|
- [**Errors:**](./docs.md#errors)
|
|
57
57
|
- 🟧 [`class DatedError`](./docs.md#class-datederror) - Base error class with a `date` property
|
|
58
58
|
- 🟧 [`class ChecksumMismatchError`](./docs.md#class-checksummismatcherror) - Error thrown when two checksums don't match
|
|
59
|
+
- 🟧 [`class CustomError`](./docs.md#class-customerror) - Custom error with a configurable name for one-off situations
|
|
59
60
|
- 🟧 [`class MigrationError`](./docs.md#class-migrationerror) - Error thrown in a failed data migration
|
|
60
61
|
- 🟧 [`class ValidationError`](./docs.md#class-validationerror) - Error while validating data
|
|
61
62
|
- [**Math:**](./docs.md#math)
|
|
@@ -90,7 +91,7 @@ Intended to be used in conjunction with [`@sv443-network/userutils`](https://git
|
|
|
90
91
|
- 🟣 [`function autoPlural()`](./docs.md#function-autoplural) - Turns the given term into its plural form, depending on the given number or list length
|
|
91
92
|
- 🟣 [`function capitalize()`](./docs.md#function-capitalize) - Capitalizes the first letter of the given string
|
|
92
93
|
- 🟣 [`function createProgressBar()`](./docs.md#function-createprogressbar) - Creates a progress bar string with the given percentage and length
|
|
93
|
-
-
|
|
94
|
+
- ⬜ [`const defaultPbChars`](./docs.md#const-defaultpbchars) - Default characters for the progress bar
|
|
94
95
|
- 🔷 [`type ProgressBarChars`](./docs.md#type-progressbarchars) - Type for the progress bar characters object
|
|
95
96
|
- 🟣 [`function joinArrayReadable()`](./docs.md#function-joinarrayreadable) - Joins the given array into a string, using the given separators and last separator
|
|
96
97
|
- 🟣 [`function secsToTimeStr()`](./docs.md#function-secstotimestr) - Turns the given number of seconds into a string in the format `(hh:)mm:ss` with intelligent zero-padding
|
|
@@ -125,7 +126,7 @@ Intended to be used in conjunction with [`@sv443-network/userutils`](https://git
|
|
|
125
126
|
> 🟣 = function
|
|
126
127
|
> 🟧 = class
|
|
127
128
|
> 🔷 = type
|
|
128
|
-
>
|
|
129
|
+
> ⬜ = const
|
|
129
130
|
|
|
130
131
|
<br>
|
|
131
132
|
|