wao 0.25.3 → 0.26.0
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/ao.js +235 -110
- package/cjs/armem-base.js +6 -5
- package/cjs/hb.js +185 -101
- package/cjs/hyperbeam.js +18 -15
- package/cjs/lua/aos_wamr.js +1 -0
- package/cjs/lua/hyper-aos.js +1 -0
- package/cjs/signer.js +35 -6
- package/cjs/utils.js +2 -1
- package/esm/ao.js +106 -46
- package/esm/armem-base.js +5 -2
- package/esm/hb.js +35 -13
- package/esm/hyperbeam.js +12 -9
- package/esm/lua/aos_wamr.js +1 -0
- package/esm/lua/hyper-aos.js +1 -0
- package/esm/signer.js +21 -4
- package/esm/utils.js +3 -1
- package/package.json +1 -1
- package/cjs/lua/aos2-wamr.wasm +0 -0
- package/cjs/lua/hyper-aos.lua +0 -2563
- package/esm/lua/aos2-wamr.wasm +0 -0
- package/esm/lua/hyper-aos.lua +0 -2563
package/cjs/armem-base.js
CHANGED
|
@@ -225,7 +225,8 @@ var ArMemBase = exports["default"] = /*#__PURE__*/function () {
|
|
|
225
225
|
this.msgs = {};
|
|
226
226
|
this.wasms = {
|
|
227
227
|
"ISShJH1ij-hPPt9St5UFFr_8Ys3Kj5cyg7zrMGt7H9s": {
|
|
228
|
-
file: "aos2_0_6"
|
|
228
|
+
file: "aos2_0_6",
|
|
229
|
+
variant: "ao.TN.1"
|
|
229
230
|
},
|
|
230
231
|
"WASM32-D8q2OmZ4Mok00sD2Y_6SYEQ7Hjx-6VZ_jl3g": {
|
|
231
232
|
file: "aos2_0_4_32",
|
|
@@ -248,7 +249,7 @@ var ArMemBase = exports["default"] = /*#__PURE__*/function () {
|
|
|
248
249
|
}
|
|
249
250
|
var txs = [];
|
|
250
251
|
for (var key in this.wasms) {
|
|
251
|
-
var
|
|
252
|
+
var _ref2, _w$variant, _w$format, _w$input_encoding, _w$output_encoding, _w$memory_limit, _w$compute_limit, _w$extension;
|
|
252
253
|
var w = this.wasms[key];
|
|
253
254
|
txs.push(key);
|
|
254
255
|
this.txs[key] = {
|
|
@@ -256,7 +257,7 @@ var ArMemBase = exports["default"] = /*#__PURE__*/function () {
|
|
|
256
257
|
block: 0,
|
|
257
258
|
tags: (0, _utils.buildTags)(null, {
|
|
258
259
|
"Data-Protocol": "ao",
|
|
259
|
-
Variant: (
|
|
260
|
+
Variant: (_ref2 = (_w$variant = w.variant) !== null && _w$variant !== void 0 ? _w$variant : this.variant) !== null && _ref2 !== void 0 ? _ref2 : "ao.TN.1",
|
|
260
261
|
Type: "Module",
|
|
261
262
|
"Module-Format": (_w$format = w.format) !== null && _w$format !== void 0 ? _w$format : "wasm64-unknown-emscripten-draft_2024_02_15",
|
|
262
263
|
"Input-Encoding": (_w$input_encoding = w.input_encoding) !== null && _w$input_encoding !== void 0 ? _w$input_encoding : "JSON-V1",
|
|
@@ -268,7 +269,7 @@ var ArMemBase = exports["default"] = /*#__PURE__*/function () {
|
|
|
268
269
|
};
|
|
269
270
|
}
|
|
270
271
|
if (this.scheduler && this.SU_URL) {
|
|
271
|
-
var _this$
|
|
272
|
+
var _this$variant;
|
|
272
273
|
var _key = this.scheduler;
|
|
273
274
|
txs.push(_key);
|
|
274
275
|
this.addrmap[this.scheduler] = {
|
|
@@ -280,7 +281,7 @@ var ArMemBase = exports["default"] = /*#__PURE__*/function () {
|
|
|
280
281
|
owner: this.scheduler,
|
|
281
282
|
tags: (0, _utils.buildTags)(null, {
|
|
282
283
|
"Data-Protocol": "ao",
|
|
283
|
-
Variant: (_this$
|
|
284
|
+
Variant: (_this$variant = this.variant) !== null && _this$variant !== void 0 ? _this$variant : "ao.TN.1",
|
|
284
285
|
Type: "Scheduler-Location",
|
|
285
286
|
Url: this.SU_URL,
|
|
286
287
|
"Time-To-Live": 1000 * 60 * 60 * 24 * 365 * 10
|
package/cjs/hb.js
CHANGED
|
@@ -10,7 +10,10 @@ var _utils = require("./utils.js");
|
|
|
10
10
|
var _signer = require("./signer.js");
|
|
11
11
|
var _path4 = require("path");
|
|
12
12
|
var _fs = require("fs");
|
|
13
|
+
var _hyperAos = _interopRequireDefault(require("./lua/hyper-aos.js"));
|
|
14
|
+
var _aos_wamr = _interopRequireDefault(require("./lua/aos_wamr.js"));
|
|
13
15
|
var _excluded = ["path"];
|
|
16
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
14
17
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
15
18
|
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
16
19
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
|
|
@@ -335,7 +338,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
335
338
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
336
339
|
while (1) switch (_context10.prev = _context10.next) {
|
|
337
340
|
case 0:
|
|
338
|
-
wasm =
|
|
341
|
+
wasm = Buffer.from(_aos_wamr["default"], "base64");
|
|
339
342
|
_context10.next = 3;
|
|
340
343
|
return this.cacheModule(wasm, "application/wasm");
|
|
341
344
|
case 3:
|
|
@@ -362,7 +365,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
362
365
|
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
363
366
|
while (1) switch (_context11.prev = _context11.next) {
|
|
364
367
|
case 0:
|
|
365
|
-
lua =
|
|
368
|
+
lua = Buffer.from(_hyperAos["default"], "base64");
|
|
366
369
|
_context11.next = 3;
|
|
367
370
|
return this.cacheModule(lua, "application/lua");
|
|
368
371
|
case 3:
|
|
@@ -1028,6 +1031,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
1028
1031
|
Type: "Process",
|
|
1029
1032
|
image: image,
|
|
1030
1033
|
"execution-device": "stack@1.0",
|
|
1034
|
+
"push-device": "push@1.0",
|
|
1031
1035
|
"device-stack": ["wasi@1.0", "json-iface@1.0", "wasm-64@1.0", "patch@1.0", "multipass@1.0"],
|
|
1032
1036
|
"output-prefix": "wasm",
|
|
1033
1037
|
"patch-from": "/results/outbox",
|
|
@@ -1106,6 +1110,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
1106
1110
|
Type: "Process",
|
|
1107
1111
|
module: lua,
|
|
1108
1112
|
"execution-device": "lua@5.3a",
|
|
1113
|
+
"push-device": "push@1.0",
|
|
1109
1114
|
"patch-from": "/results/outbox"
|
|
1110
1115
|
});
|
|
1111
1116
|
case 18:
|
|
@@ -1236,41 +1241,68 @@ var HB = /*#__PURE__*/function () {
|
|
|
1236
1241
|
}
|
|
1237
1242
|
return now;
|
|
1238
1243
|
}()
|
|
1244
|
+
}, {
|
|
1245
|
+
key: "slot",
|
|
1246
|
+
value: function () {
|
|
1247
|
+
var _slot = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee31(_ref12) {
|
|
1248
|
+
var pid, _ref12$path, path;
|
|
1249
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
1250
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
1251
|
+
case 0:
|
|
1252
|
+
pid = _ref12.pid, _ref12$path = _ref12.path, path = _ref12$path === void 0 ? "" : _ref12$path;
|
|
1253
|
+
if (path && !/^\//.test(path)) path = "/" + path;
|
|
1254
|
+
_context31.next = 4;
|
|
1255
|
+
return this.getJSON({
|
|
1256
|
+
path: "/".concat(pid, "/slot").concat(path)
|
|
1257
|
+
});
|
|
1258
|
+
case 4:
|
|
1259
|
+
return _context31.abrupt("return", _context31.sent);
|
|
1260
|
+
case 5:
|
|
1261
|
+
case "end":
|
|
1262
|
+
return _context31.stop();
|
|
1263
|
+
}
|
|
1264
|
+
}, _callee31, this);
|
|
1265
|
+
}));
|
|
1266
|
+
function slot(_x27) {
|
|
1267
|
+
return _slot.apply(this, arguments);
|
|
1268
|
+
}
|
|
1269
|
+
return slot;
|
|
1270
|
+
}()
|
|
1239
1271
|
}, {
|
|
1240
1272
|
key: "messages",
|
|
1241
1273
|
value: function () {
|
|
1242
|
-
var _messages = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1274
|
+
var _messages = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee33() {
|
|
1243
1275
|
var _this2 = this;
|
|
1244
|
-
var
|
|
1276
|
+
var _ref13,
|
|
1245
1277
|
pid,
|
|
1246
1278
|
from,
|
|
1247
1279
|
to,
|
|
1248
1280
|
limit,
|
|
1249
1281
|
params,
|
|
1250
1282
|
res,
|
|
1251
|
-
|
|
1252
|
-
return _regeneratorRuntime().wrap(function
|
|
1253
|
-
while (1) switch (
|
|
1283
|
+
_args33 = arguments;
|
|
1284
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
1285
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
1254
1286
|
case 0:
|
|
1255
|
-
|
|
1287
|
+
_ref13 = _args33.length > 0 && _args33[0] !== undefined ? _args33[0] : {}, pid = _ref13.pid, from = _ref13.from, to = _ref13.to, limit = _ref13.limit;
|
|
1256
1288
|
params = "target=".concat(pid);
|
|
1257
1289
|
if ((0, _ramda.isNotNil)(from)) params += "&from=".concat(from);
|
|
1258
1290
|
if ((0, _ramda.isNotNil)(to)) params += "&to=".concat(to);
|
|
1259
1291
|
params += "&accept=application/aos-2";
|
|
1260
|
-
|
|
1292
|
+
_context33.next = 7;
|
|
1261
1293
|
return fetch("".concat(this.url, "/~scheduler@1.0/schedule?").concat(params)).then(function (r) {
|
|
1262
1294
|
return r.json();
|
|
1263
1295
|
});
|
|
1264
1296
|
case 7:
|
|
1265
|
-
res =
|
|
1297
|
+
res = _context33.sent;
|
|
1266
1298
|
if (res.page_info.has_next_page) {
|
|
1267
|
-
res.next = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1299
|
+
res.next = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee32() {
|
|
1268
1300
|
var from2;
|
|
1269
|
-
return _regeneratorRuntime().wrap(function
|
|
1270
|
-
while (1) switch (
|
|
1301
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
1302
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
1271
1303
|
case 0:
|
|
1272
1304
|
from2 = (0, _ramda.last)(res.edges).cursor + 1;
|
|
1273
|
-
|
|
1305
|
+
_context32.next = 3;
|
|
1274
1306
|
return _this2.message({
|
|
1275
1307
|
pid: pid,
|
|
1276
1308
|
from: from2,
|
|
@@ -1278,20 +1310,20 @@ var HB = /*#__PURE__*/function () {
|
|
|
1278
1310
|
limit: limit
|
|
1279
1311
|
});
|
|
1280
1312
|
case 3:
|
|
1281
|
-
return
|
|
1313
|
+
return _context32.abrupt("return", _context32.sent);
|
|
1282
1314
|
case 4:
|
|
1283
1315
|
case "end":
|
|
1284
|
-
return
|
|
1316
|
+
return _context32.stop();
|
|
1285
1317
|
}
|
|
1286
|
-
},
|
|
1318
|
+
}, _callee32);
|
|
1287
1319
|
}));
|
|
1288
1320
|
}
|
|
1289
|
-
return
|
|
1321
|
+
return _context33.abrupt("return", res);
|
|
1290
1322
|
case 10:
|
|
1291
1323
|
case "end":
|
|
1292
|
-
return
|
|
1324
|
+
return _context33.stop();
|
|
1293
1325
|
}
|
|
1294
|
-
},
|
|
1326
|
+
}, _callee33, this);
|
|
1295
1327
|
}));
|
|
1296
1328
|
function messages() {
|
|
1297
1329
|
return _messages.apply(this, arguments);
|
|
@@ -1301,19 +1333,19 @@ var HB = /*#__PURE__*/function () {
|
|
|
1301
1333
|
}, {
|
|
1302
1334
|
key: "spawnLegacy",
|
|
1303
1335
|
value: function () {
|
|
1304
|
-
var _spawnLegacy = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1305
|
-
var
|
|
1336
|
+
var _spawnLegacy = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
|
|
1337
|
+
var _ref15,
|
|
1306
1338
|
module,
|
|
1307
|
-
|
|
1339
|
+
_ref15$tags,
|
|
1308
1340
|
tags,
|
|
1309
1341
|
data,
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1342
|
+
t,
|
|
1343
|
+
_args34 = arguments;
|
|
1344
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
1345
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
1313
1346
|
case 0:
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
data: data,
|
|
1347
|
+
_ref15 = _args34.length > 0 && _args34[0] !== undefined ? _args34[0] : {}, module = _ref15.module, _ref15$tags = _ref15.tags, tags = _ref15$tags === void 0 ? {} : _ref15$tags, data = _ref15.data;
|
|
1348
|
+
t = {
|
|
1317
1349
|
Type: "Process",
|
|
1318
1350
|
"Data-Protocol": "ao",
|
|
1319
1351
|
Variant: "ao.TN.1",
|
|
@@ -1321,68 +1353,120 @@ var HB = /*#__PURE__*/function () {
|
|
|
1321
1353
|
Authority: this._info.address,
|
|
1322
1354
|
"scheduler-location": this._info.address,
|
|
1323
1355
|
"random-seed": seed(16),
|
|
1324
|
-
module: "ISShJH1ij-hPPt9St5UFFr_8Ys3Kj5cyg7zrMGt7H9s",
|
|
1356
|
+
module: module !== null && module !== void 0 ? module : "ISShJH1ij-hPPt9St5UFFr_8Ys3Kj5cyg7zrMGt7H9s",
|
|
1325
1357
|
device: "process@1.0",
|
|
1326
1358
|
"scheduler-device": "scheduler@1.0",
|
|
1327
1359
|
"execution-device": "stack@1.0",
|
|
1360
|
+
"push-device": "push@1.0",
|
|
1328
1361
|
"device-stack": ["genesis-wasm@1.0", "patch@1.0"],
|
|
1329
1362
|
"patch-from": "/results/outbox",
|
|
1330
1363
|
"stack-keys": ["init", "compute", "snapshot", "normalize"]
|
|
1331
|
-
}
|
|
1332
|
-
|
|
1364
|
+
};
|
|
1365
|
+
if (data) t.data = data;
|
|
1366
|
+
tags = (0, _ramda.mergeLeft)(tags, t);
|
|
1367
|
+
_context34.next = 6;
|
|
1333
1368
|
return this.spawn(tags);
|
|
1334
|
-
case
|
|
1335
|
-
return
|
|
1336
|
-
case
|
|
1369
|
+
case 6:
|
|
1370
|
+
return _context34.abrupt("return", _context34.sent);
|
|
1371
|
+
case 7:
|
|
1337
1372
|
case "end":
|
|
1338
|
-
return
|
|
1373
|
+
return _context34.stop();
|
|
1339
1374
|
}
|
|
1340
|
-
},
|
|
1375
|
+
}, _callee34, this);
|
|
1341
1376
|
}));
|
|
1342
1377
|
function spawnLegacy() {
|
|
1343
1378
|
return _spawnLegacy.apply(this, arguments);
|
|
1344
1379
|
}
|
|
1345
1380
|
return spawnLegacy;
|
|
1346
1381
|
}()
|
|
1382
|
+
}, {
|
|
1383
|
+
key: "results",
|
|
1384
|
+
value: function () {
|
|
1385
|
+
var _results = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee35() {
|
|
1386
|
+
var _ref16,
|
|
1387
|
+
process,
|
|
1388
|
+
limit,
|
|
1389
|
+
_ref16$sort,
|
|
1390
|
+
sort,
|
|
1391
|
+
from,
|
|
1392
|
+
to,
|
|
1393
|
+
params,
|
|
1394
|
+
addParam,
|
|
1395
|
+
res,
|
|
1396
|
+
_args35 = arguments;
|
|
1397
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
1398
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
1399
|
+
case 0:
|
|
1400
|
+
_ref16 = _args35.length > 0 && _args35[0] !== undefined ? _args35[0] : {}, process = _ref16.process, limit = _ref16.limit, _ref16$sort = _ref16.sort, sort = _ref16$sort === void 0 ? "DESC" : _ref16$sort, from = _ref16.from, to = _ref16.to;
|
|
1401
|
+
params = "";
|
|
1402
|
+
addParam = function addParam(key, val) {
|
|
1403
|
+
params += params === "" ? "?" : "&";
|
|
1404
|
+
params += "".concat(key, "=").concat(val);
|
|
1405
|
+
};
|
|
1406
|
+
if (limit) addParam("limit", limit);
|
|
1407
|
+
if (sort) addParam("sort", sort);
|
|
1408
|
+
if (from) addParam("from", from);
|
|
1409
|
+
if (to) addParam("to", to);
|
|
1410
|
+
_context35.next = 9;
|
|
1411
|
+
return this.post({
|
|
1412
|
+
path: "/~relay@1.0/call",
|
|
1413
|
+
method: "GET",
|
|
1414
|
+
"relay-path": "".concat(this.cu, "/results/").concat(process).concat(params),
|
|
1415
|
+
"content-type": "application/json"
|
|
1416
|
+
});
|
|
1417
|
+
case 9:
|
|
1418
|
+
res = _context35.sent;
|
|
1419
|
+
return _context35.abrupt("return", JSON.parse(res.body));
|
|
1420
|
+
case 11:
|
|
1421
|
+
case "end":
|
|
1422
|
+
return _context35.stop();
|
|
1423
|
+
}
|
|
1424
|
+
}, _callee35, this);
|
|
1425
|
+
}));
|
|
1426
|
+
function results() {
|
|
1427
|
+
return _results.apply(this, arguments);
|
|
1428
|
+
}
|
|
1429
|
+
return results;
|
|
1430
|
+
}()
|
|
1347
1431
|
}, {
|
|
1348
1432
|
key: "dryrun",
|
|
1349
1433
|
value: function () {
|
|
1350
|
-
var _dryrun = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1351
|
-
var
|
|
1352
|
-
|
|
1434
|
+
var _dryrun = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee36() {
|
|
1435
|
+
var _ref17,
|
|
1436
|
+
_ref17$tags,
|
|
1353
1437
|
tags,
|
|
1354
1438
|
pid,
|
|
1355
1439
|
action,
|
|
1356
1440
|
data,
|
|
1357
1441
|
json,
|
|
1358
1442
|
res,
|
|
1359
|
-
|
|
1360
|
-
return _regeneratorRuntime().wrap(function
|
|
1361
|
-
while (1) switch (
|
|
1443
|
+
_args36 = arguments;
|
|
1444
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
1445
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
1362
1446
|
case 0:
|
|
1363
|
-
|
|
1447
|
+
_ref17 = _args36.length > 0 && _args36[0] !== undefined ? _args36[0] : {}, _ref17$tags = _ref17.tags, tags = _ref17$tags === void 0 ? {} : _ref17$tags, pid = _ref17.pid, action = _ref17.action, data = _ref17.data;
|
|
1364
1448
|
if (typeof action === "string") tags.Action = action;
|
|
1365
1449
|
json = {
|
|
1366
1450
|
Tags: (0, _utils.buildTags)(_objectSpread({}, tags)),
|
|
1367
1451
|
Owner: this.addr
|
|
1368
1452
|
};
|
|
1369
1453
|
if (data) json.Data = data;
|
|
1370
|
-
|
|
1454
|
+
_context36.next = 6;
|
|
1371
1455
|
return this.post({
|
|
1372
1456
|
path: "/~relay@1.0/call",
|
|
1373
|
-
|
|
1457
|
+
method: "POST",
|
|
1374
1458
|
"relay-path": "".concat(this.cu, "/dry-run?process-id=").concat(pid),
|
|
1375
1459
|
"content-type": "application/json",
|
|
1376
1460
|
"relay-body": JSON.stringify(json)
|
|
1377
1461
|
});
|
|
1378
1462
|
case 6:
|
|
1379
|
-
res =
|
|
1380
|
-
return
|
|
1463
|
+
res = _context36.sent;
|
|
1464
|
+
return _context36.abrupt("return", JSON.parse(res.body));
|
|
1381
1465
|
case 8:
|
|
1382
1466
|
case "end":
|
|
1383
|
-
return
|
|
1467
|
+
return _context36.stop();
|
|
1384
1468
|
}
|
|
1385
|
-
},
|
|
1469
|
+
}, _callee36, this);
|
|
1386
1470
|
}));
|
|
1387
1471
|
function dryrun() {
|
|
1388
1472
|
return _dryrun.apply(this, arguments);
|
|
@@ -1392,29 +1476,29 @@ var HB = /*#__PURE__*/function () {
|
|
|
1392
1476
|
}, {
|
|
1393
1477
|
key: "post",
|
|
1394
1478
|
value: function () {
|
|
1395
|
-
var _post = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1479
|
+
var _post = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee37(obj, json) {
|
|
1396
1480
|
var _json;
|
|
1397
|
-
return _regeneratorRuntime().wrap(function
|
|
1398
|
-
while (1) switch (
|
|
1481
|
+
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
|
1482
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
1399
1483
|
case 0:
|
|
1400
1484
|
_json = json ? "/~json@1.0/serialize" : "";
|
|
1401
1485
|
obj.path += _json;
|
|
1402
|
-
|
|
1403
|
-
|
|
1486
|
+
_context37.t0 = this;
|
|
1487
|
+
_context37.next = 5;
|
|
1404
1488
|
return this.sign(obj);
|
|
1405
1489
|
case 5:
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
return
|
|
1490
|
+
_context37.t1 = _context37.sent;
|
|
1491
|
+
_context37.next = 8;
|
|
1492
|
+
return _context37.t0.send.call(_context37.t0, _context37.t1);
|
|
1409
1493
|
case 8:
|
|
1410
|
-
return
|
|
1494
|
+
return _context37.abrupt("return", _context37.sent);
|
|
1411
1495
|
case 9:
|
|
1412
1496
|
case "end":
|
|
1413
|
-
return
|
|
1497
|
+
return _context37.stop();
|
|
1414
1498
|
}
|
|
1415
|
-
},
|
|
1499
|
+
}, _callee37, this);
|
|
1416
1500
|
}));
|
|
1417
|
-
function post(
|
|
1501
|
+
function post(_x28, _x29) {
|
|
1418
1502
|
return _post.apply(this, arguments);
|
|
1419
1503
|
}
|
|
1420
1504
|
return post;
|
|
@@ -1422,7 +1506,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
1422
1506
|
}, {
|
|
1423
1507
|
key: "get",
|
|
1424
1508
|
value: function () {
|
|
1425
|
-
var _get = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1509
|
+
var _get = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee38(_ref18) {
|
|
1426
1510
|
var _path3;
|
|
1427
1511
|
var path,
|
|
1428
1512
|
params,
|
|
@@ -1433,12 +1517,12 @@ var HB = /*#__PURE__*/function () {
|
|
|
1433
1517
|
k,
|
|
1434
1518
|
response,
|
|
1435
1519
|
headers,
|
|
1436
|
-
|
|
1437
|
-
return _regeneratorRuntime().wrap(function
|
|
1438
|
-
while (1) switch (
|
|
1520
|
+
_args38 = arguments;
|
|
1521
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
1522
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
1439
1523
|
case 0:
|
|
1440
|
-
path =
|
|
1441
|
-
json =
|
|
1524
|
+
path = _ref18.path, params = _objectWithoutProperties(_ref18, _excluded);
|
|
1525
|
+
json = _args38.length > 1 && _args38[1] !== undefined ? _args38[1] : false;
|
|
1442
1526
|
_json = json ? "/~json@1.0/serialize" : "";
|
|
1443
1527
|
(_path3 = path) !== null && _path3 !== void 0 ? _path3 : path = "/~message@1.0";
|
|
1444
1528
|
if (!/^\//.test(path)) path = "/" + path;
|
|
@@ -1450,34 +1534,34 @@ var HB = /*#__PURE__*/function () {
|
|
|
1450
1534
|
i++;
|
|
1451
1535
|
}
|
|
1452
1536
|
}
|
|
1453
|
-
|
|
1537
|
+
_context38.next = 9;
|
|
1454
1538
|
return fetch("".concat(this.url).concat(path).concat(_json).concat(_params));
|
|
1455
1539
|
case 9:
|
|
1456
|
-
response =
|
|
1540
|
+
response = _context38.sent;
|
|
1457
1541
|
headers = {};
|
|
1458
1542
|
response.headers.forEach(function (v, k) {
|
|
1459
1543
|
return headers[k] = v;
|
|
1460
1544
|
});
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1545
|
+
_context38.t0 = response;
|
|
1546
|
+
_context38.t1 = headers;
|
|
1547
|
+
_context38.next = 16;
|
|
1464
1548
|
return response.text();
|
|
1465
1549
|
case 16:
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
return
|
|
1469
|
-
response:
|
|
1470
|
-
headers:
|
|
1471
|
-
body:
|
|
1472
|
-
status:
|
|
1550
|
+
_context38.t2 = _context38.sent;
|
|
1551
|
+
_context38.t3 = response.status;
|
|
1552
|
+
return _context38.abrupt("return", {
|
|
1553
|
+
response: _context38.t0,
|
|
1554
|
+
headers: _context38.t1,
|
|
1555
|
+
body: _context38.t2,
|
|
1556
|
+
status: _context38.t3
|
|
1473
1557
|
});
|
|
1474
1558
|
case 19:
|
|
1475
1559
|
case "end":
|
|
1476
|
-
return
|
|
1560
|
+
return _context38.stop();
|
|
1477
1561
|
}
|
|
1478
|
-
},
|
|
1562
|
+
}, _callee38, this);
|
|
1479
1563
|
}));
|
|
1480
|
-
function get(
|
|
1564
|
+
function get(_x30) {
|
|
1481
1565
|
return _get.apply(this, arguments);
|
|
1482
1566
|
}
|
|
1483
1567
|
return get;
|
|
@@ -1485,23 +1569,23 @@ var HB = /*#__PURE__*/function () {
|
|
|
1485
1569
|
}, {
|
|
1486
1570
|
key: "postJSON",
|
|
1487
1571
|
value: function () {
|
|
1488
|
-
var _postJSON = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1572
|
+
var _postJSON = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee39(args) {
|
|
1489
1573
|
var res;
|
|
1490
|
-
return _regeneratorRuntime().wrap(function
|
|
1491
|
-
while (1) switch (
|
|
1574
|
+
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
|
1575
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
1492
1576
|
case 0:
|
|
1493
|
-
|
|
1577
|
+
_context39.next = 2;
|
|
1494
1578
|
return this.post(args, true);
|
|
1495
1579
|
case 2:
|
|
1496
|
-
res =
|
|
1497
|
-
return
|
|
1580
|
+
res = _context39.sent;
|
|
1581
|
+
return _context39.abrupt("return", JSON.parse(res.body));
|
|
1498
1582
|
case 4:
|
|
1499
1583
|
case "end":
|
|
1500
|
-
return
|
|
1584
|
+
return _context39.stop();
|
|
1501
1585
|
}
|
|
1502
|
-
},
|
|
1586
|
+
}, _callee39, this);
|
|
1503
1587
|
}));
|
|
1504
|
-
function postJSON(
|
|
1588
|
+
function postJSON(_x31) {
|
|
1505
1589
|
return _postJSON.apply(this, arguments);
|
|
1506
1590
|
}
|
|
1507
1591
|
return postJSON;
|
|
@@ -1509,23 +1593,23 @@ var HB = /*#__PURE__*/function () {
|
|
|
1509
1593
|
}, {
|
|
1510
1594
|
key: "getJSON",
|
|
1511
1595
|
value: function () {
|
|
1512
|
-
var _getJSON = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1596
|
+
var _getJSON = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee40(args) {
|
|
1513
1597
|
var res;
|
|
1514
|
-
return _regeneratorRuntime().wrap(function
|
|
1515
|
-
while (1) switch (
|
|
1598
|
+
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
1599
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
1516
1600
|
case 0:
|
|
1517
|
-
|
|
1601
|
+
_context40.next = 2;
|
|
1518
1602
|
return this.get(args, true);
|
|
1519
1603
|
case 2:
|
|
1520
|
-
res =
|
|
1521
|
-
return
|
|
1604
|
+
res = _context40.sent;
|
|
1605
|
+
return _context40.abrupt("return", JSON.parse(res.body));
|
|
1522
1606
|
case 4:
|
|
1523
1607
|
case "end":
|
|
1524
|
-
return
|
|
1608
|
+
return _context40.stop();
|
|
1525
1609
|
}
|
|
1526
|
-
},
|
|
1610
|
+
}, _callee40, this);
|
|
1527
1611
|
}));
|
|
1528
|
-
function getJSON(
|
|
1612
|
+
function getJSON(_x32) {
|
|
1529
1613
|
return _getJSON.apply(this, arguments);
|
|
1530
1614
|
}
|
|
1531
1615
|
return getJSON;
|
package/cjs/hyperbeam.js
CHANGED
|
@@ -40,16 +40,17 @@ var HyperBEAM = exports["default"] = /*#__PURE__*/function () {
|
|
|
40
40
|
cwd = _ref$cwd === void 0 ? "./HyperBEAM" : _ref$cwd,
|
|
41
41
|
c = _ref.c,
|
|
42
42
|
cmake = _ref.cmake,
|
|
43
|
-
_ref$legacy = _ref.legacy,
|
|
44
|
-
legacy = _ref$legacy === void 0 ? false : _ref$legacy,
|
|
45
43
|
faff = _ref.faff,
|
|
46
44
|
_ref$simplePay = _ref.simplePay,
|
|
47
45
|
simplePay = _ref$simplePay === void 0 ? false : _ref$simplePay,
|
|
48
46
|
simplePayPrice = _ref.simplePayPrice,
|
|
49
47
|
p4_lua = _ref.p4_lua,
|
|
50
48
|
store_prefix = _ref.store_prefix,
|
|
51
|
-
operator = _ref.operator
|
|
49
|
+
operator = _ref.operator,
|
|
50
|
+
_ref$console = _ref.console,
|
|
51
|
+
console = _ref$console === void 0 ? true : _ref$console;
|
|
52
52
|
_classCallCheck(this, HyperBEAM);
|
|
53
|
+
this.console = console;
|
|
53
54
|
if (clearCache) {
|
|
54
55
|
var dirname = (0, _path.resolve)(process.cwd(), cwd);
|
|
55
56
|
var _iterator = _createForOfIteratorHelper((0, _fs.readdirSync)(dirname)),
|
|
@@ -102,18 +103,20 @@ var HyperBEAM = exports["default"] = /*#__PURE__*/function () {
|
|
|
102
103
|
env: _objectSpread(_objectSpread({}, process.env), this.genEnv()),
|
|
103
104
|
cwd: (0, _path.resolve)(process.cwd(), this.cwd)
|
|
104
105
|
});
|
|
105
|
-
this.
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
106
|
+
if (this.console) {
|
|
107
|
+
this.hbeam.stdout.on("data", function (chunk) {
|
|
108
|
+
return console.log(chunk.toString());
|
|
109
|
+
});
|
|
110
|
+
this.hbeam.stderr.on("data", function (err) {
|
|
111
|
+
return console.error(err.toString());
|
|
112
|
+
});
|
|
113
|
+
this.hbeam.on("error", function (err) {
|
|
114
|
+
return console.error("failed to start process: ".concat(err));
|
|
115
|
+
});
|
|
116
|
+
this.hbeam.on("close", function (code) {
|
|
117
|
+
return console.log("child process exited with code ".concat(code));
|
|
118
|
+
});
|
|
119
|
+
}
|
|
117
120
|
}
|
|
118
121
|
}, {
|
|
119
122
|
key: "ok",
|