godprotocol 2.2.1 → 2.2.2

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
@@ -1,5 +1,5 @@
1
- import Route_table from "./server/Routable/Route_table";
2
- import version_middleware from "./server/version_control";
1
+ import Route_table from "./server/Routable/Route_table.js";
2
+ import version_middleware from "./server/version_control.js";
3
3
 
4
4
  class GodProtocol {
5
5
  constructor(config) {
package/Index.js CHANGED
@@ -1,4 +1,4 @@
1
- import GodProtocol from "./Godprotocol";
1
+ import GodProtocol from "./Godprotocol.js";
2
2
 
3
3
  let gp = new GodProtocol({
4
4
  platform_uri: "profile.savvyaisolution.com",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "godprotocol",
3
- "version": "2.2.1",
3
+ "version": "2.2.2",
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,5 @@
1
1
  import { Mongo } from "@godprotocol/repositories";
2
- import { post_request } from "../../utils/services.js";
3
- import Services from "./Services.js";
2
+ import Services, { gp_services } from "./Services.js";
4
3
 
5
4
  class DB {
6
5
  constructor(config, router) {
@@ -115,8 +114,18 @@ class Headers extends Services {
115
114
  headers["authorization"] = `Bearer ${authorization}`;
116
115
  }
117
116
 
118
- const res = await post_request(`$PROFILE/validate`, {}, headers);
117
+ const res = await fetch(`${gp_services.profile}/validate`, {
118
+ method: "post",
119
+ headers: {
120
+ "Content-Type": "application/json",
121
+ Accept: "application/json",
122
+ "x-api-version": "v2",
123
+ ...headers,
124
+ },
125
+ body: JSON.stringify({}),
126
+ });
119
127
 
128
+ res = await res.json();
120
129
  // 🔹 3. Save cache if valid
121
130
  if (res.ok && res.data) {
122
131
  await db.save_cache(query, res.data, "auth");
@@ -159,11 +168,17 @@ class Headers extends Services {
159
168
  headers["authorization"] = `Bearer ${authorization}`;
160
169
  }
161
170
 
162
- const res = await post_request(
163
- `$PROFILE/validate_third_party`,
164
- { platform_uri: xplatform },
165
- headers,
166
- );
171
+ const res = await fetch(`${gp_services.profile}/validate_third_party`, {
172
+ method: "post",
173
+ headers: {
174
+ "Content-Type": "application/json",
175
+ Accept: "application/json",
176
+ "x-api-version": "v2",
177
+ ...headers,
178
+ },
179
+ body: JSON.stringify({ platform_uri: xplatform }),
180
+ });
181
+ res = await res.json();
167
182
 
168
183
  // 🔹 3. Save cache
169
184
  if (res.ok && res.data) {
@@ -1,4 +1,3 @@
1
- import { post_request } from "../../utils/services.js";
2
1
  import { DB } from "./Header.js";
3
2
 
4
3
  let gp_services = {
@@ -6,6 +5,8 @@ let gp_services = {
6
5
  settings: "https://settings-api.savvyaisolution.com",
7
6
  };
8
7
 
8
+ export { gp_services };
9
+
9
10
  class Services {
10
11
  constructor() {
11
12
  this.services = new Object();