godprotocol 2.2.95 → 2.2.97

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
@@ -15,11 +15,13 @@ class GodProtocol {
15
15
 
16
16
  this.memory = new Map();
17
17
 
18
- this.on_start();
18
+ if (typeof this.startup_fn === "function") {
19
+ this.startup_fn(this);
20
+ }
19
21
  }
20
22
 
21
23
  on_start = async (fn) => {
22
- await fn(this);
24
+ this.startup_fn = fn;
23
25
  };
24
26
 
25
27
  uri_default_domain = (uri) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "godprotocol",
3
- "version": "2.2.95",
3
+ "version": "2.2.97",
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",
@@ -83,7 +83,7 @@ const respond = (result, res) => {
83
83
 
84
84
  res.end(JSON.stringify(response));
85
85
 
86
- res.gp.compute_response(res);
86
+ res.gp?.resource?.compute_response(res);
87
87
 
88
88
  return response;
89
89
  };
@@ -103,7 +103,7 @@ const version_middleware = async (req, res, routers) => {
103
103
  const pathname = parsed_url.pathname;
104
104
 
105
105
  req.request_id = crypto.randomUUID();
106
- routers.gp.incoming_request(req);
106
+ routers.gp?.resource?.incoming_request(req);
107
107
  res.gp = routers.gp;
108
108
  res.request_id = req.request_id;
109
109