universe-code 0.0.39 → 0.0.41

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,8 +1,8 @@
1
1
  import { DBManager, DB } from "universe-code";
2
2
 
3
- let DB_NAME = "exchange";
4
- let DB_VERSION = 1;
5
- let STORE_NAME = "exchangeStore";
3
+ let DB_NAME = null;
4
+ let DB_VERSION = null;
5
+ let STORE_NAME = null;
6
6
 
7
7
  let db = null;
8
8
  let store = null;
@@ -14,6 +14,19 @@ export const setDBConfig = ({
14
14
  storeName,
15
15
  version,
16
16
  }) => {
17
+
18
+ if (!DB_NAME) {
19
+ throw new Error("index db name is missing");
20
+ }
21
+
22
+ if (!STORE_NAME) {
23
+ throw new Error("index db store name is missing");
24
+ }
25
+
26
+ if (!DB_VERSION) {
27
+ throw new Error("index db version is missing");
28
+ }
29
+
17
30
  if (db || store) {
18
31
  throw new Error("DB already initialized");
19
32
  }
@@ -25,6 +38,18 @@ export const setDBConfig = ({
25
38
 
26
39
  // ✅ index db connection
27
40
  const connectDB = async () => {
41
+ if (!DB_NAME) {
42
+ throw new Error("index db name is missing");
43
+ }
44
+
45
+ if (!STORE_NAME) {
46
+ throw new Error("index db store name is missing");
47
+ }
48
+
49
+ if (!DB_VERSION) {
50
+ throw new Error("index db version is missing");
51
+ }
52
+
28
53
  if (!manager) {
29
54
  manager = new DBManager(DB_NAME, DB_VERSION);
30
55
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "universe-code",
3
- "version": "0.0.39",
3
+ "version": "0.0.41",
4
4
  "description": "Universal utility functions for all JS frameworks",
5
5
  "license": "ISC",
6
6
  "type": "module",