wao 0.16.4 → 0.16.7
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/adaptor-base.js +32 -24
- package/cjs/aoconnect-base.js +155 -155
- package/esm/adaptor-base.js +13 -4
- package/esm/aoconnect-base.js +20 -16
- package/package.json +1 -1
package/cjs/adaptor-base.js
CHANGED
|
@@ -1007,7 +1007,7 @@ var Adaptor = /*#__PURE__*/function () {
|
|
|
1007
1007
|
});
|
|
1008
1008
|
case 11:
|
|
1009
1009
|
slot = message;
|
|
1010
|
-
if (
|
|
1010
|
+
if (!/^[0-9a-zA-Z_-]{43,44}$/.test(message)) {
|
|
1011
1011
|
message = (_this$mem$env$process = this.mem.env[process]) === null || _this$mem$env$process === void 0 || (_this$mem$env$process = _this$mem$env$process.results) === null || _this$mem$env$process === void 0 ? void 0 : _this$mem$env$process[slot];
|
|
1012
1012
|
}
|
|
1013
1013
|
if (!(0, _ramda.isNil)(message)) {
|
|
@@ -1034,14 +1034,10 @@ var Adaptor = /*#__PURE__*/function () {
|
|
|
1034
1034
|
});
|
|
1035
1035
|
case 21:
|
|
1036
1036
|
res2 = _context24.sent;
|
|
1037
|
-
if (!(0, _ramda.isNil)(message)) {
|
|
1038
|
-
_context24.next = 24;
|
|
1039
|
-
break;
|
|
1040
|
-
}
|
|
1041
1037
|
return _context24.abrupt("return", {
|
|
1042
1038
|
json: res2
|
|
1043
1039
|
});
|
|
1044
|
-
case
|
|
1040
|
+
case 23:
|
|
1045
1041
|
case "end":
|
|
1046
1042
|
return _context24.stop();
|
|
1047
1043
|
}
|
|
@@ -1219,65 +1215,77 @@ var Adaptor = /*#__PURE__*/function () {
|
|
|
1219
1215
|
while (1) switch (_context30.prev = _context30.next) {
|
|
1220
1216
|
case 0:
|
|
1221
1217
|
query = _ref14.query, params = _ref14.params, body = _ref14.body, headers = _ref14.headers, method = _ref14.method;
|
|
1222
|
-
|
|
1218
|
+
if (body.type === "Buffer" && Array.isArray(body.data)) {
|
|
1219
|
+
body = new Uint8Array(body.data);
|
|
1220
|
+
}
|
|
1221
|
+
valid = false; // todo: cannot verify node -> broser items
|
|
1222
|
+
_context30.prev = 3;
|
|
1223
|
+
_context30.next = 6;
|
|
1223
1224
|
return _arbundles.DataItem.verify(body);
|
|
1224
|
-
case
|
|
1225
|
+
case 6:
|
|
1225
1226
|
valid = _context30.sent;
|
|
1227
|
+
_context30.next = 12;
|
|
1228
|
+
break;
|
|
1229
|
+
case 9:
|
|
1230
|
+
_context30.prev = 9;
|
|
1231
|
+
_context30.t0 = _context30["catch"](3);
|
|
1232
|
+
console.log(_context30.t0);
|
|
1233
|
+
case 12:
|
|
1226
1234
|
type = null;
|
|
1227
1235
|
item = null;
|
|
1228
|
-
if (valid) item = new _arbundles.DataItem(body);
|
|
1236
|
+
if (valid || true) item = new _arbundles.DataItem(body);
|
|
1229
1237
|
_tags = (0, _utils.tags)(item.tags);
|
|
1230
1238
|
err = null;
|
|
1231
1239
|
if (!(_tags.Type === "Process")) {
|
|
1232
|
-
_context30.next =
|
|
1240
|
+
_context30.next = 24;
|
|
1233
1241
|
break;
|
|
1234
1242
|
}
|
|
1235
|
-
_context30.next =
|
|
1243
|
+
_context30.next = 20;
|
|
1236
1244
|
return this.spawn({
|
|
1237
1245
|
item: item,
|
|
1238
1246
|
module: _tags.Module,
|
|
1239
1247
|
scheduler: _tags.Scheduler
|
|
1240
1248
|
});
|
|
1241
|
-
case
|
|
1249
|
+
case 20:
|
|
1242
1250
|
res = _context30.sent;
|
|
1243
1251
|
if (!res) err = "bad requrest";
|
|
1244
|
-
_context30.next =
|
|
1252
|
+
_context30.next = 30;
|
|
1245
1253
|
break;
|
|
1246
|
-
case
|
|
1254
|
+
case 24:
|
|
1247
1255
|
if (!(_tags.Type === "Message")) {
|
|
1248
|
-
_context30.next =
|
|
1256
|
+
_context30.next = 29;
|
|
1249
1257
|
break;
|
|
1250
1258
|
}
|
|
1251
|
-
_context30.next =
|
|
1259
|
+
_context30.next = 27;
|
|
1252
1260
|
return this.message({
|
|
1253
1261
|
item: item,
|
|
1254
1262
|
process: item.target
|
|
1255
1263
|
});
|
|
1256
|
-
case
|
|
1257
|
-
_context30.next =
|
|
1264
|
+
case 27:
|
|
1265
|
+
_context30.next = 30;
|
|
1258
1266
|
break;
|
|
1259
|
-
case
|
|
1267
|
+
case 29:
|
|
1260
1268
|
err = true;
|
|
1261
|
-
case
|
|
1269
|
+
case 30:
|
|
1262
1270
|
if (!err) {
|
|
1263
|
-
_context30.next =
|
|
1271
|
+
_context30.next = 34;
|
|
1264
1272
|
break;
|
|
1265
1273
|
}
|
|
1266
1274
|
return _context30.abrupt("return", {
|
|
1267
1275
|
status: 400,
|
|
1268
1276
|
error: err
|
|
1269
1277
|
});
|
|
1270
|
-
case
|
|
1278
|
+
case 34:
|
|
1271
1279
|
return _context30.abrupt("return", {
|
|
1272
1280
|
json: {
|
|
1273
1281
|
id: item.id
|
|
1274
1282
|
}
|
|
1275
1283
|
});
|
|
1276
|
-
case
|
|
1284
|
+
case 35:
|
|
1277
1285
|
case "end":
|
|
1278
1286
|
return _context30.stop();
|
|
1279
1287
|
}
|
|
1280
|
-
}, _callee30, this);
|
|
1288
|
+
}, _callee30, this, [[3, 9]]);
|
|
1281
1289
|
}));
|
|
1282
1290
|
function mu_post_root(_x31) {
|
|
1283
1291
|
return _mu_post_root.apply(this, arguments);
|
package/cjs/aoconnect-base.js
CHANGED
|
@@ -5,16 +5,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports["default"] = void 0;
|
|
8
|
+
var _arweave = _interopRequireDefault(require("arweave"));
|
|
8
9
|
var WarpArBundles = _interopRequireWildcard(require("warp-arbundles"));
|
|
9
10
|
var _crypto = _interopRequireDefault(require("crypto"));
|
|
10
11
|
var _base64url = _interopRequireDefault(require("base64url"));
|
|
11
12
|
var _utils = require("./utils.js");
|
|
12
13
|
var _weavedrive = _interopRequireDefault(require("./weavedrive.js"));
|
|
13
14
|
var _ramda = require("ramda");
|
|
14
|
-
var _WarpArBundles$defaul;
|
|
15
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
15
|
+
var _Arweave$default, _WarpArBundles$defaul;
|
|
16
16
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
17
17
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
18
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
18
19
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
19
20
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
20
21
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
@@ -30,6 +31,8 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
|
|
|
30
31
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
31
32
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
32
33
|
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
34
|
+
var Arweave = (_Arweave$default = _arweave["default"]["default"]) !== null && _Arweave$default !== void 0 ? _Arweave$default : _arweave["default"];
|
|
35
|
+
var arweave = Arweave.init();
|
|
33
36
|
var pkg = (_WarpArBundles$defaul = WarpArBundles["default"]) !== null && _WarpArBundles$defaul !== void 0 ? _WarpArBundles$defaul : WarpArBundles;
|
|
34
37
|
var DataItem = pkg.DataItem;
|
|
35
38
|
var onRecovery = {};
|
|
@@ -664,7 +667,7 @@ var _default = exports["default"] = function _default() {
|
|
|
664
667
|
var _assign = /*#__PURE__*/function () {
|
|
665
668
|
var _ref9 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(opt) {
|
|
666
669
|
var _opt$tags2;
|
|
667
|
-
var p, _opt, hash, _yield$ar$dataitem2, id, owner, item, _opt$data2, _ref10, _opt$from, _res$Messages, _res$Spawns, _res$Assignments, data, _tags, from,
|
|
670
|
+
var p, _opt, hash, _yield$ar$dataitem2, id, owner, item, _opt$data2, _ref10, _opt$from, _res$Messages, _res$Spawns, _res$Assignments, data, _tags, from, msg, _env, _yield$mem$getTx3, _yield$mem$getWasm2, format, mod, wasm, wdrive, start, res, _msg, _iterator3, _step3, v, _iterator4, _step4, _v, __tags, _iterator5, _step5, _v2, _iterator6, _step6, v2;
|
|
668
671
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
669
672
|
while (1) switch (_context4.prev = _context4.next) {
|
|
670
673
|
case 0:
|
|
@@ -682,16 +685,21 @@ var _default = exports["default"] = function _default() {
|
|
|
682
685
|
return mem.get("msgs", opt.message);
|
|
683
686
|
case 7:
|
|
684
687
|
_opt = _context4.sent;
|
|
685
|
-
hash =
|
|
688
|
+
hash = p.hash;
|
|
689
|
+
try {
|
|
690
|
+
hash = genHashChain(p.hash, opt.message);
|
|
691
|
+
} catch (e) {
|
|
692
|
+
console.log(e);
|
|
693
|
+
}
|
|
686
694
|
p.hash = hash;
|
|
687
695
|
_context4.t0 = _utils.buildTags;
|
|
688
696
|
_context4.t1 = _ramda.mergeLeft;
|
|
689
697
|
_context4.t2 = (0, _utils.tags)((_opt$tags2 = opt.tags) !== null && _opt$tags2 !== void 0 ? _opt$tags2 : []);
|
|
690
698
|
_context4.t3 = Date.now();
|
|
691
699
|
_context4.t4 = p.epochs.length;
|
|
692
|
-
_context4.next =
|
|
700
|
+
_context4.next = 18;
|
|
693
701
|
return mem.get("height");
|
|
694
|
-
case
|
|
702
|
+
case 18:
|
|
695
703
|
_context4.t5 = _context4.sent;
|
|
696
704
|
_context4.t6 = opt.process;
|
|
697
705
|
_context4.t7 = opt.message;
|
|
@@ -712,166 +720,158 @@ var _default = exports["default"] = function _default() {
|
|
|
712
720
|
_context4.t10 = (0, _context4.t1)(_context4.t2, _context4.t9);
|
|
713
721
|
opt.tags = (0, _context4.t0)(null, _context4.t10);
|
|
714
722
|
p.epochs.push([opt.message]);
|
|
715
|
-
_context4.next =
|
|
723
|
+
_context4.next = 28;
|
|
716
724
|
return ar.dataitem({
|
|
717
725
|
data: opt.data,
|
|
718
726
|
signer: opt.signer,
|
|
719
727
|
tags: (0, _utils.tags)(opt.tags),
|
|
720
728
|
target: opt.process
|
|
721
729
|
});
|
|
722
|
-
case
|
|
730
|
+
case 28:
|
|
723
731
|
_yield$ar$dataitem2 = _context4.sent;
|
|
724
732
|
id = _yield$ar$dataitem2.id;
|
|
725
733
|
owner = _yield$ar$dataitem2.owner;
|
|
726
734
|
item = _yield$ar$dataitem2.item;
|
|
727
735
|
if (!opt.message_item) {
|
|
728
|
-
_context4.next =
|
|
736
|
+
_context4.next = 37;
|
|
729
737
|
break;
|
|
730
738
|
}
|
|
731
|
-
_context4.next =
|
|
739
|
+
_context4.next = 35;
|
|
732
740
|
return ar.postItems([opt.message_item, item], su.jwk);
|
|
733
|
-
case
|
|
734
|
-
_context4.next =
|
|
741
|
+
case 35:
|
|
742
|
+
_context4.next = 39;
|
|
735
743
|
break;
|
|
736
|
-
case
|
|
737
|
-
_context4.next =
|
|
744
|
+
case 37:
|
|
745
|
+
_context4.next = 39;
|
|
738
746
|
return ar.postItems(item, su.jwk);
|
|
739
|
-
case
|
|
740
|
-
_context4.prev =
|
|
747
|
+
case 39:
|
|
748
|
+
_context4.prev = 39;
|
|
741
749
|
data = (_opt$data2 = _opt.data) !== null && _opt$data2 !== void 0 ? _opt$data2 : "";
|
|
742
750
|
_tags = _opt.tags;
|
|
743
751
|
from = (_ref10 = (_opt$from = _opt.from) !== null && _opt$from !== void 0 ? _opt$from : opt.from) !== null && _ref10 !== void 0 ? _ref10 : owner;
|
|
744
752
|
if (!_opt.item) {
|
|
745
|
-
_context4.next =
|
|
753
|
+
_context4.next = 50;
|
|
746
754
|
break;
|
|
747
755
|
}
|
|
748
|
-
_context4.prev = 43;
|
|
749
756
|
data = _base64url["default"].decode(_opt.item.data);
|
|
750
757
|
_tags = _opt.item.tags;
|
|
751
758
|
if (from) {
|
|
752
|
-
_context4.next =
|
|
759
|
+
_context4.next = 50;
|
|
753
760
|
break;
|
|
754
761
|
}
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
from =
|
|
763
|
-
case
|
|
764
|
-
_context4.next =
|
|
765
|
-
break;
|
|
766
|
-
case 56:
|
|
767
|
-
_context4.prev = 56;
|
|
768
|
-
_context4.t13 = _context4["catch"](43);
|
|
769
|
-
console.log(_context4.t13);
|
|
770
|
-
case 59:
|
|
771
|
-
_context4.next = 61;
|
|
762
|
+
_context4.next = 49;
|
|
763
|
+
return arweave.wallets.jwkToAddress({
|
|
764
|
+
kty: "RSA",
|
|
765
|
+
n: _opt.item.owner,
|
|
766
|
+
e: "AQAB"
|
|
767
|
+
});
|
|
768
|
+
case 49:
|
|
769
|
+
from = _context4.sent;
|
|
770
|
+
case 50:
|
|
771
|
+
_context4.next = 52;
|
|
772
772
|
return genMsg(opt.message, p, data, _tags, from, mu.addr);
|
|
773
|
-
case
|
|
773
|
+
case 52:
|
|
774
774
|
msg = _context4.sent;
|
|
775
|
-
_context4.next =
|
|
775
|
+
_context4.next = 55;
|
|
776
776
|
return genEnv({
|
|
777
777
|
pid: p.id,
|
|
778
778
|
owner: p.owner,
|
|
779
779
|
module: p.module
|
|
780
780
|
});
|
|
781
|
-
case
|
|
781
|
+
case 55:
|
|
782
782
|
_env = _context4.sent;
|
|
783
783
|
if (p.handle) {
|
|
784
|
-
_context4.next =
|
|
784
|
+
_context4.next = 88;
|
|
785
785
|
break;
|
|
786
786
|
}
|
|
787
|
-
_context4.next =
|
|
787
|
+
_context4.next = 59;
|
|
788
788
|
return mem.getWasm(p.modulea);
|
|
789
|
-
case
|
|
789
|
+
case 59:
|
|
790
790
|
_yield$mem$getWasm2 = _context4.sent;
|
|
791
791
|
format = _yield$mem$getWasm2.format;
|
|
792
792
|
mod = _yield$mem$getWasm2.mod;
|
|
793
793
|
wasm = _yield$mem$getWasm2.wasm;
|
|
794
794
|
wdrive = extensions[p.extention];
|
|
795
|
-
_context4.
|
|
796
|
-
_context4.
|
|
797
|
-
_context4.
|
|
798
|
-
_context4.
|
|
799
|
-
_context4.next =
|
|
795
|
+
_context4.t11 = AoLoader;
|
|
796
|
+
_context4.t12 = wasm;
|
|
797
|
+
_context4.t13 = format;
|
|
798
|
+
_context4.t14 = wdrive;
|
|
799
|
+
_context4.next = 70;
|
|
800
800
|
return mem.getTx(p.id);
|
|
801
|
-
case
|
|
802
|
-
_context4.
|
|
803
|
-
_context4.
|
|
804
|
-
if (_context4.
|
|
805
|
-
_context4.next =
|
|
801
|
+
case 70:
|
|
802
|
+
_context4.t16 = _yield$mem$getTx3 = _context4.sent;
|
|
803
|
+
_context4.t15 = _context4.t16 === null;
|
|
804
|
+
if (_context4.t15) {
|
|
805
|
+
_context4.next = 74;
|
|
806
806
|
break;
|
|
807
807
|
}
|
|
808
|
-
_context4.
|
|
809
|
-
case
|
|
810
|
-
if (!_context4.
|
|
811
|
-
_context4.next =
|
|
808
|
+
_context4.t15 = _yield$mem$getTx3 === void 0;
|
|
809
|
+
case 74:
|
|
810
|
+
if (!_context4.t15) {
|
|
811
|
+
_context4.next = 78;
|
|
812
812
|
break;
|
|
813
813
|
}
|
|
814
|
-
_context4.
|
|
815
|
-
_context4.next =
|
|
814
|
+
_context4.t17 = void 0;
|
|
815
|
+
_context4.next = 79;
|
|
816
816
|
break;
|
|
817
|
-
case
|
|
818
|
-
_context4.
|
|
819
|
-
case
|
|
820
|
-
_context4.
|
|
821
|
-
_context4.next =
|
|
817
|
+
case 78:
|
|
818
|
+
_context4.t17 = _yield$mem$getTx3.item;
|
|
819
|
+
case 79:
|
|
820
|
+
_context4.t18 = _context4.t17;
|
|
821
|
+
_context4.next = 82;
|
|
822
822
|
return mem.getTx(mod);
|
|
823
|
-
case
|
|
824
|
-
_context4.
|
|
825
|
-
_context4.
|
|
826
|
-
format: _context4.
|
|
827
|
-
WeaveDrive: _context4.
|
|
828
|
-
spawn: _context4.
|
|
829
|
-
module: _context4.
|
|
823
|
+
case 82:
|
|
824
|
+
_context4.t19 = _context4.sent;
|
|
825
|
+
_context4.t20 = {
|
|
826
|
+
format: _context4.t13,
|
|
827
|
+
WeaveDrive: _context4.t14,
|
|
828
|
+
spawn: _context4.t18,
|
|
829
|
+
module: _context4.t19
|
|
830
830
|
};
|
|
831
|
-
_context4.next =
|
|
832
|
-
return (0, _context4.
|
|
833
|
-
case
|
|
831
|
+
_context4.next = 86;
|
|
832
|
+
return (0, _context4.t11)(_context4.t12, _context4.t20);
|
|
833
|
+
case 86:
|
|
834
834
|
p.handle = _context4.sent;
|
|
835
835
|
mem.env[opt.process].handle = p.handle;
|
|
836
|
-
case
|
|
836
|
+
case 88:
|
|
837
837
|
if (p.compressed) {
|
|
838
838
|
start = Date.now();
|
|
839
839
|
p.memory = mem.decompress(p.memory, p.original_size);
|
|
840
840
|
p.compressed = false;
|
|
841
841
|
}
|
|
842
|
-
_context4.next =
|
|
842
|
+
_context4.next = 91;
|
|
843
843
|
return p.handle(p.memory, msg, _env);
|
|
844
|
-
case
|
|
844
|
+
case 91:
|
|
845
845
|
res = _context4.sent;
|
|
846
846
|
p.memory = res.Memory;
|
|
847
847
|
delete res.Memory;
|
|
848
848
|
p.results.push(opt.message);
|
|
849
|
-
_context4.next =
|
|
849
|
+
_context4.next = 97;
|
|
850
850
|
return mem.set(p, "env", opt.process);
|
|
851
|
-
case
|
|
851
|
+
case 97:
|
|
852
852
|
_msg = _objectSpread(_objectSpread({}, (0, _ramda.dissoc)("signer", _opt)), {}, {
|
|
853
853
|
res: res
|
|
854
854
|
});
|
|
855
|
-
_context4.next =
|
|
855
|
+
_context4.next = 100;
|
|
856
856
|
return mem.set(_msg, "msgs", opt.message);
|
|
857
|
-
case
|
|
857
|
+
case 100:
|
|
858
858
|
_iterator3 = _createForOfIteratorHelper((_res$Messages = res.Messages) !== null && _res$Messages !== void 0 ? _res$Messages : []);
|
|
859
|
-
_context4.prev =
|
|
859
|
+
_context4.prev = 101;
|
|
860
860
|
_iterator3.s();
|
|
861
|
-
case
|
|
861
|
+
case 103:
|
|
862
862
|
if ((_step3 = _iterator3.n()).done) {
|
|
863
|
-
_context4.next =
|
|
863
|
+
_context4.next = 112;
|
|
864
864
|
break;
|
|
865
865
|
}
|
|
866
866
|
v = _step3.value;
|
|
867
|
-
_context4.next =
|
|
867
|
+
_context4.next = 107;
|
|
868
868
|
return mem.get("env", v.Target);
|
|
869
|
-
case
|
|
869
|
+
case 107:
|
|
870
870
|
if (!_context4.sent) {
|
|
871
|
-
_context4.next =
|
|
871
|
+
_context4.next = 110;
|
|
872
872
|
break;
|
|
873
873
|
}
|
|
874
|
-
_context4.next =
|
|
874
|
+
_context4.next = 110;
|
|
875
875
|
return message({
|
|
876
876
|
"for": opt.message,
|
|
877
877
|
process: v.Target,
|
|
@@ -880,32 +880,32 @@ var _default = exports["default"] = function _default() {
|
|
|
880
880
|
signer: mu.signer,
|
|
881
881
|
from: opt.process
|
|
882
882
|
});
|
|
883
|
-
case
|
|
884
|
-
_context4.next =
|
|
883
|
+
case 110:
|
|
884
|
+
_context4.next = 103;
|
|
885
885
|
break;
|
|
886
|
-
case
|
|
887
|
-
_context4.next =
|
|
886
|
+
case 112:
|
|
887
|
+
_context4.next = 117;
|
|
888
888
|
break;
|
|
889
|
-
case
|
|
890
|
-
_context4.prev =
|
|
891
|
-
_context4.
|
|
892
|
-
_iterator3.e(_context4.
|
|
893
|
-
case
|
|
894
|
-
_context4.prev =
|
|
889
|
+
case 114:
|
|
890
|
+
_context4.prev = 114;
|
|
891
|
+
_context4.t21 = _context4["catch"](101);
|
|
892
|
+
_iterator3.e(_context4.t21);
|
|
893
|
+
case 117:
|
|
894
|
+
_context4.prev = 117;
|
|
895
895
|
_iterator3.f();
|
|
896
|
-
return _context4.finish(
|
|
897
|
-
case
|
|
896
|
+
return _context4.finish(117);
|
|
897
|
+
case 120:
|
|
898
898
|
_iterator4 = _createForOfIteratorHelper((_res$Spawns = res.Spawns) !== null && _res$Spawns !== void 0 ? _res$Spawns : []);
|
|
899
|
-
_context4.prev =
|
|
899
|
+
_context4.prev = 121;
|
|
900
900
|
_iterator4.s();
|
|
901
|
-
case
|
|
901
|
+
case 123:
|
|
902
902
|
if ((_step4 = _iterator4.n()).done) {
|
|
903
|
-
_context4.next =
|
|
903
|
+
_context4.next = 130;
|
|
904
904
|
break;
|
|
905
905
|
}
|
|
906
906
|
_v = _step4.value;
|
|
907
907
|
__tags = (0, _utils.tags)(_v.Tags);
|
|
908
|
-
_context4.next =
|
|
908
|
+
_context4.next = 128;
|
|
909
909
|
return spawn({
|
|
910
910
|
"for": opt.message,
|
|
911
911
|
module: __tags.Module,
|
|
@@ -915,87 +915,87 @@ var _default = exports["default"] = function _default() {
|
|
|
915
915
|
from: __tags["From-Process"],
|
|
916
916
|
signer: mu.signer
|
|
917
917
|
});
|
|
918
|
-
case
|
|
919
|
-
_context4.next =
|
|
918
|
+
case 128:
|
|
919
|
+
_context4.next = 123;
|
|
920
920
|
break;
|
|
921
|
-
case
|
|
922
|
-
_context4.next =
|
|
921
|
+
case 130:
|
|
922
|
+
_context4.next = 135;
|
|
923
923
|
break;
|
|
924
|
-
case
|
|
925
|
-
_context4.prev =
|
|
926
|
-
_context4.
|
|
927
|
-
_iterator4.e(_context4.
|
|
928
|
-
case
|
|
929
|
-
_context4.prev =
|
|
924
|
+
case 132:
|
|
925
|
+
_context4.prev = 132;
|
|
926
|
+
_context4.t22 = _context4["catch"](121);
|
|
927
|
+
_iterator4.e(_context4.t22);
|
|
928
|
+
case 135:
|
|
929
|
+
_context4.prev = 135;
|
|
930
930
|
_iterator4.f();
|
|
931
|
-
return _context4.finish(
|
|
932
|
-
case
|
|
931
|
+
return _context4.finish(135);
|
|
932
|
+
case 138:
|
|
933
933
|
_iterator5 = _createForOfIteratorHelper((_res$Assignments = res.Assignments) !== null && _res$Assignments !== void 0 ? _res$Assignments : []);
|
|
934
|
-
_context4.prev =
|
|
934
|
+
_context4.prev = 139;
|
|
935
935
|
_iterator5.s();
|
|
936
|
-
case
|
|
936
|
+
case 141:
|
|
937
937
|
if ((_step5 = _iterator5.n()).done) {
|
|
938
|
-
_context4.next =
|
|
938
|
+
_context4.next = 162;
|
|
939
939
|
break;
|
|
940
940
|
}
|
|
941
941
|
_v2 = _step5.value;
|
|
942
942
|
_iterator6 = _createForOfIteratorHelper(_v2.Processes);
|
|
943
|
-
_context4.prev =
|
|
943
|
+
_context4.prev = 144;
|
|
944
944
|
_iterator6.s();
|
|
945
|
-
case
|
|
945
|
+
case 146:
|
|
946
946
|
if ((_step6 = _iterator6.n()).done) {
|
|
947
|
-
_context4.next =
|
|
947
|
+
_context4.next = 152;
|
|
948
948
|
break;
|
|
949
949
|
}
|
|
950
950
|
v2 = _step6.value;
|
|
951
|
-
_context4.next =
|
|
951
|
+
_context4.next = 150;
|
|
952
952
|
return _assign({
|
|
953
953
|
message: _v2.Message,
|
|
954
954
|
process: v2,
|
|
955
955
|
from: opt.process,
|
|
956
956
|
signer: mu.signer
|
|
957
957
|
});
|
|
958
|
-
case
|
|
959
|
-
_context4.next =
|
|
958
|
+
case 150:
|
|
959
|
+
_context4.next = 146;
|
|
960
960
|
break;
|
|
961
|
-
case
|
|
962
|
-
_context4.next =
|
|
961
|
+
case 152:
|
|
962
|
+
_context4.next = 157;
|
|
963
963
|
break;
|
|
964
|
-
case
|
|
965
|
-
_context4.prev =
|
|
966
|
-
_context4.
|
|
967
|
-
_iterator6.e(_context4.
|
|
968
|
-
case
|
|
969
|
-
_context4.prev =
|
|
964
|
+
case 154:
|
|
965
|
+
_context4.prev = 154;
|
|
966
|
+
_context4.t23 = _context4["catch"](144);
|
|
967
|
+
_iterator6.e(_context4.t23);
|
|
968
|
+
case 157:
|
|
969
|
+
_context4.prev = 157;
|
|
970
970
|
_iterator6.f();
|
|
971
|
-
return _context4.finish(
|
|
972
|
-
case
|
|
973
|
-
_context4.next =
|
|
971
|
+
return _context4.finish(157);
|
|
972
|
+
case 160:
|
|
973
|
+
_context4.next = 141;
|
|
974
974
|
break;
|
|
975
|
-
case
|
|
976
|
-
_context4.next =
|
|
975
|
+
case 162:
|
|
976
|
+
_context4.next = 167;
|
|
977
977
|
break;
|
|
978
|
+
case 164:
|
|
979
|
+
_context4.prev = 164;
|
|
980
|
+
_context4.t24 = _context4["catch"](139);
|
|
981
|
+
_iterator5.e(_context4.t24);
|
|
982
|
+
case 167:
|
|
983
|
+
_context4.prev = 167;
|
|
984
|
+
_iterator5.f();
|
|
985
|
+
return _context4.finish(167);
|
|
986
|
+
case 170:
|
|
987
|
+
return _context4.abrupt("return", id);
|
|
978
988
|
case 173:
|
|
979
989
|
_context4.prev = 173;
|
|
980
|
-
_context4.
|
|
981
|
-
|
|
990
|
+
_context4.t25 = _context4["catch"](39);
|
|
991
|
+
console.log(_context4.t25);
|
|
982
992
|
case 176:
|
|
983
|
-
_context4.prev = 176;
|
|
984
|
-
_iterator5.f();
|
|
985
|
-
return _context4.finish(176);
|
|
986
|
-
case 179:
|
|
987
|
-
return _context4.abrupt("return", id);
|
|
988
|
-
case 182:
|
|
989
|
-
_context4.prev = 182;
|
|
990
|
-
_context4.t28 = _context4["catch"](38);
|
|
991
|
-
console.log(_context4.t28);
|
|
992
|
-
case 185:
|
|
993
993
|
return _context4.abrupt("return", null);
|
|
994
|
-
case
|
|
994
|
+
case 177:
|
|
995
995
|
case "end":
|
|
996
996
|
return _context4.stop();
|
|
997
997
|
}
|
|
998
|
-
}, _callee4, null, [[
|
|
998
|
+
}, _callee4, null, [[39, 173], [101, 114, 117, 120], [121, 132, 135, 138], [139, 164, 167, 170], [144, 154, 157, 160]]);
|
|
999
999
|
}));
|
|
1000
1000
|
return function assign(_x8) {
|
|
1001
1001
|
return _ref9.apply(this, arguments);
|
|
@@ -1003,7 +1003,7 @@ var _default = exports["default"] = function _default() {
|
|
|
1003
1003
|
}();
|
|
1004
1004
|
var message = /*#__PURE__*/function () {
|
|
1005
1005
|
var _ref11 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(opt) {
|
|
1006
|
-
var id, owner, item, _opt$id2, _key, i, _yield$ar$httpmsg2, _p, new_slot, last_slot, _opt$item$id, _opt$item, _opt$owner,
|
|
1006
|
+
var id, owner, item, _opt$id2, _key, i, _yield$ar$httpmsg2, _p, new_slot, last_slot, _opt$item$id, _opt$item, _opt$owner, p, _opt$tags3, _yield$mem$getTx$tags3, _yield$mem$getTx4, pr, module, _yield$ar$dataitem3, _msg, _opt, _ref12, _opt$from2, _opt$http_msg$data, from, data, _tags, msg, _env, _yield$mem$getTx5, _yield$mem$getWasm3, format, mod, wasm, wdrive, start, res, _msg2, key;
|
|
1007
1007
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
1008
1008
|
while (1) switch (_context5.prev = _context5.next) {
|
|
1009
1009
|
case 0:
|
|
@@ -1064,9 +1064,9 @@ var _default = exports["default"] = function _default() {
|
|
|
1064
1064
|
_context5.next = 38;
|
|
1065
1065
|
break;
|
|
1066
1066
|
case 35:
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1067
|
+
id = (_opt$item$id = opt === null || opt === void 0 || (_opt$item = opt.item) === null || _opt$item === void 0 ? void 0 : _opt$item.id) !== null && _opt$item$id !== void 0 ? _opt$item$id : "";
|
|
1068
|
+
owner = (_opt$owner = opt.owner) !== null && _opt$owner !== void 0 ? _opt$owner : "";
|
|
1069
|
+
item = opt.item;
|
|
1070
1070
|
case 38:
|
|
1071
1071
|
_context5.next = 40;
|
|
1072
1072
|
return mem.get("env", opt.process);
|
package/esm/adaptor-base.js
CHANGED
|
@@ -324,7 +324,7 @@ class Adaptor {
|
|
|
324
324
|
}
|
|
325
325
|
}
|
|
326
326
|
const slot = message
|
|
327
|
-
if (
|
|
327
|
+
if (!/^[0-9a-zA-Z_-]{43,44}$/.test(message)) {
|
|
328
328
|
message = this.mem.env[process]?.results?.[slot]
|
|
329
329
|
}
|
|
330
330
|
if (isNil(message)) {
|
|
@@ -333,7 +333,7 @@ class Adaptor {
|
|
|
333
333
|
if (isNil(message)) return { status: 404, error: "not Found" }
|
|
334
334
|
}
|
|
335
335
|
const res2 = await this.result({ message, process })
|
|
336
|
-
|
|
336
|
+
return { json: res2 }
|
|
337
337
|
}
|
|
338
338
|
|
|
339
339
|
async su_get_root({ query, params, body, headers, method }) {
|
|
@@ -388,10 +388,19 @@ class Adaptor {
|
|
|
388
388
|
}
|
|
389
389
|
|
|
390
390
|
async mu_post_root({ query, params, body, headers, method }) {
|
|
391
|
-
|
|
391
|
+
if (body.type === "Buffer" && Array.isArray(body.data)) {
|
|
392
|
+
body = new Uint8Array(body.data)
|
|
393
|
+
}
|
|
394
|
+
let valid = false
|
|
395
|
+
// todo: cannot verify node -> broser items
|
|
396
|
+
try {
|
|
397
|
+
valid = await DataItem.verify(body)
|
|
398
|
+
} catch (e) {
|
|
399
|
+
console.log(e)
|
|
400
|
+
}
|
|
392
401
|
let type = null
|
|
393
402
|
let item = null
|
|
394
|
-
if (valid) item = new DataItem(body)
|
|
403
|
+
if (valid || true) item = new DataItem(body)
|
|
395
404
|
const _tags = tags(item.tags)
|
|
396
405
|
let err = null
|
|
397
406
|
if (_tags.Type === "Process") {
|
package/esm/aoconnect-base.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import _Arweave from "arweave"
|
|
2
|
+
const Arweave = _Arweave.default ?? _Arweave
|
|
3
|
+
const arweave = Arweave.init()
|
|
1
4
|
import * as WarpArBundles from "warp-arbundles"
|
|
2
5
|
const pkg = WarpArBundles.default ?? WarpArBundles
|
|
3
6
|
const { DataItem } = pkg
|
|
@@ -269,7 +272,12 @@ export default ({ AR, scheduler, mu, su, cu, acc, AoLoader, ArMem } = {}) => {
|
|
|
269
272
|
const p = await mem.get("env", opt.process)
|
|
270
273
|
if (!p || !opt.process) return null
|
|
271
274
|
let _opt = await mem.get("msgs", opt.message)
|
|
272
|
-
let hash =
|
|
275
|
+
let hash = p.hash
|
|
276
|
+
try {
|
|
277
|
+
hash = genHashChain(p.hash, opt.message)
|
|
278
|
+
} catch (e) {
|
|
279
|
+
console.log(e)
|
|
280
|
+
}
|
|
273
281
|
p.hash = hash
|
|
274
282
|
opt.tags = buildTags(
|
|
275
283
|
null,
|
|
@@ -304,18 +312,14 @@ export default ({ AR, scheduler, mu, su, cu, acc, AoLoader, ArMem } = {}) => {
|
|
|
304
312
|
let _tags = _opt.tags
|
|
305
313
|
let from = _opt.from ?? opt.from ?? owner
|
|
306
314
|
if (_opt.item) {
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
from = base64url.encode(hashBuffer)
|
|
316
|
-
}
|
|
317
|
-
} catch (e) {
|
|
318
|
-
console.log(e)
|
|
315
|
+
data = base64url.decode(_opt.item.data)
|
|
316
|
+
_tags = _opt.item.tags
|
|
317
|
+
if (!from) {
|
|
318
|
+
from = await arweave.wallets.jwkToAddress({
|
|
319
|
+
kty: "RSA",
|
|
320
|
+
n: _opt.item.owner,
|
|
321
|
+
e: "AQAB",
|
|
322
|
+
})
|
|
319
323
|
}
|
|
320
324
|
}
|
|
321
325
|
// check: is owner=mu.addr right?
|
|
@@ -415,9 +419,9 @@ export default ({ AR, scheduler, mu, su, cu, acc, AoLoader, ArMem } = {}) => {
|
|
|
415
419
|
}
|
|
416
420
|
}
|
|
417
421
|
} else {
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
422
|
+
id = opt?.item?.id ?? ""
|
|
423
|
+
owner = opt.owner ?? ""
|
|
424
|
+
item = opt.item
|
|
421
425
|
}
|
|
422
426
|
|
|
423
427
|
const p = await mem.get("env", opt.process)
|