@sv443-network/coreutils 3.0.8 → 3.2.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.
@@ -63,6 +63,11 @@ export type DataStoreOptions<TData extends DataStoreData, TMemCache extends bool
63
63
  * This may be useful if multiple sources are modifying the data, or the data is very large and you want to save memory, but it will make accessing the data slower, especially when combined with compression.
64
64
  */
65
65
  memoryCache?: TMemCache;
66
+ /**
67
+ * Allows overriding the default prefix (`__ds-`) that is prepended to all keys used for persistent storage.
68
+ * Note: this will break backwards compatibility with any previously saved data, so only change this if you know what you're doing and ideally before any non-volatile data is saved by the end user.
69
+ */
70
+ keyPrefix?: string;
66
71
  } & ({
67
72
  encodeData?: never;
68
73
  decodeData?: never;
@@ -123,6 +128,7 @@ export declare class DataStore<TData extends DataStoreData, TMemCache extends bo
123
128
  readonly compressionFormat: Exclude<DataStoreOptions<TData>["compressionFormat"], undefined>;
124
129
  readonly memoryCache: TMemCache;
125
130
  readonly engine: DataStoreEngine;
131
+ readonly keyPrefix: string;
126
132
  options: DataStoreOptions<TData, TMemCache>;
127
133
  /**
128
134
  * Whether all first-init checks should be done.
@@ -73,7 +73,7 @@ export declare class BrowserStorageEngine<TData extends DataStoreData = DataStor
73
73
  /** Options for the {@linkcode FileStorageEngine} class */
74
74
  export type FileStorageEngineOptions = {
75
75
  /** Function that returns a string or a plain string that is the data file path, including name and extension. Defaults to `.ds-${dataStoreID}` */
76
- filePath?: ((dataStoreID: string) => string) | string;
76
+ filePath?: ((dataStoreID: string, dataStoreOptions: DataStoreEngineDSOptions<DataStoreData>) => string) | string;
77
77
  /**
78
78
  * Specifies the necessary options for storing data.
79
79
  * - ⚠️ Only specify this if you are using this instance standalone! The parent DataStore will set this automatically.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sv443-network/coreutils",
3
3
  "libName": "@sv443-network/coreutils",
4
- "version": "3.0.8",
4
+ "version": "3.2.0",
5
5
  "description": "Cross-platform, general-purpose, JavaScript core library for Node, Deno and the browser. Intended to be used in conjunction with `@sv443-network/userutils` and `@sv443-network/djsutils`, but can be used independently as well.",
6
6
  "main": "dist/CoreUtils.cjs",
7
7
  "module": "dist/CoreUtils.mjs",
@@ -47,11 +47,11 @@
47
47
  "@swc/core": "^1.15.11",
48
48
  "@testing-library/dom": "^10.4.1",
49
49
  "@types/deno": "^2.5.0",
50
- "@types/node": "^22.19.7",
50
+ "@types/node": "^22.19.11",
51
51
  "@types/tx2": "^1.0.3",
52
- "@typescript-eslint/eslint-plugin": "^8.54.0",
53
- "@typescript-eslint/parser": "^8.54.0",
54
- "@typescript-eslint/utils": "^8.54.0",
52
+ "@typescript-eslint/eslint-plugin": "^8.56.0",
53
+ "@typescript-eslint/parser": "^8.56.0",
54
+ "@typescript-eslint/utils": "^8.56.0",
55
55
  "@vitest/coverage-v8": "^3.2.4",
56
56
  "esbuild-plugin-umd-wrapper": "^3.0.0",
57
57
  "eslint": "^9.39.2",