godprotocol 2.2.88 → 2.2.90

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.2.88",
3
+ "version": "2.2.90",
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",
@@ -1,6 +1,6 @@
1
1
  import { DB } from "./Header.js";
2
2
 
3
- let DEV = false;
3
+ let DEV = process.env.DEV;
4
4
  let gp_services = {
5
5
  profile: DEV
6
6
  ? "http://localhost:4000"
@@ -18,6 +18,7 @@ class Services {
18
18
  }
19
19
 
20
20
  load_services = async (services) => {
21
+ if (typeof services === "function") services = await services();
21
22
  this.services = services;
22
23
  };
23
24
 
@@ -94,9 +95,12 @@ class Services {
94
95
  if (token?.ok === false) return token;
95
96
  }
96
97
  }
98
+
99
+ if (token) headers["Authorization"] = `Bearer ${token}`;
100
+ headers["x-platform"] = this.platform_uri;
101
+ } else {
102
+ headers["x-api-key"] = servic.api_key || this.gp.api_key;
97
103
  }
98
- if (token) headers["Authorization"] = `Bearer ${token}`;
99
- headers["x-platform"] = this.platform_uri;
100
104
 
101
105
  try {
102
106
  let response = await fetch(`${servic.url}/${path}`, {