@sv443-network/userutils 1.1.1 → 1.1.3

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
+ ## 1.1.3
4
+
5
+ ### Patch Changes
6
+
7
+ - ad17374: Add support for OpenUserJS
8
+
9
+ ## 1.1.2
10
+
11
+ ### Patch Changes
12
+
13
+ - 049aeb0: Export ConfigMigrationsDict for easier use with TypeScript
14
+
3
15
  ## 1.1.1
4
16
 
5
17
  ### Patch Changes
@@ -1,14 +1,24 @@
1
1
  // ==UserScript==
2
- // @name UserUtils
3
- // @description Library with various utilities for userscripts - register listeners for when CSS selectors exist, intercept events, manage persistent user configurations, modify the DOM more easily and more
4
2
  // @namespace https://github.com/Sv443-Network/UserUtils
5
- // @version 1.1.1
6
- // @license MIT
3
+ // @exclude *
7
4
  // @author Sv443
8
- // @copyright Sv443 (https://github.com/Sv443)
9
5
  // @supportURL https://github.com/Sv443-Network/UserUtils/issues
10
6
  // @homepageURL https://github.com/Sv443-Network/UserUtils#readme
7
+ // @supportURL https://github.com/Sv443-Network/UserUtils/issues
8
+
9
+ // ==UserLibrary==
10
+ // @name UserUtils
11
+ // @description Library with various utilities for userscripts - register listeners for when CSS selectors exist, intercept events, manage persistent user configurations, modify the DOM more easily and more
12
+ // @version 1.1.3
13
+ // @license MIT
14
+ // @copyright Sv443 (https://github.com/Sv443)
15
+
11
16
  // ==/UserScript==
17
+ // ==/UserLibrary==
18
+
19
+ // ==OpenUserJS==
20
+ // @author Sv443
21
+ // ==/OpenUserJS==
12
22
 
