wao 0.16.4 → 0.16.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.
- package/cjs/adaptor-base.js +32 -24
- package/cjs/aoconnect-base.js +126 -121
- package/esm/adaptor-base.js +13 -4
- package/esm/aoconnect-base.js +9 -4
- 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
|
@@ -682,16 +682,21 @@ var _default = exports["default"] = function _default() {
|
|
|
682
682
|
return mem.get("msgs", opt.message);
|
|
683
683
|
case 7:
|
|
684
684
|
_opt = _context4.sent;
|
|
685
|
-
hash =
|
|
685
|
+
hash = p.hash;
|
|
686
|
+
try {
|
|
687
|
+
hash = genHashChain(p.hash, opt.message);
|
|
688
|
+
} catch (e) {
|
|
689
|
+
console.log(e);
|
|
690
|
+
}
|
|
686
691
|
p.hash = hash;
|
|
687
692
|
_context4.t0 = _utils.buildTags;
|
|
688
693
|
_context4.t1 = _ramda.mergeLeft;
|
|
689
694
|
_context4.t2 = (0, _utils.tags)((_opt$tags2 = opt.tags) !== null && _opt$tags2 !== void 0 ? _opt$tags2 : []);
|
|
690
695
|
_context4.t3 = Date.now();
|
|
691
696
|
_context4.t4 = p.epochs.length;
|
|
692
|
-
_context4.next =
|
|
697
|
+
_context4.next = 18;
|
|
693
698
|
return mem.get("height");
|
|
694
|
-
case
|
|
699
|
+
case 18:
|
|
695
700
|
_context4.t5 = _context4.sent;
|
|
696
701
|
_context4.t6 = opt.process;
|
|
697
702
|
_context4.t7 = opt.message;
|
|
@@ -712,81 +717,81 @@ var _default = exports["default"] = function _default() {
|
|
|
712
717
|
_context4.t10 = (0, _context4.t1)(_context4.t2, _context4.t9);
|
|
713
718
|
opt.tags = (0, _context4.t0)(null, _context4.t10);
|
|
714
719
|
p.epochs.push([opt.message]);
|
|
715
|
-
_context4.next =
|
|
720
|
+
_context4.next = 28;
|
|
716
721
|
return ar.dataitem({
|
|
717
722
|
data: opt.data,
|
|
718
723
|
signer: opt.signer,
|
|
719
724
|
tags: (0, _utils.tags)(opt.tags),
|
|
720
725
|
target: opt.process
|
|
721
726
|
});
|
|
722
|
-
case
|
|
727
|
+
case 28:
|
|
723
728
|
_yield$ar$dataitem2 = _context4.sent;
|
|
724
729
|
id = _yield$ar$dataitem2.id;
|
|
725
730
|
owner = _yield$ar$dataitem2.owner;
|
|
726
731
|
item = _yield$ar$dataitem2.item;
|
|
727
732
|
if (!opt.message_item) {
|
|
728
|
-
_context4.next =
|
|
733
|
+
_context4.next = 37;
|
|
729
734
|
break;
|
|
730
735
|
}
|
|
731
|
-
_context4.next =
|
|
736
|
+
_context4.next = 35;
|
|
732
737
|
return ar.postItems([opt.message_item, item], su.jwk);
|
|
733
|
-
case
|
|
734
|
-
_context4.next =
|
|
738
|
+
case 35:
|
|
739
|
+
_context4.next = 39;
|
|
735
740
|
break;
|
|
736
|
-
case
|
|
737
|
-
_context4.next =
|
|
741
|
+
case 37:
|
|
742
|
+
_context4.next = 39;
|
|
738
743
|
return ar.postItems(item, su.jwk);
|
|
739
|
-
case
|
|
740
|
-
_context4.prev =
|
|
744
|
+
case 39:
|
|
745
|
+
_context4.prev = 39;
|
|
741
746
|
data = (_opt$data2 = _opt.data) !== null && _opt$data2 !== void 0 ? _opt$data2 : "";
|
|
742
747
|
_tags = _opt.tags;
|
|
743
748
|
from = (_ref10 = (_opt$from = _opt.from) !== null && _opt$from !== void 0 ? _opt$from : opt.from) !== null && _ref10 !== void 0 ? _ref10 : owner;
|
|
744
749
|
if (!_opt.item) {
|
|
745
|
-
_context4.next =
|
|
750
|
+
_context4.next = 60;
|
|
746
751
|
break;
|
|
747
752
|
}
|
|
748
|
-
_context4.prev =
|
|
753
|
+
_context4.prev = 44;
|
|
749
754
|
data = _base64url["default"].decode(_opt.item.data);
|
|
750
755
|
_tags = _opt.item.tags;
|
|
751
756
|
if (from) {
|
|
752
|
-
_context4.next =
|
|
757
|
+
_context4.next = 55;
|
|
753
758
|
break;
|
|
754
759
|
}
|
|
755
760
|
raw_owner = _opt.item.rawOwner;
|
|
756
761
|
_context4.t11 = Buffer;
|
|
757
|
-
_context4.next =
|
|
762
|
+
_context4.next = 52;
|
|
758
763
|
return _crypto["default"].subtle.digest("SHA-256", raw_owner);
|
|
759
|
-
case
|
|
764
|
+
case 52:
|
|
760
765
|
_context4.t12 = _context4.sent;
|
|
761
766
|
hashBuffer = _context4.t11.from.call(_context4.t11, _context4.t12);
|
|
762
767
|
from = _base64url["default"].encode(hashBuffer);
|
|
763
|
-
case
|
|
764
|
-
_context4.next =
|
|
768
|
+
case 55:
|
|
769
|
+
_context4.next = 60;
|
|
765
770
|
break;
|
|
766
|
-
case
|
|
767
|
-
_context4.prev =
|
|
768
|
-
_context4.t13 = _context4["catch"](
|
|
771
|
+
case 57:
|
|
772
|
+
_context4.prev = 57;
|
|
773
|
+
_context4.t13 = _context4["catch"](44);
|
|
769
774
|
console.log(_context4.t13);
|
|
770
|
-
case
|
|
771
|
-
_context4.next =
|
|
775
|
+
case 60:
|
|
776
|
+
_context4.next = 62;
|
|
772
777
|
return genMsg(opt.message, p, data, _tags, from, mu.addr);
|
|
773
|
-
case
|
|
778
|
+
case 62:
|
|
774
779
|
msg = _context4.sent;
|
|
775
|
-
_context4.next =
|
|
780
|
+
_context4.next = 65;
|
|
776
781
|
return genEnv({
|
|
777
782
|
pid: p.id,
|
|
778
783
|
owner: p.owner,
|
|
779
784
|
module: p.module
|
|
780
785
|
});
|
|
781
|
-
case
|
|
786
|
+
case 65:
|
|
782
787
|
_env = _context4.sent;
|
|
783
788
|
if (p.handle) {
|
|
784
|
-
_context4.next =
|
|
789
|
+
_context4.next = 98;
|
|
785
790
|
break;
|
|
786
791
|
}
|
|
787
|
-
_context4.next =
|
|
792
|
+
_context4.next = 69;
|
|
788
793
|
return mem.getWasm(p.modulea);
|
|
789
|
-
case
|
|
794
|
+
case 69:
|
|
790
795
|
_yield$mem$getWasm2 = _context4.sent;
|
|
791
796
|
format = _yield$mem$getWasm2.format;
|
|
792
797
|
mod = _yield$mem$getWasm2.mod;
|
|
@@ -796,31 +801,31 @@ var _default = exports["default"] = function _default() {
|
|
|
796
801
|
_context4.t15 = wasm;
|
|
797
802
|
_context4.t16 = format;
|
|
798
803
|
_context4.t17 = wdrive;
|
|
799
|
-
_context4.next =
|
|
804
|
+
_context4.next = 80;
|
|
800
805
|
return mem.getTx(p.id);
|
|
801
|
-
case
|
|
806
|
+
case 80:
|
|
802
807
|
_context4.t19 = _yield$mem$getTx3 = _context4.sent;
|
|
803
808
|
_context4.t18 = _context4.t19 === null;
|
|
804
809
|
if (_context4.t18) {
|
|
805
|
-
_context4.next =
|
|
810
|
+
_context4.next = 84;
|
|
806
811
|
break;
|
|
807
812
|
}
|
|
808
813
|
_context4.t18 = _yield$mem$getTx3 === void 0;
|
|
809
|
-
case
|
|
814
|
+
case 84:
|
|
810
815
|
if (!_context4.t18) {
|
|
811
|
-
_context4.next =
|
|
816
|
+
_context4.next = 88;
|
|
812
817
|
break;
|
|
813
818
|
}
|
|
814
819
|
_context4.t20 = void 0;
|
|
815
|
-
_context4.next =
|
|
820
|
+
_context4.next = 89;
|
|
816
821
|
break;
|
|
817
|
-
case 87:
|
|
818
|
-
_context4.t20 = _yield$mem$getTx3.item;
|
|
819
822
|
case 88:
|
|
823
|
+
_context4.t20 = _yield$mem$getTx3.item;
|
|
824
|
+
case 89:
|
|
820
825
|
_context4.t21 = _context4.t20;
|
|
821
|
-
_context4.next =
|
|
826
|
+
_context4.next = 92;
|
|
822
827
|
return mem.getTx(mod);
|
|
823
|
-
case
|
|
828
|
+
case 92:
|
|
824
829
|
_context4.t22 = _context4.sent;
|
|
825
830
|
_context4.t23 = {
|
|
826
831
|
format: _context4.t16,
|
|
@@ -828,50 +833,50 @@ var _default = exports["default"] = function _default() {
|
|
|
828
833
|
spawn: _context4.t21,
|
|
829
834
|
module: _context4.t22
|
|
830
835
|
};
|
|
831
|
-
_context4.next =
|
|
836
|
+
_context4.next = 96;
|
|
832
837
|
return (0, _context4.t14)(_context4.t15, _context4.t23);
|
|
833
|
-
case
|
|
838
|
+
case 96:
|
|
834
839
|
p.handle = _context4.sent;
|
|
835
840
|
mem.env[opt.process].handle = p.handle;
|
|
836
|
-
case
|
|
841
|
+
case 98:
|
|
837
842
|
if (p.compressed) {
|
|
838
843
|
start = Date.now();
|
|
839
844
|
p.memory = mem.decompress(p.memory, p.original_size);
|
|
840
845
|
p.compressed = false;
|
|
841
846
|
}
|
|
842
|
-
_context4.next =
|
|
847
|
+
_context4.next = 101;
|
|
843
848
|
return p.handle(p.memory, msg, _env);
|
|
844
|
-
case
|
|
849
|
+
case 101:
|
|
845
850
|
res = _context4.sent;
|
|
846
851
|
p.memory = res.Memory;
|
|
847
852
|
delete res.Memory;
|
|
848
853
|
p.results.push(opt.message);
|
|
849
|
-
_context4.next =
|
|
854
|
+
_context4.next = 107;
|
|
850
855
|
return mem.set(p, "env", opt.process);
|
|
851
|
-
case
|
|
856
|
+
case 107:
|
|
852
857
|
_msg = _objectSpread(_objectSpread({}, (0, _ramda.dissoc)("signer", _opt)), {}, {
|
|
853
858
|
res: res
|
|
854
859
|
});
|
|
855
|
-
_context4.next =
|
|
860
|
+
_context4.next = 110;
|
|
856
861
|
return mem.set(_msg, "msgs", opt.message);
|
|
857
|
-
case
|
|
862
|
+
case 110:
|
|
858
863
|
_iterator3 = _createForOfIteratorHelper((_res$Messages = res.Messages) !== null && _res$Messages !== void 0 ? _res$Messages : []);
|
|
859
|
-
_context4.prev =
|
|
864
|
+
_context4.prev = 111;
|
|
860
865
|
_iterator3.s();
|
|
861
|
-
case
|
|
866
|
+
case 113:
|
|
862
867
|
if ((_step3 = _iterator3.n()).done) {
|
|
863
|
-
_context4.next =
|
|
868
|
+
_context4.next = 122;
|
|
864
869
|
break;
|
|
865
870
|
}
|
|
866
871
|
v = _step3.value;
|
|
867
|
-
_context4.next =
|
|
872
|
+
_context4.next = 117;
|
|
868
873
|
return mem.get("env", v.Target);
|
|
869
|
-
case
|
|
874
|
+
case 117:
|
|
870
875
|
if (!_context4.sent) {
|
|
871
|
-
_context4.next =
|
|
876
|
+
_context4.next = 120;
|
|
872
877
|
break;
|
|
873
878
|
}
|
|
874
|
-
_context4.next =
|
|
879
|
+
_context4.next = 120;
|
|
875
880
|
return message({
|
|
876
881
|
"for": opt.message,
|
|
877
882
|
process: v.Target,
|
|
@@ -880,32 +885,32 @@ var _default = exports["default"] = function _default() {
|
|
|
880
885
|
signer: mu.signer,
|
|
881
886
|
from: opt.process
|
|
882
887
|
});
|
|
883
|
-
case
|
|
884
|
-
_context4.next =
|
|
888
|
+
case 120:
|
|
889
|
+
_context4.next = 113;
|
|
885
890
|
break;
|
|
886
|
-
case
|
|
887
|
-
_context4.next =
|
|
891
|
+
case 122:
|
|
892
|
+
_context4.next = 127;
|
|
888
893
|
break;
|
|
889
|
-
case
|
|
890
|
-
_context4.prev =
|
|
891
|
-
_context4.t24 = _context4["catch"](
|
|
894
|
+
case 124:
|
|
895
|
+
_context4.prev = 124;
|
|
896
|
+
_context4.t24 = _context4["catch"](111);
|
|
892
897
|
_iterator3.e(_context4.t24);
|
|
893
|
-
case
|
|
894
|
-
_context4.prev =
|
|
898
|
+
case 127:
|
|
899
|
+
_context4.prev = 127;
|
|
895
900
|
_iterator3.f();
|
|
896
|
-
return _context4.finish(
|
|
897
|
-
case
|
|
901
|
+
return _context4.finish(127);
|
|
902
|
+
case 130:
|
|
898
903
|
_iterator4 = _createForOfIteratorHelper((_res$Spawns = res.Spawns) !== null && _res$Spawns !== void 0 ? _res$Spawns : []);
|
|
899
|
-
_context4.prev =
|
|
904
|
+
_context4.prev = 131;
|
|
900
905
|
_iterator4.s();
|
|
901
|
-
case
|
|
906
|
+
case 133:
|
|
902
907
|
if ((_step4 = _iterator4.n()).done) {
|
|
903
|
-
_context4.next =
|
|
908
|
+
_context4.next = 140;
|
|
904
909
|
break;
|
|
905
910
|
}
|
|
906
911
|
_v = _step4.value;
|
|
907
912
|
__tags = (0, _utils.tags)(_v.Tags);
|
|
908
|
-
_context4.next =
|
|
913
|
+
_context4.next = 138;
|
|
909
914
|
return spawn({
|
|
910
915
|
"for": opt.message,
|
|
911
916
|
module: __tags.Module,
|
|
@@ -915,87 +920,87 @@ var _default = exports["default"] = function _default() {
|
|
|
915
920
|
from: __tags["From-Process"],
|
|
916
921
|
signer: mu.signer
|
|
917
922
|
});
|
|
918
|
-
case
|
|
919
|
-
_context4.next =
|
|
923
|
+
case 138:
|
|
924
|
+
_context4.next = 133;
|
|
920
925
|
break;
|
|
921
|
-
case
|
|
922
|
-
_context4.next =
|
|
926
|
+
case 140:
|
|
927
|
+
_context4.next = 145;
|
|
923
928
|
break;
|
|
924
|
-
case
|
|
925
|
-
_context4.prev =
|
|
926
|
-
_context4.t25 = _context4["catch"](
|
|
929
|
+
case 142:
|
|
930
|
+
_context4.prev = 142;
|
|
931
|
+
_context4.t25 = _context4["catch"](131);
|
|
927
932
|
_iterator4.e(_context4.t25);
|
|
928
|
-
case
|
|
929
|
-
_context4.prev =
|
|
933
|
+
case 145:
|
|
934
|
+
_context4.prev = 145;
|
|
930
935
|
_iterator4.f();
|
|
931
|
-
return _context4.finish(
|
|
932
|
-
case
|
|
936
|
+
return _context4.finish(145);
|
|
937
|
+
case 148:
|
|
933
938
|
_iterator5 = _createForOfIteratorHelper((_res$Assignments = res.Assignments) !== null && _res$Assignments !== void 0 ? _res$Assignments : []);
|
|
934
|
-
_context4.prev =
|
|
939
|
+
_context4.prev = 149;
|
|
935
940
|
_iterator5.s();
|
|
936
|
-
case
|
|
941
|
+
case 151:
|
|
937
942
|
if ((_step5 = _iterator5.n()).done) {
|
|
938
|
-
_context4.next =
|
|
943
|
+
_context4.next = 172;
|
|
939
944
|
break;
|
|
940
945
|
}
|
|
941
946
|
_v2 = _step5.value;
|
|
942
947
|
_iterator6 = _createForOfIteratorHelper(_v2.Processes);
|
|
943
|
-
_context4.prev =
|
|
948
|
+
_context4.prev = 154;
|
|
944
949
|
_iterator6.s();
|
|
945
|
-
case
|
|
950
|
+
case 156:
|
|
946
951
|
if ((_step6 = _iterator6.n()).done) {
|
|
947
|
-
_context4.next =
|
|
952
|
+
_context4.next = 162;
|
|
948
953
|
break;
|
|
949
954
|
}
|
|
950
955
|
v2 = _step6.value;
|
|
951
|
-
_context4.next =
|
|
956
|
+
_context4.next = 160;
|
|
952
957
|
return _assign({
|
|
953
958
|
message: _v2.Message,
|
|
954
959
|
process: v2,
|
|
955
960
|
from: opt.process,
|
|
956
961
|
signer: mu.signer
|
|
957
962
|
});
|
|
958
|
-
case
|
|
959
|
-
_context4.next =
|
|
963
|
+
case 160:
|
|
964
|
+
_context4.next = 156;
|
|
960
965
|
break;
|
|
961
|
-
case
|
|
962
|
-
_context4.next =
|
|
966
|
+
case 162:
|
|
967
|
+
_context4.next = 167;
|
|
963
968
|
break;
|
|
964
|
-
case
|
|
965
|
-
_context4.prev =
|
|
966
|
-
_context4.t26 = _context4["catch"](
|
|
969
|
+
case 164:
|
|
970
|
+
_context4.prev = 164;
|
|
971
|
+
_context4.t26 = _context4["catch"](154);
|
|
967
972
|
_iterator6.e(_context4.t26);
|
|
968
|
-
case
|
|
969
|
-
_context4.prev =
|
|
973
|
+
case 167:
|
|
974
|
+
_context4.prev = 167;
|
|
970
975
|
_iterator6.f();
|
|
971
|
-
return _context4.finish(
|
|
972
|
-
case
|
|
973
|
-
_context4.next =
|
|
976
|
+
return _context4.finish(167);
|
|
977
|
+
case 170:
|
|
978
|
+
_context4.next = 151;
|
|
974
979
|
break;
|
|
975
|
-
case
|
|
976
|
-
_context4.next =
|
|
980
|
+
case 172:
|
|
981
|
+
_context4.next = 177;
|
|
977
982
|
break;
|
|
978
|
-
case
|
|
979
|
-
_context4.prev =
|
|
980
|
-
_context4.t27 = _context4["catch"](
|
|
983
|
+
case 174:
|
|
984
|
+
_context4.prev = 174;
|
|
985
|
+
_context4.t27 = _context4["catch"](149);
|
|
981
986
|
_iterator5.e(_context4.t27);
|
|
982
|
-
case
|
|
983
|
-
_context4.prev =
|
|
987
|
+
case 177:
|
|
988
|
+
_context4.prev = 177;
|
|
984
989
|
_iterator5.f();
|
|
985
|
-
return _context4.finish(
|
|
986
|
-
case
|
|
990
|
+
return _context4.finish(177);
|
|
991
|
+
case 180:
|
|
987
992
|
return _context4.abrupt("return", id);
|
|
988
|
-
case
|
|
989
|
-
_context4.prev =
|
|
990
|
-
_context4.t28 = _context4["catch"](
|
|
993
|
+
case 183:
|
|
994
|
+
_context4.prev = 183;
|
|
995
|
+
_context4.t28 = _context4["catch"](39);
|
|
991
996
|
console.log(_context4.t28);
|
|
992
|
-
case 185:
|
|
993
|
-
return _context4.abrupt("return", null);
|
|
994
997
|
case 186:
|
|
998
|
+
return _context4.abrupt("return", null);
|
|
999
|
+
case 187:
|
|
995
1000
|
case "end":
|
|
996
1001
|
return _context4.stop();
|
|
997
1002
|
}
|
|
998
|
-
}, _callee4, null, [[
|
|
1003
|
+
}, _callee4, null, [[39, 183], [44, 57], [111, 124, 127, 130], [131, 142, 145, 148], [149, 174, 177, 180], [154, 164, 167, 170]]);
|
|
999
1004
|
}));
|
|
1000
1005
|
return function assign(_x8) {
|
|
1001
1006
|
return _ref9.apply(this, arguments);
|
|
@@ -1003,7 +1008,7 @@ var _default = exports["default"] = function _default() {
|
|
|
1003
1008
|
}();
|
|
1004
1009
|
var message = /*#__PURE__*/function () {
|
|
1005
1010
|
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,
|
|
1011
|
+
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
1012
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
1008
1013
|
while (1) switch (_context5.prev = _context5.next) {
|
|
1009
1014
|
case 0:
|
|
@@ -1064,9 +1069,9 @@ var _default = exports["default"] = function _default() {
|
|
|
1064
1069
|
_context5.next = 38;
|
|
1065
1070
|
break;
|
|
1066
1071
|
case 35:
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1072
|
+
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 : "";
|
|
1073
|
+
owner = (_opt$owner = opt.owner) !== null && _opt$owner !== void 0 ? _opt$owner : "";
|
|
1074
|
+
item = opt.item;
|
|
1070
1075
|
case 38:
|
|
1071
1076
|
_context5.next = 40;
|
|
1072
1077
|
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
|
@@ -269,7 +269,12 @@ export default ({ AR, scheduler, mu, su, cu, acc, AoLoader, ArMem } = {}) => {
|
|
|
269
269
|
const p = await mem.get("env", opt.process)
|
|
270
270
|
if (!p || !opt.process) return null
|
|
271
271
|
let _opt = await mem.get("msgs", opt.message)
|
|
272
|
-
let hash =
|
|
272
|
+
let hash = p.hash
|
|
273
|
+
try {
|
|
274
|
+
hash = genHashChain(p.hash, opt.message)
|
|
275
|
+
} catch (e) {
|
|
276
|
+
console.log(e)
|
|
277
|
+
}
|
|
273
278
|
p.hash = hash
|
|
274
279
|
opt.tags = buildTags(
|
|
275
280
|
null,
|
|
@@ -415,9 +420,9 @@ export default ({ AR, scheduler, mu, su, cu, acc, AoLoader, ArMem } = {}) => {
|
|
|
415
420
|
}
|
|
416
421
|
}
|
|
417
422
|
} else {
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
423
|
+
id = opt?.item?.id ?? ""
|
|
424
|
+
owner = opt.owner ?? ""
|
|
425
|
+
item = opt.item
|
|
421
426
|
}
|
|
422
427
|
|
|
423
428
|
const p = await mem.get("env", opt.process)
|