godprotocol 2.3.27 → 2.3.29

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
@@ -81,6 +81,19 @@ class GodProtocol {
81
81
  await this.route_table.load_services(services);
82
82
  };
83
83
 
84
+ _loaded_routers = [];
85
+
86
+ load_locals = async (services, opts = {}) => {
87
+ let { services_config } = opts;
88
+
89
+ for (let service of services) {
90
+ if (this._loaded_routers.includes(service.router)) continue;
91
+
92
+ this._loaded_routers.push(service.router);
93
+ await service.router(this, { services_config });
94
+ }
95
+ };
96
+
84
97
  add_router = async (version, routes, opts = {}) => {
85
98
  if (opts.alias) {
86
99
  for (let o of opts.alias) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "godprotocol",
3
- "version": "2.3.27",
3
+ "version": "2.3.29",
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",
@@ -82,9 +82,9 @@ class Services {
82
82
  "Content-Type": "application/json",
83
83
  Accept: "application/json",
84
84
  "x-api-version":
85
- servic.local && !header.api_version.startsWith(`${servic.local}:`)
86
- ? `${servic.local}:${header.api_version || servic.api_version}`
87
- : header.api_version || servic.api_version || "v1",
85
+ servic.local && !header?.api_version?.startsWith(`${servic.local}:`)
86
+ ? `${servic.local}:${header?.api_version || servic.api_version}`
87
+ : header?.api_version || servic.api_version || "v1",
88
88
  };
89
89
 
90
90
  if (header?.api_key) {
@@ -137,7 +137,7 @@ class Services {
137
137
 
138
138
  this.get_version(prev_version);
139
139
 
140
- if (!reply?.ok) {
140
+ if (typeof reply?.ok !== "boolean") {
141
141
  return {
142
142
  ok: false,
143
143
  message: `Response calling ${service} service at path ${path}`,