@wxn0brp/db 0.41.0 → 0.42.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.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2025 wxn0brP
3
+ Copyright (c) 2026 wxn0brP
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
  [![License](https://img.shields.io/npm/l/@wxn0brp/db)](./LICENSE)
5
5
  [![Downloads](https://img.shields.io/npm/dm/@wxn0brp/db)](https://www.npmjs.com/package/@wxn0brp/db)
6
6
 
7
- **Welcome to ValtheraDB a modular, embedded database for developers who want to build their perfect data layer. With a familiar API and unparalleled flexibility, ValtheraDB empowers you to take control of your data storage.**
7
+ **Welcome to ValtheraDB - a modular, embedded database for developers who want to build their perfect data layer. With a familiar API and unparalleled flexibility, ValtheraDB empowers you to take control of your data storage.**
8
8
 
9
9
  ---
10
10
 
@@ -10,9 +10,7 @@ import Valthera from "./valthera.js";
10
10
  * @returns A new instance of DataBaseRemote or DataBase.
11
11
  */
12
12
  export function ValtheraAutoCreate(cfg) {
13
- if (typeof cfg === "object")
14
- return new ValtheraRemote(cfg);
15
- if (cfg.startsWith("http"))
13
+ if (typeof cfg === "object" || cfg.startsWith("http"))
16
14
  return new ValtheraRemote(cfg);
17
15
  return new Valthera(cfg);
18
16
  }
package/dist/index.d.ts CHANGED
@@ -1,10 +1,5 @@
1
- import GraphRemote from "@wxn0brp/db-client/graph";
2
- import { ValtheraAutoCreate } from "./autoCreate.js";
3
- import Graph from "./graph.js";
4
- import { Valthera } from "./valthera.js";
5
- /** @deprecated */
6
- type GraphCompatible = Graph | GraphRemote;
7
- export * from "@wxn0brp/db-core";
1
+ export type { Id } from "@wxn0brp/db-core/types/Id";
2
+ export { ValtheraAutoCreate } from "./autoCreate.js";
3
+ export { Valthera } from "./valthera.js";
8
4
  export * from "@wxn0brp/db-client";
9
- export { Graph, GraphCompatible, GraphRemote, Valthera, ValtheraAutoCreate };
10
- export type Id = import("@wxn0brp/db-core/types/Id").Id;
5
+ export * from "@wxn0brp/db-core";
package/dist/index.js CHANGED
@@ -1,7 +1,4 @@
1
- import GraphRemote from "@wxn0brp/db-client/graph";
2
- import { ValtheraAutoCreate } from "./autoCreate.js";
3
- import Graph from "./graph.js";
4
- import { Valthera } from "./valthera.js";
5
- export * from "@wxn0brp/db-core";
1
+ export { ValtheraAutoCreate } from "./autoCreate.js";
2
+ export { Valthera } from "./valthera.js";
6
3
  export * from "@wxn0brp/db-client";
7
- export { Graph, GraphRemote, Valthera, ValtheraAutoCreate };
4
+ export * from "@wxn0brp/db-core";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const version = "0.41.0";
1
+ export const version = "0.42.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wxn0brp/db",
3
- "version": "0.41.0",
3
+ "version": "0.42.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.2.3",
29
- "@wxn0brp/db-core": ">=0.3.0",
30
- "@wxn0brp/db-storage-dir": ">=0.1.4"
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"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@types/node": "*",
package/dist/graph.d.ts DELETED
@@ -1,51 +0,0 @@
1
- import Data from "@wxn0brp/db-core/types/data";
2
- import Valthera from "./valthera.js";
3
- /**
4
- * A class representing a graph database.
5
- * @class
6
- * @deprecated
7
- */
8
- declare class Graph {
9
- db: Valthera;
10
- constructor(databaseFolder: string);
11
- /**
12
- * Adds an edge between two nodes.
13
- */
14
- add(collection: string, nodeA: string, nodeB: string): Promise<{
15
- a: string;
16
- b: string;
17
- }>;
18
- /**
19
- * Removes an edge between two nodes.
20
- */
21
- remove(collection: string, nodeA: string, nodeB: string): Promise<boolean>;
22
- /**
23
- * Finds all edges with either node equal to `node`.
24
- */
25
- find(collection: string, node: string): Promise<Data[]>;
26
- /**
27
- * Finds one edge with either node equal to `nodeA` and the other equal to `nodeB`.
28
- */
29
- findOne(collection: string, nodeA: string, nodeB: string): Promise<Data>;
30
- /**
31
- * Gets all edges in the database.
32
- */
33
- getAll(collection: string): Promise<Data[]>;
34
- /**
35
- * Get the names of all available databases.
36
- */
37
- getCollections(): Promise<string[]>;
38
- /**
39
- * Check and create the specified collection if it doesn't exist.
40
- */
41
- ensureCollection(collection: string): Promise<void>;
42
- /**
43
- * Check if a collection exists.
44
- */
45
- issetCollection(collection: string): Promise<boolean>;
46
- /**
47
- * Removes a database collection from the file system.
48
- */
49
- removeCollection(collection: string): void;
50
- }
51
- export default Graph;
package/dist/graph.js DELETED
@@ -1,86 +0,0 @@
1
- import Valthera from "./valthera.js";
2
- /**
3
- * A class representing a graph database.
4
- * @class
5
- * @deprecated
6
- */
7
- class Graph {
8
- db;
9
- constructor(databaseFolder) {
10
- this.db = new Valthera(databaseFolder);
11
- }
12
- /**
13
- * Adds an edge between two nodes.
14
- */
15
- async add(collection, nodeA, nodeB) {
16
- const sortedNodes = [nodeA, nodeB].sort();
17
- return await this.db.add(collection, {
18
- a: sortedNodes[0],
19
- b: sortedNodes[1]
20
- }, false);
21
- }
22
- /**
23
- * Removes an edge between two nodes.
24
- */
25
- async remove(collection, nodeA, nodeB) {
26
- const sortedNodes = [nodeA, nodeB].sort();
27
- const query = { a: sortedNodes[0], b: sortedNodes[1] };
28
- return await this.db.removeOne(collection, query);
29
- }
30
- /**
31
- * Finds all edges with either node equal to `node`.
32
- */
33
- async find(collection, node) {
34
- const edges = [];
35
- const edgesByANode = await this.db.find(collection, { a: node });
36
- const edgesByBNode = await this.db.find(collection, { b: node });
37
- if (edgesByANode)
38
- edges.push(...edgesByANode);
39
- if (edgesByBNode)
40
- edges.push(...edgesByBNode);
41
- return edges;
42
- }
43
- /**
44
- * Finds one edge with either node equal to `nodeA` and the other equal to `nodeB`.
45
- */
46
- async findOne(collection, nodeA, nodeB) {
47
- const edgeAB = await this.db.findOne(collection, { a: nodeA, b: nodeB });
48
- if (edgeAB)
49
- return edgeAB;
50
- const edgeBA = await this.db.findOne(collection, { a: nodeB, b: nodeA });
51
- if (edgeBA)
52
- return edgeBA;
53
- return null;
54
- }
55
- /**
56
- * Gets all edges in the database.
57
- */
58
- async getAll(collection) {
59
- return await this.db.find(collection, {});
60
- }
61
- /**
62
- * Get the names of all available databases.
63
- */
64
- async getCollections() {
65
- return await this.db.getCollections();
66
- }
67
- /**
68
- * Check and create the specified collection if it doesn't exist.
69
- */
70
- async ensureCollection(collection) {
71
- await this.db.ensureCollection(collection);
72
- }
73
- /**
74
- * Check if a collection exists.
75
- */
76
- async issetCollection(collection) {
77
- return await this.db.issetCollection(collection);
78
- }
79
- /**
80
- * Removes a database collection from the file system.
81
- */
82
- removeCollection(collection) {
83
- this.db.removeCollection(collection);
84
- }
85
- }
86
- export default Graph;