@hazae41/turbine 0.1.3 → 0.1.5

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.
@@ -53,6 +53,7 @@ var __disposeResources = (this && this.__disposeResources) || (function (Suppres
53
53
  import { RpcPaymentError } from "@hazae41/bobine";
54
54
  import { RpcErr, RpcError, RpcInvalidParamsError, RpcMethodNotFoundError, RpcOk } from "@hazae41/jsonrpc";
55
55
  import { Mutex } from "@hazae41/mutex";
56
+ import { Packed } from "@hazae41/webpack";
56
57
  /**
57
58
  * Translates HTTP or WebSocket into JSON-RPC
58
59
  */
@@ -78,8 +79,10 @@ export class Server {
78
79
  return this.#upgrade(request);
79
80
  if (request.method === "OPTIONS")
80
81
  return new Response(null, { status: 204 });
82
+ if (request.method === "GET")
83
+ return new Response("Yes it works");
81
84
  if (request.method === "POST")
82
- return Response.json(await this.subserver.respond(await request.json()), { status: 200 });
85
+ return Response.json(await this.subserver.respond(await request.json()));
83
86
  return new Response(null, { status: 405 });
84
87
  }
85
88
  #upgrade(request) {
@@ -168,7 +171,7 @@ export class RpcServer {
168
171
  const proven = new Uint8Array(await crypto.subtle.digest("SHA-256", effort));
169
172
  const target = (2n ** 256n) / BigInt("0x" + proven.toHex());
170
173
  const result = await this.worker.execute(module, method, params, target);
171
- return result.toHex();
174
+ return Packed.encode(result).toHex();
172
175
  }
173
176
  catch (e_2) {
174
177
  env_2.error = e_2;
@@ -201,7 +204,7 @@ export class RpcServer {
201
204
  const proven = new Uint8Array(await crypto.subtle.digest("SHA-256", effort));
202
205
  const target = (2n ** 256n) / BigInt("0x" + proven.toHex());
203
206
  const result = await this.worker.simulate(module, method, params, target);
204
- return result.toHex();
207
+ return Packed.encode(result).toHex();
205
208
  }
206
209
  catch (e_3) {
207
210
  env_3.error = e_3;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@hazae41/turbine",
4
- "version": "0.1.3",
4
+ "version": "0.1.5",
5
5
  "description": "Bobine over HTTP and WebSocket",
6
6
  "repository": "github:hazae41/turbine",
7
7
  "author": "hazae41",
@@ -22,14 +22,16 @@
22
22
  }
23
23
  },
24
24
  "dependencies": {
25
- "@hazae41/bobine": "^0.1.2",
25
+ "@hazae41/binary": "^2.1.1",
26
+ "@hazae41/bobine": "^0.1.6",
26
27
  "@hazae41/jsonrpc": "^1.2.1",
27
- "@hazae41/mutex": "^3.0.1"
28
+ "@hazae41/mutex": "^3.0.1",
29
+ "@hazae41/webpack": "^1.0.0"
28
30
  },
29
31
  "devDependencies": {
30
32
  "@hazae41/phobos": "^2.0.16",
31
33
  "@hazae41/tscousin": "^1.0.28",
32
- "@types/node": "^26.6.6",
34
+ "@types/node": "^26.6.11",
33
35
  "typescript": "^7.0.2"
34
36
  },
35
37
  "keywords": [