wao 0.15.6 → 0.16.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/adaptor.js +1695 -0
- package/cjs/index.js +7 -0
- package/cjs/server.js +127 -941
- package/cjs/utils.js +59 -3
- package/esm/adaptor.js +504 -0
- package/esm/index.js +2 -2
- package/esm/server.js +78 -428
- package/esm/utils.js +75 -2
- package/package.json +5 -1
package/cjs/adaptor.js
ADDED
|
@@ -0,0 +1,1695 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _hb = _interopRequireDefault(require("./hb.js"));
|
|
8
|
+
var _arbundles = require("arbundles");
|
|
9
|
+
var _utils = require("./utils.js");
|
|
10
|
+
var _aoconnect = require("./aoconnect.js");
|
|
11
|
+
var _test = require("./test.js");
|
|
12
|
+
var _ramda = require("ramda");
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
14
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
15
|
+
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; }
|
|
16
|
+
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; }
|
|
17
|
+
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; }
|
|
18
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
19
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
20
|
+
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; }
|
|
21
|
+
function _objectDestructuringEmpty(t) { if (null == t) throw new TypeError("Cannot destructure " + t); }
|
|
22
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
23
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
24
|
+
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
25
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
26
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
27
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
28
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
29
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
30
|
+
//import { httpbis, createVerifier } from "http-message-signatures"
|
|
31
|
+
//import { createPublicKey } from "node:crypto"
|
|
32
|
+
//const { verifyMessage } = httpbis
|
|
33
|
+
var Adaptor = /*#__PURE__*/function () {
|
|
34
|
+
function Adaptor(_ref) {
|
|
35
|
+
var hb_url = _ref.hb_url,
|
|
36
|
+
aoconnect = _ref.aoconnect,
|
|
37
|
+
_ref$log = _ref.log,
|
|
38
|
+
log = _ref$log === void 0 ? false : _ref$log,
|
|
39
|
+
db = _ref.db;
|
|
40
|
+
_classCallCheck(this, Adaptor);
|
|
41
|
+
this.data = {};
|
|
42
|
+
var hb = null;
|
|
43
|
+
if (hb_url) hb = new _hb["default"]({
|
|
44
|
+
url: hb_url
|
|
45
|
+
});
|
|
46
|
+
var _connect = (0, _aoconnect.connect)(aoconnect, {
|
|
47
|
+
log: log,
|
|
48
|
+
cache: db,
|
|
49
|
+
hb: hb
|
|
50
|
+
}),
|
|
51
|
+
_ar = _connect.ar,
|
|
52
|
+
message = _connect.message,
|
|
53
|
+
spawn = _connect.spawn,
|
|
54
|
+
dryrun = _connect.dryrun,
|
|
55
|
+
result = _connect.result,
|
|
56
|
+
results = _connect.results,
|
|
57
|
+
mem = _connect.mem,
|
|
58
|
+
monitor = _connect.monitor,
|
|
59
|
+
unmonitor = _connect.unmonitor,
|
|
60
|
+
recover = _connect.recover;
|
|
61
|
+
this.recover = recover;
|
|
62
|
+
this.monitor = monitor;
|
|
63
|
+
this.unmonitor = unmonitor;
|
|
64
|
+
this.spawn = spawn;
|
|
65
|
+
this._ar = _ar;
|
|
66
|
+
this.message = message;
|
|
67
|
+
this.dryrun = dryrun;
|
|
68
|
+
this.result = result;
|
|
69
|
+
this.results = results;
|
|
70
|
+
this.mem = mem;
|
|
71
|
+
this.gql = new _test.GQL({
|
|
72
|
+
mem: mem
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
return _createClass(Adaptor, [{
|
|
76
|
+
key: "get",
|
|
77
|
+
value: function () {
|
|
78
|
+
var _get = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(req, res) {
|
|
79
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
80
|
+
while (1) switch (_context.prev = _context.next) {
|
|
81
|
+
case 0:
|
|
82
|
+
_context.t0 = res;
|
|
83
|
+
_context.next = 3;
|
|
84
|
+
return this[req.device](req);
|
|
85
|
+
case 3:
|
|
86
|
+
_context.t1 = _context.sent;
|
|
87
|
+
(0, _context.t0)(_context.t1);
|
|
88
|
+
case 5:
|
|
89
|
+
case "end":
|
|
90
|
+
return _context.stop();
|
|
91
|
+
}
|
|
92
|
+
}, _callee, this);
|
|
93
|
+
}));
|
|
94
|
+
function get(_x, _x2) {
|
|
95
|
+
return _get.apply(this, arguments);
|
|
96
|
+
}
|
|
97
|
+
return get;
|
|
98
|
+
}()
|
|
99
|
+
}, {
|
|
100
|
+
key: "bd",
|
|
101
|
+
value: function () {
|
|
102
|
+
var _bd = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(req) {
|
|
103
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
104
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
105
|
+
case 0:
|
|
106
|
+
_context2.next = 2;
|
|
107
|
+
return this["bd_".concat(req.method.toLowerCase())](req);
|
|
108
|
+
case 2:
|
|
109
|
+
return _context2.abrupt("return", _context2.sent);
|
|
110
|
+
case 3:
|
|
111
|
+
case "end":
|
|
112
|
+
return _context2.stop();
|
|
113
|
+
}
|
|
114
|
+
}, _callee2, this);
|
|
115
|
+
}));
|
|
116
|
+
function bd(_x3) {
|
|
117
|
+
return _bd.apply(this, arguments);
|
|
118
|
+
}
|
|
119
|
+
return bd;
|
|
120
|
+
}()
|
|
121
|
+
}, {
|
|
122
|
+
key: "ar",
|
|
123
|
+
value: function () {
|
|
124
|
+
var _ar2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(req) {
|
|
125
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
126
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
127
|
+
case 0:
|
|
128
|
+
_context3.next = 2;
|
|
129
|
+
return this["ar_".concat(req.method.toLowerCase())](req);
|
|
130
|
+
case 2:
|
|
131
|
+
return _context3.abrupt("return", _context3.sent);
|
|
132
|
+
case 3:
|
|
133
|
+
case "end":
|
|
134
|
+
return _context3.stop();
|
|
135
|
+
}
|
|
136
|
+
}, _callee3, this);
|
|
137
|
+
}));
|
|
138
|
+
function ar(_x4) {
|
|
139
|
+
return _ar2.apply(this, arguments);
|
|
140
|
+
}
|
|
141
|
+
return ar;
|
|
142
|
+
}()
|
|
143
|
+
}, {
|
|
144
|
+
key: "su",
|
|
145
|
+
value: function () {
|
|
146
|
+
var _su = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(req) {
|
|
147
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
148
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
149
|
+
case 0:
|
|
150
|
+
_context4.next = 2;
|
|
151
|
+
return this["su_".concat(req.method.toLowerCase())](req);
|
|
152
|
+
case 2:
|
|
153
|
+
return _context4.abrupt("return", _context4.sent);
|
|
154
|
+
case 3:
|
|
155
|
+
case "end":
|
|
156
|
+
return _context4.stop();
|
|
157
|
+
}
|
|
158
|
+
}, _callee4, this);
|
|
159
|
+
}));
|
|
160
|
+
function su(_x5) {
|
|
161
|
+
return _su.apply(this, arguments);
|
|
162
|
+
}
|
|
163
|
+
return su;
|
|
164
|
+
}()
|
|
165
|
+
}, {
|
|
166
|
+
key: "mu",
|
|
167
|
+
value: function () {
|
|
168
|
+
var _mu = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(req) {
|
|
169
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
170
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
171
|
+
case 0:
|
|
172
|
+
_context5.next = 2;
|
|
173
|
+
return this["mu_".concat(req.method.toLowerCase())](req);
|
|
174
|
+
case 2:
|
|
175
|
+
return _context5.abrupt("return", _context5.sent);
|
|
176
|
+
case 3:
|
|
177
|
+
case "end":
|
|
178
|
+
return _context5.stop();
|
|
179
|
+
}
|
|
180
|
+
}, _callee5, this);
|
|
181
|
+
}));
|
|
182
|
+
function mu(_x6) {
|
|
183
|
+
return _mu.apply(this, arguments);
|
|
184
|
+
}
|
|
185
|
+
return mu;
|
|
186
|
+
}()
|
|
187
|
+
}, {
|
|
188
|
+
key: "cu",
|
|
189
|
+
value: function () {
|
|
190
|
+
var _cu = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(req) {
|
|
191
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
192
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
193
|
+
case 0:
|
|
194
|
+
_context6.next = 2;
|
|
195
|
+
return this["cu_".concat(req.method.toLowerCase())](req);
|
|
196
|
+
case 2:
|
|
197
|
+
return _context6.abrupt("return", _context6.sent);
|
|
198
|
+
case 3:
|
|
199
|
+
case "end":
|
|
200
|
+
return _context6.stop();
|
|
201
|
+
}
|
|
202
|
+
}, _callee6, this);
|
|
203
|
+
}));
|
|
204
|
+
function cu(_x7) {
|
|
205
|
+
return _cu.apply(this, arguments);
|
|
206
|
+
}
|
|
207
|
+
return cu;
|
|
208
|
+
}()
|
|
209
|
+
}, {
|
|
210
|
+
key: "bd_get",
|
|
211
|
+
value: function () {
|
|
212
|
+
var _bd_get = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(req) {
|
|
213
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
214
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
215
|
+
case 0:
|
|
216
|
+
switch (req.path) {
|
|
217
|
+
default:
|
|
218
|
+
}
|
|
219
|
+
case 1:
|
|
220
|
+
case "end":
|
|
221
|
+
return _context7.stop();
|
|
222
|
+
}
|
|
223
|
+
}, _callee7);
|
|
224
|
+
}));
|
|
225
|
+
function bd_get(_x8) {
|
|
226
|
+
return _bd_get.apply(this, arguments);
|
|
227
|
+
}
|
|
228
|
+
return bd_get;
|
|
229
|
+
}()
|
|
230
|
+
}, {
|
|
231
|
+
key: "bd_post",
|
|
232
|
+
value: function () {
|
|
233
|
+
var _bd_post = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(req) {
|
|
234
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
235
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
236
|
+
case 0:
|
|
237
|
+
_context8.t0 = req.path;
|
|
238
|
+
_context8.next = _context8.t0 === "/tx" ? 3 : 6;
|
|
239
|
+
break;
|
|
240
|
+
case 3:
|
|
241
|
+
_context8.next = 5;
|
|
242
|
+
return this.bd_post_tx(req);
|
|
243
|
+
case 5:
|
|
244
|
+
return _context8.abrupt("return", _context8.sent);
|
|
245
|
+
case 6:
|
|
246
|
+
_context8.next = 8;
|
|
247
|
+
return this.bad();
|
|
248
|
+
case 8:
|
|
249
|
+
return _context8.abrupt("return", _context8.sent);
|
|
250
|
+
case 9:
|
|
251
|
+
case "end":
|
|
252
|
+
return _context8.stop();
|
|
253
|
+
}
|
|
254
|
+
}, _callee8, this);
|
|
255
|
+
}));
|
|
256
|
+
function bd_post(_x9) {
|
|
257
|
+
return _bd_post.apply(this, arguments);
|
|
258
|
+
}
|
|
259
|
+
return bd_post;
|
|
260
|
+
}()
|
|
261
|
+
}, {
|
|
262
|
+
key: "ar_get",
|
|
263
|
+
value: function () {
|
|
264
|
+
var _ar_get = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(req) {
|
|
265
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
266
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
267
|
+
case 0:
|
|
268
|
+
_context9.t0 = req.path;
|
|
269
|
+
_context9.next = _context9.t0 === "/" ? 3 : _context9.t0 === "/wallet/:id/balance" ? 6 : _context9.t0 === "/mint/:id/:amount" ? 9 : _context9.t0 === "/tx/:id/offset" ? 12 : _context9.t0 === "/tx_anchor" ? 15 : _context9.t0 === "/mine" ? 18 : _context9.t0 === "/:id" ? 21 : _context9.t0 === "/price/:id" ? 24 : 27;
|
|
270
|
+
break;
|
|
271
|
+
case 3:
|
|
272
|
+
_context9.next = 5;
|
|
273
|
+
return this.ar_get_root(req);
|
|
274
|
+
case 5:
|
|
275
|
+
return _context9.abrupt("return", _context9.sent);
|
|
276
|
+
case 6:
|
|
277
|
+
_context9.next = 8;
|
|
278
|
+
return this.ar_get_wallet_balance(req);
|
|
279
|
+
case 8:
|
|
280
|
+
return _context9.abrupt("return", _context9.sent);
|
|
281
|
+
case 9:
|
|
282
|
+
_context9.next = 11;
|
|
283
|
+
return this.ar_get_mint(req);
|
|
284
|
+
case 11:
|
|
285
|
+
return _context9.abrupt("return", _context9.sent);
|
|
286
|
+
case 12:
|
|
287
|
+
_context9.next = 14;
|
|
288
|
+
return this.ar_get_tx_offset(req);
|
|
289
|
+
case 14:
|
|
290
|
+
return _context9.abrupt("return", _context9.sent);
|
|
291
|
+
case 15:
|
|
292
|
+
_context9.next = 17;
|
|
293
|
+
return this.ar_get_tx_anchor(req);
|
|
294
|
+
case 17:
|
|
295
|
+
return _context9.abrupt("return", _context9.sent);
|
|
296
|
+
case 18:
|
|
297
|
+
_context9.next = 20;
|
|
298
|
+
return this.ar_get_mine(req);
|
|
299
|
+
case 20:
|
|
300
|
+
return _context9.abrupt("return", _context9.sent);
|
|
301
|
+
case 21:
|
|
302
|
+
_context9.next = 23;
|
|
303
|
+
return this.ar_get_id(req);
|
|
304
|
+
case 23:
|
|
305
|
+
return _context9.abrupt("return", _context9.sent);
|
|
306
|
+
case 24:
|
|
307
|
+
_context9.next = 26;
|
|
308
|
+
return this.ar_get_price(req);
|
|
309
|
+
case 26:
|
|
310
|
+
return _context9.abrupt("return", _context9.sent);
|
|
311
|
+
case 27:
|
|
312
|
+
_context9.next = 29;
|
|
313
|
+
return this.bad();
|
|
314
|
+
case 29:
|
|
315
|
+
return _context9.abrupt("return", _context9.sent);
|
|
316
|
+
case 30:
|
|
317
|
+
case "end":
|
|
318
|
+
return _context9.stop();
|
|
319
|
+
}
|
|
320
|
+
}, _callee9, this);
|
|
321
|
+
}));
|
|
322
|
+
function ar_get(_x10) {
|
|
323
|
+
return _ar_get.apply(this, arguments);
|
|
324
|
+
}
|
|
325
|
+
return ar_get;
|
|
326
|
+
}()
|
|
327
|
+
}, {
|
|
328
|
+
key: "ar_post",
|
|
329
|
+
value: function () {
|
|
330
|
+
var _ar_post = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10(req) {
|
|
331
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
332
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
333
|
+
case 0:
|
|
334
|
+
_context10.t0 = req.path;
|
|
335
|
+
_context10.next = _context10.t0 === "/graphql" ? 3 : _context10.t0 === "/:id" ? 6 : 9;
|
|
336
|
+
break;
|
|
337
|
+
case 3:
|
|
338
|
+
_context10.next = 5;
|
|
339
|
+
return this.ar_post_graphql(req);
|
|
340
|
+
case 5:
|
|
341
|
+
return _context10.abrupt("return", _context10.sent);
|
|
342
|
+
case 6:
|
|
343
|
+
_context10.next = 8;
|
|
344
|
+
return this.ar_post_id(req);
|
|
345
|
+
case 8:
|
|
346
|
+
return _context10.abrupt("return", _context10.sent);
|
|
347
|
+
case 9:
|
|
348
|
+
_context10.next = 11;
|
|
349
|
+
return this.bad();
|
|
350
|
+
case 11:
|
|
351
|
+
return _context10.abrupt("return", _context10.sent);
|
|
352
|
+
case 12:
|
|
353
|
+
case "end":
|
|
354
|
+
return _context10.stop();
|
|
355
|
+
}
|
|
356
|
+
}, _callee10, this);
|
|
357
|
+
}));
|
|
358
|
+
function ar_post(_x11) {
|
|
359
|
+
return _ar_post.apply(this, arguments);
|
|
360
|
+
}
|
|
361
|
+
return ar_post;
|
|
362
|
+
}()
|
|
363
|
+
}, {
|
|
364
|
+
key: "su_get",
|
|
365
|
+
value: function () {
|
|
366
|
+
var _su_get = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11(req) {
|
|
367
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
368
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
369
|
+
case 0:
|
|
370
|
+
_context11.t0 = req.path;
|
|
371
|
+
_context11.next = _context11.t0 === "/" ? 3 : _context11.t0 === "/timestamp" ? 6 : _context11.t0 === "/:pid" ? 9 : 12;
|
|
372
|
+
break;
|
|
373
|
+
case 3:
|
|
374
|
+
_context11.next = 5;
|
|
375
|
+
return this.su_get_root(req);
|
|
376
|
+
case 5:
|
|
377
|
+
return _context11.abrupt("return", _context11.sent);
|
|
378
|
+
case 6:
|
|
379
|
+
_context11.next = 8;
|
|
380
|
+
return this.su_get_timestamp(req);
|
|
381
|
+
case 8:
|
|
382
|
+
return _context11.abrupt("return", _context11.sent);
|
|
383
|
+
case 9:
|
|
384
|
+
_context11.next = 11;
|
|
385
|
+
return this.su_get_pid(req);
|
|
386
|
+
case 11:
|
|
387
|
+
return _context11.abrupt("return", _context11.sent);
|
|
388
|
+
case 12:
|
|
389
|
+
_context11.next = 14;
|
|
390
|
+
return this.bad();
|
|
391
|
+
case 14:
|
|
392
|
+
return _context11.abrupt("return", _context11.sent);
|
|
393
|
+
case 15:
|
|
394
|
+
case "end":
|
|
395
|
+
return _context11.stop();
|
|
396
|
+
}
|
|
397
|
+
}, _callee11, this);
|
|
398
|
+
}));
|
|
399
|
+
function su_get(_x12) {
|
|
400
|
+
return _su_get.apply(this, arguments);
|
|
401
|
+
}
|
|
402
|
+
return su_get;
|
|
403
|
+
}()
|
|
404
|
+
}, {
|
|
405
|
+
key: "su_post",
|
|
406
|
+
value: function () {
|
|
407
|
+
var _su_post = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12(req) {
|
|
408
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
409
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
410
|
+
case 0:
|
|
411
|
+
_context12.t0 = req.path;
|
|
412
|
+
_context12.next = 3;
|
|
413
|
+
break;
|
|
414
|
+
case 3:
|
|
415
|
+
_context12.next = 5;
|
|
416
|
+
return this.bad();
|
|
417
|
+
case 5:
|
|
418
|
+
return _context12.abrupt("return", _context12.sent);
|
|
419
|
+
case 6:
|
|
420
|
+
case "end":
|
|
421
|
+
return _context12.stop();
|
|
422
|
+
}
|
|
423
|
+
}, _callee12, this);
|
|
424
|
+
}));
|
|
425
|
+
function su_post(_x13) {
|
|
426
|
+
return _su_post.apply(this, arguments);
|
|
427
|
+
}
|
|
428
|
+
return su_post;
|
|
429
|
+
}()
|
|
430
|
+
}, {
|
|
431
|
+
key: "mu_get",
|
|
432
|
+
value: function () {
|
|
433
|
+
var _mu_get = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13(req) {
|
|
434
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
435
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
436
|
+
case 0:
|
|
437
|
+
_context13.t0 = req.path;
|
|
438
|
+
_context13.next = _context13.t0 === "/" ? 3 : _context13.t0 === "/monitor:pid" ? 6 : 9;
|
|
439
|
+
break;
|
|
440
|
+
case 3:
|
|
441
|
+
_context13.next = 5;
|
|
442
|
+
return this.mu_get_root(req);
|
|
443
|
+
case 5:
|
|
444
|
+
return _context13.abrupt("return", _context13.sent);
|
|
445
|
+
case 6:
|
|
446
|
+
_context13.next = 8;
|
|
447
|
+
return this.mu_get_monitor(req);
|
|
448
|
+
case 8:
|
|
449
|
+
return _context13.abrupt("return", _context13.sent);
|
|
450
|
+
case 9:
|
|
451
|
+
_context13.next = 11;
|
|
452
|
+
return this.bad();
|
|
453
|
+
case 11:
|
|
454
|
+
return _context13.abrupt("return", _context13.sent);
|
|
455
|
+
case 12:
|
|
456
|
+
case "end":
|
|
457
|
+
return _context13.stop();
|
|
458
|
+
}
|
|
459
|
+
}, _callee13, this);
|
|
460
|
+
}));
|
|
461
|
+
function mu_get(_x14) {
|
|
462
|
+
return _mu_get.apply(this, arguments);
|
|
463
|
+
}
|
|
464
|
+
return mu_get;
|
|
465
|
+
}()
|
|
466
|
+
}, {
|
|
467
|
+
key: "mu_delete",
|
|
468
|
+
value: function () {
|
|
469
|
+
var _mu_delete = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee14(req) {
|
|
470
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
471
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
472
|
+
case 0:
|
|
473
|
+
_context14.t0 = req.path;
|
|
474
|
+
_context14.next = _context14.t0 === "/monitor:pid" ? 3 : 6;
|
|
475
|
+
break;
|
|
476
|
+
case 3:
|
|
477
|
+
_context14.next = 5;
|
|
478
|
+
return this.mu_delete_monitor(req);
|
|
479
|
+
case 5:
|
|
480
|
+
return _context14.abrupt("return", _context14.sent);
|
|
481
|
+
case 6:
|
|
482
|
+
_context14.next = 8;
|
|
483
|
+
return this.bad();
|
|
484
|
+
case 8:
|
|
485
|
+
return _context14.abrupt("return", _context14.sent);
|
|
486
|
+
case 9:
|
|
487
|
+
case "end":
|
|
488
|
+
return _context14.stop();
|
|
489
|
+
}
|
|
490
|
+
}, _callee14, this);
|
|
491
|
+
}));
|
|
492
|
+
function mu_delete(_x15) {
|
|
493
|
+
return _mu_delete.apply(this, arguments);
|
|
494
|
+
}
|
|
495
|
+
return mu_delete;
|
|
496
|
+
}()
|
|
497
|
+
}, {
|
|
498
|
+
key: "mu_post",
|
|
499
|
+
value: function () {
|
|
500
|
+
var _mu_post = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee15(req) {
|
|
501
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
502
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
503
|
+
case 0:
|
|
504
|
+
_context15.t0 = req.path;
|
|
505
|
+
_context15.next = _context15.t0 === "/" ? 3 : _context15.t0 === "/monitor:pid" ? 6 : 9;
|
|
506
|
+
break;
|
|
507
|
+
case 3:
|
|
508
|
+
_context15.next = 5;
|
|
509
|
+
return this.mu_post_root(req);
|
|
510
|
+
case 5:
|
|
511
|
+
return _context15.abrupt("return", _context15.sent);
|
|
512
|
+
case 6:
|
|
513
|
+
_context15.next = 8;
|
|
514
|
+
return this.mu_post_monitor(req);
|
|
515
|
+
case 8:
|
|
516
|
+
return _context15.abrupt("return", _context15.sent);
|
|
517
|
+
case 9:
|
|
518
|
+
_context15.next = 11;
|
|
519
|
+
return this.bad();
|
|
520
|
+
case 11:
|
|
521
|
+
return _context15.abrupt("return", _context15.sent);
|
|
522
|
+
case 12:
|
|
523
|
+
case "end":
|
|
524
|
+
return _context15.stop();
|
|
525
|
+
}
|
|
526
|
+
}, _callee15, this);
|
|
527
|
+
}));
|
|
528
|
+
function mu_post(_x16) {
|
|
529
|
+
return _mu_post.apply(this, arguments);
|
|
530
|
+
}
|
|
531
|
+
return mu_post;
|
|
532
|
+
}()
|
|
533
|
+
}, {
|
|
534
|
+
key: "cu_get",
|
|
535
|
+
value: function () {
|
|
536
|
+
var _cu_get = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee16(req) {
|
|
537
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
538
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
539
|
+
case 0:
|
|
540
|
+
_context16.t0 = req.path;
|
|
541
|
+
_context16.next = _context16.t0 === "/" ? 3 : _context16.t0 === "/result/:mid" ? 6 : _context16.t0 === "/results/:pid" ? 9 : _context16.t0 === "/state/:pid" ? 12 : 15;
|
|
542
|
+
break;
|
|
543
|
+
case 3:
|
|
544
|
+
_context16.next = 5;
|
|
545
|
+
return this.cu_get_root(req);
|
|
546
|
+
case 5:
|
|
547
|
+
return _context16.abrupt("return", _context16.sent);
|
|
548
|
+
case 6:
|
|
549
|
+
_context16.next = 8;
|
|
550
|
+
return this.cu_get_result(req);
|
|
551
|
+
case 8:
|
|
552
|
+
return _context16.abrupt("return", _context16.sent);
|
|
553
|
+
case 9:
|
|
554
|
+
_context16.next = 11;
|
|
555
|
+
return this.cu_get_results(req);
|
|
556
|
+
case 11:
|
|
557
|
+
return _context16.abrupt("return", _context16.sent);
|
|
558
|
+
case 12:
|
|
559
|
+
_context16.next = 14;
|
|
560
|
+
return this.cu_get_state(req);
|
|
561
|
+
case 14:
|
|
562
|
+
return _context16.abrupt("return", _context16.sent);
|
|
563
|
+
case 15:
|
|
564
|
+
_context16.next = 17;
|
|
565
|
+
return this.bad();
|
|
566
|
+
case 17:
|
|
567
|
+
return _context16.abrupt("return", _context16.sent);
|
|
568
|
+
case 18:
|
|
569
|
+
case "end":
|
|
570
|
+
return _context16.stop();
|
|
571
|
+
}
|
|
572
|
+
}, _callee16, this);
|
|
573
|
+
}));
|
|
574
|
+
function cu_get(_x17) {
|
|
575
|
+
return _cu_get.apply(this, arguments);
|
|
576
|
+
}
|
|
577
|
+
return cu_get;
|
|
578
|
+
}()
|
|
579
|
+
}, {
|
|
580
|
+
key: "cu_post",
|
|
581
|
+
value: function () {
|
|
582
|
+
var _cu_post = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee17(req) {
|
|
583
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
584
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
585
|
+
case 0:
|
|
586
|
+
_context17.t0 = req.path;
|
|
587
|
+
_context17.next = _context17.t0 === "/result/:mid" ? 3 : _context17.t0 === "/dry-run" ? 6 : 9;
|
|
588
|
+
break;
|
|
589
|
+
case 3:
|
|
590
|
+
_context17.next = 5;
|
|
591
|
+
return this.cu_post_result(req);
|
|
592
|
+
case 5:
|
|
593
|
+
return _context17.abrupt("return", _context17.sent);
|
|
594
|
+
case 6:
|
|
595
|
+
_context17.next = 8;
|
|
596
|
+
return this.cu_post_dryrun(req);
|
|
597
|
+
case 8:
|
|
598
|
+
return _context17.abrupt("return", _context17.sent);
|
|
599
|
+
case 9:
|
|
600
|
+
_context17.next = 11;
|
|
601
|
+
return this.bad();
|
|
602
|
+
case 11:
|
|
603
|
+
return _context17.abrupt("return", _context17.sent);
|
|
604
|
+
case 12:
|
|
605
|
+
case "end":
|
|
606
|
+
return _context17.stop();
|
|
607
|
+
}
|
|
608
|
+
}, _callee17, this);
|
|
609
|
+
}));
|
|
610
|
+
function cu_post(_x18) {
|
|
611
|
+
return _cu_post.apply(this, arguments);
|
|
612
|
+
}
|
|
613
|
+
return cu_post;
|
|
614
|
+
}()
|
|
615
|
+
}, {
|
|
616
|
+
key: "bad",
|
|
617
|
+
value: function () {
|
|
618
|
+
var _bad = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee18(_ref2) {
|
|
619
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
620
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
621
|
+
case 0:
|
|
622
|
+
_objectDestructuringEmpty(_ref2);
|
|
623
|
+
return _context18.abrupt("return", {
|
|
624
|
+
status: 400,
|
|
625
|
+
error: "bad request"
|
|
626
|
+
});
|
|
627
|
+
case 2:
|
|
628
|
+
case "end":
|
|
629
|
+
return _context18.stop();
|
|
630
|
+
}
|
|
631
|
+
}, _callee18);
|
|
632
|
+
}));
|
|
633
|
+
function bad(_x19) {
|
|
634
|
+
return _bad.apply(this, arguments);
|
|
635
|
+
}
|
|
636
|
+
return bad;
|
|
637
|
+
}()
|
|
638
|
+
}, {
|
|
639
|
+
key: "bd_post_tx",
|
|
640
|
+
value: function () {
|
|
641
|
+
var _bd_post_tx = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee19(_ref3) {
|
|
642
|
+
var query, params, body, headers, method, lines, sigs, currentKey, _iterator, _step, line, trimmed, headerMatch, key, value, id, item, _iterator2, _step2, v, res, _iterator3, _step3, _v, _res2;
|
|
643
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
644
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
645
|
+
case 0:
|
|
646
|
+
query = _ref3.query, params = _ref3.params, body = _ref3.body, headers = _ref3.headers, method = _ref3.method;
|
|
647
|
+
return _context19.abrupt("return", {
|
|
648
|
+
send: "Success"
|
|
649
|
+
});
|
|
650
|
+
case 5:
|
|
651
|
+
lines = body.toString("utf8").split(/\r?\n/);
|
|
652
|
+
sigs = {};
|
|
653
|
+
currentKey = null;
|
|
654
|
+
_iterator = _createForOfIteratorHelper(lines);
|
|
655
|
+
_context19.prev = 9;
|
|
656
|
+
_iterator.s();
|
|
657
|
+
case 11:
|
|
658
|
+
if ((_step = _iterator.n()).done) {
|
|
659
|
+
_context19.next = 21;
|
|
660
|
+
break;
|
|
661
|
+
}
|
|
662
|
+
line = _step.value;
|
|
663
|
+
trimmed = line.trim();
|
|
664
|
+
if (!/^--[a-zA-Z0-9_\-=]+/.test(trimmed)) {
|
|
665
|
+
_context19.next = 17;
|
|
666
|
+
break;
|
|
667
|
+
}
|
|
668
|
+
currentKey = null;
|
|
669
|
+
return _context19.abrupt("continue", 19);
|
|
670
|
+
case 17:
|
|
671
|
+
headerMatch = trimmed.match(/^([a-zA-Z0-9_-]+):\s*(.*)$/);
|
|
672
|
+
if (headerMatch && !headerMatch[2].includes(": ")) {
|
|
673
|
+
key = headerMatch[1];
|
|
674
|
+
value = headerMatch[2];
|
|
675
|
+
sigs[key] = value;
|
|
676
|
+
currentKey = key;
|
|
677
|
+
} else if (currentKey) sigs[currentKey] += "\n" + line;
|
|
678
|
+
case 19:
|
|
679
|
+
_context19.next = 11;
|
|
680
|
+
break;
|
|
681
|
+
case 21:
|
|
682
|
+
_context19.next = 26;
|
|
683
|
+
break;
|
|
684
|
+
case 23:
|
|
685
|
+
_context19.prev = 23;
|
|
686
|
+
_context19.t0 = _context19["catch"](9);
|
|
687
|
+
_iterator.e(_context19.t0);
|
|
688
|
+
case 26:
|
|
689
|
+
_context19.prev = 26;
|
|
690
|
+
_iterator.f();
|
|
691
|
+
return _context19.finish(26);
|
|
692
|
+
case 29:
|
|
693
|
+
sigs.target = headers.process;
|
|
694
|
+
sigs.slot = headers.slot;
|
|
695
|
+
/*
|
|
696
|
+
const input = parseSignatureInput(headers["signature-input"])
|
|
697
|
+
const key = { kty: "RSA", n: input.keyid, e: "AQAB" }
|
|
698
|
+
const verifier = createVerifier(
|
|
699
|
+
createPublicKey({ key, format: "jwk" }),
|
|
700
|
+
"rsa-pss-sha512"
|
|
701
|
+
)*/
|
|
702
|
+
id = null;
|
|
703
|
+
_context19.prev = 32;
|
|
704
|
+
/*
|
|
705
|
+
const isValid = await verifyMessage(
|
|
706
|
+
{ keyLookup: params => ({ verify: verifier }) },
|
|
707
|
+
{
|
|
708
|
+
method: method,
|
|
709
|
+
headers: headers,
|
|
710
|
+
url: `http://ao.com${headers.path}`,
|
|
711
|
+
}
|
|
712
|
+
)*/
|
|
713
|
+
item = (0, _utils.toANS104Request)(sigs).item;
|
|
714
|
+
if (!(sigs.slot === "0" || sigs.type === "Process")) {
|
|
715
|
+
_context19.next = 42;
|
|
716
|
+
break;
|
|
717
|
+
}
|
|
718
|
+
_iterator2 = _createForOfIteratorHelper(item.tags);
|
|
719
|
+
try {
|
|
720
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
721
|
+
v = _step2.value;
|
|
722
|
+
if (v.name === "Type") v.value = "Process";
|
|
723
|
+
}
|
|
724
|
+
} catch (err) {
|
|
725
|
+
_iterator2.e(err);
|
|
726
|
+
} finally {
|
|
727
|
+
_iterator2.f();
|
|
728
|
+
}
|
|
729
|
+
_context19.next = 39;
|
|
730
|
+
return this.spawn({
|
|
731
|
+
http_msg: item,
|
|
732
|
+
module: sigs.module,
|
|
733
|
+
scheduler: sigs.scheduler
|
|
734
|
+
});
|
|
735
|
+
case 39:
|
|
736
|
+
res = _context19.sent;
|
|
737
|
+
_context19.next = 48;
|
|
738
|
+
break;
|
|
739
|
+
case 42:
|
|
740
|
+
if (!(sigs.type === "Message")) {
|
|
741
|
+
_context19.next = 48;
|
|
742
|
+
break;
|
|
743
|
+
}
|
|
744
|
+
_iterator3 = _createForOfIteratorHelper(item.tags);
|
|
745
|
+
try {
|
|
746
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
747
|
+
_v = _step3.value;
|
|
748
|
+
if (_v.name === "id") item.target = _v.value;
|
|
749
|
+
}
|
|
750
|
+
} catch (err) {
|
|
751
|
+
_iterator3.e(err);
|
|
752
|
+
} finally {
|
|
753
|
+
_iterator3.f();
|
|
754
|
+
}
|
|
755
|
+
_context19.next = 47;
|
|
756
|
+
return this.message({
|
|
757
|
+
slot: sigs.slot,
|
|
758
|
+
http_msg: item,
|
|
759
|
+
process: sigs.target
|
|
760
|
+
});
|
|
761
|
+
case 47:
|
|
762
|
+
_res2 = _context19.sent;
|
|
763
|
+
case 48:
|
|
764
|
+
_context19.next = 53;
|
|
765
|
+
break;
|
|
766
|
+
case 50:
|
|
767
|
+
_context19.prev = 50;
|
|
768
|
+
_context19.t1 = _context19["catch"](32);
|
|
769
|
+
console.log(_context19.t1);
|
|
770
|
+
case 53:
|
|
771
|
+
return _context19.abrupt("return", {
|
|
772
|
+
send: "Success"
|
|
773
|
+
});
|
|
774
|
+
case 54:
|
|
775
|
+
case "end":
|
|
776
|
+
return _context19.stop();
|
|
777
|
+
}
|
|
778
|
+
}, _callee19, this, [[9, 23, 26, 29], [32, 50]]);
|
|
779
|
+
}));
|
|
780
|
+
function bd_post_tx(_x20) {
|
|
781
|
+
return _bd_post_tx.apply(this, arguments);
|
|
782
|
+
}
|
|
783
|
+
return bd_post_tx;
|
|
784
|
+
}()
|
|
785
|
+
}, {
|
|
786
|
+
key: "cu_get_root",
|
|
787
|
+
value: function () {
|
|
788
|
+
var _cu_get_root = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee20(_ref4) {
|
|
789
|
+
var query, params, body, headers, method;
|
|
790
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
791
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
792
|
+
case 0:
|
|
793
|
+
query = _ref4.query, params = _ref4.params, body = _ref4.body, headers = _ref4.headers, method = _ref4.method;
|
|
794
|
+
return _context20.abrupt("return", {
|
|
795
|
+
json: {
|
|
796
|
+
timestamp: Date.now(),
|
|
797
|
+
address: _test.cu.addr
|
|
798
|
+
}
|
|
799
|
+
});
|
|
800
|
+
case 2:
|
|
801
|
+
case "end":
|
|
802
|
+
return _context20.stop();
|
|
803
|
+
}
|
|
804
|
+
}, _callee20);
|
|
805
|
+
}));
|
|
806
|
+
function cu_get_root(_x21) {
|
|
807
|
+
return _cu_get_root.apply(this, arguments);
|
|
808
|
+
}
|
|
809
|
+
return cu_get_root;
|
|
810
|
+
}()
|
|
811
|
+
}, {
|
|
812
|
+
key: "cu_get_state",
|
|
813
|
+
value: function () {
|
|
814
|
+
var _cu_get_state = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee21(_ref5) {
|
|
815
|
+
var _this$mem$env$pid$mem, _this$mem$env$pid;
|
|
816
|
+
var query, params, body, headers, method, pid, memory;
|
|
817
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
818
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
819
|
+
case 0:
|
|
820
|
+
query = _ref5.query, params = _ref5.params, body = _ref5.body, headers = _ref5.headers, method = _ref5.method;
|
|
821
|
+
pid = params.pid;
|
|
822
|
+
memory = (_this$mem$env$pid$mem = (_this$mem$env$pid = this.mem.env[pid]) === null || _this$mem$env$pid === void 0 ? void 0 : _this$mem$env$pid.memory) !== null && _this$mem$env$pid$mem !== void 0 ? _this$mem$env$pid$mem : null;
|
|
823
|
+
if (memory) {
|
|
824
|
+
_context21.next = 7;
|
|
825
|
+
break;
|
|
826
|
+
}
|
|
827
|
+
return _context21.abrupt("return", {
|
|
828
|
+
status: 404,
|
|
829
|
+
error: "TransactionNotFound: Process ".concat(pid, " was not found on gateway")
|
|
830
|
+
});
|
|
831
|
+
case 7:
|
|
832
|
+
return _context21.abrupt("return", {
|
|
833
|
+
send: Buffer.from(memory)
|
|
834
|
+
});
|
|
835
|
+
case 8:
|
|
836
|
+
case "end":
|
|
837
|
+
return _context21.stop();
|
|
838
|
+
}
|
|
839
|
+
}, _callee21, this);
|
|
840
|
+
}));
|
|
841
|
+
function cu_get_state(_x22) {
|
|
842
|
+
return _cu_get_state.apply(this, arguments);
|
|
843
|
+
}
|
|
844
|
+
return cu_get_state;
|
|
845
|
+
}()
|
|
846
|
+
}, {
|
|
847
|
+
key: "cu_post_dryrun",
|
|
848
|
+
value: function () {
|
|
849
|
+
var _cu_post_dryrun = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee22(_ref6) {
|
|
850
|
+
var query, params, body, headers, method, process, id, owner, tags, data, res2;
|
|
851
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
852
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
853
|
+
case 0:
|
|
854
|
+
query = _ref6.query, params = _ref6.params, body = _ref6.body, headers = _ref6.headers, method = _ref6.method;
|
|
855
|
+
process = query["process-id"];
|
|
856
|
+
id = body.Id, owner = body.Owner, tags = body.Tags, data = body.Data;
|
|
857
|
+
_context22.next = 5;
|
|
858
|
+
return this.dryrun({
|
|
859
|
+
id: id,
|
|
860
|
+
owner: owner,
|
|
861
|
+
tags: tags,
|
|
862
|
+
data: data,
|
|
863
|
+
process: process
|
|
864
|
+
});
|
|
865
|
+
case 5:
|
|
866
|
+
res2 = _context22.sent;
|
|
867
|
+
if (res2) {
|
|
868
|
+
_context22.next = 10;
|
|
869
|
+
break;
|
|
870
|
+
}
|
|
871
|
+
return _context22.abrupt("return", {
|
|
872
|
+
status: 400,
|
|
873
|
+
error: true
|
|
874
|
+
});
|
|
875
|
+
case 10:
|
|
876
|
+
delete res2.Memory;
|
|
877
|
+
return _context22.abrupt("return", {
|
|
878
|
+
json: res2
|
|
879
|
+
});
|
|
880
|
+
case 12:
|
|
881
|
+
case "end":
|
|
882
|
+
return _context22.stop();
|
|
883
|
+
}
|
|
884
|
+
}, _callee22, this);
|
|
885
|
+
}));
|
|
886
|
+
function cu_post_dryrun(_x23) {
|
|
887
|
+
return _cu_post_dryrun.apply(this, arguments);
|
|
888
|
+
}
|
|
889
|
+
return cu_post_dryrun;
|
|
890
|
+
}()
|
|
891
|
+
}, {
|
|
892
|
+
key: "cu_post_results",
|
|
893
|
+
value: function () {
|
|
894
|
+
var _cu_post_results = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee23(_ref7) {
|
|
895
|
+
var _this$mem$env$pid$res, _this$mem$env$pid2;
|
|
896
|
+
var query, params, body, headers, method, pid, _query$from, from, _query$to, to, _query$sort, sort, _query$limit, limit, results, _res, i, count, started, _iterator4, _step4, v, _this$mem$msgs$v;
|
|
897
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
898
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
899
|
+
case 0:
|
|
900
|
+
query = _ref7.query, params = _ref7.params, body = _ref7.body, headers = _ref7.headers, method = _ref7.method;
|
|
901
|
+
pid = params.pid;
|
|
902
|
+
_query$from = query.from, from = _query$from === void 0 ? null : _query$from, _query$to = query.to, to = _query$to === void 0 ? null : _query$to, _query$sort = query.sort, sort = _query$sort === void 0 ? "ASC" : _query$sort, _query$limit = query.limit, limit = _query$limit === void 0 ? 25 : _query$limit;
|
|
903
|
+
results = (_this$mem$env$pid$res = (_this$mem$env$pid2 = this.mem.env[pid]) === null || _this$mem$env$pid2 === void 0 ? void 0 : _this$mem$env$pid2.results) !== null && _this$mem$env$pid$res !== void 0 ? _this$mem$env$pid$res : [];
|
|
904
|
+
if (sort === "DESC") results = (0, _ramda.reverse)(results);
|
|
905
|
+
_res = [];
|
|
906
|
+
i = 1;
|
|
907
|
+
count = 0;
|
|
908
|
+
started = (0, _ramda.isNil)(from);
|
|
909
|
+
_iterator4 = _createForOfIteratorHelper(results);
|
|
910
|
+
_context23.prev = 10;
|
|
911
|
+
_iterator4.s();
|
|
912
|
+
case 12:
|
|
913
|
+
if ((_step4 = _iterator4.n()).done) {
|
|
914
|
+
_context23.next = 27;
|
|
915
|
+
break;
|
|
916
|
+
}
|
|
917
|
+
v = _step4.value;
|
|
918
|
+
if (!started) {
|
|
919
|
+
_context23.next = 23;
|
|
920
|
+
break;
|
|
921
|
+
}
|
|
922
|
+
_res.push({
|
|
923
|
+
cursor: v,
|
|
924
|
+
node: (_this$mem$msgs$v = this.mem.msgs[v]) === null || _this$mem$msgs$v === void 0 ? void 0 : _this$mem$msgs$v.res
|
|
925
|
+
});
|
|
926
|
+
count++;
|
|
927
|
+
if (!(!(0, _ramda.isNil)(to) && v === to)) {
|
|
928
|
+
_context23.next = 19;
|
|
929
|
+
break;
|
|
930
|
+
}
|
|
931
|
+
return _context23.abrupt("break", 27);
|
|
932
|
+
case 19:
|
|
933
|
+
if (!(limit <= count)) {
|
|
934
|
+
_context23.next = 21;
|
|
935
|
+
break;
|
|
936
|
+
}
|
|
937
|
+
return _context23.abrupt("break", 27);
|
|
938
|
+
case 21:
|
|
939
|
+
_context23.next = 24;
|
|
940
|
+
break;
|
|
941
|
+
case 23:
|
|
942
|
+
if (from === v) started = true;
|
|
943
|
+
case 24:
|
|
944
|
+
i++;
|
|
945
|
+
case 25:
|
|
946
|
+
_context23.next = 12;
|
|
947
|
+
break;
|
|
948
|
+
case 27:
|
|
949
|
+
_context23.next = 32;
|
|
950
|
+
break;
|
|
951
|
+
case 29:
|
|
952
|
+
_context23.prev = 29;
|
|
953
|
+
_context23.t0 = _context23["catch"](10);
|
|
954
|
+
_iterator4.e(_context23.t0);
|
|
955
|
+
case 32:
|
|
956
|
+
_context23.prev = 32;
|
|
957
|
+
_iterator4.f();
|
|
958
|
+
return _context23.finish(32);
|
|
959
|
+
case 35:
|
|
960
|
+
return _context23.abrupt("return", {
|
|
961
|
+
json: {
|
|
962
|
+
edges: _res
|
|
963
|
+
}
|
|
964
|
+
});
|
|
965
|
+
case 36:
|
|
966
|
+
case "end":
|
|
967
|
+
return _context23.stop();
|
|
968
|
+
}
|
|
969
|
+
}, _callee23, this, [[10, 29, 32, 35]]);
|
|
970
|
+
}));
|
|
971
|
+
function cu_post_results(_x24) {
|
|
972
|
+
return _cu_post_results.apply(this, arguments);
|
|
973
|
+
}
|
|
974
|
+
return cu_post_results;
|
|
975
|
+
}()
|
|
976
|
+
}, {
|
|
977
|
+
key: "cu_get_result",
|
|
978
|
+
value: function () {
|
|
979
|
+
var _cu_get_result = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee24(_ref8) {
|
|
980
|
+
var query, params, body, headers, method, message, process, _yield$this$recover, success, slot, _this$mem$env$process, _this$mem$env$process2, res2;
|
|
981
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
982
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
983
|
+
case 0:
|
|
984
|
+
query = _ref8.query, params = _ref8.params, body = _ref8.body, headers = _ref8.headers, method = _ref8.method;
|
|
985
|
+
message = params.mid;
|
|
986
|
+
process = query["process-id"]; // check if recovery is ongoing and
|
|
987
|
+
if (!(0, _ramda.isNil)(this.mem.env[process])) {
|
|
988
|
+
_context24.next = 11;
|
|
989
|
+
break;
|
|
990
|
+
}
|
|
991
|
+
_context24.next = 6;
|
|
992
|
+
return this.recover(process);
|
|
993
|
+
case 6:
|
|
994
|
+
_yield$this$recover = _context24.sent;
|
|
995
|
+
success = _yield$this$recover.success;
|
|
996
|
+
if (success) {
|
|
997
|
+
_context24.next = 11;
|
|
998
|
+
break;
|
|
999
|
+
}
|
|
1000
|
+
console.log("process not found:", query["process-id"]);
|
|
1001
|
+
return _context24.abrupt("return", {
|
|
1002
|
+
status: 404,
|
|
1003
|
+
error: "not Found"
|
|
1004
|
+
});
|
|
1005
|
+
case 11:
|
|
1006
|
+
slot = message;
|
|
1007
|
+
if (!/^--[0-9a-zA-Z_-]{43,44}$/.test(message)) {
|
|
1008
|
+
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];
|
|
1009
|
+
}
|
|
1010
|
+
if (!(0, _ramda.isNil)(message)) {
|
|
1011
|
+
_context24.next = 19;
|
|
1012
|
+
break;
|
|
1013
|
+
}
|
|
1014
|
+
_context24.next = 16;
|
|
1015
|
+
return this.recover(process);
|
|
1016
|
+
case 16:
|
|
1017
|
+
message = (_this$mem$env$process2 = this.mem.env[process]) === null || _this$mem$env$process2 === void 0 || (_this$mem$env$process2 = _this$mem$env$process2.results) === null || _this$mem$env$process2 === void 0 ? void 0 : _this$mem$env$process2[slot];
|
|
1018
|
+
if (!(0, _ramda.isNil)(message)) {
|
|
1019
|
+
_context24.next = 19;
|
|
1020
|
+
break;
|
|
1021
|
+
}
|
|
1022
|
+
return _context24.abrupt("return", {
|
|
1023
|
+
status: 404,
|
|
1024
|
+
error: "not Found"
|
|
1025
|
+
});
|
|
1026
|
+
case 19:
|
|
1027
|
+
_context24.next = 21;
|
|
1028
|
+
return this.result({
|
|
1029
|
+
message: message,
|
|
1030
|
+
process: process
|
|
1031
|
+
});
|
|
1032
|
+
case 21:
|
|
1033
|
+
res2 = _context24.sent;
|
|
1034
|
+
if (!(0, _ramda.isNil)(message)) {
|
|
1035
|
+
_context24.next = 24;
|
|
1036
|
+
break;
|
|
1037
|
+
}
|
|
1038
|
+
return _context24.abrupt("return", {
|
|
1039
|
+
json: res2
|
|
1040
|
+
});
|
|
1041
|
+
case 24:
|
|
1042
|
+
case "end":
|
|
1043
|
+
return _context24.stop();
|
|
1044
|
+
}
|
|
1045
|
+
}, _callee24, this);
|
|
1046
|
+
}));
|
|
1047
|
+
function cu_get_result(_x25) {
|
|
1048
|
+
return _cu_get_result.apply(this, arguments);
|
|
1049
|
+
}
|
|
1050
|
+
return cu_get_result;
|
|
1051
|
+
}()
|
|
1052
|
+
}, {
|
|
1053
|
+
key: "su_get_root",
|
|
1054
|
+
value: function () {
|
|
1055
|
+
var _su_get_root = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee25(_ref9) {
|
|
1056
|
+
var query, params, body, headers, method;
|
|
1057
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
1058
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
1059
|
+
case 0:
|
|
1060
|
+
query = _ref9.query, params = _ref9.params, body = _ref9.body, headers = _ref9.headers, method = _ref9.method;
|
|
1061
|
+
return _context25.abrupt("return", {
|
|
1062
|
+
json: {
|
|
1063
|
+
Unit: "Scheduler",
|
|
1064
|
+
Timestamp: Date.now(),
|
|
1065
|
+
Address: _test.su.addr,
|
|
1066
|
+
Processes: (0, _ramda.keys)(this.mem.env)
|
|
1067
|
+
}
|
|
1068
|
+
});
|
|
1069
|
+
case 2:
|
|
1070
|
+
case "end":
|
|
1071
|
+
return _context25.stop();
|
|
1072
|
+
}
|
|
1073
|
+
}, _callee25, this);
|
|
1074
|
+
}));
|
|
1075
|
+
function su_get_root(_x26) {
|
|
1076
|
+
return _su_get_root.apply(this, arguments);
|
|
1077
|
+
}
|
|
1078
|
+
return su_get_root;
|
|
1079
|
+
}()
|
|
1080
|
+
}, {
|
|
1081
|
+
key: "su_get_timestamp",
|
|
1082
|
+
value: function () {
|
|
1083
|
+
var _su_get_timestamp = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee26(_ref10) {
|
|
1084
|
+
var query, params, body, headers, method;
|
|
1085
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
1086
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
1087
|
+
case 0:
|
|
1088
|
+
query = _ref10.query, params = _ref10.params, body = _ref10.body, headers = _ref10.headers, method = _ref10.method;
|
|
1089
|
+
return _context26.abrupt("return", {
|
|
1090
|
+
json: {
|
|
1091
|
+
timestamp: Date.now(),
|
|
1092
|
+
block_height: this.mem.height
|
|
1093
|
+
}
|
|
1094
|
+
});
|
|
1095
|
+
case 2:
|
|
1096
|
+
case "end":
|
|
1097
|
+
return _context26.stop();
|
|
1098
|
+
}
|
|
1099
|
+
}, _callee26, this);
|
|
1100
|
+
}));
|
|
1101
|
+
function su_get_timestamp(_x27) {
|
|
1102
|
+
return _su_get_timestamp.apply(this, arguments);
|
|
1103
|
+
}
|
|
1104
|
+
return su_get_timestamp;
|
|
1105
|
+
}()
|
|
1106
|
+
}, {
|
|
1107
|
+
key: "su_get_pid",
|
|
1108
|
+
value: function () {
|
|
1109
|
+
var _su_get_pid = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee28(_ref11) {
|
|
1110
|
+
var _this = this,
|
|
1111
|
+
_this$mem$env$pid$res2,
|
|
1112
|
+
_this$mem$env$pid3;
|
|
1113
|
+
var query, params, body, headers, method, pid, edges;
|
|
1114
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
1115
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
1116
|
+
case 0:
|
|
1117
|
+
query = _ref11.query, params = _ref11.params, body = _ref11.body, headers = _ref11.headers, method = _ref11.method;
|
|
1118
|
+
pid = params.pid;
|
|
1119
|
+
edges = (0, _ramda.map)(/*#__PURE__*/function () {
|
|
1120
|
+
var _ref12 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee27(v) {
|
|
1121
|
+
var _mtx$anchor, _tx$anchor;
|
|
1122
|
+
var tx, _tags, mid, mtx;
|
|
1123
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
1124
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
1125
|
+
case 0:
|
|
1126
|
+
_context27.next = 2;
|
|
1127
|
+
return _this.mem.getTx(v);
|
|
1128
|
+
case 2:
|
|
1129
|
+
tx = _context27.sent;
|
|
1130
|
+
_tags = (0, _utils.tags)(v.tags);
|
|
1131
|
+
mid = _tags.Message;
|
|
1132
|
+
_context27.next = 7;
|
|
1133
|
+
return _this.mem.getTx(mid);
|
|
1134
|
+
case 7:
|
|
1135
|
+
mtx = _context27.sent;
|
|
1136
|
+
return _context27.abrupt("return", {
|
|
1137
|
+
cursor: v,
|
|
1138
|
+
node: {
|
|
1139
|
+
message: {
|
|
1140
|
+
id: mtx.id,
|
|
1141
|
+
tags: mtx.tags,
|
|
1142
|
+
owner: _this.mem.addrmap[mtx.owner],
|
|
1143
|
+
anchor: (_mtx$anchor = mtx.anchor) !== null && _mtx$anchor !== void 0 ? _mtx$anchor : null,
|
|
1144
|
+
target: pid,
|
|
1145
|
+
signature: mtx.signature,
|
|
1146
|
+
data: tx.data
|
|
1147
|
+
},
|
|
1148
|
+
assignment: {
|
|
1149
|
+
id: tx.id,
|
|
1150
|
+
tags: tx.tags,
|
|
1151
|
+
owner: _this.mem.addrmap[tx.owner],
|
|
1152
|
+
anchor: (_tx$anchor = tx.anchor) !== null && _tx$anchor !== void 0 ? _tx$anchor : null,
|
|
1153
|
+
target: null,
|
|
1154
|
+
signature: tx.signature
|
|
1155
|
+
}
|
|
1156
|
+
}
|
|
1157
|
+
});
|
|
1158
|
+
case 9:
|
|
1159
|
+
case "end":
|
|
1160
|
+
return _context27.stop();
|
|
1161
|
+
}
|
|
1162
|
+
}, _callee27);
|
|
1163
|
+
}));
|
|
1164
|
+
return function (_x29) {
|
|
1165
|
+
return _ref12.apply(this, arguments);
|
|
1166
|
+
};
|
|
1167
|
+
}())((0, _ramda.reverse)((_this$mem$env$pid$res2 = (_this$mem$env$pid3 = this.mem.env[pid]) === null || _this$mem$env$pid3 === void 0 ? void 0 : _this$mem$env$pid3.results) !== null && _this$mem$env$pid$res2 !== void 0 ? _this$mem$env$pid$res2 : [])); // need mod
|
|
1168
|
+
return _context28.abrupt("return", {
|
|
1169
|
+
json: {
|
|
1170
|
+
page_info: {
|
|
1171
|
+
has_next_page: false
|
|
1172
|
+
},
|
|
1173
|
+
edges: edges
|
|
1174
|
+
}
|
|
1175
|
+
});
|
|
1176
|
+
case 4:
|
|
1177
|
+
case "end":
|
|
1178
|
+
return _context28.stop();
|
|
1179
|
+
}
|
|
1180
|
+
}, _callee28, this);
|
|
1181
|
+
}));
|
|
1182
|
+
function su_get_pid(_x28) {
|
|
1183
|
+
return _su_get_pid.apply(this, arguments);
|
|
1184
|
+
}
|
|
1185
|
+
return su_get_pid;
|
|
1186
|
+
}()
|
|
1187
|
+
}, {
|
|
1188
|
+
key: "mu_get_root",
|
|
1189
|
+
value: function () {
|
|
1190
|
+
var _mu_get_root = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee29(_ref13) {
|
|
1191
|
+
var query, params, body, headers, method;
|
|
1192
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
1193
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
1194
|
+
case 0:
|
|
1195
|
+
query = _ref13.query, params = _ref13.params, body = _ref13.body, headers = _ref13.headers, method = _ref13.method;
|
|
1196
|
+
return _context29.abrupt("return", {
|
|
1197
|
+
send: "ao messenger unit"
|
|
1198
|
+
});
|
|
1199
|
+
case 2:
|
|
1200
|
+
case "end":
|
|
1201
|
+
return _context29.stop();
|
|
1202
|
+
}
|
|
1203
|
+
}, _callee29);
|
|
1204
|
+
}));
|
|
1205
|
+
function mu_get_root(_x30) {
|
|
1206
|
+
return _mu_get_root.apply(this, arguments);
|
|
1207
|
+
}
|
|
1208
|
+
return mu_get_root;
|
|
1209
|
+
}()
|
|
1210
|
+
}, {
|
|
1211
|
+
key: "mu_post_root",
|
|
1212
|
+
value: function () {
|
|
1213
|
+
var _mu_post_root = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee30(_ref14) {
|
|
1214
|
+
var query, params, body, headers, method, valid, type, item, _tags, err, res;
|
|
1215
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
1216
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
1217
|
+
case 0:
|
|
1218
|
+
query = _ref14.query, params = _ref14.params, body = _ref14.body, headers = _ref14.headers, method = _ref14.method;
|
|
1219
|
+
_context30.next = 3;
|
|
1220
|
+
return _arbundles.DataItem.verify(body);
|
|
1221
|
+
case 3:
|
|
1222
|
+
valid = _context30.sent;
|
|
1223
|
+
type = null;
|
|
1224
|
+
item = null;
|
|
1225
|
+
if (valid) item = new _arbundles.DataItem(body);
|
|
1226
|
+
_tags = (0, _utils.tags)(item.tags);
|
|
1227
|
+
err = null;
|
|
1228
|
+
if (!(_tags.Type === "Process")) {
|
|
1229
|
+
_context30.next = 16;
|
|
1230
|
+
break;
|
|
1231
|
+
}
|
|
1232
|
+
_context30.next = 12;
|
|
1233
|
+
return this.spawn({
|
|
1234
|
+
item: item,
|
|
1235
|
+
module: _tags.Module,
|
|
1236
|
+
scheduler: _tags.Scheduler
|
|
1237
|
+
});
|
|
1238
|
+
case 12:
|
|
1239
|
+
res = _context30.sent;
|
|
1240
|
+
if (!res) err = "bad requrest";
|
|
1241
|
+
_context30.next = 22;
|
|
1242
|
+
break;
|
|
1243
|
+
case 16:
|
|
1244
|
+
if (!(_tags.Type === "Message")) {
|
|
1245
|
+
_context30.next = 21;
|
|
1246
|
+
break;
|
|
1247
|
+
}
|
|
1248
|
+
_context30.next = 19;
|
|
1249
|
+
return this.message({
|
|
1250
|
+
item: item,
|
|
1251
|
+
process: item.target
|
|
1252
|
+
});
|
|
1253
|
+
case 19:
|
|
1254
|
+
_context30.next = 22;
|
|
1255
|
+
break;
|
|
1256
|
+
case 21:
|
|
1257
|
+
err = true;
|
|
1258
|
+
case 22:
|
|
1259
|
+
if (!err) {
|
|
1260
|
+
_context30.next = 26;
|
|
1261
|
+
break;
|
|
1262
|
+
}
|
|
1263
|
+
return _context30.abrupt("return", {
|
|
1264
|
+
status: 400,
|
|
1265
|
+
error: err
|
|
1266
|
+
});
|
|
1267
|
+
case 26:
|
|
1268
|
+
return _context30.abrupt("return", {
|
|
1269
|
+
json: {
|
|
1270
|
+
id: item.id
|
|
1271
|
+
}
|
|
1272
|
+
});
|
|
1273
|
+
case 27:
|
|
1274
|
+
case "end":
|
|
1275
|
+
return _context30.stop();
|
|
1276
|
+
}
|
|
1277
|
+
}, _callee30, this);
|
|
1278
|
+
}));
|
|
1279
|
+
function mu_post_root(_x31) {
|
|
1280
|
+
return _mu_post_root.apply(this, arguments);
|
|
1281
|
+
}
|
|
1282
|
+
return mu_post_root;
|
|
1283
|
+
}()
|
|
1284
|
+
}, {
|
|
1285
|
+
key: "mu_post_monitor",
|
|
1286
|
+
value: function () {
|
|
1287
|
+
var _mu_post_monitor = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee31(_ref15) {
|
|
1288
|
+
var query, params, body, headers, method;
|
|
1289
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
1290
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
1291
|
+
case 0:
|
|
1292
|
+
query = _ref15.query, params = _ref15.params, body = _ref15.body, headers = _ref15.headers, method = _ref15.method;
|
|
1293
|
+
_context31.next = 3;
|
|
1294
|
+
return this.monitor({
|
|
1295
|
+
process: params.pid
|
|
1296
|
+
});
|
|
1297
|
+
case 3:
|
|
1298
|
+
return _context31.abrupt("return", {
|
|
1299
|
+
json: {
|
|
1300
|
+
id: params.pid,
|
|
1301
|
+
messag: "cron monitored!"
|
|
1302
|
+
}
|
|
1303
|
+
});
|
|
1304
|
+
case 4:
|
|
1305
|
+
case "end":
|
|
1306
|
+
return _context31.stop();
|
|
1307
|
+
}
|
|
1308
|
+
}, _callee31, this);
|
|
1309
|
+
}));
|
|
1310
|
+
function mu_post_monitor(_x32) {
|
|
1311
|
+
return _mu_post_monitor.apply(this, arguments);
|
|
1312
|
+
}
|
|
1313
|
+
return mu_post_monitor;
|
|
1314
|
+
}()
|
|
1315
|
+
}, {
|
|
1316
|
+
key: "mu_delete_monitor",
|
|
1317
|
+
value: function () {
|
|
1318
|
+
var _mu_delete_monitor = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee32(_ref16) {
|
|
1319
|
+
var query, params, body, headers, method;
|
|
1320
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
1321
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
1322
|
+
case 0:
|
|
1323
|
+
query = _ref16.query, params = _ref16.params, body = _ref16.body, headers = _ref16.headers, method = _ref16.method;
|
|
1324
|
+
_context32.next = 3;
|
|
1325
|
+
return this.unmonitor({
|
|
1326
|
+
process: params.pid
|
|
1327
|
+
});
|
|
1328
|
+
case 3:
|
|
1329
|
+
return _context32.abrupt("return", {
|
|
1330
|
+
json: {
|
|
1331
|
+
id: params.pid,
|
|
1332
|
+
message: "cron deleted!"
|
|
1333
|
+
}
|
|
1334
|
+
});
|
|
1335
|
+
case 4:
|
|
1336
|
+
case "end":
|
|
1337
|
+
return _context32.stop();
|
|
1338
|
+
}
|
|
1339
|
+
}, _callee32, this);
|
|
1340
|
+
}));
|
|
1341
|
+
function mu_delete_monitor(_x33) {
|
|
1342
|
+
return _mu_delete_monitor.apply(this, arguments);
|
|
1343
|
+
}
|
|
1344
|
+
return mu_delete_monitor;
|
|
1345
|
+
}()
|
|
1346
|
+
}, {
|
|
1347
|
+
key: "ar_get_root",
|
|
1348
|
+
value: function () {
|
|
1349
|
+
var _ar_get_root = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee33(_ref17) {
|
|
1350
|
+
var query, params, body, headers, method;
|
|
1351
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
1352
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
1353
|
+
case 0:
|
|
1354
|
+
query = _ref17.query, params = _ref17.params, body = _ref17.body, headers = _ref17.headers, method = _ref17.method;
|
|
1355
|
+
return _context33.abrupt("return", {
|
|
1356
|
+
json: {
|
|
1357
|
+
version: 1,
|
|
1358
|
+
timestamp: Date.now(),
|
|
1359
|
+
height: this.mem.height,
|
|
1360
|
+
network: "wao.LN.1",
|
|
1361
|
+
current: this.mem.getAnchor()
|
|
1362
|
+
}
|
|
1363
|
+
});
|
|
1364
|
+
case 2:
|
|
1365
|
+
case "end":
|
|
1366
|
+
return _context33.stop();
|
|
1367
|
+
}
|
|
1368
|
+
}, _callee33, this);
|
|
1369
|
+
}));
|
|
1370
|
+
function ar_get_root(_x34) {
|
|
1371
|
+
return _ar_get_root.apply(this, arguments);
|
|
1372
|
+
}
|
|
1373
|
+
return ar_get_root;
|
|
1374
|
+
}()
|
|
1375
|
+
}, {
|
|
1376
|
+
key: "ar_get_wallet_balance",
|
|
1377
|
+
value: function () {
|
|
1378
|
+
var _ar_get_wallet_balance = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee34(_ref18) {
|
|
1379
|
+
var query, params, body, headers, method;
|
|
1380
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
1381
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
1382
|
+
case 0:
|
|
1383
|
+
query = _ref18.query, params = _ref18.params, body = _ref18.body, headers = _ref18.headers, method = _ref18.method;
|
|
1384
|
+
return _context34.abrupt("return", {
|
|
1385
|
+
send: "0"
|
|
1386
|
+
});
|
|
1387
|
+
case 2:
|
|
1388
|
+
case "end":
|
|
1389
|
+
return _context34.stop();
|
|
1390
|
+
}
|
|
1391
|
+
}, _callee34);
|
|
1392
|
+
}));
|
|
1393
|
+
function ar_get_wallet_balance(_x35) {
|
|
1394
|
+
return _ar_get_wallet_balance.apply(this, arguments);
|
|
1395
|
+
}
|
|
1396
|
+
return ar_get_wallet_balance;
|
|
1397
|
+
}()
|
|
1398
|
+
}, {
|
|
1399
|
+
key: "ar_get_mint",
|
|
1400
|
+
value: function () {
|
|
1401
|
+
var _ar_get_mint = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee35(_ref19) {
|
|
1402
|
+
var query, params, body, headers, method;
|
|
1403
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
1404
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
1405
|
+
case 0:
|
|
1406
|
+
query = _ref19.query, params = _ref19.params, body = _ref19.body, headers = _ref19.headers, method = _ref19.method;
|
|
1407
|
+
return _context35.abrupt("return", {
|
|
1408
|
+
json: {
|
|
1409
|
+
id: "0"
|
|
1410
|
+
}
|
|
1411
|
+
});
|
|
1412
|
+
case 2:
|
|
1413
|
+
case "end":
|
|
1414
|
+
return _context35.stop();
|
|
1415
|
+
}
|
|
1416
|
+
}, _callee35);
|
|
1417
|
+
}));
|
|
1418
|
+
function ar_get_mint(_x36) {
|
|
1419
|
+
return _ar_get_mint.apply(this, arguments);
|
|
1420
|
+
}
|
|
1421
|
+
return ar_get_mint;
|
|
1422
|
+
}()
|
|
1423
|
+
}, {
|
|
1424
|
+
key: "ar_get_tx_offset",
|
|
1425
|
+
value: function () {
|
|
1426
|
+
var _ar_get_tx_offset = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee36(_ref20) {
|
|
1427
|
+
var query, params, body, headers, method;
|
|
1428
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
1429
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
1430
|
+
case 0:
|
|
1431
|
+
query = _ref20.query, params = _ref20.params, body = _ref20.body, headers = _ref20.headers, method = _ref20.method;
|
|
1432
|
+
return _context36.abrupt("return", {
|
|
1433
|
+
status: 400,
|
|
1434
|
+
send: null
|
|
1435
|
+
});
|
|
1436
|
+
case 2:
|
|
1437
|
+
case "end":
|
|
1438
|
+
return _context36.stop();
|
|
1439
|
+
}
|
|
1440
|
+
}, _callee36);
|
|
1441
|
+
}));
|
|
1442
|
+
function ar_get_tx_offset(_x37) {
|
|
1443
|
+
return _ar_get_tx_offset.apply(this, arguments);
|
|
1444
|
+
}
|
|
1445
|
+
return ar_get_tx_offset;
|
|
1446
|
+
}()
|
|
1447
|
+
}, {
|
|
1448
|
+
key: "ar_get_tx_anchor",
|
|
1449
|
+
value: function () {
|
|
1450
|
+
var _ar_get_tx_anchor = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee37(_ref21) {
|
|
1451
|
+
var query, params, body, headers, method;
|
|
1452
|
+
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
|
1453
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
1454
|
+
case 0:
|
|
1455
|
+
query = _ref21.query, params = _ref21.params, body = _ref21.body, headers = _ref21.headers, method = _ref21.method;
|
|
1456
|
+
return _context37.abrupt("return", {
|
|
1457
|
+
send: this.mem.getAnchor()
|
|
1458
|
+
});
|
|
1459
|
+
case 2:
|
|
1460
|
+
case "end":
|
|
1461
|
+
return _context37.stop();
|
|
1462
|
+
}
|
|
1463
|
+
}, _callee37, this);
|
|
1464
|
+
}));
|
|
1465
|
+
function ar_get_tx_anchor(_x38) {
|
|
1466
|
+
return _ar_get_tx_anchor.apply(this, arguments);
|
|
1467
|
+
}
|
|
1468
|
+
return ar_get_tx_anchor;
|
|
1469
|
+
}()
|
|
1470
|
+
}, {
|
|
1471
|
+
key: "ar_get_mine",
|
|
1472
|
+
value: function () {
|
|
1473
|
+
var _ar_get_mine = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee38(_ref22) {
|
|
1474
|
+
var query, params, body, headers, method;
|
|
1475
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
1476
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
1477
|
+
case 0:
|
|
1478
|
+
query = _ref22.query, params = _ref22.params, body = _ref22.body, headers = _ref22.headers, method = _ref22.method;
|
|
1479
|
+
return _context38.abrupt("return", {
|
|
1480
|
+
json: params
|
|
1481
|
+
});
|
|
1482
|
+
case 2:
|
|
1483
|
+
case "end":
|
|
1484
|
+
return _context38.stop();
|
|
1485
|
+
}
|
|
1486
|
+
}, _callee38);
|
|
1487
|
+
}));
|
|
1488
|
+
function ar_get_mine(_x39) {
|
|
1489
|
+
return _ar_get_mine.apply(this, arguments);
|
|
1490
|
+
}
|
|
1491
|
+
return ar_get_mine;
|
|
1492
|
+
}()
|
|
1493
|
+
}, {
|
|
1494
|
+
key: "ar_get_id",
|
|
1495
|
+
value: function () {
|
|
1496
|
+
var _ar_get_id = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee39(_ref23) {
|
|
1497
|
+
var query, params, body, headers, method, _data;
|
|
1498
|
+
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
|
1499
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
1500
|
+
case 0:
|
|
1501
|
+
query = _ref23.query, params = _ref23.params, body = _ref23.body, headers = _ref23.headers, method = _ref23.method;
|
|
1502
|
+
_context39.next = 3;
|
|
1503
|
+
return this._ar.data(params.id);
|
|
1504
|
+
case 3:
|
|
1505
|
+
_data = _context39.sent;
|
|
1506
|
+
if (_data) {
|
|
1507
|
+
_context39.next = 8;
|
|
1508
|
+
break;
|
|
1509
|
+
}
|
|
1510
|
+
return _context39.abrupt("return", {
|
|
1511
|
+
status: 404,
|
|
1512
|
+
send: null
|
|
1513
|
+
});
|
|
1514
|
+
case 8:
|
|
1515
|
+
return _context39.abrupt("return", {
|
|
1516
|
+
send: Buffer.from(_data, "base64")
|
|
1517
|
+
});
|
|
1518
|
+
case 9:
|
|
1519
|
+
case "end":
|
|
1520
|
+
return _context39.stop();
|
|
1521
|
+
}
|
|
1522
|
+
}, _callee39, this);
|
|
1523
|
+
}));
|
|
1524
|
+
function ar_get_id(_x40) {
|
|
1525
|
+
return _ar_get_id.apply(this, arguments);
|
|
1526
|
+
}
|
|
1527
|
+
return ar_get_id;
|
|
1528
|
+
}()
|
|
1529
|
+
}, {
|
|
1530
|
+
key: "ar_get_price",
|
|
1531
|
+
value: function () {
|
|
1532
|
+
var _ar_get_price = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee40(_ref24) {
|
|
1533
|
+
var query, params, body, headers, method;
|
|
1534
|
+
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
1535
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
1536
|
+
case 0:
|
|
1537
|
+
query = _ref24.query, params = _ref24.params, body = _ref24.body, headers = _ref24.headers, method = _ref24.method;
|
|
1538
|
+
return _context40.abrupt("return", {
|
|
1539
|
+
send: "0"
|
|
1540
|
+
});
|
|
1541
|
+
case 2:
|
|
1542
|
+
case "end":
|
|
1543
|
+
return _context40.stop();
|
|
1544
|
+
}
|
|
1545
|
+
}, _callee40);
|
|
1546
|
+
}));
|
|
1547
|
+
function ar_get_price(_x41) {
|
|
1548
|
+
return _ar_get_price.apply(this, arguments);
|
|
1549
|
+
}
|
|
1550
|
+
return ar_get_price;
|
|
1551
|
+
}()
|
|
1552
|
+
}, {
|
|
1553
|
+
key: "ar_post_graphql",
|
|
1554
|
+
value: function () {
|
|
1555
|
+
var _ar_post_graphql = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee41(_ref25) {
|
|
1556
|
+
var query, params, body, headers, method, _query, variables, _toGraphObj, tar, args, res2, edges;
|
|
1557
|
+
return _regeneratorRuntime().wrap(function _callee41$(_context41) {
|
|
1558
|
+
while (1) switch (_context41.prev = _context41.next) {
|
|
1559
|
+
case 0:
|
|
1560
|
+
query = _ref25.query, params = _ref25.params, body = _ref25.body, headers = _ref25.headers, method = _ref25.method;
|
|
1561
|
+
_context41.prev = 1;
|
|
1562
|
+
_query = body.query, variables = body.variables;
|
|
1563
|
+
_toGraphObj = (0, _utils.toGraphObj)({
|
|
1564
|
+
query: _query,
|
|
1565
|
+
variables: variables
|
|
1566
|
+
}), tar = _toGraphObj.tar, args = _toGraphObj.args;
|
|
1567
|
+
res2 = null;
|
|
1568
|
+
if (!(tar === "transactions")) {
|
|
1569
|
+
_context41.next = 11;
|
|
1570
|
+
break;
|
|
1571
|
+
}
|
|
1572
|
+
_context41.next = 8;
|
|
1573
|
+
return this.gql.txs(_objectSpread({}, args));
|
|
1574
|
+
case 8:
|
|
1575
|
+
res2 = _context41.sent;
|
|
1576
|
+
_context41.next = 15;
|
|
1577
|
+
break;
|
|
1578
|
+
case 11:
|
|
1579
|
+
if (!(tar === "blocks")) {
|
|
1580
|
+
_context41.next = 15;
|
|
1581
|
+
break;
|
|
1582
|
+
}
|
|
1583
|
+
_context41.next = 14;
|
|
1584
|
+
return this.gql.blocks(_objectSpread({}, args));
|
|
1585
|
+
case 14:
|
|
1586
|
+
res2 = _context41.sent;
|
|
1587
|
+
case 15:
|
|
1588
|
+
edges = (0, _ramda.map)(function (v) {
|
|
1589
|
+
return {
|
|
1590
|
+
node: v,
|
|
1591
|
+
cursor: v.cursor
|
|
1592
|
+
};
|
|
1593
|
+
}, res2);
|
|
1594
|
+
return _context41.abrupt("return", {
|
|
1595
|
+
json: {
|
|
1596
|
+
data: {
|
|
1597
|
+
transactions: {
|
|
1598
|
+
pageInfo: {
|
|
1599
|
+
hasNextPage: true
|
|
1600
|
+
},
|
|
1601
|
+
edges: edges
|
|
1602
|
+
}
|
|
1603
|
+
}
|
|
1604
|
+
}
|
|
1605
|
+
});
|
|
1606
|
+
case 19:
|
|
1607
|
+
_context41.prev = 19;
|
|
1608
|
+
_context41.t0 = _context41["catch"](1);
|
|
1609
|
+
console.log(_context41.t0);
|
|
1610
|
+
return _context41.abrupt("return", {
|
|
1611
|
+
status: 400,
|
|
1612
|
+
error: "bad request"
|
|
1613
|
+
});
|
|
1614
|
+
case 23:
|
|
1615
|
+
case "end":
|
|
1616
|
+
return _context41.stop();
|
|
1617
|
+
}
|
|
1618
|
+
}, _callee41, this, [[1, 19]]);
|
|
1619
|
+
}));
|
|
1620
|
+
function ar_post_graphql(_x42) {
|
|
1621
|
+
return _ar_post_graphql.apply(this, arguments);
|
|
1622
|
+
}
|
|
1623
|
+
return ar_post_graphql;
|
|
1624
|
+
}()
|
|
1625
|
+
}, {
|
|
1626
|
+
key: "ar_post_id",
|
|
1627
|
+
value: function () {
|
|
1628
|
+
var _ar_post_id = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee42(_ref26) {
|
|
1629
|
+
var query, params, body, headers, method, buf;
|
|
1630
|
+
return _regeneratorRuntime().wrap(function _callee42$(_context42) {
|
|
1631
|
+
while (1) switch (_context42.prev = _context42.next) {
|
|
1632
|
+
case 0:
|
|
1633
|
+
query = _ref26.query, params = _ref26.params, body = _ref26.body, headers = _ref26.headers, method = _ref26.method;
|
|
1634
|
+
if (!body.chunk) {
|
|
1635
|
+
_context42.next = 15;
|
|
1636
|
+
break;
|
|
1637
|
+
}
|
|
1638
|
+
if (!this.data[body.data_root]) {
|
|
1639
|
+
_context42.next = 12;
|
|
1640
|
+
break;
|
|
1641
|
+
}
|
|
1642
|
+
this.data[body.data_root].data += body.chunk;
|
|
1643
|
+
buf = Buffer.from(body.chunk, "base64");
|
|
1644
|
+
if (!this.data[body.data_root].chunks) {
|
|
1645
|
+
this.data[body.data_root].chunks = buf;
|
|
1646
|
+
} else {
|
|
1647
|
+
this.data[body.data_root].chunks = Buffer.concat([this.data[body.data_root].chunks, buf]);
|
|
1648
|
+
}
|
|
1649
|
+
delete body.chunk;
|
|
1650
|
+
if (!(this.data[body.data_root].data_size <= this.data[body.data_root].chunks.length)) {
|
|
1651
|
+
_context42.next = 12;
|
|
1652
|
+
break;
|
|
1653
|
+
}
|
|
1654
|
+
this.data[body.data_root].data = this.data[body.data_root].chunks.toString("base64");
|
|
1655
|
+
_context42.next = 11;
|
|
1656
|
+
return this._ar.postTx(this.data[body.data_root]);
|
|
1657
|
+
case 11:
|
|
1658
|
+
delete this.data[body.data_root];
|
|
1659
|
+
case 12:
|
|
1660
|
+
return _context42.abrupt("return", {
|
|
1661
|
+
json: {
|
|
1662
|
+
id: body.id
|
|
1663
|
+
}
|
|
1664
|
+
});
|
|
1665
|
+
case 15:
|
|
1666
|
+
if (!(body.data_root && body.data === "")) {
|
|
1667
|
+
_context42.next = 19;
|
|
1668
|
+
break;
|
|
1669
|
+
}
|
|
1670
|
+
this.data[body.data_root] = body;
|
|
1671
|
+
_context42.next = 21;
|
|
1672
|
+
break;
|
|
1673
|
+
case 19:
|
|
1674
|
+
_context42.next = 21;
|
|
1675
|
+
return this._ar.postTx(body);
|
|
1676
|
+
case 21:
|
|
1677
|
+
return _context42.abrupt("return", {
|
|
1678
|
+
json: {
|
|
1679
|
+
id: body.id
|
|
1680
|
+
}
|
|
1681
|
+
});
|
|
1682
|
+
case 22:
|
|
1683
|
+
case "end":
|
|
1684
|
+
return _context42.stop();
|
|
1685
|
+
}
|
|
1686
|
+
}, _callee42, this);
|
|
1687
|
+
}));
|
|
1688
|
+
function ar_post_id(_x43) {
|
|
1689
|
+
return _ar_post_id.apply(this, arguments);
|
|
1690
|
+
}
|
|
1691
|
+
return ar_post_id;
|
|
1692
|
+
}()
|
|
1693
|
+
}]);
|
|
1694
|
+
}();
|
|
1695
|
+
var _default = exports["default"] = Adaptor;
|