@sv443-network/userutils 10.0.4 → 10.0.6

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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @sv443-network/userutils
2
2
 
3
+ ## 10.0.6
4
+
5
+ ### Patch Changes
6
+
7
+ - 85540a2: Updated to [CoreUtils v3.0.5](https://github.com/Sv443-Network/CoreUtils/releases/tag/%40sv443-network%2Fcoreutils%403.0.5)
8
+
9
+ ## 10.0.5
10
+
11
+ ### Patch Changes
12
+
13
+ - 0c63a9b: Added UMD bundle explicitly made for userscript usage (at `dist/UserUtils.user.js`).
14
+
3
15
  ## 10.0.4
4
16
 
5
17
  ### Patch Changes
package/README.md CHANGED
@@ -102,7 +102,6 @@ View the documentation of previous major versions:
102
102
  - 🟧 [`class DataStore`](https://github.com/Sv443-Network/CoreUtils/blob/main/docs.md#class-datastore) - The main class for the data store
103
103
  - 🔷 [`type DataStoreOptions`](https://github.com/Sv443-Network/CoreUtils/blob/main/docs.md#type-datastoreoptions) - Options for the data store
104
104
  - 🔷 [`type DataMigrationsDict`](https://github.com/Sv443-Network/CoreUtils/blob/main/docs.md#type-datamigrationsdict) - Dictionary of data migration functions
105
- - 🔷 [`type DataStoreData`](https://github.com/Sv443-Network/CoreUtils/blob/main/docs.md#type-datastoredata) - The type of the serializable data
106
105
  - 🟧 [`class DataStoreSerializer`](https://github.com/Sv443-Network/CoreUtils/blob/main/docs.md#class-datastoreserializer) - Serializes and deserializes data for multiple DataStore instances
107
106
  - 🔷 [`type DataStoreSerializerOptions`](https://github.com/Sv443-Network/CoreUtils/blob/main/docs.md#type-datastoreserializeroptions) - Options for the DataStoreSerializer
108
107
  - 🔷 [`type LoadStoresDataResult`](https://github.com/Sv443-Network/CoreUtils/blob/main/docs.md#type-loadstoresdataresult) - Result of calling [`loadStoresData()`](https://github.com/Sv443-Network/CoreUtils/blob/main/docs.md#datastoreserializer-loadstoresdata)
@@ -164,19 +163,6 @@ View the documentation of previous major versions:
164
163
  - 🟣 [`function joinArrayReadable()`](https://github.com/Sv443-Network/CoreUtils/blob/main/docs.md#function-joinarrayreadable) - Joins the given array into a string, using the given separators and last separator
165
164
  - 🟣 [`function secsToTimeStr()`](https://github.com/Sv443-Network/CoreUtils/blob/main/docs.md#function-secstotimestr) - Turns the given number of seconds into a string in the format `(hh:)mm:ss` with intelligent zero-padding
166
165
  - 🟣 [`function truncStr()`](https://github.com/Sv443-Network/CoreUtils/blob/main/docs.md#function-truncstr) - Truncates the given string to the given length
167
- <!-- - *[**TieredCache:**](https://github.com/Sv443-Network/CoreUtils/blob/main/docs.md#tieredcache)
168
- - 🟧 *[`class TieredCache`](https://github.com/Sv443-Network/CoreUtils/blob/main/docs.md#class-tieredcache) - A multi-tier cache that uses multiple storage engines with different expiration times
169
- - 🔷 *[`type TieredCacheOptions`](https://github.com/Sv443-Network/CoreUtils/blob/main/docs.md#type-tieredcacheoptions) - Options for the [`TieredCache` class](https://github.com/Sv443-Network/CoreUtils/blob/main/docs.md#class-tieredcache)
170
- - 🔷 *[`type TieredCachePropagateTierOptions`](https://github.com/Sv443-Network/CoreUtils/blob/main/docs.md#type-tieredcachestaleoptions) - Entry propagation options for each tier
171
- - 🔷 *[`type TieredCacheStaleOptions`](https://github.com/Sv443-Network/CoreUtils/blob/main/docs.md#type-tieredcachepropagatetieroptions) - Entry staleness options for each tier
172
- - 🔷 *[`type TieredCacheTierOptions`](https://github.com/Sv443-Network/CoreUtils/blob/main/docs.md#type-tieredcachetieroptions) - Options for each tier of a [`TieredCache` instance](https://github.com/Sv443-Network/CoreUtils/blob/main/docs.md#class-tieredcache)
173
- - *[**Translate:**](https://github.com/Sv443-Network/CoreUtils/blob/main/docs.md#translate)
174
- - 🟧 *[`class Translate`](https://github.com/Sv443-Network/CoreUtils/blob/main/docs.md#class-translate) - JSON-based translation system supporting transformation hooks, value injection, nested objects, etc.
175
- - 🔷 *[`type TransformFn`](https://github.com/Sv443-Network/CoreUtils/blob/main/docs.md#type-transformfn) - The type of the transformation hook functions
176
- - 🔷 *[`type TransformFnProps`](https://github.com/Sv443-Network/CoreUtils/blob/main/docs.md#type-transformfnprops) - The properties passed to the transformation functions
177
- - 🔷 *[`type TranslateOptions`](https://github.com/Sv443-Network/CoreUtils/blob/main/docs.md#type-translateoptions) - The options for the [`Translate` class](https://github.com/Sv443-Network/CoreUtils/blob/main/docs.md#class-translate)
178
- - 🔷 *[`type TrKeys`](https://github.com/Sv443-Network/CoreUtils/blob/main/docs.md#type-trkeys) - Generic type that gives you a union of keys from the passed [`TrObject` object](https://github.com/Sv443-Network/CoreUtils/blob/main/docs.md#type-trobject)
179
- - 🔷 *[`type TrObject`](https://github.com/Sv443-Network/CoreUtils/blob/main/docs.md#type-trobject) - The translation object for a specific language -->
180
166
  - [**Misc. Types:**](https://github.com/Sv443-Network/CoreUtils/blob/main/docs.md#types)
181
167
  - 🔷 [`type LooseUnion`](https://github.com/Sv443-Network/CoreUtils/blob/main/docs.md#type-looseunion) - A union type that allows for autocomplete suggestions as well as substitutions of the same type
182
168
  - 🔷 [`type ListLike`](https://github.com/Sv443-Network/CoreUtils/blob/main/docs.md#type-listlike) - Any value with a quantifiable `length`, `count` or `size` property
@@ -229,8 +215,8 @@ Shameless plug: I made a [template for userscripts in TypeScript](https://github
229
215
 
230
216
  Versioned (recommended):
231
217
  ```
232
- // @require https://cdn.jsdelivr.net/npm/@sv443-network/userutils@INSERT_VERSION/dist/index.global.js
233
- // @require https://unpkg.com/@sv443-network/userutils@INSERT_VERSION/dist/index.global.js
218
+ // @require https://cdn.jsdelivr.net/npm/@sv443-network/userutils@INSERT_VERSION/dist/UserUtils.user.js
219
+ // @require https://unpkg.com/@sv443-network/userutils@INSERT_VERSION/dist/UserUtils.user.js
234
220
  ```
235
221
  Non-versioned (not recommended because it auto-updates):
236
222
  ```
@@ -240,12 +226,12 @@ Shameless plug: I made a [template for userscripts in TypeScript](https://github
240
226
 
241
227
  - If you are using this library in a generic DOM environment without access to the GreaseMonkey API, either download the latest release from the [releases page](https://github.com/Sv443-Network/UserUtils/releases) to include in your project or add one of the following tags to the &lt;head&gt;:
242
228
  ```html
243
- <script src="https://cdn.jsdelivr.net/npm/@sv443-network/userutils@INSERT_VERSION/dist/index.global.js"></script>
244
- <script src="https://unpkg.com/@sv443-network/userutils@INSERT_VERSION/dist/index.global.js"></script>
229
+ <script src="https://cdn.jsdelivr.net/npm/@sv443-network/userutils@INSERT_VERSION/dist/UserUtils.umd.js"></script>
230
+ <script src="https://unpkg.com/@sv443-network/userutils@INSERT_VERSION/dist/UserUtils.umd.js"></script>
245
231
  ```
246
232
 
247
233
  > [!NOTE]
248
- > In order for your script not to break on a major library update, use one the versioned URLs above after replacing `INSERT_VERSION` with the desired version (e.g. `8.3.2`) or the versioned URL that's shown [at the top of the GreasyFork page.](https://greasyfork.org/scripts/472956-userutils)
234
+ > In order for your script not to break on a major library update, use one the versioned URLs above after replacing `INSERT_VERSION` with the desired version (e.g. `10.0.4`) or the versioned URL that's shown [at the top of the GreasyFork page.](https://greasyfork.org/scripts/472956-userutils)
249
235
 
250
236
  <br>
251
237
 
@@ -114,7 +114,7 @@ __export(lib_exports, {
114
114
  });
115
115
  module.exports = __toCommonJS(lib_exports);
116
116
 
117
- // node_modules/.pnpm/@sv443-network+coreutils@3.0.4/node_modules/@sv443-network/coreutils/dist/CoreUtils.mjs
117
+ // node_modules/.pnpm/@sv443-network+coreutils@3.0.5/node_modules/@sv443-network/coreutils/dist/CoreUtils.mjs
118
118
  function bitSetHas(bitSet, checkVal) {
119
119
  return (bitSet & checkVal) === checkVal;
120
120
  }
@@ -574,7 +574,7 @@ var DataStore = class {
574
574
  encodeData;
575
575
  decodeData;
576
576
  compressionFormat = "deflate-raw";
577
- memoryCache = true;
577
+ memoryCache;
578
578
  engine;
579
579
  options;
580
580
  /**
@@ -601,7 +601,7 @@ var DataStore = class {
601
601
  this.id = opts.id;
602
602
  this.formatVersion = opts.formatVersion;
603
603
  this.defaultData = opts.defaultData;
604
- this.memoryCache = Boolean(opts.memoryCache ?? true);
604
+ this.memoryCache = opts.memoryCache ?? true;
605
605
  this.cachedData = this.memoryCache ? opts.defaultData : {};
606
606
  this.migrations = opts.migrations;
607
607
  if (opts.migrateIds)
@@ -699,7 +699,7 @@ var DataStore = class {
699
699
  /**
700
700
  * Returns a copy of the data from the in-memory cache.
701
701
  * Use {@linkcode loadData()} to get fresh data from persistent storage (usually not necessary since the cache should always exactly reflect persistent storage).
702
- * ⚠️ If `memoryCache` was set to `false` in the constructor options, this method will throw an error.
702
+ * ⚠️ Only available when `memoryCache` is `true` (default). When set to `false`, this produces a type and runtime error - use {@linkcode loadData()} instead.
703
703
  */
704
704
  getData() {
705
705
  if (!this.memoryCache)
@@ -776,7 +776,7 @@ var DataStore = class {
776
776
  if (!resetOnError)
777
777
  throw new MigrationError(`Error while running migration function for format version '${fmtVer}'`, { cause: err });
778
778
  await this.saveDefaultData();
779
- return this.getData();
779
+ return this.engine.deepCopy(this.defaultData);
780
780
  }
781
781
  }
782
782
  }
@@ -1,4 +1,4 @@
1
- // node_modules/.pnpm/@sv443-network+coreutils@3.0.4/node_modules/@sv443-network/coreutils/dist/CoreUtils.mjs
1
+ // node_modules/.pnpm/@sv443-network+coreutils@3.0.5/node_modules/@sv443-network/coreutils/dist/CoreUtils.mjs
2
2
  function bitSetHas(bitSet, checkVal) {
3
3
  return (bitSet & checkVal) === checkVal;
4
4
  }
@@ -458,7 +458,7 @@ var DataStore = class {
458
458
  encodeData;
459
459
  decodeData;
460
460
  compressionFormat = "deflate-raw";
461
- memoryCache = true;
461
+ memoryCache;
462
462
  engine;
463
463
  options;
464
464
  /**
@@ -485,7 +485,7 @@ var DataStore = class {
485
485
  this.id = opts.id;
486
486
  this.formatVersion = opts.formatVersion;
487
487
  this.defaultData = opts.defaultData;
488
- this.memoryCache = Boolean(opts.memoryCache ?? true);
488
+ this.memoryCache = opts.memoryCache ?? true;
489
489
  this.cachedData = this.memoryCache ? opts.defaultData : {};
490
490
  this.migrations = opts.migrations;
491
491
  if (opts.migrateIds)
@@ -583,7 +583,7 @@ var DataStore = class {
583
583
  /**
584
584
  * Returns a copy of the data from the in-memory cache.
585
585
  * Use {@linkcode loadData()} to get fresh data from persistent storage (usually not necessary since the cache should always exactly reflect persistent storage).
586
- * ⚠️ If `memoryCache` was set to `false` in the constructor options, this method will throw an error.
586
+ * ⚠️ Only available when `memoryCache` is `true` (default). When set to `false`, this produces a type and runtime error - use {@linkcode loadData()} instead.
587
587
  */
588
588
  getData() {
589
589
  if (!this.memoryCache)
@@ -660,7 +660,7 @@ var DataStore = class {
660
660
  if (!resetOnError)
661
661
  throw new MigrationError(`Error while running migration function for format version '${fmtVer}'`, { cause: err });
662
662
  await this.saveDefaultData();
663
- return this.getData();
663
+ return this.engine.deepCopy(this.defaultData);
664
664
  }
665
665
  }
666
666
  }
@@ -183,7 +183,7 @@ __export(lib_exports, {
183
183
  });
184
184
  module.exports = __toCommonJS(lib_exports);
185
185
 
186
- // node_modules/.pnpm/@sv443-network+coreutils@3.0.4/node_modules/@sv443-network/coreutils/dist/CoreUtils.mjs
186
+ // node_modules/.pnpm/@sv443-network+coreutils@3.0.5/node_modules/@sv443-network/coreutils/dist/CoreUtils.mjs
187
187
  function bitSetHas(bitSet, checkVal) {
188
188
  return (bitSet & checkVal) === checkVal;
189
189
  }
@@ -668,7 +668,7 @@ var DataStore = class {
668
668
  __publicField(this, "encodeData");
669
669
  __publicField(this, "decodeData");
670
670
  __publicField(this, "compressionFormat", "deflate-raw");
671
- __publicField(this, "memoryCache", true);
671
+ __publicField(this, "memoryCache");
672
672
  __publicField(this, "engine");
673
673
  __publicField(this, "options");
674
674
  /**
@@ -685,7 +685,7 @@ var DataStore = class {
685
685
  this.id = opts.id;
686
686
  this.formatVersion = opts.formatVersion;
687
687
  this.defaultData = opts.defaultData;
688
- this.memoryCache = Boolean((_a = opts.memoryCache) != null ? _a : true);
688
+ this.memoryCache = (_a = opts.memoryCache) != null ? _a : true;
689
689
  this.cachedData = this.memoryCache ? opts.defaultData : {};
690
690
  this.migrations = opts.migrations;
691
691
  if (opts.migrateIds)
@@ -790,7 +790,7 @@ var DataStore = class {
790
790
  /**
791
791
  * Returns a copy of the data from the in-memory cache.
792
792
  * Use {@linkcode loadData()} to get fresh data from persistent storage (usually not necessary since the cache should always exactly reflect persistent storage).
793
- * ⚠️ If `memoryCache` was set to `false` in the constructor options, this method will throw an error.
793
+ * ⚠️ Only available when `memoryCache` is `true` (default). When set to `false`, this produces a type and runtime error - use {@linkcode loadData()} instead.
794
794
  */
795
795
  getData() {
796
796
  if (!this.memoryCache)
@@ -872,7 +872,7 @@ var DataStore = class {
872
872
  if (!resetOnError)
873
873
  throw new MigrationError(`Error while running migration function for format version '${fmtVer}'`, { cause: err });
874
874
  yield this.saveDefaultData();
875
- return this.getData();
875
+ return this.engine.deepCopy(this.defaultData);
876
876
  }
877
877
  }
878
878
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sv443-network/userutils",
3
3
  "libName": "UserUtils",
4
- "version": "10.0.4",
4
+ "version": "10.0.6",
5
5
  "description": "General purpose DOM/GreaseMonkey library that allows you to register listeners for when CSS selectors exist, intercept events, create persistent & synchronous data stores, modify the DOM more easily and much more",
6
6
  "main": "dist/UserUtils.mjs",
7
7
  "module": "dist/UserUtils.mjs",
@@ -33,7 +33,7 @@
33
33
  },
34
34
  "homepage": "https://github.com/Sv443-Network/UserUtils",
35
35
  "dependencies": {
36
- "@sv443-network/coreutils": "3.0.4",
36
+ "@sv443-network/coreutils": "3.0.5",
37
37
  "nanoevents": "9.1.0"
38
38
  },
39
39
  "devDependencies": {