wao 0.9.2 → 0.10.2
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 +31 -32
- package/cjs/aoconnect-base.js +197 -175
- package/cjs/armem-base.js +300 -116
- package/cjs/armem-web.js +11 -1
- package/cjs/armem.js +8 -1
- package/cjs/{ar-base.js → bar.js} +29 -30
- package/cjs/build.js +8 -0
- package/cjs/compress.js +165 -0
- package/cjs/server.js +66 -46
- package/cjs/tar.js +2 -2
- package/cjs/tgql.js +81 -78
- package/cjs/waosm/waosm.js +332 -0
- package/cjs/waosm-node/waosm.js +21 -0
- package/cjs/waosm-node/waosm_bg.js +193 -0
- package/cjs/waosm-node.js +28 -0
- package/cjs/war.js +2 -2
- package/esm/ao.js +7 -7
- package/esm/aoconnect-base.js +25 -24
- package/esm/armem-base.js +91 -11
- package/esm/armem-web.js +2 -1
- package/esm/armem.js +2 -1
- package/esm/{ar-base.js → bar.js} +9 -15
- package/esm/build.js +7 -0
- package/esm/compress.js +113 -0
- package/esm/lfdb.js +1 -3
- package/esm/server.js +5 -5
- package/esm/tar.js +1 -1
- package/esm/tgql.js +2 -2
- package/esm/waosm/README.md +79 -0
- package/esm/waosm/package.json +14 -0
- package/esm/waosm/waosm.d.ts +46 -0
- package/esm/waosm/waosm.js +264 -0
- package/esm/waosm/waosm_bg.wasm +0 -0
- package/esm/waosm/waosm_bg.wasm.d.ts +10 -0
- package/esm/waosm-node/README.md +79 -0
- package/esm/waosm-node/waosm.d.ts +12 -0
- package/esm/waosm-node/waosm.js +4 -0
- package/esm/waosm-node/waosm_bg.js +171 -0
- package/esm/waosm-node/waosm_bg.wasm +0 -0
- package/esm/waosm-node/waosm_bg.wasm.d.ts +10 -0
- package/esm/waosm-node.js +13 -0
- package/esm/war.js +1 -1
- package/package.json +4 -1
package/cjs/armem-web.js
CHANGED
|
@@ -8,10 +8,16 @@ exports["default"] = void 0;
|
|
|
8
8
|
var _weavedbLite = _interopRequireDefault(require("./lua/weavedb-lite.js"));
|
|
9
9
|
var _armemBase = _interopRequireDefault(require("./armem-base.js"));
|
|
10
10
|
var _lfdb = _interopRequireDefault(require("./lfdb.js"));
|
|
11
|
+
var _waosm = _interopRequireWildcard(require("./waosm/waosm.js"));
|
|
12
|
+
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); }
|
|
13
|
+
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; }
|
|
11
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
12
15
|
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; }
|
|
13
16
|
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); }
|
|
14
17
|
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); }); }; }
|
|
18
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
19
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
20
|
+
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; }
|
|
15
21
|
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
16
22
|
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); } }
|
|
17
23
|
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
@@ -29,7 +35,11 @@ var ArMem = exports["default"] = /*#__PURE__*/function (_Base) {
|
|
|
29
35
|
var _this;
|
|
30
36
|
var args = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
31
37
|
_classCallCheck(this, ArMem);
|
|
32
|
-
_this = _callSuper(this, ArMem, [args
|
|
38
|
+
_this = _callSuper(this, ArMem, [_objectSpread(_objectSpread({}, args), {}, {
|
|
39
|
+
init: _waosm["default"],
|
|
40
|
+
Compressor: _waosm.Compressor,
|
|
41
|
+
Decompressor: _waosm.Decompressor
|
|
42
|
+
})]);
|
|
33
43
|
_this.db = (0, _lfdb["default"])(_this);
|
|
34
44
|
_this.initSync();
|
|
35
45
|
return _this;
|
package/cjs/armem.js
CHANGED
|
@@ -12,10 +12,14 @@ var _lmdb = require("lmdb");
|
|
|
12
12
|
var _fs = require("fs");
|
|
13
13
|
var _path = require("path");
|
|
14
14
|
var _armemBase = _interopRequireDefault(require("./armem-base.js"));
|
|
15
|
+
var _waosmNode = require("./waosm-node.js");
|
|
15
16
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
16
17
|
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; }
|
|
17
18
|
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); }
|
|
18
19
|
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); }); }; }
|
|
20
|
+
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; }
|
|
21
|
+
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; }
|
|
22
|
+
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; }
|
|
19
23
|
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
20
24
|
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); } }
|
|
21
25
|
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
@@ -34,7 +38,10 @@ var ArMem = exports["default"] = /*#__PURE__*/function (_Base) {
|
|
|
34
38
|
var args = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
35
39
|
_classCallCheck(this, ArMem);
|
|
36
40
|
var cache = args.cache;
|
|
37
|
-
_this = _callSuper(this, ArMem, [args
|
|
41
|
+
_this = _callSuper(this, ArMem, [_objectSpread(_objectSpread({}, args), {}, {
|
|
42
|
+
Compressor: _waosmNode.Compressor,
|
|
43
|
+
Decompressor: _waosmNode.Decompressor
|
|
44
|
+
})]);
|
|
38
45
|
if (cache) _this.db = (0, _lmdb.open)({
|
|
39
46
|
path: cache,
|
|
40
47
|
compression: true
|
|
@@ -62,18 +62,17 @@ var AR = /*#__PURE__*/function (_MAR) {
|
|
|
62
62
|
key: "owner",
|
|
63
63
|
value: function () {
|
|
64
64
|
var _owner = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(di) {
|
|
65
|
-
var raw_owner, hashBuffer;
|
|
66
65
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
67
66
|
while (1) switch (_context.prev = _context.next) {
|
|
68
67
|
case 0:
|
|
69
|
-
|
|
70
|
-
_context.
|
|
68
|
+
_context.t0 = _base64url["default"];
|
|
69
|
+
_context.t1 = Buffer;
|
|
71
70
|
_context.next = 4;
|
|
72
|
-
return crypto.subtle.digest("SHA-256",
|
|
71
|
+
return crypto.subtle.digest("SHA-256", di.rawOwner);
|
|
73
72
|
case 4:
|
|
74
|
-
_context.
|
|
75
|
-
|
|
76
|
-
return _context.abrupt("return",
|
|
73
|
+
_context.t2 = _context.sent;
|
|
74
|
+
_context.t3 = _context.t1.from.call(_context.t1, _context.t2);
|
|
75
|
+
return _context.abrupt("return", _context.t0.encode.call(_context.t0, _context.t3));
|
|
77
76
|
case 7:
|
|
78
77
|
case "end":
|
|
79
78
|
return _context.stop();
|
|
@@ -89,38 +88,37 @@ var AR = /*#__PURE__*/function (_MAR) {
|
|
|
89
88
|
key: "dataitem",
|
|
90
89
|
value: function () {
|
|
91
90
|
var _dataitem = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref) {
|
|
92
|
-
var _ref$target, target, _ref$data, data, _ref$tags, tags, signer, item, di,
|
|
91
|
+
var _ref$target, target, _ref$data, data, _ref$tags, tags, signer, item, di, _item, owner;
|
|
93
92
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
94
93
|
while (1) switch (_context2.prev = _context2.next) {
|
|
95
94
|
case 0:
|
|
96
95
|
_ref$target = _ref.target, target = _ref$target === void 0 ? "" : _ref$target, _ref$data = _ref.data, data = _ref$data === void 0 ? "1984" : _ref$data, _ref$tags = _ref.tags, tags = _ref$tags === void 0 ? {} : _ref$tags, signer = _ref.signer, item = _ref.item;
|
|
97
96
|
di = item;
|
|
98
97
|
if (di) {
|
|
99
|
-
_context2.next =
|
|
98
|
+
_context2.next = 9;
|
|
100
99
|
break;
|
|
101
100
|
}
|
|
102
|
-
|
|
103
|
-
_context2.next = 6;
|
|
101
|
+
_context2.next = 5;
|
|
104
102
|
return signer({
|
|
105
103
|
data: data,
|
|
106
|
-
tags:
|
|
104
|
+
tags: (0, _utils.buildTags)(tags),
|
|
107
105
|
target: target
|
|
108
106
|
});
|
|
109
|
-
case
|
|
107
|
+
case 5:
|
|
110
108
|
_item = _context2.sent;
|
|
111
109
|
di = new DataItem(_item.raw);
|
|
112
|
-
_context2.next =
|
|
110
|
+
_context2.next = 10;
|
|
113
111
|
break;
|
|
114
|
-
case
|
|
112
|
+
case 9:
|
|
115
113
|
tags = (0, _utils.tags)(di.tags);
|
|
116
|
-
case
|
|
117
|
-
_context2.next =
|
|
114
|
+
case 10:
|
|
115
|
+
_context2.next = 12;
|
|
118
116
|
return this.owner(di);
|
|
119
|
-
case
|
|
117
|
+
case 12:
|
|
120
118
|
owner = _context2.sent;
|
|
121
|
-
_context2.next =
|
|
119
|
+
_context2.next = 15;
|
|
122
120
|
return di.id;
|
|
123
|
-
case
|
|
121
|
+
case 15:
|
|
124
122
|
_context2.t0 = _context2.sent;
|
|
125
123
|
_context2.t1 = owner;
|
|
126
124
|
_context2.t2 = di;
|
|
@@ -131,7 +129,7 @@ var AR = /*#__PURE__*/function (_MAR) {
|
|
|
131
129
|
item: _context2.t2,
|
|
132
130
|
tags: _context2.t3
|
|
133
131
|
});
|
|
134
|
-
case
|
|
132
|
+
case 20:
|
|
135
133
|
case "end":
|
|
136
134
|
return _context2.stop();
|
|
137
135
|
}
|
|
@@ -146,7 +144,7 @@ var AR = /*#__PURE__*/function (_MAR) {
|
|
|
146
144
|
key: "post",
|
|
147
145
|
value: function () {
|
|
148
146
|
var _post = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref2) {
|
|
149
|
-
var _ref2$data, data, _ref2$tags, tags, jwk, err, _yield$this$checkWall, tx,
|
|
147
|
+
var _ref2$data, data, _ref2$tags, tags, jwk, err, _yield$this$checkWall, tx, _iterator, _step, v;
|
|
150
148
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
151
149
|
while (1) switch (_context3.prev = _context3.next) {
|
|
152
150
|
case 0:
|
|
@@ -174,8 +172,7 @@ var AR = /*#__PURE__*/function (_MAR) {
|
|
|
174
172
|
});
|
|
175
173
|
case 11:
|
|
176
174
|
tx = _context3.sent;
|
|
177
|
-
|
|
178
|
-
_iterator = _createForOfIteratorHelper(_tags);
|
|
175
|
+
_iterator = _createForOfIteratorHelper((0, _utils.buildTags)(null, tags));
|
|
179
176
|
try {
|
|
180
177
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
181
178
|
v = _step.value;
|
|
@@ -186,11 +183,11 @@ var AR = /*#__PURE__*/function (_MAR) {
|
|
|
186
183
|
} finally {
|
|
187
184
|
_iterator.f();
|
|
188
185
|
}
|
|
189
|
-
_context3.next =
|
|
186
|
+
_context3.next = 16;
|
|
190
187
|
return this.postTx(tx, jwk);
|
|
191
|
-
case
|
|
188
|
+
case 16:
|
|
192
189
|
return _context3.abrupt("return", _context3.sent);
|
|
193
|
-
case
|
|
190
|
+
case 17:
|
|
194
191
|
case "end":
|
|
195
192
|
return _context3.stop();
|
|
196
193
|
}
|
|
@@ -490,7 +487,9 @@ var AR = /*#__PURE__*/function (_MAR) {
|
|
|
490
487
|
block.txs.push(item.id);
|
|
491
488
|
_txs2.block = block.id;
|
|
492
489
|
_context5.next = 58;
|
|
493
|
-
return this.mem.set(
|
|
490
|
+
return this.mem.set({
|
|
491
|
+
bundle: tx.id
|
|
492
|
+
}, "txs", item.id);
|
|
494
493
|
case 58:
|
|
495
494
|
_context5.next = 43;
|
|
496
495
|
break;
|
|
@@ -606,7 +605,7 @@ var AR = /*#__PURE__*/function (_MAR) {
|
|
|
606
605
|
while (1) switch (_context6.prev = _context6.next) {
|
|
607
606
|
case 0:
|
|
608
607
|
_context6.next = 2;
|
|
609
|
-
return this.mem.
|
|
608
|
+
return this.mem.getTx(id);
|
|
610
609
|
case 2:
|
|
611
610
|
return _context6.abrupt("return", _context6.sent);
|
|
612
611
|
case 3:
|
|
@@ -636,7 +635,7 @@ var AR = /*#__PURE__*/function (_MAR) {
|
|
|
636
635
|
if (!(0, _ramda.isNil)(_string.string)) string = _string.string;
|
|
637
636
|
}
|
|
638
637
|
_context7.next = 5;
|
|
639
|
-
return this.mem.
|
|
638
|
+
return this.mem.getTx(id);
|
|
640
639
|
case 5:
|
|
641
640
|
tx = _context7.sent;
|
|
642
641
|
_data = (_tx$data = tx === null || tx === void 0 ? void 0 : tx.data) !== null && _tx$data !== void 0 ? _tx$data : null;
|
package/cjs/build.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _fs = _interopRequireDefault(require("fs"));
|
|
4
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
5
|
+
var wasmBytes = _fs["default"].readFileSync("./waosm/waosm_bg.wasm");
|
|
6
|
+
var wasmB64 = wasmBytes.toString("base64");
|
|
7
|
+
var _exports = "export const wasmB64 = \"".concat(wasmB64, "\";");
|
|
8
|
+
_fs["default"].writeFileSync("./waosm/waosm_b64.js", _exports);
|
package/cjs/compress.js
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.decompress = exports.compress = void 0;
|
|
7
|
+
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 _n2 = 0, F = function F() {}; return { s: F, n: function n() { return _n2 >= r.length ? { done: !0 } : { done: !1, value: r[_n2++] }; }, 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; } } }; }
|
|
8
|
+
function _toArray(r) { return _arrayWithHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableRest(); }
|
|
9
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
10
|
+
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; } }
|
|
11
|
+
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; }
|
|
12
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
13
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
14
|
+
function toBase256(n) {
|
|
15
|
+
var result = [];
|
|
16
|
+
while (n > 0) {
|
|
17
|
+
result.unshift(n % 256);
|
|
18
|
+
n = Math.floor(n / 256);
|
|
19
|
+
}
|
|
20
|
+
return [result.length].concat(result);
|
|
21
|
+
}
|
|
22
|
+
var _comp = function _comp(arr, _arr, mode) {
|
|
23
|
+
var _nums = null;
|
|
24
|
+
var _elms = null;
|
|
25
|
+
var len = _arr.length;
|
|
26
|
+
var flag = 0;
|
|
27
|
+
if (mode === 1 && _arr[0] !== 0) {
|
|
28
|
+
flag += 100;
|
|
29
|
+
_elms = [_arr[0]];
|
|
30
|
+
} else if (mode === 2) {
|
|
31
|
+
flag += 200;
|
|
32
|
+
_elms = _arr;
|
|
33
|
+
}
|
|
34
|
+
if (len < 10) flag += len;else if (len !== 10) {
|
|
35
|
+
var _toBase = toBase256(len),
|
|
36
|
+
_toBase2 = _toArray(_toBase),
|
|
37
|
+
elm = _toBase2[0],
|
|
38
|
+
nums = _toBase2.slice(1);
|
|
39
|
+
_nums = nums;
|
|
40
|
+
flag += elm * 10;
|
|
41
|
+
if (_nums[0] < 10) flag += _nums.shift();
|
|
42
|
+
}
|
|
43
|
+
arr.push(flag);
|
|
44
|
+
if (_nums) {
|
|
45
|
+
var _iterator = _createForOfIteratorHelper(_nums),
|
|
46
|
+
_step;
|
|
47
|
+
try {
|
|
48
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
49
|
+
var n = _step.value;
|
|
50
|
+
arr.push(n);
|
|
51
|
+
}
|
|
52
|
+
} catch (err) {
|
|
53
|
+
_iterator.e(err);
|
|
54
|
+
} finally {
|
|
55
|
+
_iterator.f();
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
if (_elms) {
|
|
59
|
+
var _iterator2 = _createForOfIteratorHelper(_elms),
|
|
60
|
+
_step2;
|
|
61
|
+
try {
|
|
62
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
63
|
+
var _n = _step2.value;
|
|
64
|
+
arr.push(_n);
|
|
65
|
+
}
|
|
66
|
+
} catch (err) {
|
|
67
|
+
_iterator2.e(err);
|
|
68
|
+
} finally {
|
|
69
|
+
_iterator2.f();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
var compress = exports.compress = function compress(d) {
|
|
74
|
+
var _arr = [];
|
|
75
|
+
var mode = 1;
|
|
76
|
+
var prev = null;
|
|
77
|
+
var max = 0;
|
|
78
|
+
var arr = [];
|
|
79
|
+
var _iterator3 = _createForOfIteratorHelper(d),
|
|
80
|
+
_step3;
|
|
81
|
+
try {
|
|
82
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
83
|
+
var v = _step3.value;
|
|
84
|
+
if (prev === null) _arr.push(v);else if (_arr.length === 1) {
|
|
85
|
+
mode = prev !== v ? 2 : 1;
|
|
86
|
+
_arr.push(v);
|
|
87
|
+
} else {
|
|
88
|
+
if (prev !== v && mode === 1) {
|
|
89
|
+
_comp(arr, _arr, mode);
|
|
90
|
+
_arr = [v];
|
|
91
|
+
mode = 2;
|
|
92
|
+
} else if (prev === v && mode === 2) {
|
|
93
|
+
var last = _arr.pop();
|
|
94
|
+
_comp(arr, _arr, mode);
|
|
95
|
+
_arr = [last, v];
|
|
96
|
+
mode = 1;
|
|
97
|
+
} else {
|
|
98
|
+
_arr.push(v);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
prev = v;
|
|
102
|
+
}
|
|
103
|
+
} catch (err) {
|
|
104
|
+
_iterator3.e(err);
|
|
105
|
+
} finally {
|
|
106
|
+
_iterator3.f();
|
|
107
|
+
}
|
|
108
|
+
if (_arr.length > 0) _comp(arr, _arr, mode);
|
|
109
|
+
return arr;
|
|
110
|
+
};
|
|
111
|
+
var decompress = exports.decompress = function decompress(d) {
|
|
112
|
+
var arr = [];
|
|
113
|
+
var flag = null;
|
|
114
|
+
var elm = 0;
|
|
115
|
+
var sum = 0;
|
|
116
|
+
var nums = [];
|
|
117
|
+
var first = null;
|
|
118
|
+
var second = null;
|
|
119
|
+
var third = null;
|
|
120
|
+
var _iterator4 = _createForOfIteratorHelper(d),
|
|
121
|
+
_step4;
|
|
122
|
+
try {
|
|
123
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
124
|
+
var v = _step4.value;
|
|
125
|
+
if (flag === null) {
|
|
126
|
+
flag = v;
|
|
127
|
+
first = Math.floor(flag / 100);
|
|
128
|
+
second = Math.floor((flag - first * 100) / 10);
|
|
129
|
+
third = flag - first * 100 - second * 10;
|
|
130
|
+
nums = [];
|
|
131
|
+
if (second === 0) {
|
|
132
|
+
nums.push(third === 0 ? 10 : third);
|
|
133
|
+
elm = 0;
|
|
134
|
+
} else if (third !== 0) {
|
|
135
|
+
nums.push(third);
|
|
136
|
+
elm = second - 1;
|
|
137
|
+
} else elm = second;
|
|
138
|
+
console.log(flag, first, second, third, elm, nums);
|
|
139
|
+
} else if (sum === 0) {
|
|
140
|
+
elm -= 1;
|
|
141
|
+
nums.push(v);
|
|
142
|
+
}
|
|
143
|
+
if (sum > 0) {
|
|
144
|
+
if (first === 2) arr.push(v);else if (first === 1) for (var i = 0; i < to10(nums); i++) arr.push(v);
|
|
145
|
+
sum -= 1;
|
|
146
|
+
if (sum === 0) flag = null;
|
|
147
|
+
} else if (elm === 0) {
|
|
148
|
+
if (first === 0) {
|
|
149
|
+
for (var _i = 0; _i < to10(nums); _i++) arr.push(0);
|
|
150
|
+
flag = null;
|
|
151
|
+
} else if (first === 2) sum = to10(nums);else sum = 1;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
} catch (err) {
|
|
155
|
+
_iterator4.e(err);
|
|
156
|
+
} finally {
|
|
157
|
+
_iterator4.f();
|
|
158
|
+
}
|
|
159
|
+
return new Uint8Array(arr);
|
|
160
|
+
};
|
|
161
|
+
function to10(arr) {
|
|
162
|
+
var num = 0;
|
|
163
|
+
for (var i = 0; i < arr.length; i++) num = num * 256 + arr[i];
|
|
164
|
+
return num;
|
|
165
|
+
}
|
package/cjs/server.js
CHANGED
|
@@ -499,37 +499,57 @@ var Server = /*#__PURE__*/function () {
|
|
|
499
499
|
});
|
|
500
500
|
});
|
|
501
501
|
app.get("/:pid", function (req, res) {
|
|
502
|
-
var _this3$mem$env$pid$
|
|
502
|
+
var _this3$mem$env$pid$re, _this3$mem$env$pid;
|
|
503
503
|
var pid = req.params.pid;
|
|
504
|
-
var edges = (0, _ramda.map)(function (
|
|
505
|
-
var
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
504
|
+
var edges = (0, _ramda.map)(/*#__PURE__*/function () {
|
|
505
|
+
var _ref12 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11(v) {
|
|
506
|
+
var _mtx$anchor, _tx$anchor;
|
|
507
|
+
var tx, _tags, mid, mtx;
|
|
508
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
509
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
510
|
+
case 0:
|
|
511
|
+
_context11.next = 2;
|
|
512
|
+
return _this3.mem.getTx(v);
|
|
513
|
+
case 2:
|
|
514
|
+
tx = _context11.sent;
|
|
515
|
+
_tags = (0, _utils.tags)(v.tags);
|
|
516
|
+
mid = _tags.Message;
|
|
517
|
+
_context11.next = 7;
|
|
518
|
+
return _this3.mem.getTx(mid);
|
|
519
|
+
case 7:
|
|
520
|
+
mtx = _context11.sent;
|
|
521
|
+
return _context11.abrupt("return", {
|
|
522
|
+
cursor: v,
|
|
523
|
+
node: {
|
|
524
|
+
message: {
|
|
525
|
+
id: mtx.id,
|
|
526
|
+
tags: mtx.tags,
|
|
527
|
+
owner: _this3.mem.addrmap[mtx.owner],
|
|
528
|
+
anchor: (_mtx$anchor = mtx.anchor) !== null && _mtx$anchor !== void 0 ? _mtx$anchor : null,
|
|
529
|
+
target: pid,
|
|
530
|
+
signature: mtx.signature,
|
|
531
|
+
data: tx.data
|
|
532
|
+
},
|
|
533
|
+
assignment: {
|
|
534
|
+
id: tx.id,
|
|
535
|
+
tags: tx.tags,
|
|
536
|
+
owner: _this3.mem.addrmap[tx.owner],
|
|
537
|
+
anchor: (_tx$anchor = tx.anchor) !== null && _tx$anchor !== void 0 ? _tx$anchor : null,
|
|
538
|
+
target: null,
|
|
539
|
+
signature: tx.signature
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
});
|
|
543
|
+
case 9:
|
|
544
|
+
case "end":
|
|
545
|
+
return _context11.stop();
|
|
529
546
|
}
|
|
530
|
-
}
|
|
547
|
+
}, _callee11);
|
|
548
|
+
}));
|
|
549
|
+
return function (_x21) {
|
|
550
|
+
return _ref12.apply(this, arguments);
|
|
531
551
|
};
|
|
532
|
-
})((0, _ramda.reverse)((_this3$mem$env$pid$
|
|
552
|
+
}())((0, _ramda.reverse)((_this3$mem$env$pid$re = (_this3$mem$env$pid = _this3.mem.env[pid]) === null || _this3$mem$env$pid === void 0 ? void 0 : _this3$mem$env$pid.results) !== null && _this3$mem$env$pid$re !== void 0 ? _this3$mem$env$pid$re : [])); // need mod
|
|
533
553
|
res.json({
|
|
534
554
|
page_info: {
|
|
535
555
|
has_next_page: false
|
|
@@ -556,38 +576,38 @@ var Server = /*#__PURE__*/function () {
|
|
|
556
576
|
});
|
|
557
577
|
});
|
|
558
578
|
app.get("/result/:mid", /*#__PURE__*/function () {
|
|
559
|
-
var
|
|
579
|
+
var _ref13 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12(req, res) {
|
|
560
580
|
var res2;
|
|
561
|
-
return _regeneratorRuntime().wrap(function
|
|
562
|
-
while (1) switch (
|
|
581
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
582
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
563
583
|
case 0:
|
|
564
|
-
|
|
584
|
+
_context12.next = 2;
|
|
565
585
|
return _this4.result({
|
|
566
586
|
message: req.params.mid,
|
|
567
587
|
process: req.query["process-id"]
|
|
568
588
|
});
|
|
569
589
|
case 2:
|
|
570
|
-
res2 =
|
|
590
|
+
res2 = _context12.sent;
|
|
571
591
|
res.json(res2);
|
|
572
592
|
case 4:
|
|
573
593
|
case "end":
|
|
574
|
-
return
|
|
594
|
+
return _context12.stop();
|
|
575
595
|
}
|
|
576
|
-
},
|
|
596
|
+
}, _callee12);
|
|
577
597
|
}));
|
|
578
|
-
return function (
|
|
579
|
-
return
|
|
598
|
+
return function (_x22, _x23) {
|
|
599
|
+
return _ref13.apply(this, arguments);
|
|
580
600
|
};
|
|
581
601
|
}());
|
|
582
602
|
app.post("/dry-run", /*#__PURE__*/function () {
|
|
583
|
-
var
|
|
603
|
+
var _ref14 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13(req, res) {
|
|
584
604
|
var process, _req$body2, id, owner, tags, data, res2;
|
|
585
|
-
return _regeneratorRuntime().wrap(function
|
|
586
|
-
while (1) switch (
|
|
605
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
606
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
587
607
|
case 0:
|
|
588
608
|
process = req.query["process-id"];
|
|
589
609
|
_req$body2 = req.body, id = _req$body2.Id, owner = _req$body2.Owner, tags = _req$body2.Tags, data = _req$body2.Data;
|
|
590
|
-
|
|
610
|
+
_context13.next = 4;
|
|
591
611
|
return _this4.dryrun({
|
|
592
612
|
id: id,
|
|
593
613
|
owner: owner,
|
|
@@ -596,7 +616,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
596
616
|
process: process
|
|
597
617
|
});
|
|
598
618
|
case 4:
|
|
599
|
-
res2 =
|
|
619
|
+
res2 = _context13.sent;
|
|
600
620
|
if (!res2) {
|
|
601
621
|
res.status(400);
|
|
602
622
|
res.json({
|
|
@@ -608,12 +628,12 @@ var Server = /*#__PURE__*/function () {
|
|
|
608
628
|
}
|
|
609
629
|
case 6:
|
|
610
630
|
case "end":
|
|
611
|
-
return
|
|
631
|
+
return _context13.stop();
|
|
612
632
|
}
|
|
613
|
-
},
|
|
633
|
+
}, _callee13);
|
|
614
634
|
}));
|
|
615
|
-
return function (
|
|
616
|
-
return
|
|
635
|
+
return function (_x24, _x25) {
|
|
636
|
+
return _ref14.apply(this, arguments);
|
|
617
637
|
};
|
|
618
638
|
}());
|
|
619
639
|
var server = app.listen(this.ports.cu, function () {
|
package/cjs/tar.js
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports["default"] = void 0;
|
|
8
|
-
var
|
|
8
|
+
var _bar = _interopRequireDefault(require("./bar.js"));
|
|
9
9
|
var _armem = _interopRequireDefault(require("./armem.js"));
|
|
10
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
11
11
|
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; }
|
|
@@ -33,5 +33,5 @@ var AR = /*#__PURE__*/function (_BAR) {
|
|
|
33
33
|
}
|
|
34
34
|
_inherits(AR, _BAR);
|
|
35
35
|
return _createClass(AR);
|
|
36
|
-
}(
|
|
36
|
+
}(_bar["default"]);
|
|
37
37
|
var _default = exports["default"] = AR;
|