universe-code 0.0.44 → 0.0.46

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,12 +1,11 @@
1
- import { getIdbStore, setDBConfig } from './indexdb/store/idbStore.js';
1
+ import { getIdbStore } from './indexdb/store/idbStore.js';
2
2
  import { useIdbStore } from './indexdb/hooks/idbHook.js';
3
3
 
4
4
  // Export everything as a unified object or individual pieces
5
- export { getIdbStore, useIdbStore, setDBConfig };
5
+ export { getIdbStore, useIdbStore };
6
6
 
7
7
  // Default export for easy usage
8
8
  export default {
9
- setDBConfig,
10
9
  getIdbStore,
11
10
  useIdbStore,
12
11
  };
@@ -1,58 +1,15 @@
1
1
  import { DBManager, DB } from "universe-code";
2
2
 
3
- let DB_NAME = null;
4
- let DB_VERSION = null;
5
- let STORE_NAME = null;
3
+ let DB_NAME = process.env.DB_NAME | null;
4
+ let DB_VERSION = process.env.DB_NAME | null;
5
+ let STORE_NAME = process.env.DB_NAME | null;
6
6
 
7
7
  let db = null;
8
8
  let store = null;
9
9
  let manager = null; // ⬅️ IMPORTANT
10
10
 
11
- // ✅ set index db config from outside
12
- export const setDBConfig = ({
13
- dbName,
14
- storeName,
15
- version,
16
- }) => {
17
-
18
- if (!dbName) {
19
- throw new Error("index db name is missing");
20
- }
21
-
22
- if (!storeName) {
23
- throw new Error("index db store name is missing");
24
- }
25
-
26
- if (!version) {
27
- throw new Error("index db version is missing");
28
- }
29
-
30
- if (db || store) {
31
- throw new Error("DB already initialized");
32
- }
33
-
34
- if (dbName) DB_NAME = dbName;
35
- if (storeName) STORE_NAME = storeName;
36
- if (version) DB_VERSION = version;
37
-
38
- connectDB();
39
- getIdbStore();
40
- };
41
-
42
11
  // ✅ index db connection
43
12
  const connectDB = async () => {
44
- if (!DB_NAME) {
45
- throw new Error("index db name is missing");
46
- }
47
-
48
- if (!STORE_NAME) {
49
- throw new Error("index db store name is missing");
50
- }
51
-
52
- if (!DB_VERSION) {
53
- throw new Error("index db version is missing");
54
- }
55
-
56
13
  if (!manager) {
57
14
  manager = new DBManager(DB_NAME, DB_VERSION);
58
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "universe-code",
3
- "version": "0.0.44",
3
+ "version": "0.0.46",
4
4
  "description": "Universal utility functions for all JS frameworks",
5
5
  "license": "ISC",
6
6
  "type": "module",