wao 0.14.5 → 0.15.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 CHANGED
@@ -14,6 +14,10 @@ var _WarpArBundles$defaul;
14
14
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
15
15
  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); }
16
16
  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; }
17
+ function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
18
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
19
+ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
20
+ function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
17
21
  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; }
18
22
  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; }
19
23
  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; }
@@ -618,38 +622,20 @@ var AO = /*#__PURE__*/function () {
618
622
  return spwn;
619
623
  }()
620
624
  }, {
621
- key: "msg",
625
+ key: "res",
622
626
  value: function () {
623
- var _msg = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11(_ref12) {
627
+ var _res2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11(_ref12) {
624
628
  var _this3 = this;
625
- var pid, jwk, data, _ref12$act, act, _ref12$tags, tags, _ref12$check, check, get, _ref12$timeout, timeout, _ref12$mode, mode, _ref12$limit, limit, err, _yield$this$ar$checkW2, anchors, hash, mid, getNewTxs, checkOut, res, out, results, _tags, start, _txs, _txmap, checked, _iterator5, _step5, v, _res;
629
+ var jwk, pid, mid, _ref12$check, check, get, _ref12$timeout, timeout, _ref12$mode, mode, _ref12$limit, limit, err, hash, getNewTxs, checkOut, res, out, results, start, _txs, _txmap, checked, _iterator5, _step5, v, _res;
626
630
  return _regeneratorRuntime().wrap(function _callee11$(_context11) {
627
631
  while (1) switch (_context11.prev = _context11.next) {
628
632
  case 0:
629
- pid = _ref12.pid, jwk = _ref12.jwk, data = _ref12.data, _ref12$act = _ref12.act, act = _ref12$act === void 0 ? "Eval" : _ref12$act, _ref12$tags = _ref12.tags, tags = _ref12$tags === void 0 ? {} : _ref12$tags, _ref12$check = _ref12.check, check = _ref12$check === void 0 ? [] : _ref12$check, get = _ref12.get, _ref12$timeout = _ref12.timeout, timeout = _ref12$timeout === void 0 ? 0 : _ref12$timeout, _ref12$mode = _ref12.mode, mode = _ref12$mode === void 0 ? "aoconnect" : _ref12$mode, _ref12$limit = _ref12.limit, limit = _ref12$limit === void 0 ? 25 : _ref12$limit;
633
+ jwk = _ref12.jwk, pid = _ref12.pid, mid = _ref12.mid, _ref12$check = _ref12.check, check = _ref12$check === void 0 ? [] : _ref12$check, get = _ref12.get, _ref12$timeout = _ref12.timeout, timeout = _ref12$timeout === void 0 ? 0 : _ref12$timeout, _ref12$mode = _ref12.mode, mode = _ref12$mode === void 0 ? "aoconnect" : _ref12$mode, _ref12$limit = _ref12.limit, limit = _ref12$limit === void 0 ? 25 : _ref12$limit;
630
634
  err = null;
631
- _context11.next = 4;
632
- return this.ar.checkWallet({
633
- jwk: jwk
634
- });
635
- case 4:
636
- _yield$this$ar$checkW2 = _context11.sent;
637
- jwk = _yield$this$ar$checkW2.jwk;
638
- err = _yield$this$ar$checkW2.err;
639
- if (!err) {
640
- _context11.next = 9;
641
- break;
642
- }
643
- return _context11.abrupt("return", {
644
- err: err
645
- });
646
- case 9:
647
- anchors = {};
648
635
  hash = null;
649
- mid = null;
650
636
  getNewTxs = /*#__PURE__*/function () {
651
637
  var _ref13 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(pid, _txs, _txmap) {
652
- var exists, txs, _iterator2, _step2, v, t, _t$fromProcess, _v$owner, _iterator3, _step3, _v, hash2;
638
+ var exists, txs, _iterator2, _step2, v, t, _t$fromProcess, _v$owner, _yield$_this3$ress, _out2, _iterator3, _step3, _v, hash2;
653
639
  return _regeneratorRuntime().wrap(function _callee9$(_context9) {
654
640
  while (1) switch (_context9.prev = _context9.next) {
655
641
  case 0:
@@ -691,20 +677,18 @@ var AO = /*#__PURE__*/function () {
691
677
  } finally {
692
678
  _iterator2.f();
693
679
  }
694
- _context9.next = 17;
680
+ _context9.next = 15;
695
681
  break;
696
682
  case 9:
697
- _context9.t0 = _createForOfIteratorHelper;
698
- _context9.t1 = _ramda.reverse;
699
- _context9.next = 13;
700
- return _this3.res({
683
+ _context9.next = 11;
684
+ return _this3.ress({
701
685
  pid: pid,
702
686
  limit: limit
703
687
  });
704
- case 13:
705
- _context9.t2 = _context9.sent;
706
- _context9.t3 = (0, _context9.t1)(_context9.t2);
707
- _iterator3 = (0, _context9.t0)(_context9.t3);
688
+ case 11:
689
+ _yield$_this3$ress = _context9.sent;
690
+ _out2 = _yield$_this3$ress.out;
691
+ _iterator3 = _createForOfIteratorHelper((0, _ramda.reverse)(_out2));
708
692
  try {
709
693
  for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
710
694
  _v = _step3.value;
@@ -728,7 +712,7 @@ var AO = /*#__PURE__*/function () {
728
712
  } finally {
729
713
  _iterator3.f();
730
714
  }
731
- case 17:
715
+ case 15:
732
716
  case "end":
733
717
  return _context9.stop();
734
718
  }
@@ -740,7 +724,7 @@ var AO = /*#__PURE__*/function () {
740
724
  }();
741
725
  checkOut = /*#__PURE__*/function () {
742
726
  var _ref14 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10(get, _txs, _txmap, out) {
743
- var _iterator4, _step4, v, _res2, _out;
727
+ var _iterator4, _step4, v, _res3, _out;
744
728
  return _regeneratorRuntime().wrap(function _callee10$(_context10) {
745
729
  while (1) switch (_context10.prev = _context10.next) {
746
730
  case 0:
@@ -758,14 +742,14 @@ var AO = /*#__PURE__*/function () {
758
742
  break;
759
743
  }
760
744
  _context10.next = 8;
761
- return _this3.res({
762
- pid: pid,
763
- mid: v.id
745
+ return _this3.result({
746
+ process: pid,
747
+ message: v.id
764
748
  });
765
749
  case 8:
766
- _res2 = _context10.sent;
767
- if (!hash) console.log(_res2);
768
- _txmap[v.id].res = _res2;
750
+ _res3 = _context10.sent;
751
+ if (!hash) console.log(_res3);
752
+ _txmap[v.id].res = _res3;
769
753
  case 11:
770
754
  if (!(!(0, _ramda.isNil)(_txmap[v.id].res) && _txmap[v.id].out !== true)) {
771
755
  _context10.next = 17;
@@ -806,35 +790,25 @@ var AO = /*#__PURE__*/function () {
806
790
  };
807
791
  }();
808
792
  res = null, out = null, results = [];
809
- _tags = (0, _utils.buildTags)(act, tags);
810
793
  start = Date.now();
811
- _context11.prev = 17;
812
- _context11.next = 20;
813
- return this.message({
814
- process: pid,
815
- signer: this.toSigner(jwk),
816
- tags: _tags,
817
- data: (0, _utils.jsonToStr)(data)
818
- });
819
- case 20:
820
- mid = _context11.sent;
794
+ _context11.prev = 7;
821
795
  if (!(0, _ramda.is)(Array, check)) check = [check];
822
796
  _context11.t0 = mid;
823
- _context11.next = 25;
797
+ _context11.next = 12;
824
798
  return this.ar.toAddr(jwk);
825
- case 25:
799
+ case 12:
826
800
  _context11.t1 = _context11.sent;
827
801
  _context11.t2 = {
828
802
  id: _context11.t0,
829
803
  from: _context11.t1
830
804
  };
831
805
  _txs = [_context11.t2];
832
- _context11.next = 30;
833
- return this.res({
834
- pid: pid,
835
- mid: mid
806
+ _context11.next = 17;
807
+ return this.result({
808
+ process: pid,
809
+ message: mid
836
810
  });
837
- case 30:
811
+ case 17:
838
812
  res = _context11.sent;
839
813
  hash = getHash(res);
840
814
  _txmap = _defineProperty({}, mid, {
@@ -846,131 +820,131 @@ var AO = /*#__PURE__*/function () {
846
820
  res: res
847
821
  });
848
822
  checked = false;
849
- case 35:
823
+ case 22:
850
824
  _iterator5 = _createForOfIteratorHelper(_txs);
851
- _context11.prev = 36;
825
+ _context11.prev = 23;
852
826
  _iterator5.s();
853
- case 38:
827
+ case 25:
854
828
  if ((_step5 = _iterator5.n()).done) {
855
- _context11.next = 52;
829
+ _context11.next = 39;
856
830
  break;
857
831
  }
858
832
  v = _step5.value;
859
833
  if (_txmap[v.id].checked) {
860
- _context11.next = 50;
834
+ _context11.next = 37;
861
835
  break;
862
836
  }
863
837
  _txmap[v.id].checked = true;
864
838
  if (!(0, _ramda.isNil)(_txmap[v.id].res)) {
865
- _context11.next = 47;
839
+ _context11.next = 34;
866
840
  break;
867
841
  }
868
- _context11.next = 45;
869
- return this.res({
870
- pid: pid,
871
- mid: v.id
842
+ _context11.next = 32;
843
+ return this.result({
844
+ process: pid,
845
+ message: v.id
872
846
  });
873
- case 45:
847
+ case 32:
874
848
  _res = _context11.sent;
875
849
  _txmap[v.id].res = _res;
876
- case 47:
850
+ case 34:
877
851
  if (!(0, _ramda.isNil)(check) && check.length > 0) {
878
852
  checked = (0, _utils.allChecked)(check, _txmap[v.id].res, v.from);
879
853
  } else {
880
854
  checked = true;
881
855
  }
882
856
  if (!checked) {
883
- _context11.next = 50;
857
+ _context11.next = 37;
884
858
  break;
885
859
  }
886
- return _context11.abrupt("break", 52);
887
- case 50:
888
- _context11.next = 38;
860
+ return _context11.abrupt("break", 39);
861
+ case 37:
862
+ _context11.next = 25;
889
863
  break;
890
- case 52:
891
- _context11.next = 57;
864
+ case 39:
865
+ _context11.next = 44;
892
866
  break;
893
- case 54:
894
- _context11.prev = 54;
895
- _context11.t3 = _context11["catch"](36);
867
+ case 41:
868
+ _context11.prev = 41;
869
+ _context11.t3 = _context11["catch"](23);
896
870
  _iterator5.e(_context11.t3);
897
- case 57:
898
- _context11.prev = 57;
871
+ case 44:
872
+ _context11.prev = 44;
899
873
  _iterator5.f();
900
- return _context11.finish(57);
901
- case 60:
874
+ return _context11.finish(44);
875
+ case 47:
902
876
  if (!checked) {
903
- _context11.next = 62;
877
+ _context11.next = 49;
904
878
  break;
905
879
  }
906
- return _context11.abrupt("break", 67);
907
- case 62:
908
- _context11.next = 64;
880
+ return _context11.abrupt("break", 54);
881
+ case 49:
882
+ _context11.next = 51;
909
883
  return (0, _utils.wait)(1000);
910
- case 64:
911
- _context11.next = 66;
884
+ case 51:
885
+ _context11.next = 53;
912
886
  return getNewTxs(pid, _txs, _txmap);
913
- case 66:
887
+ case 53:
914
888
  if (Date.now() - start < timeout) {
915
- _context11.next = 35;
889
+ _context11.next = 22;
916
890
  break;
917
891
  }
918
- case 67:
892
+ case 54:
919
893
  if (checked) {
920
- _context11.next = 71;
894
+ _context11.next = 58;
921
895
  break;
922
896
  }
923
897
  err = "something went wrong!";
924
- _context11.next = 95;
898
+ _context11.next = 82;
925
899
  break;
926
- case 71:
900
+ case 58:
927
901
  _context11.t4 = _utils.mergeOut;
928
902
  _context11.t5 = out;
929
- _context11.next = 75;
903
+ _context11.next = 62;
930
904
  return checkOut(get, _txs, _txmap, out);
931
- case 75:
905
+ case 62:
932
906
  _context11.t6 = _context11.sent;
933
907
  _context11.t7 = get;
934
908
  out = (0, _context11.t4)(_context11.t5, _context11.t6, _context11.t7);
935
909
  if (!(!(0, _utils.isOutComplete)(out, get) && !(0, _ramda.isNil)(get))) {
936
- _context11.next = 95;
910
+ _context11.next = 82;
937
911
  break;
938
912
  }
939
- case 79:
913
+ case 66:
940
914
  if (!(Date.now() - start < timeout)) {
941
- _context11.next = 95;
915
+ _context11.next = 82;
942
916
  break;
943
917
  }
944
- _context11.next = 82;
918
+ _context11.next = 69;
945
919
  return getNewTxs(pid, _txs, _txmap);
946
- case 82:
920
+ case 69:
947
921
  _context11.t8 = _utils.mergeOut;
948
922
  _context11.t9 = out;
949
- _context11.next = 86;
923
+ _context11.next = 73;
950
924
  return checkOut(get, _txs, _txmap, out);
951
- case 86:
925
+ case 73:
952
926
  _context11.t10 = _context11.sent;
953
927
  _context11.t11 = get;
954
928
  out = (0, _context11.t8)(_context11.t9, _context11.t10, _context11.t11);
955
929
  if (!(0, _utils.isOutComplete)(out, get)) {
956
- _context11.next = 91;
930
+ _context11.next = 78;
957
931
  break;
958
932
  }
959
- return _context11.abrupt("break", 95);
960
- case 91:
961
- _context11.next = 93;
933
+ return _context11.abrupt("break", 82);
934
+ case 78:
935
+ _context11.next = 80;
962
936
  return (0, _utils.wait)(1000);
963
- case 93:
964
- _context11.next = 79;
937
+ case 80:
938
+ _context11.next = 66;
965
939
  break;
966
- case 95:
967
- _context11.next = 100;
940
+ case 82:
941
+ _context11.next = 87;
968
942
  break;
969
- case 97:
970
- _context11.prev = 97;
971
- _context11.t12 = _context11["catch"](17);
943
+ case 84:
944
+ _context11.prev = 84;
945
+ _context11.t12 = _context11["catch"](7);
972
946
  err = _context11.t12;
973
- case 100:
947
+ case 87:
974
948
  return _context11.abrupt("return", {
975
949
  mid: mid,
976
950
  res: res,
@@ -978,13 +952,72 @@ var AO = /*#__PURE__*/function () {
978
952
  out: out,
979
953
  results: results
980
954
  });
981
- case 101:
955
+ case 88:
982
956
  case "end":
983
957
  return _context11.stop();
984
958
  }
985
- }, _callee11, this, [[17, 97], [36, 54, 57, 60]]);
959
+ }, _callee11, this, [[7, 84], [23, 41, 44, 47]]);
960
+ }));
961
+ function res(_x7) {
962
+ return _res2.apply(this, arguments);
963
+ }
964
+ return res;
965
+ }()
966
+ }, {
967
+ key: "msg",
968
+ value: function () {
969
+ var _msg = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12(_ref15) {
970
+ var pid, jwk, data, _ref15$act, act, _ref15$tags, tags, _ref15$check, check, get, _ref15$timeout, timeout, _ref15$mode, mode, _ref15$limit, limit, err, _yield$this$ar$checkW2, _tags, mid;
971
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
972
+ while (1) switch (_context12.prev = _context12.next) {
973
+ case 0:
974
+ pid = _ref15.pid, jwk = _ref15.jwk, data = _ref15.data, _ref15$act = _ref15.act, act = _ref15$act === void 0 ? "Eval" : _ref15$act, _ref15$tags = _ref15.tags, tags = _ref15$tags === void 0 ? {} : _ref15$tags, _ref15$check = _ref15.check, check = _ref15$check === void 0 ? [] : _ref15$check, get = _ref15.get, _ref15$timeout = _ref15.timeout, timeout = _ref15$timeout === void 0 ? 0 : _ref15$timeout, _ref15$mode = _ref15.mode, mode = _ref15$mode === void 0 ? "aoconnect" : _ref15$mode, _ref15$limit = _ref15.limit, limit = _ref15$limit === void 0 ? 25 : _ref15$limit;
975
+ _context12.next = 3;
976
+ return this.ar.checkWallet({
977
+ jwk: jwk
978
+ });
979
+ case 3:
980
+ _yield$this$ar$checkW2 = _context12.sent;
981
+ jwk = _yield$this$ar$checkW2.jwk;
982
+ err = _yield$this$ar$checkW2.err;
983
+ if (!err) {
984
+ _context12.next = 8;
985
+ break;
986
+ }
987
+ return _context12.abrupt("return", {
988
+ err: err
989
+ });
990
+ case 8:
991
+ _tags = (0, _utils.buildTags)(act, tags);
992
+ _context12.next = 11;
993
+ return this.message({
994
+ process: pid,
995
+ signer: this.toSigner(jwk),
996
+ tags: _tags,
997
+ data: (0, _utils.jsonToStr)(data)
998
+ });
999
+ case 11:
1000
+ mid = _context12.sent;
1001
+ _context12.next = 14;
1002
+ return this.res({
1003
+ pid: pid,
1004
+ mid: mid,
1005
+ jwk: jwk,
1006
+ check: check,
1007
+ get: get,
1008
+ timeout: timeout,
1009
+ mode: mode,
1010
+ limit: limit
1011
+ });
1012
+ case 14:
1013
+ return _context12.abrupt("return", _context12.sent);
1014
+ case 15:
1015
+ case "end":
1016
+ return _context12.stop();
1017
+ }
1018
+ }, _callee12, this);
986
1019
  }));
987
- function msg(_x7) {
1020
+ function msg(_x15) {
988
1021
  return _msg.apply(this, arguments);
989
1022
  }
990
1023
  return msg;
@@ -992,60 +1025,60 @@ var AO = /*#__PURE__*/function () {
992
1025
  }, {
993
1026
  key: "asgn",
994
1027
  value: function () {
995
- var _asgn = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12(_ref15) {
996
- var pid, mid, jwk, _ref15$check, check, get, err, _yield$this$ar$checkW3, res, out;
997
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
998
- while (1) switch (_context12.prev = _context12.next) {
1028
+ var _asgn = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13(_ref16) {
1029
+ var pid, mid, jwk, _ref16$check, check, get, err, _yield$this$ar$checkW3, res, out;
1030
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
1031
+ while (1) switch (_context13.prev = _context13.next) {
999
1032
  case 0:
1000
- pid = _ref15.pid, mid = _ref15.mid, jwk = _ref15.jwk, _ref15$check = _ref15.check, check = _ref15$check === void 0 ? [] : _ref15$check, get = _ref15.get;
1033
+ pid = _ref16.pid, mid = _ref16.mid, jwk = _ref16.jwk, _ref16$check = _ref16.check, check = _ref16$check === void 0 ? [] : _ref16$check, get = _ref16.get;
1001
1034
  err = null;
1002
- _context12.next = 4;
1035
+ _context13.next = 4;
1003
1036
  return this.ar.checkWallet({
1004
1037
  jwk: jwk
1005
1038
  });
1006
1039
  case 4:
1007
- _yield$this$ar$checkW3 = _context12.sent;
1040
+ _yield$this$ar$checkW3 = _context13.sent;
1008
1041
  jwk = _yield$this$ar$checkW3.jwk;
1009
1042
  err = _yield$this$ar$checkW3.err;
1010
1043
  if (!err) {
1011
- _context12.next = 9;
1044
+ _context13.next = 9;
1012
1045
  break;
1013
1046
  }
1014
- return _context12.abrupt("return", {
1047
+ return _context13.abrupt("return", {
1015
1048
  err: err
1016
1049
  });
1017
1050
  case 9:
1018
1051
  res = null, out = null;
1019
- _context12.prev = 10;
1020
- _context12.next = 13;
1052
+ _context13.prev = 10;
1053
+ _context13.next = 13;
1021
1054
  return this.assign({
1022
1055
  process: pid,
1023
1056
  message: mid,
1024
1057
  signer: this.toSigner(jwk)
1025
1058
  });
1026
1059
  case 13:
1027
- mid = _context12.sent;
1028
- _context12.next = 16;
1029
- return this.res({
1030
- pid: pid,
1031
- mid: mid
1060
+ mid = _context13.sent;
1061
+ _context13.next = 16;
1062
+ return this.result({
1063
+ process: pid,
1064
+ message: mid
1032
1065
  });
1033
1066
  case 16:
1034
- res = _context12.sent;
1067
+ res = _context13.sent;
1035
1068
  if (!res) err = "something went wrong";
1036
1069
  if (res.Error) err = res.Error;else {
1037
1070
  if (!(0, _ramda.is)(Array, check)) check = [check];
1038
1071
  if (!(0, _utils.allChecked)(check, res)) err = "something went wrong";
1039
1072
  if (!err && !(0, _ramda.isNil)(get)) out = (0, _utils.getTagVal)(get, res); // todo: from
1040
1073
  }
1041
- _context12.next = 24;
1074
+ _context13.next = 24;
1042
1075
  break;
1043
1076
  case 21:
1044
- _context12.prev = 21;
1045
- _context12.t0 = _context12["catch"](10);
1046
- err = _context12.t0;
1077
+ _context13.prev = 21;
1078
+ _context13.t0 = _context13["catch"](10);
1079
+ err = _context13.t0;
1047
1080
  case 24:
1048
- return _context12.abrupt("return", {
1081
+ return _context13.abrupt("return", {
1049
1082
  mid: mid,
1050
1083
  res: res,
1051
1084
  err: err,
@@ -1053,11 +1086,11 @@ var AO = /*#__PURE__*/function () {
1053
1086
  });
1054
1087
  case 25:
1055
1088
  case "end":
1056
- return _context12.stop();
1089
+ return _context13.stop();
1057
1090
  }
1058
- }, _callee12, this, [[10, 21]]);
1091
+ }, _callee13, this, [[10, 21]]);
1059
1092
  }));
1060
- function asgn(_x15) {
1093
+ function asgn(_x16) {
1061
1094
  return _asgn.apply(this, arguments);
1062
1095
  }
1063
1096
  return asgn;
@@ -1065,33 +1098,33 @@ var AO = /*#__PURE__*/function () {
1065
1098
  }, {
1066
1099
  key: "dry",
1067
1100
  value: function () {
1068
- var _dry = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13(_ref16) {
1069
- var pid, jwk, data, _ref16$act, act, _ref16$tags, tags, _ref16$check, check, get, err, _yield$this$ar$checkW4, res, out, _tags, _res, checks;
1070
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
1071
- while (1) switch (_context13.prev = _context13.next) {
1101
+ var _dry = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee14(_ref17) {
1102
+ var pid, jwk, data, _ref17$act, act, _ref17$tags, tags, _ref17$check, check, get, err, _yield$this$ar$checkW4, res, out, _tags, _res, checks;
1103
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1104
+ while (1) switch (_context14.prev = _context14.next) {
1072
1105
  case 0:
1073
- pid = _ref16.pid, jwk = _ref16.jwk, data = _ref16.data, _ref16$act = _ref16.act, act = _ref16$act === void 0 ? "Eval" : _ref16$act, _ref16$tags = _ref16.tags, tags = _ref16$tags === void 0 ? {} : _ref16$tags, _ref16$check = _ref16.check, check = _ref16$check === void 0 ? [] : _ref16$check, get = _ref16.get;
1106
+ pid = _ref17.pid, jwk = _ref17.jwk, data = _ref17.data, _ref17$act = _ref17.act, act = _ref17$act === void 0 ? "Eval" : _ref17$act, _ref17$tags = _ref17.tags, tags = _ref17$tags === void 0 ? {} : _ref17$tags, _ref17$check = _ref17.check, check = _ref17$check === void 0 ? [] : _ref17$check, get = _ref17.get;
1074
1107
  err = null;
1075
- _context13.next = 4;
1108
+ _context14.next = 4;
1076
1109
  return this.ar.checkWallet({
1077
1110
  jwk: jwk
1078
1111
  });
1079
1112
  case 4:
1080
- _yield$this$ar$checkW4 = _context13.sent;
1113
+ _yield$this$ar$checkW4 = _context14.sent;
1081
1114
  jwk = _yield$this$ar$checkW4.jwk;
1082
1115
  err = _yield$this$ar$checkW4.err;
1083
1116
  if (!err) {
1084
- _context13.next = 9;
1117
+ _context14.next = 9;
1085
1118
  break;
1086
1119
  }
1087
- return _context13.abrupt("return", {
1120
+ return _context14.abrupt("return", {
1088
1121
  err: err
1089
1122
  });
1090
1123
  case 9:
1091
1124
  res = null, out = null;
1092
1125
  _tags = (0, _utils.buildTags)(act, tags);
1093
- _context13.prev = 11;
1094
- _context13.next = 14;
1126
+ _context14.prev = 11;
1127
+ _context14.next = 14;
1095
1128
  return this.dryrun({
1096
1129
  process: pid,
1097
1130
  signer: this.toSigner(jwk),
@@ -1099,124 +1132,155 @@ var AO = /*#__PURE__*/function () {
1099
1132
  data: (0, _utils.jsonToStr)(data)
1100
1133
  });
1101
1134
  case 14:
1102
- _res = _context13.sent;
1135
+ _res = _context14.sent;
1103
1136
  res = _res;
1104
1137
  checks = [];
1105
1138
  if (!(0, _ramda.is)(Array, check)) check = [check];
1106
1139
  if (!(0, _utils.allChecked)(check, res)) err = "something went wrong";
1107
1140
  if (!err && !(0, _ramda.isNil)(get)) out = (0, _utils.getTagVal)(get, res);
1108
- _context13.next = 25;
1141
+ _context14.next = 25;
1109
1142
  break;
1110
1143
  case 22:
1111
- _context13.prev = 22;
1112
- _context13.t0 = _context13["catch"](11);
1113
- err = _context13.t0;
1144
+ _context14.prev = 22;
1145
+ _context14.t0 = _context14["catch"](11);
1146
+ err = _context14.t0;
1114
1147
  case 25:
1115
- return _context13.abrupt("return", {
1148
+ return _context14.abrupt("return", {
1116
1149
  res: res,
1117
1150
  err: err,
1118
1151
  out: out
1119
1152
  });
1120
1153
  case 26:
1121
1154
  case "end":
1122
- return _context13.stop();
1155
+ return _context14.stop();
1123
1156
  }
1124
- }, _callee13, this, [[11, 22]]);
1157
+ }, _callee14, this, [[11, 22]]);
1125
1158
  }));
1126
- function dry(_x16) {
1159
+ function dry(_x17) {
1127
1160
  return _dry.apply(this, arguments);
1128
1161
  }
1129
1162
  return dry;
1130
1163
  }()
1131
1164
  }, {
1132
- key: "res",
1165
+ key: "ress",
1133
1166
  value: function () {
1134
- var _res3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee14(_ref17) {
1135
- var pid, mid, limit, asc, from, to, sort, _res4;
1136
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1137
- while (1) switch (_context14.prev = _context14.next) {
1167
+ var _ress = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee16(_ref18) {
1168
+ var _this4 = this;
1169
+ var pid, limit, asc, cursor, err, msgs, next, res, sort;
1170
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1171
+ while (1) switch (_context16.prev = _context16.next) {
1138
1172
  case 0:
1139
- pid = _ref17.pid, mid = _ref17.mid, limit = _ref17.limit, asc = _ref17.asc, from = _ref17.from, to = _ref17.to;
1140
- if (mid) {
1141
- _context14.next = 11;
1142
- break;
1143
- }
1173
+ pid = _ref18.pid, limit = _ref18.limit, asc = _ref18.asc, cursor = _ref18.cursor;
1174
+ err = null;
1175
+ msgs = null;
1176
+ next = null;
1177
+ res = null;
1178
+ _context16.prev = 5;
1144
1179
  sort = asc ? "ASC" : "DESC";
1145
- _context14.next = 5;
1180
+ _context16.next = 9;
1146
1181
  return this.results({
1147
1182
  process: pid,
1148
1183
  limit: limit,
1149
1184
  sort: sort,
1150
- from: from,
1151
- to: to
1185
+ cursor: cursor
1152
1186
  });
1153
- case 5:
1154
- _res4 = _context14.sent;
1155
- if (_res4.edges) {
1156
- _context14.next = 8;
1187
+ case 9:
1188
+ res = _context16.sent;
1189
+ if (res.edges) {
1190
+ _context16.next = 12;
1157
1191
  break;
1158
1192
  }
1159
- return _context14.abrupt("return", null);
1160
- case 8:
1161
- return _context14.abrupt("return", (0, _ramda.map)(function (v) {
1193
+ return _context16.abrupt("return", null);
1194
+ case 12:
1195
+ msgs = (0, _ramda.map)(function (v) {
1162
1196
  return _objectSpread({
1163
1197
  cursor: v.cursor
1164
1198
  }, v.node);
1165
- })(_res4.edges));
1166
- case 11:
1167
- _context14.next = 13;
1168
- return this.result({
1169
- process: pid,
1170
- message: mid
1199
+ })(res.edges);
1200
+ if (res.page_info.has_next_page) {
1201
+ next = /*#__PURE__*/function () {
1202
+ var _ref19 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
1203
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1204
+ while (1) switch (_context15.prev = _context15.next) {
1205
+ case 0:
1206
+ _context15.next = 2;
1207
+ return _this4.results({
1208
+ process: pid,
1209
+ limit: limit,
1210
+ sort: sort,
1211
+ cursor: (0, _ramda.last)(res.edges).cursor
1212
+ });
1213
+ case 2:
1214
+ return _context15.abrupt("return", _context15.sent);
1215
+ case 3:
1216
+ case "end":
1217
+ return _context15.stop();
1218
+ }
1219
+ }, _callee15);
1220
+ }));
1221
+ return function next() {
1222
+ return _ref19.apply(this, arguments);
1223
+ };
1224
+ }();
1225
+ }
1226
+ _context16.next = 19;
1227
+ break;
1228
+ case 16:
1229
+ _context16.prev = 16;
1230
+ _context16.t0 = _context16["catch"](5);
1231
+ err = _context16.t0;
1232
+ case 19:
1233
+ return _context16.abrupt("return", {
1234
+ err: err,
1235
+ out: msgs,
1236
+ res: res
1171
1237
  });
1172
- case 13:
1173
- return _context14.abrupt("return", _context14.sent);
1174
- case 14:
1238
+ case 20:
1175
1239
  case "end":
1176
- return _context14.stop();
1240
+ return _context16.stop();
1177
1241
  }
1178
- }, _callee14, this);
1242
+ }, _callee16, this, [[5, 16]]);
1179
1243
  }));
1180
- function res(_x17) {
1181
- return _res3.apply(this, arguments);
1244
+ function ress(_x18) {
1245
+ return _ress.apply(this, arguments);
1182
1246
  }
1183
- return res;
1247
+ return ress;
1184
1248
  }()
1185
1249
  }, {
1186
1250
  key: "eval",
1187
1251
  value: function () {
1188
- var _eval2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee15(_ref18) {
1252
+ var _eval2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee17(_ref20) {
1189
1253
  var pid, jwk, data, fns;
1190
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1191
- while (1) switch (_context15.prev = _context15.next) {
1254
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1255
+ while (1) switch (_context17.prev = _context17.next) {
1192
1256
  case 0:
1193
- pid = _ref18.pid, jwk = _ref18.jwk, data = _ref18.data;
1257
+ pid = _ref20.pid, jwk = _ref20.jwk, data = _ref20.data;
1194
1258
  fns = [{
1195
1259
  args: {
1196
1260
  pid: pid,
1197
1261
  data: data,
1198
1262
  act: "Eval"
1199
1263
  },
1200
- err: function err(_ref19) {
1264
+ err: function err(_ref21) {
1201
1265
  var _res$Output, _res$Output2, _res$Output3;
1202
- var res = _ref19.res;
1266
+ var res = _ref21.res;
1203
1267
  return _typeof(res === null || res === void 0 || (_res$Output = res.Output) === null || _res$Output === void 0 ? void 0 : _res$Output.data) !== "object" && !(typeof (res === null || res === void 0 || (_res$Output2 = res.Output) === null || _res$Output2 === void 0 ? void 0 : _res$Output2.prompt) === "string" && /aos\-/.test(res === null || res === void 0 || (_res$Output3 = res.Output) === null || _res$Output3 === void 0 ? void 0 : _res$Output3.prompt));
1204
1268
  }
1205
1269
  }];
1206
- _context15.next = 4;
1270
+ _context17.next = 4;
1207
1271
  return this.pipe({
1208
1272
  jwk: jwk,
1209
1273
  fns: fns
1210
1274
  });
1211
1275
  case 4:
1212
- return _context15.abrupt("return", _context15.sent);
1276
+ return _context17.abrupt("return", _context17.sent);
1213
1277
  case 5:
1214
1278
  case "end":
1215
- return _context15.stop();
1279
+ return _context17.stop();
1216
1280
  }
1217
- }, _callee15, this);
1281
+ }, _callee17, this);
1218
1282
  }));
1219
- function _eval(_x18) {
1283
+ function _eval(_x19) {
1220
1284
  return _eval2.apply(this, arguments);
1221
1285
  }
1222
1286
  return _eval;
@@ -1224,27 +1288,27 @@ var AO = /*#__PURE__*/function () {
1224
1288
  }, {
1225
1289
  key: "transform",
1226
1290
  value: function () {
1227
- var _transform = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee16(_ref20) {
1291
+ var _transform = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee18(_ref22) {
1228
1292
  var src, data, fills, err, out, _data, k, text;
1229
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1230
- while (1) switch (_context16.prev = _context16.next) {
1293
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1294
+ while (1) switch (_context18.prev = _context18.next) {
1231
1295
  case 0:
1232
- src = _ref20.src, data = _ref20.data, fills = _ref20.fills;
1296
+ src = _ref22.src, data = _ref22.data, fills = _ref22.fills;
1233
1297
  err = null, out = null;
1234
1298
  if (!(data !== null && data !== void 0)) {
1235
- _context16.next = 6;
1299
+ _context18.next = 6;
1236
1300
  break;
1237
1301
  }
1238
- _context16.t0 = data;
1239
- _context16.next = 9;
1302
+ _context18.t0 = data;
1303
+ _context18.next = 9;
1240
1304
  break;
1241
1305
  case 6:
1242
- _context16.next = 8;
1306
+ _context18.next = 8;
1243
1307
  return this.ar.data(src, true);
1244
1308
  case 8:
1245
- _context16.t0 = _context16.sent;
1309
+ _context18.t0 = _context18.sent;
1246
1310
  case 9:
1247
- _data = _context16.t0;
1311
+ _data = _context18.t0;
1248
1312
  if (!_data) err = "data doesn't exist";else {
1249
1313
  for (k in fills !== null && fills !== void 0 ? fills : {}) {
1250
1314
  text = fills[k];
@@ -1253,17 +1317,17 @@ var AO = /*#__PURE__*/function () {
1253
1317
  }
1254
1318
  out = _data;
1255
1319
  }
1256
- return _context16.abrupt("return", {
1320
+ return _context18.abrupt("return", {
1257
1321
  err: err,
1258
1322
  out: out
1259
1323
  });
1260
1324
  case 12:
1261
1325
  case "end":
1262
- return _context16.stop();
1326
+ return _context18.stop();
1263
1327
  }
1264
- }, _callee16, this);
1328
+ }, _callee18, this);
1265
1329
  }));
1266
- function transform(_x19) {
1330
+ function transform(_x20) {
1267
1331
  return _transform.apply(this, arguments);
1268
1332
  }
1269
1333
  return transform;
@@ -1271,12 +1335,12 @@ var AO = /*#__PURE__*/function () {
1271
1335
  }, {
1272
1336
  key: "load",
1273
1337
  value: function () {
1274
- var _load = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee17(_ref21) {
1338
+ var _load = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee19(_ref23) {
1275
1339
  var src, data, fills, pid, jwk, fns;
1276
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1277
- while (1) switch (_context17.prev = _context17.next) {
1340
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1341
+ while (1) switch (_context19.prev = _context19.next) {
1278
1342
  case 0:
1279
- src = _ref21.src, data = _ref21.data, fills = _ref21.fills, pid = _ref21.pid, jwk = _ref21.jwk;
1343
+ src = _ref23.src, data = _ref23.data, fills = _ref23.fills, pid = _ref23.pid, jwk = _ref23.jwk;
1280
1344
  fns = [{
1281
1345
  fn: this.transform,
1282
1346
  args: {
@@ -1293,20 +1357,20 @@ var AO = /*#__PURE__*/function () {
1293
1357
  pid: pid
1294
1358
  }
1295
1359
  }];
1296
- _context17.next = 4;
1360
+ _context19.next = 4;
1297
1361
  return this.pipe({
1298
1362
  jwk: jwk,
1299
1363
  fns: fns
1300
1364
  });
1301
1365
  case 4:
1302
- return _context17.abrupt("return", _context17.sent);
1366
+ return _context19.abrupt("return", _context19.sent);
1303
1367
  case 5:
1304
1368
  case "end":
1305
- return _context17.stop();
1369
+ return _context19.stop();
1306
1370
  }
1307
- }, _callee17, this);
1371
+ }, _callee19, this);
1308
1372
  }));
1309
- function load(_x20) {
1373
+ function load(_x21) {
1310
1374
  return _load.apply(this, arguments);
1311
1375
  }
1312
1376
  return load;
@@ -1314,66 +1378,66 @@ var AO = /*#__PURE__*/function () {
1314
1378
  }, {
1315
1379
  key: "wait",
1316
1380
  value: function () {
1317
- var _wait2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee18(_ref22) {
1318
- var pid, _ref22$attempts, attempts, exist, err, _yield$this$dry, res, _err;
1319
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1320
- while (1) switch (_context18.prev = _context18.next) {
1381
+ var _wait2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee20(_ref24) {
1382
+ var pid, _ref24$attempts, attempts, exist, err, _yield$this$dry, res, _err;
1383
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1384
+ while (1) switch (_context20.prev = _context20.next) {
1321
1385
  case 0:
1322
- pid = _ref22.pid, _ref22$attempts = _ref22.attempts, attempts = _ref22$attempts === void 0 ? 10 : _ref22$attempts;
1386
+ pid = _ref24.pid, _ref24$attempts = _ref24.attempts, attempts = _ref24$attempts === void 0 ? 10 : _ref24$attempts;
1323
1387
  exist = false;
1324
1388
  err = null;
1325
1389
  case 3:
1326
1390
  if (!(attempts > 0)) {
1327
- _context18.next = 20;
1391
+ _context20.next = 20;
1328
1392
  break;
1329
1393
  }
1330
1394
  if (this.in_memory) {
1331
- _context18.next = 7;
1395
+ _context20.next = 7;
1332
1396
  break;
1333
1397
  }
1334
- _context18.next = 7;
1398
+ _context20.next = 7;
1335
1399
  return (0, _utils.wait)(1000);
1336
1400
  case 7:
1337
- _context18.next = 9;
1401
+ _context20.next = 9;
1338
1402
  return this.dry({
1339
1403
  pid: pid,
1340
1404
  data: "#Inbox"
1341
1405
  });
1342
1406
  case 9:
1343
- _yield$this$dry = _context18.sent;
1407
+ _yield$this$dry = _context20.sent;
1344
1408
  res = _yield$this$dry.res;
1345
1409
  _err = _yield$this$dry.err;
1346
1410
  if (!(res !== null && res !== void 0 && res.error)) {
1347
- _context18.next = 14;
1411
+ _context20.next = 14;
1348
1412
  break;
1349
1413
  }
1350
- return _context18.abrupt("return", {
1414
+ return _context20.abrupt("return", {
1351
1415
  err: res.error,
1352
1416
  pid: pid
1353
1417
  });
1354
1418
  case 14:
1355
1419
  if (!(_typeof(res === null || res === void 0 ? void 0 : res.Output) === "object")) {
1356
- _context18.next = 16;
1420
+ _context20.next = 16;
1357
1421
  break;
1358
1422
  }
1359
- return _context18.abrupt("break", 20);
1423
+ return _context20.abrupt("break", 20);
1360
1424
  case 16:
1361
1425
  attempts -= 1;
1362
1426
  if (attempts === 0) err = "timeout";
1363
- _context18.next = 3;
1427
+ _context20.next = 3;
1364
1428
  break;
1365
1429
  case 20:
1366
- return _context18.abrupt("return", {
1430
+ return _context20.abrupt("return", {
1367
1431
  err: err,
1368
1432
  pid: pid
1369
1433
  });
1370
1434
  case 21:
1371
1435
  case "end":
1372
- return _context18.stop();
1436
+ return _context20.stop();
1373
1437
  }
1374
- }, _callee18, this);
1438
+ }, _callee20, this);
1375
1439
  }));
1376
- function wait(_x21) {
1440
+ function wait(_x22) {
1377
1441
  return _wait2.apply(this, arguments);
1378
1442
  }
1379
1443
  return wait;
@@ -1381,13 +1445,13 @@ var AO = /*#__PURE__*/function () {
1381
1445
  }, {
1382
1446
  key: "attest",
1383
1447
  value: function () {
1384
- var _attest = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee19(_ref23) {
1448
+ var _attest = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee21(_ref25) {
1385
1449
  var id, jwk, tags;
1386
- return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1387
- while (1) switch (_context19.prev = _context19.next) {
1450
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1451
+ while (1) switch (_context21.prev = _context21.next) {
1388
1452
  case 0:
1389
- id = _ref23.id, jwk = _ref23.jwk, tags = _ref23.tags;
1390
- _context19.next = 3;
1453
+ id = _ref25.id, jwk = _ref25.jwk, tags = _ref25.tags;
1454
+ _context21.next = 3;
1391
1455
  return this.ar.post({
1392
1456
  tags: (0, _ramda.mergeLeft)(tags, {
1393
1457
  "Data-Protocol": "ao",
@@ -1397,14 +1461,14 @@ var AO = /*#__PURE__*/function () {
1397
1461
  jwk: jwk
1398
1462
  });
1399
1463
  case 3:
1400
- return _context19.abrupt("return", _context19.sent);
1464
+ return _context21.abrupt("return", _context21.sent);
1401
1465
  case 4:
1402
1466
  case "end":
1403
- return _context19.stop();
1467
+ return _context21.stop();
1404
1468
  }
1405
- }, _callee19, this);
1469
+ }, _callee21, this);
1406
1470
  }));
1407
- function attest(_x22) {
1471
+ function attest(_x23) {
1408
1472
  return _attest.apply(this, arguments);
1409
1473
  }
1410
1474
  return attest;
@@ -1412,13 +1476,13 @@ var AO = /*#__PURE__*/function () {
1412
1476
  }, {
1413
1477
  key: "avail",
1414
1478
  value: function () {
1415
- var _avail = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee20(_ref24) {
1479
+ var _avail = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee22(_ref26) {
1416
1480
  var ids, jwk, tags;
1417
- return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1418
- while (1) switch (_context20.prev = _context20.next) {
1481
+ return _regeneratorRuntime().wrap(function _callee22$(_context22) {
1482
+ while (1) switch (_context22.prev = _context22.next) {
1419
1483
  case 0:
1420
- ids = _ref24.ids, jwk = _ref24.jwk, tags = _ref24.tags;
1421
- _context20.next = 3;
1484
+ ids = _ref26.ids, jwk = _ref26.jwk, tags = _ref26.tags;
1485
+ _context22.next = 3;
1422
1486
  return this.ar.post({
1423
1487
  tags: (0, _ramda.mergeLeft)(tags, {
1424
1488
  "Data-Protocol": "WeaveDrive",
@@ -1429,14 +1493,14 @@ var AO = /*#__PURE__*/function () {
1429
1493
  jwk: jwk
1430
1494
  });
1431
1495
  case 3:
1432
- return _context20.abrupt("return", _context20.sent);
1496
+ return _context22.abrupt("return", _context22.sent);
1433
1497
  case 4:
1434
1498
  case "end":
1435
- return _context20.stop();
1499
+ return _context22.stop();
1436
1500
  }
1437
- }, _callee20, this);
1501
+ }, _callee22, this);
1438
1502
  }));
1439
- function avail(_x23) {
1503
+ function avail(_x24) {
1440
1504
  return _avail.apply(this, arguments);
1441
1505
  }
1442
1506
  return avail;
@@ -1444,12 +1508,12 @@ var AO = /*#__PURE__*/function () {
1444
1508
  }, {
1445
1509
  key: "deploy",
1446
1510
  value: function () {
1447
- var _deploy = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee21(_ref25) {
1448
- var boot, loads, src, src_data, _ref25$fills, fills, _ref25$module, module, _ref25$scheduler, scheduler, jwk, _ref25$tags, tags, data, fns, isBoot, i, _iterator6, _step6, v, args, result;
1449
- return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1450
- while (1) switch (_context21.prev = _context21.next) {
1511
+ var _deploy = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee23(_ref27) {
1512
+ var boot, loads, src, src_data, _ref27$fills, fills, _ref27$module, module, _ref27$scheduler, scheduler, jwk, _ref27$tags, tags, data, fns, isBoot, i, _iterator6, _step6, v, args, result;
1513
+ return _regeneratorRuntime().wrap(function _callee23$(_context23) {
1514
+ while (1) switch (_context23.prev = _context23.next) {
1451
1515
  case 0:
1452
- boot = _ref25.boot, loads = _ref25.loads, src = _ref25.src, src_data = _ref25.src_data, _ref25$fills = _ref25.fills, fills = _ref25$fills === void 0 ? {} : _ref25$fills, _ref25$module = _ref25.module, module = _ref25$module === void 0 ? this.module : _ref25$module, _ref25$scheduler = _ref25.scheduler, scheduler = _ref25$scheduler === void 0 ? this.scheduler : _ref25$scheduler, jwk = _ref25.jwk, _ref25$tags = _ref25.tags, tags = _ref25$tags === void 0 ? {} : _ref25$tags, data = _ref25.data;
1516
+ boot = _ref27.boot, loads = _ref27.loads, src = _ref27.src, src_data = _ref27.src_data, _ref27$fills = _ref27.fills, fills = _ref27$fills === void 0 ? {} : _ref27$fills, _ref27$module = _ref27.module, module = _ref27$module === void 0 ? this.module : _ref27$module, _ref27$scheduler = _ref27.scheduler, scheduler = _ref27$scheduler === void 0 ? this.scheduler : _ref27$scheduler, jwk = _ref27.jwk, _ref27$tags = _ref27.tags, tags = _ref27$tags === void 0 ? {} : _ref27$tags, data = _ref27.data;
1453
1517
  fns = [], isBoot = false;
1454
1518
  if (boot === true && !data) {
1455
1519
  isBoot = true;
@@ -1525,26 +1589,142 @@ var AO = /*#__PURE__*/function () {
1525
1589
  } finally {
1526
1590
  _iterator6.f();
1527
1591
  }
1528
- _context21.next = 9;
1592
+ _context23.next = 9;
1529
1593
  return this.pipe({
1530
1594
  jwk: jwk,
1531
1595
  fns: fns
1532
1596
  });
1533
1597
  case 9:
1534
- result = _context21.sent;
1598
+ result = _context23.sent;
1535
1599
  if (result.pid) result.p = this.p(result.pid);
1536
- return _context21.abrupt("return", result);
1600
+ return _context23.abrupt("return", result);
1537
1601
  case 12:
1538
1602
  case "end":
1539
- return _context21.stop();
1603
+ return _context23.stop();
1540
1604
  }
1541
- }, _callee21, this);
1605
+ }, _callee23, this);
1542
1606
  }));
1543
- function deploy(_x24) {
1607
+ function deploy(_x25) {
1544
1608
  return _deploy.apply(this, arguments);
1545
1609
  }
1546
1610
  return deploy;
1547
1611
  }()
1612
+ }, {
1613
+ key: "var",
1614
+ value: function () {
1615
+ var _var2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee24(_ref28) {
1616
+ var pid, data, _ref28$json, json, _ref28$pretty, pretty, _yield$this$dry2, _var3, _yield$this$dry3, _var4;
1617
+ return _regeneratorRuntime().wrap(function _callee24$(_context24) {
1618
+ while (1) switch (_context24.prev = _context24.next) {
1619
+ case 0:
1620
+ pid = _ref28.pid, data = _ref28.data, _ref28$json = _ref28.json, json = _ref28$json === void 0 ? true : _ref28$json, _ref28$pretty = _ref28.pretty, pretty = _ref28$pretty === void 0 ? false : _ref28$pretty;
1621
+ if (!json) {
1622
+ _context24.next = 31;
1623
+ break;
1624
+ }
1625
+ _context24.next = 4;
1626
+ return this.dry({
1627
+ data: "require(\"json\").encode(".concat(data, ")"),
1628
+ pid: pid
1629
+ });
1630
+ case 4:
1631
+ _context24.t3 = _yield$this$dry2 = _context24.sent;
1632
+ _context24.t2 = _context24.t3 === null;
1633
+ if (_context24.t2) {
1634
+ _context24.next = 8;
1635
+ break;
1636
+ }
1637
+ _context24.t2 = _yield$this$dry2 === void 0;
1638
+ case 8:
1639
+ _context24.t1 = _context24.t2;
1640
+ if (_context24.t1) {
1641
+ _context24.next = 11;
1642
+ break;
1643
+ }
1644
+ _context24.t1 = (_yield$this$dry2 = _yield$this$dry2.res) === null || _yield$this$dry2 === void 0;
1645
+ case 11:
1646
+ _context24.t0 = _context24.t1;
1647
+ if (_context24.t0) {
1648
+ _context24.next = 14;
1649
+ break;
1650
+ }
1651
+ _context24.t0 = (_yield$this$dry2 = _yield$this$dry2.Output) === null || _yield$this$dry2 === void 0;
1652
+ case 14:
1653
+ if (!_context24.t0) {
1654
+ _context24.next = 18;
1655
+ break;
1656
+ }
1657
+ _context24.t4 = void 0;
1658
+ _context24.next = 19;
1659
+ break;
1660
+ case 18:
1661
+ _context24.t4 = _yield$this$dry2.data;
1662
+ case 19:
1663
+ _var3 = _context24.t4;
1664
+ if (!_var3) {
1665
+ _context24.next = 28;
1666
+ break;
1667
+ }
1668
+ _context24.prev = 21;
1669
+ return _context24.abrupt("return", JSON.parse(strip(_var3)));
1670
+ case 25:
1671
+ _context24.prev = 25;
1672
+ _context24.t5 = _context24["catch"](21);
1673
+ return _context24.abrupt("return", strip(_var3));
1674
+ case 28:
1675
+ return _context24.abrupt("return", _var3);
1676
+ case 31:
1677
+ _context24.next = 33;
1678
+ return this.dry({
1679
+ data: data,
1680
+ pid: pid
1681
+ });
1682
+ case 33:
1683
+ _context24.t9 = _yield$this$dry3 = _context24.sent;
1684
+ _context24.t8 = _context24.t9 === null;
1685
+ if (_context24.t8) {
1686
+ _context24.next = 37;
1687
+ break;
1688
+ }
1689
+ _context24.t8 = _yield$this$dry3 === void 0;
1690
+ case 37:
1691
+ _context24.t7 = _context24.t8;
1692
+ if (_context24.t7) {
1693
+ _context24.next = 40;
1694
+ break;
1695
+ }
1696
+ _context24.t7 = (_yield$this$dry3 = _yield$this$dry3.res) === null || _yield$this$dry3 === void 0;
1697
+ case 40:
1698
+ _context24.t6 = _context24.t7;
1699
+ if (_context24.t6) {
1700
+ _context24.next = 43;
1701
+ break;
1702
+ }
1703
+ _context24.t6 = (_yield$this$dry3 = _yield$this$dry3.Output) === null || _yield$this$dry3 === void 0;
1704
+ case 43:
1705
+ if (!_context24.t6) {
1706
+ _context24.next = 47;
1707
+ break;
1708
+ }
1709
+ _context24.t10 = void 0;
1710
+ _context24.next = 48;
1711
+ break;
1712
+ case 47:
1713
+ _context24.t10 = _yield$this$dry3.data;
1714
+ case 48:
1715
+ _var4 = _context24.t10;
1716
+ return _context24.abrupt("return", pretty ? _var4 : strip(_var4));
1717
+ case 50:
1718
+ case "end":
1719
+ return _context24.stop();
1720
+ }
1721
+ }, _callee24, this, [[21, 25]]);
1722
+ }));
1723
+ function _var(_x26) {
1724
+ return _var2.apply(this, arguments);
1725
+ }
1726
+ return _var;
1727
+ }()
1548
1728
  }, {
1549
1729
  key: "p",
1550
1730
  value: function p(pid) {
@@ -1552,10 +1732,13 @@ var AO = /*#__PURE__*/function () {
1552
1732
  }
1553
1733
  }]);
1554
1734
  }();
1735
+ function strip(str) {
1736
+ return str.replace(/\x1B\[[0-9;]*[JKmsu]/g, "");
1737
+ }
1555
1738
  var getParams = function getParams(tags, opts) {
1556
1739
  var _tags = tags;
1557
1740
  var _opts = opts;
1558
- if ((!(0, _ramda.isNil)(tags === null || tags === void 0 ? void 0 : tags.get) || !(0, _ramda.isNil)(tags === null || tags === void 0 ? void 0 : tags.check) || !(0, _ramda.isNil)(tags === null || tags === void 0 ? void 0 : tags.data) || (0, _ramda.is)(Boolean, tags) || (0, _ramda.is)(String, tags)) && (0, _ramda.isNil)(opts)) {
1741
+ if ((!(0, _ramda.isNil)(tags === null || tags === void 0 ? void 0 : tags.get) || !(0, _ramda.isNil)(tags === null || tags === void 0 ? void 0 : tags.check) || !(0, _ramda.isNil)(tags === null || tags === void 0 ? void 0 : tags.jwk) || !(0, _ramda.isNil)(tags === null || tags === void 0 ? void 0 : tags.data) || (0, _ramda.is)(Boolean, tags) || (0, _ramda.is)(String, tags)) && (0, _ramda.isNil)(opts)) {
1559
1742
  _opts = tags;
1560
1743
  _tags = null;
1561
1744
  }
@@ -1578,24 +1761,24 @@ var Process = /*#__PURE__*/function () {
1578
1761
  return _createClass(Process, [{
1579
1762
  key: "load",
1580
1763
  value: function () {
1581
- var _load2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
1764
+ var _load2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
1582
1765
  var opt,
1583
- _args22 = arguments;
1584
- return _regeneratorRuntime().wrap(function _callee22$(_context22) {
1585
- while (1) switch (_context22.prev = _context22.next) {
1766
+ _args25 = arguments;
1767
+ return _regeneratorRuntime().wrap(function _callee25$(_context25) {
1768
+ while (1) switch (_context25.prev = _context25.next) {
1586
1769
  case 0:
1587
- opt = _args22.length > 0 && _args22[0] !== undefined ? _args22[0] : {};
1588
- _context22.next = 3;
1770
+ opt = _args25.length > 0 && _args25[0] !== undefined ? _args25[0] : {};
1771
+ _context25.next = 3;
1589
1772
  return this.ao.load(_objectSpread({
1590
1773
  pid: this.pid
1591
1774
  }, opt));
1592
1775
  case 3:
1593
- return _context22.abrupt("return", _context22.sent);
1776
+ return _context25.abrupt("return", _context25.sent);
1594
1777
  case 4:
1595
1778
  case "end":
1596
- return _context22.stop();
1779
+ return _context25.stop();
1597
1780
  }
1598
- }, _callee22, this);
1781
+ }, _callee25, this);
1599
1782
  }));
1600
1783
  function load() {
1601
1784
  return _load2.apply(this, arguments);
@@ -1605,27 +1788,27 @@ var Process = /*#__PURE__*/function () {
1605
1788
  }, {
1606
1789
  key: "msg",
1607
1790
  value: function () {
1608
- var _msg2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee23(act, tags, opts) {
1791
+ var _msg2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee26(act, tags, opts) {
1609
1792
  var _getParams, _tags, _opts;
1610
- return _regeneratorRuntime().wrap(function _callee23$(_context23) {
1611
- while (1) switch (_context23.prev = _context23.next) {
1793
+ return _regeneratorRuntime().wrap(function _callee26$(_context26) {
1794
+ while (1) switch (_context26.prev = _context26.next) {
1612
1795
  case 0:
1613
1796
  _getParams = getParams(tags, opts), _tags = _getParams._tags, _opts = _getParams._opts;
1614
- _context23.next = 3;
1797
+ _context26.next = 3;
1615
1798
  return this.ao.msg(_objectSpread({
1616
1799
  pid: this.pid,
1617
1800
  act: act,
1618
1801
  tags: _tags
1619
1802
  }, _opts));
1620
1803
  case 3:
1621
- return _context23.abrupt("return", _context23.sent);
1804
+ return _context26.abrupt("return", _context26.sent);
1622
1805
  case 4:
1623
1806
  case "end":
1624
- return _context23.stop();
1807
+ return _context26.stop();
1625
1808
  }
1626
- }, _callee23, this);
1809
+ }, _callee26, this);
1627
1810
  }));
1628
- function msg(_x25, _x26, _x27) {
1811
+ function msg(_x27, _x28, _x29) {
1629
1812
  return _msg2.apply(this, arguments);
1630
1813
  }
1631
1814
  return msg;
@@ -1633,56 +1816,107 @@ var Process = /*#__PURE__*/function () {
1633
1816
  }, {
1634
1817
  key: "dry",
1635
1818
  value: function () {
1636
- var _dry2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee24(act, tags, opts) {
1819
+ var _dry2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee27(act, tags, opts) {
1637
1820
  var _getParams2, _tags, _opts;
1638
- return _regeneratorRuntime().wrap(function _callee24$(_context24) {
1639
- while (1) switch (_context24.prev = _context24.next) {
1821
+ return _regeneratorRuntime().wrap(function _callee27$(_context27) {
1822
+ while (1) switch (_context27.prev = _context27.next) {
1640
1823
  case 0:
1641
1824
  _getParams2 = getParams(tags, opts), _tags = _getParams2._tags, _opts = _getParams2._opts;
1642
- _context24.next = 3;
1825
+ _context27.next = 3;
1643
1826
  return this.ao.dry(_objectSpread({
1644
1827
  pid: this.pid,
1645
1828
  act: act,
1646
1829
  tags: _tags
1647
1830
  }, _opts));
1648
1831
  case 3:
1649
- return _context24.abrupt("return", _context24.sent);
1832
+ return _context27.abrupt("return", _context27.sent);
1650
1833
  case 4:
1651
1834
  case "end":
1652
- return _context24.stop();
1835
+ return _context27.stop();
1653
1836
  }
1654
- }, _callee24, this);
1837
+ }, _callee27, this);
1655
1838
  }));
1656
- function dry(_x28, _x29, _x30) {
1839
+ function dry(_x30, _x31, _x32) {
1657
1840
  return _dry2.apply(this, arguments);
1658
1841
  }
1659
1842
  return dry;
1660
1843
  }()
1661
1844
  }, {
1662
- key: "m",
1845
+ key: "res",
1663
1846
  value: function () {
1664
- var _m = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
1665
- var res,
1666
- _args25 = arguments;
1667
- return _regeneratorRuntime().wrap(function _callee25$(_context25) {
1668
- while (1) switch (_context25.prev = _context25.next) {
1847
+ var _res4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee28(opts) {
1848
+ var _getParams3, _opts;
1849
+ return _regeneratorRuntime().wrap(function _callee28$(_context28) {
1850
+ while (1) switch (_context28.prev = _context28.next) {
1851
+ case 0:
1852
+ _getParams3 = getParams(null, opts), _opts = _getParams3._opts;
1853
+ _context28.next = 3;
1854
+ return this.ao.res(_objectSpread({
1855
+ pid: this.pid
1856
+ }, _opts));
1857
+ case 3:
1858
+ return _context28.abrupt("return", _context28.sent);
1859
+ case 4:
1860
+ case "end":
1861
+ return _context28.stop();
1862
+ }
1863
+ }, _callee28, this);
1864
+ }));
1865
+ function res(_x33) {
1866
+ return _res4.apply(this, arguments);
1867
+ }
1868
+ return res;
1869
+ }()
1870
+ }, {
1871
+ key: "o",
1872
+ value: function () {
1873
+ var _o = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee29(name, opt) {
1874
+ var res;
1875
+ return _regeneratorRuntime().wrap(function _callee29$(_context29) {
1876
+ while (1) switch (_context29.prev = _context29.next) {
1669
1877
  case 0:
1670
- _context25.next = 2;
1671
- return this.msg.apply(this, _args25);
1878
+ _context29.next = 2;
1879
+ return this[name].apply(this, _toConsumableArray(opt));
1672
1880
  case 2:
1673
- res = _context25.sent;
1881
+ res = _context29.sent;
1674
1882
  if (!res.err) {
1675
- _context25.next = 5;
1883
+ _context29.next = 5;
1676
1884
  break;
1677
1885
  }
1678
1886
  throw Error(res.err);
1679
1887
  case 5:
1680
- return _context25.abrupt("return", res.out);
1888
+ return _context29.abrupt("return", res.out);
1681
1889
  case 6:
1682
1890
  case "end":
1683
- return _context25.stop();
1891
+ return _context29.stop();
1684
1892
  }
1685
- }, _callee25, this);
1893
+ }, _callee29, this);
1894
+ }));
1895
+ function o(_x34, _x35) {
1896
+ return _o.apply(this, arguments);
1897
+ }
1898
+ return o;
1899
+ }()
1900
+ }, {
1901
+ key: "m",
1902
+ value: function () {
1903
+ var _m = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
1904
+ var _len,
1905
+ opt,
1906
+ _key,
1907
+ _args30 = arguments;
1908
+ return _regeneratorRuntime().wrap(function _callee30$(_context30) {
1909
+ while (1) switch (_context30.prev = _context30.next) {
1910
+ case 0:
1911
+ for (_len = _args30.length, opt = new Array(_len), _key = 0; _key < _len; _key++) {
1912
+ opt[_key] = _args30[_key];
1913
+ }
1914
+ return _context30.abrupt("return", this.o("msg", opt));
1915
+ case 2:
1916
+ case "end":
1917
+ return _context30.stop();
1918
+ }
1919
+ }, _callee30, this);
1686
1920
  }));
1687
1921
  function m() {
1688
1922
  return _m.apply(this, arguments);
@@ -1692,34 +1926,87 @@ var Process = /*#__PURE__*/function () {
1692
1926
  }, {
1693
1927
  key: "d",
1694
1928
  value: function () {
1695
- var _d = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
1696
- var res,
1697
- _args26 = arguments;
1698
- return _regeneratorRuntime().wrap(function _callee26$(_context26) {
1699
- while (1) switch (_context26.prev = _context26.next) {
1929
+ var _d = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee31() {
1930
+ var _len2,
1931
+ opt,
1932
+ _key2,
1933
+ _args31 = arguments;
1934
+ return _regeneratorRuntime().wrap(function _callee31$(_context31) {
1935
+ while (1) switch (_context31.prev = _context31.next) {
1700
1936
  case 0:
1701
- _context26.next = 2;
1702
- return this.dry.apply(this, _args26);
1703
- case 2:
1704
- res = _context26.sent;
1705
- if (!res.err) {
1706
- _context26.next = 5;
1707
- break;
1937
+ for (_len2 = _args31.length, opt = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
1938
+ opt[_key2] = _args31[_key2];
1708
1939
  }
1709
- throw Error(res.err);
1710
- case 5:
1711
- return _context26.abrupt("return", res.out);
1712
- case 6:
1940
+ return _context31.abrupt("return", this.o("dry", opt));
1941
+ case 2:
1713
1942
  case "end":
1714
- return _context26.stop();
1943
+ return _context31.stop();
1715
1944
  }
1716
- }, _callee26, this);
1945
+ }, _callee31, this);
1717
1946
  }));
1718
1947
  function d() {
1719
1948
  return _d.apply(this, arguments);
1720
1949
  }
1721
1950
  return d;
1722
1951
  }()
1952
+ }, {
1953
+ key: "v",
1954
+ value: function () {
1955
+ var _v2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee32(data) {
1956
+ var json,
1957
+ pretty,
1958
+ _args32 = arguments;
1959
+ return _regeneratorRuntime().wrap(function _callee32$(_context32) {
1960
+ while (1) switch (_context32.prev = _context32.next) {
1961
+ case 0:
1962
+ json = _args32.length > 1 && _args32[1] !== undefined ? _args32[1] : true;
1963
+ pretty = _args32.length > 2 && _args32[2] !== undefined ? _args32[2] : false;
1964
+ _context32.next = 4;
1965
+ return this.ao["var"]({
1966
+ pid: this.pid,
1967
+ data: data,
1968
+ json: json,
1969
+ pretty: pretty
1970
+ });
1971
+ case 4:
1972
+ return _context32.abrupt("return", _context32.sent);
1973
+ case 5:
1974
+ case "end":
1975
+ return _context32.stop();
1976
+ }
1977
+ }, _callee32, this);
1978
+ }));
1979
+ function v(_x36) {
1980
+ return _v2.apply(this, arguments);
1981
+ }
1982
+ return v;
1983
+ }()
1984
+ }, {
1985
+ key: "r",
1986
+ value: function () {
1987
+ var _r = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee33() {
1988
+ var _len3,
1989
+ opt,
1990
+ _key3,
1991
+ _args33 = arguments;
1992
+ return _regeneratorRuntime().wrap(function _callee33$(_context33) {
1993
+ while (1) switch (_context33.prev = _context33.next) {
1994
+ case 0:
1995
+ for (_len3 = _args33.length, opt = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
1996
+ opt[_key3] = _args33[_key3];
1997
+ }
1998
+ return _context33.abrupt("return", this.o("res", opt));
1999
+ case 2:
2000
+ case "end":
2001
+ return _context33.stop();
2002
+ }
2003
+ }, _callee33, this);
2004
+ }));
2005
+ function r() {
2006
+ return _r.apply(this, arguments);
2007
+ }
2008
+ return r;
2009
+ }()
1723
2010
  }]);
1724
2011
  }();
1725
2012
  var _default = exports["default"] = AO;