@sv443-network/coreutils 2.0.0 → 2.0.2

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.
@@ -20,7 +20,7 @@ export declare abstract class DataStoreEngine<TData extends DataStoreData> {
20
20
  constructor(options?: DataStoreEngineDSOptions<TData>);
21
21
  /** Called by DataStore on creation, to pass its options. Only call this if you are using this instance standalone! */
22
22
  setDataStoreOptions(dataStoreOptions: DataStoreEngineDSOptions<TData>): void;
23
- /** Fetches a value from persistent storage */
23
+ /** Fetches a value from persistent storage. Defaults to `defaultValue` if the value does not exist. `null` is considered a valid value. */
24
24
  abstract getValue<TValue extends SerializableVal = string>(name: string, defaultValue: TValue): Promise<string | TValue>;
25
25
  /** Sets a value in persistent storage */
26
26
  abstract setValue(name: string, value: SerializableVal): Promise<void>;
@@ -88,6 +88,7 @@ export type FileStorageEngineOptions = {
88
88
  */
89
89
  export declare class FileStorageEngine<TData extends DataStoreData> extends DataStoreEngine<TData> {
90
90
  protected options: FileStorageEngineOptions & Required<Pick<FileStorageEngineOptions, "filePath">>;
91
+ private fileAccessQueue;
91
92
  /**
92
93
  * Creates an instance of `FileStorageEngine`.
93
94
  *
@@ -0,0 +1,12 @@
1
+ import { DataStore, type DataStoreData } from "./DataStore.js";
2
+ import type { SerializableVal } from "./types.js";
3
+ /**
4
+ * A DataStore wrapper subclass that exposes internal methods for testing via the `direct_` prefixed methods.
5
+ */
6
+ export declare class TestDataStore<TData extends DataStoreData> extends DataStore<TData> {
7
+ direct_getValue<TValue extends SerializableVal = string>(name: string, defaultValue: TValue): Promise<string | TValue>;
8
+ direct_setValue(name: string, value: SerializableVal): Promise<void>;
9
+ direct_renameKey(oldName: string, newName: string): Promise<void>;
10
+ direct_deleteValue(name: string): Promise<void>;
11
+ direct_setFirstInit(value: boolean): void;
12
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sv443-network/coreutils",
3
3
  "libName": "@sv443-network/coreutils",
4
- "version": "2.0.0",
4
+ "version": "2.0.2",
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",