@wxn0brp/db 0.42.0 → 0.50.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.
@@ -1,4 +1,6 @@
1
1
  import { Remote } from "@wxn0brp/db-client/remote";
2
+ import { Data } from "@wxn0brp/db-core/types/data";
3
+ import { DbOpts } from "@wxn0brp/db-core/types/options";
2
4
  import { ValtheraCompatible } from "@wxn0brp/db-core/types/valthera";
3
5
  /**
4
6
  * Creates a database instance based on the provided configuration.
@@ -9,4 +11,12 @@ import { ValtheraCompatible } from "@wxn0brp/db-core/types/valthera";
9
11
  * @param cfg - The configuration object or string for the database.
10
12
  * @returns A new instance of DataBaseRemote or DataBase.
11
13
  */
12
- export declare function ValtheraAutoCreate(cfg: string | Remote): ValtheraCompatible;
14
+ export declare function ValtheraAutoRemoteCreate(cfg: string | Remote): ValtheraCompatible;
15
+ /**
16
+ * Creates a new instance of forged Valthera.
17
+ *
18
+ * @param folder - The folder path where the database files are stored.
19
+ * @param options - Optional configuration options.
20
+ * @returns A new instance of Valthera.
21
+ */
22
+ export declare function ValtheraCreate<T extends Record<string, Data> = {}>(folder: string, options?: DbOpts): import("@wxn0brp/db-core").ValtheraClass & { [K in keyof T]: import("@wxn0brp/db-core/helpers/collection").Collection<T[K]>; };
@@ -1,5 +1,6 @@
1
- import ValtheraRemote from "@wxn0brp/db-client/valthera";
2
- import Valthera from "./valthera.js";
1
+ import { ValtheraRemote } from "@wxn0brp/db-client/valthera";
2
+ import { forgeTypedValthera } from "@wxn0brp/db-core";
3
+ import { Valthera } from "./valthera.js";
3
4
  /**
4
5
  * Creates a database instance based on the provided configuration.
5
6
  * If the configuration is an object, it creates a DataBaseRemote instance.
@@ -9,8 +10,18 @@ import Valthera from "./valthera.js";
9
10
  * @param cfg - The configuration object or string for the database.
10
11
  * @returns A new instance of DataBaseRemote or DataBase.
11
12
  */
12
- export function ValtheraAutoCreate(cfg) {
13
+ export function ValtheraAutoRemoteCreate(cfg) {
13
14
  if (typeof cfg === "object" || cfg.startsWith("http"))
14
15
  return new ValtheraRemote(cfg);
15
16
  return new Valthera(cfg);
16
17
  }
18
+ /**
19
+ * Creates a new instance of forged Valthera.
20
+ *
21
+ * @param folder - The folder path where the database files are stored.
22
+ * @param options - Optional configuration options.
23
+ * @returns A new instance of Valthera.
24
+ */
25
+ export function ValtheraCreate(folder, options = {}) {
26
+ return forgeTypedValthera(new Valthera(folder, options));
27
+ }
package/dist/bin.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import Valthera from "./valthera.js";
2
+ import { Valthera } from "./valthera.js";
3
3
  const args = process.argv.slice(2);
4
4
  if (args.length < 2) {
5
5
  console.error(`Use: ${process.argv[1]} <path> <op> <collection> [args]`);
package/dist/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  export type { Id } from "@wxn0brp/db-core/types/Id";
2
- export { ValtheraAutoCreate } from "./autoCreate.js";
3
- export { Valthera } from "./valthera.js";
2
+ export { ValtheraAutoRemoteCreate, ValtheraCreate } from "./autoCreate.js";
4
3
  export * from "@wxn0brp/db-client";
5
4
  export * from "@wxn0brp/db-core";
package/dist/index.js CHANGED
@@ -1,4 +1,3 @@
1
- export { ValtheraAutoCreate } from "./autoCreate.js";
2
- export { Valthera } from "./valthera.js";
1
+ export { ValtheraAutoRemoteCreate, ValtheraCreate } from "./autoCreate.js";
3
2
  export * from "@wxn0brp/db-client";
4
3
  export * from "@wxn0brp/db-core";
@@ -1,7 +1,6 @@
1
- import ValtheraClass from "@wxn0brp/db-core/db/valthera";
2
- import FileCpu from "@wxn0brp/db-core/types/fileCpu";
1
+ import { ValtheraClass } from "@wxn0brp/db-core/db/valthera";
2
+ import { FileCpu } from "@wxn0brp/db-core/types/fileCpu";
3
3
  import { DbOpts } from "@wxn0brp/db-core/types/options";
4
4
  export declare class Valthera extends ValtheraClass {
5
5
  constructor(folder: string, options?: DbOpts, fileCpu?: FileCpu);
6
6
  }
7
- export default Valthera;
package/dist/valthera.js CHANGED
@@ -1,14 +1,13 @@
1
- import ValtheraClass from "@wxn0brp/db-core/db/valthera";
2
- import executorC from "@wxn0brp/db-core/helpers/executor";
3
- import dbActionC from "@wxn0brp/db-storage-dir/action";
4
- import vFileCpu from "@wxn0brp/db-storage-dir/file/index";
1
+ import { ValtheraClass } from "@wxn0brp/db-core/db/valthera";
2
+ import { Executor } from "@wxn0brp/db-core/helpers/executor";
3
+ import { FileActions } from "@wxn0brp/db-storage-dir";
4
+ import { vFileCpu } from "@wxn0brp/db-storage-dir/file/index";
5
5
  export class Valthera extends ValtheraClass {
6
6
  constructor(folder, options = {}, fileCpu) {
7
7
  super(options);
8
8
  if (!fileCpu)
9
9
  fileCpu = vFileCpu;
10
- this.dbAction = options.dbAction || new dbActionC(folder, options, fileCpu);
11
- this.executor = options.executor || new executorC();
10
+ this.dbAction = options.dbAction || new FileActions(folder, options, fileCpu);
11
+ this.executor = options.executor || new Executor();
12
12
  }
13
13
  }
14
- export default Valthera;
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const version = "0.42.0";
1
+ export const version = "0.50.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wxn0brp/db",
3
- "version": "0.42.0",
3
+ "version": "0.50.0",
4
4
  "description": "A modular, embedded database for developers who want control over their data storage.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -25,9 +25,9 @@
25
25
  "lightweight"
26
26
  ],
27
27
  "dependencies": {
28
- "@wxn0brp/db-client": ">=0.3.0 <0.4.0",
29
- "@wxn0brp/db-core": ">=0.4.0 <0.5.0",
30
- "@wxn0brp/db-storage-dir": ">=0.1.6"
28
+ "@wxn0brp/db-client": "~0.4.0",
29
+ "@wxn0brp/db-core": "~0.5.0",
30
+ "@wxn0brp/db-storage-dir": "~0.2.0"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@types/node": "*",