13
23
  var UserUtils = (function (exports) {
14
24
  var __defProp = Object.defineProperty;
@@ -168,7 +178,7 @@ var UserUtils = (function (exports) {
168
178
  setData(data) {
169
179
  this.cachedConfig = data;
170
180
  return new Promise((resolve) => __async(this, null, function* () {
171
- yield Promise.allSettled([
181
+ yield Promise.all([
172
182
  GM.setValue(`_uucfg-${this.id}`, JSON.stringify(data)),
173
183
  GM.setValue(`_uucfgver-${this.id}`, this.formatVersion)
174
184
  ]);
@@ -180,7 +190,7 @@ var UserUtils = (function (exports) {
180
190
  return __async(this, null, function* () {
181
191
  this.cachedConfig = this.defaultConfig;
182
192
  return new Promise((resolve) => __async(this, null, function* () {
183
- yield Promise.allSettled([
193
+ yield Promise.all([
184
194
  GM.setValue(`_uucfg-${this.id}`, JSON.stringify(this.defaultConfig)),
185
195
  GM.setValue(`_uucfgver-${this.id}`, this.formatVersion)
186
196
  ]);
@@ -197,7 +207,7 @@ var UserUtils = (function (exports) {
197
207
  */
198
208
  deleteConfig() {
199
209
  return __async(this, null, function* () {
200
- yield Promise.allSettled([
210
+ yield Promise.all([
201
211
  GM.deleteValue(`_uucfg-${this.id}`),
202
212
  GM.deleteValue(`_uucfgver-${this.id}`)
203
213
  ]);
@@ -223,7 +233,7 @@ var UserUtils = (function (exports) {
223
233
  }
224
234
  }
225
235
  }
226
- yield Promise.allSettled([
236
+ yield Promise.all([
227
237
  GM.setValue(`_uucfg-${this.id}`, JSON.stringify(newData)),
228
238
  GM.setValue(`_uucfgver-${this.id}`, lastFmtVer)
229
239
  ]);
package/dist/index.js CHANGED
@@ -157,7 +157,7 @@ var ConfigManager = class {
157
157
  setData(data) {
158
158
  this.cachedConfig = data;
159
159
  return new Promise((resolve) => __async(this, null, function* () {
160
- yield Promise.allSettled([
160
+ yield Promise.all([
161
161
  GM.setValue(`_uucfg-${this.id}`, JSON.stringify(data)),
162
162
  GM.setValue(`_uucfgver-${this.id}`, this.formatVersion)
163
163
  ]);
@@ -169,7 +169,7 @@ var ConfigManager = class {
169
169
  return __async(this, null, function* () {
170
170
  this.cachedConfig = this.defaultConfig;
171
171
  return new Promise((resolve) => __async(this, null, function* () {
172
- yield Promise.allSettled([
172
+ yield Promise.all([
173
173
  GM.setValue(`_uucfg-${this.id}`, JSON.stringify(this.defaultConfig)),
174
174
  GM.setValue(`_uucfgver-${this.id}`, this.formatVersion)
175
175
  ]);
@@ -186,7 +186,7 @@ var ConfigManager = class {
186
186
  */
187
187
  deleteConfig() {
188
188
  return __async(this, null, function* () {
189
- yield Promise.allSettled([
189
+ yield Promise.all([
190
190
  GM.deleteValue(`_uucfg-${this.id}`),
191
191
  GM.deleteValue(`_uucfgver-${this.id}`)
192
192
  ]);
@@ -212,7 +212,7 @@ var ConfigManager = class {
212
212
  }
213
213
  }
214
214
  }
215
- yield Promise.allSettled([
215
+ yield Promise.all([
216
216
  GM.setValue(`_uucfg-${this.id}`, JSON.stringify(newData)),
217
217
  GM.setValue(`_uucfgver-${this.id}`, lastFmtVer)
218
218
  ]);
package/dist/index.mjs CHANGED
@@ -155,7 +155,7 @@ var ConfigManager = class {
155
155
  setData(data) {
156
156
  this.cachedConfig = data;
157
157
  return new Promise((resolve) => __async(this, null, function* () {
158
- yield Promise.allSettled([
158
+ yield Promise.all([
159
159
  GM.setValue(`_uucfg-${this.id}`, JSON.stringify(data)),
160
160
  GM.setValue(`_uucfgver-${this.id}`, this.formatVersion)
161
161
  ]);
@@ -167,7 +167,7 @@ var ConfigManager = class {
167
167
  return __async(this, null, function* () {
168
168
  this.cachedConfig = this.defaultConfig;
169
169
  return new Promise((resolve) => __async(this, null, function* () {
170
- yield Promise.allSettled([
170
+ yield Promise.all([
171
171
  GM.setValue(`_uucfg-${this.id}`, JSON.stringify(this.defaultConfig)),
172
172
  GM.setValue(`_uucfgver-${this.id}`, this.formatVersion)
173
173
  ]);
@@ -184,7 +184,7 @@ var ConfigManager = class {
184
184
  */
185
185
  deleteConfig() {
186
186
  return __async(this, null, function* () {
187
- yield Promise.allSettled([
187
+ yield Promise.all([
188
188
  GM.deleteValue(`_uucfg-${this.id}`),
189
189
  GM.deleteValue(`_uucfgver-${this.id}`)
190
190
  ]);
@@ -210,7 +210,7 @@ var ConfigManager = class {
210
210
  }
211
211
  }
212
212
  }
213
- yield Promise.allSettled([
213
+ yield Promise.all([
214
214
  GM.setValue(`_uucfg-${this.id}`, JSON.stringify(newData)),
215
215
  GM.setValue(`_uucfgver-${this.id}`, lastFmtVer)
216
216
  ]);
@@ -1,7 +1,7 @@
1
1
  /** Function that takes the data in the old format and returns the data in the new format. Also supports an asynchronous migration. */
2
2
  type MigrationFunc = (oldData: any) => any | Promise<any>;
3
3
  /** Dictionary of format version numbers and the function that migrates to them from the previous whole integer */
4
- type MigrationsDict = Record<number, MigrationFunc>;
4
+ export type ConfigMigrationsDict = Record<number, MigrationFunc>;
5
5
  /** Options for the ConfigManager instance */
6
6
  export interface ConfigManagerOptions<TData> {
7
7
  /** A unique internal ID for this configuration - choose wisely as changing it is not supported yet. */
@@ -15,7 +15,7 @@ export interface ConfigManagerOptions<TData> {
15
15
  defaultConfig: TData;
16
16
  /**
17
17
  * An incremental, whole integer version number of the current format of config data.
18
- * If the format of the data is changed, this number should be incremented, in which case all necessary functions of the migrations dictionary will be run consecutively.
18
+ * If the format of the data is changed in any way, this number should be incremented, in which case all necessary functions of the migrations dictionary will be run consecutively.
19
19
  *
20
20
  * ⚠️ Never decrement this number and optimally don't skip any numbers either!
21
21
  */
@@ -27,7 +27,7 @@ export interface ConfigManagerOptions<TData> {
27
27
  * The functions will be run in order from the oldest to the newest version.
28
28
  * If the current format version is not in the dictionary, no migrations will be run.
29
29
  */
30
- migrations?: MigrationsDict;
30
+ migrations?: ConfigMigrationsDict;
31
31
  }
32
32
  /**
33
33
  * Manages a user configuration that is cached in memory and persistently saved across sessions.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sv443-network/userutils",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "description": "Library with various utilities for userscripts - register listeners for when CSS selectors exist, intercept events, manage persistent user configurations, modify the DOM more easily and more",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",