@sv443-network/coreutils 3.2.0 → 3.4.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 +34 -0
- package/README.md +3 -0
- package/dist/CoreUtils.cjs +295 -234
- package/dist/CoreUtils.min.cjs +3 -3
- package/dist/CoreUtils.min.mjs +3 -3
- package/dist/CoreUtils.min.umd.js +3 -3
- package/dist/CoreUtils.mjs +295 -234
- package/dist/CoreUtils.umd.js +297 -404
- package/dist/lib/DataStore.d.ts +34 -6
- package/dist/lib/DataStoreSerializer.d.ts +6 -2
- package/dist/lib/Debouncer.d.ts +3 -3
- package/dist/lib/misc.d.ts +36 -0
- package/package.json +23 -23
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# @sv443-network/coreutils
|
|
2
2
|
|
|
3
|
+
## 3.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 7e5c0b6: `Debouncer` and `debounce` now have an extra parameter of type `NanoEmitterOptions` to customize the underlying `NanoEmitter` instance.
|
|
8
|
+
- 2a04a7d: Added function `createRecurringTask()` as a "batteries included" alternative to `setImmediateTimeoutLoop()` and `setImmediateInterval()`, with more ways to control task execution and aborting.
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- 328c460: Fix internal event emission problems in `Debouncer`
|
|
13
|
+
|
|
14
|
+
## 3.3.0
|
|
15
|
+
|
|
16
|
+
### Minor Changes
|
|
17
|
+
|
|
18
|
+
- 4af3dda: `DataStore` now extends `NanoEmitter` to allow for much better event-driven programming using the methods `on()`, `once()`, `onMulti()`, etc.
|
|
19
|
+
Currently, the following events are emitted by the `DataStore` class:
|
|
20
|
+
|
|
21
|
+
| Name | Description |
|
|
22
|
+
| :--------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
23
|
+
| `loadData` | Whenever the data is loaded from persistent storage with `DataStore.loadData()`. |
|
|
24
|
+
| `updateData` | When the data is updated with `DataStore.setData()` or `DataStore.runMigrations()`. |
|
|
25
|
+
| `updateDataSync` | When the memory cache was updated with `DataStore.setData()`, before the data is saved to persistent storage. Not emitted if `memoryCache` is set to `false`. |
|
|
26
|
+
| `migrateData` | For every called migration function with the resulting data. |
|
|
27
|
+
| `migrateId` | For every successfully migrated old ID. Gets passed the old and new ID. |
|
|
28
|
+
| `setDefaultData` | Whenever the data is reset to the default value with `DataStore.saveDefaultData()` (will not be called on the initial population of persistent storage with the default data in `DataStore.loadData()`). |
|
|
29
|
+
| `deleteData` | After the data was deleted from persistent storage with `DataStore.deleteData()`. |
|
|
30
|
+
| `error` | When an error occurs at any point. |
|
|
31
|
+
| `migrationError` | Only when an error occurs during a migration function. |
|
|
32
|
+
|
|
33
|
+
### Patch Changes
|
|
34
|
+
|
|
35
|
+
- f7dbacf: Fixed DataStore error handling inconsistencies.
|
|
36
|
+
|
|
3
37
|
## 3.2.0
|
|
4
38
|
|
|
5
39
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -35,6 +35,7 @@ Intended to be used in conjunction with [`@sv443-network/userutils`](https://git
|
|
|
35
35
|
- 🔷 [`type DataStoreOptions`](./docs.md#type-datastoreoptions) - Options for the data store
|
|
36
36
|
- 🔷 [`type DataMigrationsDict`](./docs.md#type-datamigrationsdict) - Dictionary of data migration functions
|
|
37
37
|
- 🔷 [`type DataStoreData`](./docs.md#type-datastoredata) - The type of the serializable data
|
|
38
|
+
- 🔷 [`type DataStoreEventMap`](./docs.md#type-datastoreeventmap) - Map of DataStore events
|
|
38
39
|
- 🟧 [`class DataStoreSerializer`](./docs.md#class-datastoreserializer) - Serializes and deserializes data for multiple DataStore instances
|
|
39
40
|
- 🔷 [`type DataStoreSerializerOptions`](./docs.md#type-datastoreserializeroptions) - Options for the DataStoreSerializer
|
|
40
41
|
- 🔷 [`type LoadStoresDataResult`](./docs.md#type-loadstoresdataresult) - Result of calling [`loadStoresData()`](./docs.md#datastoreserializer-loadstoresdata)
|
|
@@ -83,6 +84,8 @@ Intended to be used in conjunction with [`@sv443-network/userutils`](https://git
|
|
|
83
84
|
- 🟣 [`function pureObj()`](./docs.md#function-pureobj) - Applies an object's props to a null object (object without prototype chain) or just returns a new null object
|
|
84
85
|
- 🟣 [`function setImmediateInterval()`](./docs.md#function-setimmediateinterval) - Like `setInterval()`, but instantly calls the callback and supports passing an [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal)
|
|
85
86
|
- 🟣 [`function setImmediateTimeoutLoop()`](./docs.md#function-setimmediatetimeoutloop) - Like a recursive `setTimeout()` loop, but instantly calls the callback and supports passing an [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal)
|
|
87
|
+
- 🟣 [`function createRecurringTask()`](./docs.md#function-createrecurringtask) - Similar to `setImmediateTimeoutLoop()`, but with many more ways of controlling execution.
|
|
88
|
+
- 🔷 [`type RecurringTaskOptions`](./docs.md#type-recurringtaskoptions) - Options for the `createRecurringTask()` function.
|
|
86
89
|
- 🟣 [`function scheduleExit()`](./docs.md#function-scheduleexit) - Schedules a process exit after the next event loop tick, to allow operations like IO writes to finish.
|
|
87
90
|
- [**NanoEmitter:**](./docs.md#nanoemitter)
|
|
88
91
|
- 🟧 [`class NanoEmitter`](./docs.md#class-nanoemitter) - Simple, lightweight event emitter class that can be used in both FP and OOP, inspired by [`EventEmitter` from `node:events`](https://nodejs.org/api/events.html#class-eventemitter), based on [`nanoevents`](https://npmjs.com/package/nanoevents)
|