@wxn0brp/db 0.5.6 → 0.5.7

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.
@@ -0,0 +1,4 @@
1
+ import DataBaseRemote from "./client/database.js";
2
+ import { Remote } from "./client/remote.js";
3
+ import DataBase from "./database.js";
4
+ export declare function autoCreate(cfg: string | Remote): DataBase | DataBaseRemote;
@@ -0,0 +1,9 @@
1
+ import DataBaseRemote from "./client/database.js";
2
+ import DataBase from "./database.js";
3
+ export function autoCreate(cfg) {
4
+ if (typeof cfg === "object")
5
+ return new DataBaseRemote(cfg);
6
+ if (cfg.startsWith("http"))
7
+ return new DataBaseRemote(cfg);
8
+ return new DataBase(cfg);
9
+ }
package/dist/index.d.ts CHANGED
@@ -6,7 +6,8 @@ import genId from "./gen.js";
6
6
  import Relation from "./relation.js";
7
7
  import CustomFileCpu from "./file/customFileCpu.js";
8
8
  import ValtheraMemory, { createMemoryValthera } from "./memory.js";
9
- export { DataBase as Valthera, Graph, DataBaseRemote as ValtheraRemote, GraphRemote, Relation, genId, CustomFileCpu, ValtheraMemory, createMemoryValthera };
9
+ import { autoCreate } from "./autoCreate.js";
10
+ export { DataBase as Valthera, Graph, DataBaseRemote as ValtheraRemote, GraphRemote, Relation, genId, CustomFileCpu, ValtheraMemory, createMemoryValthera, autoCreate, };
10
11
  export type Id = import("./types/Id.js").Id;
11
12
  export declare namespace ValtheraTypes {
12
13
  type Arg = import("./types/arg.js").Arg;
package/dist/index.js CHANGED
@@ -6,4 +6,5 @@ import genId from "./gen.js";
6
6
  import Relation from "./relation.js";
7
7
  import CustomFileCpu from "./file/customFileCpu.js";
8
8
  import ValtheraMemory, { createMemoryValthera } from "./memory.js";
9
- export { DataBase as Valthera, Graph, DataBaseRemote as ValtheraRemote, GraphRemote, Relation, genId, CustomFileCpu, ValtheraMemory, createMemoryValthera };
9
+ import { autoCreate } from "./autoCreate.js";
10
+ export { DataBase as Valthera, Graph, DataBaseRemote as ValtheraRemote, GraphRemote, Relation, genId, CustomFileCpu, ValtheraMemory, createMemoryValthera, autoCreate, };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wxn0brp/db",
3
- "version": "0.5.6",
3
+ "version": "0.5.7",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "description": "A simple file-based database management system with support for CRUD operations, custom queries, and graph structures.",