godprotocol 2.3.16 → 2.3.18
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/Godprotocol.js +4 -0
- package/package.json +1 -1
- package/server/Routable/Route_table.js +2 -0
- package/server/Routable/Services.js +18 -16
package/Godprotocol.js
CHANGED
|
@@ -42,6 +42,10 @@ class GodProtocol {
|
|
|
42
42
|
return await this.route_table.platform_db();
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
+
version_db = async (version) => {
|
|
46
|
+
return await this.route_table.version_db(version);
|
|
47
|
+
};
|
|
48
|
+
|
|
45
49
|
load_services = async (services) => {
|
|
46
50
|
await this.route_table.load_services(services);
|
|
47
51
|
};
|
package/package.json
CHANGED
|
@@ -34,7 +34,7 @@ class Services {
|
|
|
34
34
|
constructor() {
|
|
35
35
|
this.services = new Object();
|
|
36
36
|
|
|
37
|
-
this.
|
|
37
|
+
this.dbs = new Object();
|
|
38
38
|
this.load_services(gp_services);
|
|
39
39
|
}
|
|
40
40
|
|
|
@@ -153,24 +153,26 @@ class Services {
|
|
|
153
153
|
};
|
|
154
154
|
};
|
|
155
155
|
|
|
156
|
-
|
|
156
|
+
version_db = async (ver) => {
|
|
157
|
+
let version = await this.get_version(ver);
|
|
158
|
+
if (!version) return;
|
|
159
|
+
|
|
160
|
+
return await this.platform_db();
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
platform_db = async (name) => {
|
|
157
164
|
let prefix = this.db_prefix;
|
|
158
|
-
|
|
165
|
+
name = name || this.db_name || this.db_config.name;
|
|
166
|
+
|
|
159
167
|
if (prefix) {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
let conf = { ...this.db_config };
|
|
163
|
-
conf.name = `${prefix}:${this.db_config.name}`;
|
|
168
|
+
name = `${prefix}:${name}`;
|
|
169
|
+
}
|
|
164
170
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
if (!db) {
|
|
171
|
-
db = new DB(this.db_config, this);
|
|
172
|
-
this.db = db;
|
|
173
|
-
}
|
|
171
|
+
let db = this.dbs[name];
|
|
172
|
+
if (!db) {
|
|
173
|
+
db = new DB({ ...this.db_config, name }, this);
|
|
174
|
+
|
|
175
|
+
this.dbs[name] = db;
|
|
174
176
|
}
|
|
175
177
|
|
|
176
178
|
return db;
|