wao 0.26.0 → 0.26.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/cjs/hb.js +9 -11
- package/cjs/workspace/package.json +1 -1
- package/esm/hb.js +3 -5
- package/esm/workspace/package.json +1 -1
- package/package.json +1 -1
package/cjs/hb.js
CHANGED
|
@@ -8,8 +8,6 @@ var _aoconnect = require("@permaweb/aoconnect");
|
|
|
8
8
|
var _ramda = require("ramda");
|
|
9
9
|
var _utils = require("./utils.js");
|
|
10
10
|
var _signer = require("./signer.js");
|
|
11
|
-
var _path4 = require("path");
|
|
12
|
-
var _fs = require("fs");
|
|
13
11
|
var _hyperAos = _interopRequireDefault(require("./lua/hyper-aos.js"));
|
|
14
12
|
var _aos_wamr = _interopRequireDefault(require("./lua/aos_wamr.js"));
|
|
15
13
|
var _excluded = ["path"];
|
|
@@ -340,7 +338,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
340
338
|
case 0:
|
|
341
339
|
wasm = Buffer.from(_aos_wamr["default"], "base64");
|
|
342
340
|
_context10.next = 3;
|
|
343
|
-
return this.
|
|
341
|
+
return this.cacheBinary(wasm, "application/wasm");
|
|
344
342
|
case 3:
|
|
345
343
|
id = _context10.sent;
|
|
346
344
|
(_this$image = this.image) !== null && _this$image !== void 0 ? _this$image : this.image = id;
|
|
@@ -762,7 +760,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
762
760
|
return spawn;
|
|
763
761
|
}()
|
|
764
762
|
}, {
|
|
765
|
-
key: "
|
|
763
|
+
key: "cacheModule",
|
|
766
764
|
value: function () {
|
|
767
765
|
var _cacheModule = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee22(data, type) {
|
|
768
766
|
var _yield$this$spawn, pid, _yield$this$schedule, slot, msgs;
|
|
@@ -804,15 +802,15 @@ var HB = /*#__PURE__*/function () {
|
|
|
804
802
|
}
|
|
805
803
|
}, _callee22, this);
|
|
806
804
|
}));
|
|
807
|
-
function
|
|
805
|
+
function cacheModule(_x19, _x20) {
|
|
808
806
|
return _cacheModule.apply(this, arguments);
|
|
809
807
|
}
|
|
810
|
-
return
|
|
808
|
+
return cacheModule;
|
|
811
809
|
}()
|
|
812
810
|
}, {
|
|
813
|
-
key: "
|
|
811
|
+
key: "cacheBinary",
|
|
814
812
|
value: function () {
|
|
815
|
-
var
|
|
813
|
+
var _cacheBinary = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee23(data, type) {
|
|
816
814
|
var res;
|
|
817
815
|
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
818
816
|
while (1) switch (_context23.prev = _context23.next) {
|
|
@@ -832,10 +830,10 @@ var HB = /*#__PURE__*/function () {
|
|
|
832
830
|
}
|
|
833
831
|
}, _callee23, this);
|
|
834
832
|
}));
|
|
835
|
-
function
|
|
836
|
-
return
|
|
833
|
+
function cacheBinary(_x21, _x22) {
|
|
834
|
+
return _cacheBinary.apply(this, arguments);
|
|
837
835
|
}
|
|
838
|
-
return
|
|
836
|
+
return cacheBinary;
|
|
839
837
|
}()
|
|
840
838
|
}, {
|
|
841
839
|
key: "message",
|
package/esm/hb.js
CHANGED
|
@@ -2,8 +2,6 @@ import { connect, createSigner } from "@permaweb/aoconnect"
|
|
|
2
2
|
import { isEmpty, last, isNotNil, mergeLeft } from "ramda"
|
|
3
3
|
import { toAddr, buildTags } from "./utils.js"
|
|
4
4
|
import { send as _send, createRequest } from "./signer.js"
|
|
5
|
-
import { resolve } from "path"
|
|
6
|
-
import { readFileSync } from "fs"
|
|
7
5
|
import hyper_aos from "./lua/hyper-aos.js"
|
|
8
6
|
import aos_wamr from "./lua/aos_wamr.js"
|
|
9
7
|
|
|
@@ -99,7 +97,7 @@ class HB {
|
|
|
99
97
|
|
|
100
98
|
async getImage() {
|
|
101
99
|
const wasm = Buffer.from(aos_wamr, "base64")
|
|
102
|
-
const id = await this.
|
|
100
|
+
const id = await this.cacheBinary(wasm, "application/wasm")
|
|
103
101
|
this.image ??= id
|
|
104
102
|
return id
|
|
105
103
|
}
|
|
@@ -212,7 +210,7 @@ class HB {
|
|
|
212
210
|
return { res, pid: res.headers.process }
|
|
213
211
|
}
|
|
214
212
|
|
|
215
|
-
async
|
|
213
|
+
async cacheModule(data, type) {
|
|
216
214
|
if (!this.cache) {
|
|
217
215
|
const { pid } = await this.spawn({})
|
|
218
216
|
this.cache = pid
|
|
@@ -226,7 +224,7 @@ class HB {
|
|
|
226
224
|
return msgs.edges[0].node.message.Id
|
|
227
225
|
}
|
|
228
226
|
|
|
229
|
-
async
|
|
227
|
+
async cacheBinary(data, type) {
|
|
230
228
|
const res = await this.post({ path: "/~wao@1.0/cache_module", data, type })
|
|
231
229
|
return res.headers.id
|
|
232
230
|
}
|