godprotocol 2.3.17 → 2.3.19

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 CHANGED
@@ -5,6 +5,7 @@ import version_middleware from "./server/version_control.js";
5
5
  class GodProtocol {
6
6
  constructor(config) {
7
7
  this.db_config = config.db_config;
8
+ this.server = config.server;
8
9
 
9
10
  this.resource = new Resource(this);
10
11
 
@@ -42,6 +43,10 @@ class GodProtocol {
42
43
  return await this.route_table.platform_db();
43
44
  };
44
45
 
46
+ version_db = async (version) => {
47
+ return await this.route_table.version_db(version);
48
+ };
49
+
45
50
  load_services = async (services) => {
46
51
  await this.route_table.load_services(services);
47
52
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "godprotocol",
3
- "version": "2.3.17",
3
+ "version": "2.3.19",
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",
@@ -153,9 +153,16 @@ class Services {
153
153
  };
154
154
  };
155
155
 
156
- platform_db = async () => {
157
- let prefix = this.db_prefix,
158
- name = this.db_name || this.db_config.name;
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) => {
164
+ let prefix = this.db_prefix;
165
+ name = name || this.db_name || this.db_config.name;
159
166
 
160
167
  if (prefix) {
161
168
  name = `${prefix}:${name}`;
@@ -80,6 +80,10 @@ const respond = (result, res) => {
80
80
  response.next = result.next;
81
81
  }
82
82
 
83
+ if (result?.status_code) {
84
+ response.status_code = result.status_code;
85
+ }
86
+
83
87
  const status = result?.status || (result?.ok ? 200 : 403);
84
88
 
85
89
  res.statusCode = status;