godprotocol 2.3.16 → 2.3.17

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "godprotocol",
3
- "version": "2.3.16",
3
+ "version": "2.3.17",
4
4
  "description": "A distributed computing environment for Web 4.0 — integrating AI, decentralisation, and virtual computation.",
5
5
  "main": "Index.js",
6
6
  "type": "module",
@@ -27,6 +27,8 @@ class Route_table extends Headers {
27
27
 
28
28
  this.active_version = version;
29
29
 
30
+ this.db_name = ver.config?.db_name === true ? version : ver.config?.db_name;
31
+
30
32
  this.db_prefix =
31
33
  ver.config?.db_prefix === true ? version : ver.config?.db_prefix;
32
34
 
@@ -34,7 +34,7 @@ class Services {
34
34
  constructor() {
35
35
  this.services = new Object();
36
36
 
37
- this.db_prefixes = new Object();
37
+ this.dbs = new Object();
38
38
  this.load_services(gp_services);
39
39
  }
40
40
 
@@ -154,23 +154,18 @@ class Services {
154
154
  };
155
155
 
156
156
  platform_db = async () => {
157
- let prefix = this.db_prefix;
158
- let db;
157
+ let prefix = this.db_prefix,
158
+ name = this.db_name || this.db_config.name;
159
+
159
160
  if (prefix) {
160
- db = this.db_prefixes[prefix];
161
- if (!db) {
162
- let conf = { ...this.db_config };
163
- conf.name = `${prefix}:${this.db_config.name}`;
161
+ name = `${prefix}:${name}`;
162
+ }
164
163
 
165
- db = new DB(conf, this);
166
- this.db_prefixes[prefix] = db;
167
- }
168
- } else {
169
- db = this.db;
170
- if (!db) {
171
- db = new DB(this.db_config, this);
172
- this.db = db;
173
- }
164
+ let db = this.dbs[name];
165
+ if (!db) {
166
+ db = new DB({ ...this.db_config, name }, this);
167
+
168
+ this.dbs[name] = db;
174
169
  }
175
170
 
176
171
  return db;