wao 0.40.2 → 0.41.1
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/accounts-web.js +25 -0
- package/cjs/accounts.js +38 -0
- package/cjs/adaptor-base.js +504 -287
- package/cjs/adaptor-cf.js +42 -0
- package/cjs/ao-loader.js +1 -1
- package/cjs/ao.js +18 -6
- package/cjs/aoconnect-base.js +1017 -546
- package/cjs/aoconnect-cf.js +24 -0
- package/cjs/ar-remote.js +277 -0
- package/cjs/armem-base.js +822 -211
- package/cjs/armem-cf.js +128 -0
- package/cjs/armem.js +11 -5
- package/cjs/bar.js +511 -173
- package/cjs/car.js +37 -0
- package/cjs/cf-env.js +54 -0
- package/cjs/cf.js +76 -0
- package/cjs/cli.js +12 -6
- package/cjs/create.js +1 -1
- package/cjs/devs.js +53 -0
- package/cjs/dodb.js +116 -0
- package/cjs/hb.js +136 -53
- package/cjs/hyperbeam.js +85 -44
- package/cjs/keygen.js +94 -0
- package/cjs/run.js +4 -1
- package/cjs/server.js +40 -9
- package/cjs/storage-multi.js +525 -0
- package/cjs/tgql-d1.js +664 -0
- package/cjs/tgql.js +293 -172
- package/cjs/workspace/.claude/agents/tester.md +2 -2
- package/cjs/workspace/.claude/skills/build/SKILL.md +2 -2
- package/cjs/workspace/.claude/skills/test/SKILL.md +3 -2
- package/cjs/workspace/CLAUDE.md +2 -2
- package/cjs/workspace/README.md +1 -1
- package/cjs/workspace/docs/debug.md +9 -4
- package/cjs/workspace/docs/hyperbeam-devices.md +50 -1
- package/cjs/workspace/package.json +3 -3
- package/esm/accounts-web.js +14 -0
- package/esm/accounts.js +27 -0
- package/esm/adaptor-base.js +129 -31
- package/esm/adaptor-cf.js +11 -0
- package/esm/ao-loader.js +1 -1
- package/esm/ao.js +21 -2
- package/esm/aoconnect-base.js +255 -7
- package/esm/aoconnect-cf.js +9 -0
- package/esm/ar-remote.js +87 -0
- package/esm/armem-base.js +304 -53
- package/esm/armem-cf.js +67 -0
- package/esm/armem.js +7 -2
- package/esm/bar.js +126 -16
- package/esm/car.js +10 -0
- package/esm/cf-env.js +29 -0
- package/esm/cf.js +11 -0
- package/esm/cli.js +6 -2
- package/esm/create.js +1 -1
- package/esm/devs.js +15 -0
- package/esm/dodb.js +26 -0
- package/esm/hb.js +93 -16
- package/esm/hyperbeam.js +68 -30
- package/esm/keygen.js +47 -0
- package/esm/run.js +4 -1
- package/esm/server.js +29 -9
- package/esm/storage-multi.js +183 -0
- package/esm/tgql-d1.js +407 -0
- package/esm/tgql.js +29 -10
- package/esm/workspace/.claude/agents/tester.md +2 -2
- package/esm/workspace/.claude/skills/build/SKILL.md +2 -2
- package/esm/workspace/.claude/skills/test/SKILL.md +3 -2
- package/esm/workspace/CLAUDE.md +2 -2
- package/esm/workspace/README.md +1 -1
- package/esm/workspace/docs/debug.md +9 -4
- package/esm/workspace/docs/hyperbeam-devices.md +50 -1
- package/esm/workspace/package.json +3 -3
- package/package.json +10 -3
- package/postinstall.cjs +84 -0
- package/wao-0.41.1.tgz +0 -0
package/cjs/armem-base.js
CHANGED
|
@@ -11,12 +11,20 @@ var _compress = require("./compress.js");
|
|
|
11
11
|
var _ramda = require("ramda");
|
|
12
12
|
var _utils = require("./utils.js");
|
|
13
13
|
var _base64url = _interopRequireDefault(require("base64url"));
|
|
14
|
+
var _arRemote = _interopRequireDefault(require("./ar-remote.js"));
|
|
14
15
|
var _Arweave$default;
|
|
15
16
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
16
17
|
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; } } }; }
|
|
18
|
+
function _regeneratorKeys(e) { var n = Object(e), r = []; for (var t in n) r.unshift(t); return function e() { for (; r.length;) if ((t = r.pop()) in n) return e.value = t, e.done = !1, e; return e.done = !0, e; }; }
|
|
19
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
20
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
17
21
|
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; } }
|
|
22
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
23
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
18
24
|
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; }
|
|
19
|
-
function
|
|
25
|
+
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; }
|
|
26
|
+
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; }
|
|
27
|
+
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; }
|
|
20
28
|
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
21
29
|
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
|
|
22
30
|
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); }
|
|
@@ -60,7 +68,8 @@ var ArMemBase = exports["default"] = /*#__PURE__*/function () {
|
|
|
60
68
|
cache = _ref.cache,
|
|
61
69
|
init = _ref.init,
|
|
62
70
|
Waosm = _ref.Waosm,
|
|
63
|
-
variant = _ref.variant
|
|
71
|
+
variant = _ref.variant,
|
|
72
|
+
ar_url = _ref.ar_url;
|
|
64
73
|
_classCallCheck(this, ArMemBase);
|
|
65
74
|
this.variant = variant;
|
|
66
75
|
this.__type__ = "mem";
|
|
@@ -78,6 +87,10 @@ var ArMemBase = exports["default"] = /*#__PURE__*/function () {
|
|
|
78
87
|
};
|
|
79
88
|
this.scheduler = scheduler;
|
|
80
89
|
this.SU_URL = SU_URL;
|
|
90
|
+
this._txCache = new Map();
|
|
91
|
+
this._TX_CACHE_MAX = 200;
|
|
92
|
+
this.ar_url = ar_url || null;
|
|
93
|
+
this._remote = ar_url ? new _arRemote["default"](ar_url) : null;
|
|
81
94
|
}
|
|
82
95
|
return _createClass(ArMemBase, [{
|
|
83
96
|
key: "compress",
|
|
@@ -116,28 +129,117 @@ var ArMemBase = exports["default"] = /*#__PURE__*/function () {
|
|
|
116
129
|
}, {
|
|
117
130
|
key: "getAnchor",
|
|
118
131
|
value: function getAnchor() {
|
|
119
|
-
|
|
132
|
+
if (this._remote) {
|
|
133
|
+
var _this$_remoteAnchor;
|
|
134
|
+
return (_this$_remoteAnchor = this._remoteAnchor) !== null && _this$_remoteAnchor !== void 0 ? _this$_remoteAnchor : "Do_Uc2Sju_ffp6Ev0AnLVdPtot15rvMjP-a9VVaA5fM";
|
|
135
|
+
}
|
|
136
|
+
// D1 ready: use lastBlockId scalar (block.id === last tx.id)
|
|
137
|
+
if (this._d1Ready) {
|
|
138
|
+
return this.lastBlockId || "Do_Uc2Sju_ffp6Ev0AnLVdPtot15rvMjP-a9VVaA5fM";
|
|
139
|
+
}
|
|
140
|
+
// Fallback: use blocks array
|
|
141
|
+
if (this.blocks.length === 0) {
|
|
142
|
+
return "Do_Uc2Sju_ffp6Ev0AnLVdPtot15rvMjP-a9VVaA5fM";
|
|
143
|
+
}
|
|
144
|
+
var lastBlock = this.blockmap[(0, _ramda.last)(this.blocks)];
|
|
145
|
+
if (!lastBlock) return "Do_Uc2Sju_ffp6Ev0AnLVdPtot15rvMjP-a9VVaA5fM";
|
|
146
|
+
return (0, _ramda.last)(lastBlock.txs);
|
|
120
147
|
}
|
|
121
148
|
}, {
|
|
122
149
|
key: "get",
|
|
123
150
|
value: function () {
|
|
124
151
|
var _get = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(key, field) {
|
|
125
|
-
var _this$key;
|
|
152
|
+
var _this$key, _this$key3;
|
|
153
|
+
var val, _this$key2, r2mem, meta, _t3, _t4;
|
|
126
154
|
return _regenerator().w(function (_context2) {
|
|
127
|
-
while (1) switch (_context2.n) {
|
|
155
|
+
while (1) switch (_context2.p = _context2.n) {
|
|
128
156
|
case 0:
|
|
129
157
|
_context2.n = 1;
|
|
130
158
|
return this.init();
|
|
131
159
|
case 1:
|
|
132
160
|
if (field) {
|
|
133
|
-
_context2.n =
|
|
161
|
+
_context2.n = 4;
|
|
134
162
|
break;
|
|
135
163
|
}
|
|
136
|
-
|
|
164
|
+
if (!(key === "height" && this._remote && !this[key])) {
|
|
165
|
+
_context2.n = 3;
|
|
166
|
+
break;
|
|
167
|
+
}
|
|
168
|
+
_context2.n = 2;
|
|
169
|
+
return this._remote.getHeight();
|
|
137
170
|
case 2:
|
|
138
|
-
|
|
171
|
+
this[key] = _context2.v;
|
|
172
|
+
case 3:
|
|
173
|
+
return _context2.a(2, this[key]);
|
|
174
|
+
case 4:
|
|
175
|
+
if (!(((_this$key = this[key]) === null || _this$key === void 0 ? void 0 : _this$key[field]) === undefined && this.db)) {
|
|
176
|
+
_context2.n = 15;
|
|
177
|
+
break;
|
|
178
|
+
}
|
|
179
|
+
_context2.n = 5;
|
|
180
|
+
return this.db.get("".concat(key, ".").concat(field));
|
|
181
|
+
case 5:
|
|
182
|
+
val = _context2.v;
|
|
183
|
+
if (!(val !== null)) {
|
|
184
|
+
_context2.n = 15;
|
|
185
|
+
break;
|
|
186
|
+
}
|
|
187
|
+
(_this$key2 = this[key]) !== null && _this$key2 !== void 0 ? _this$key2 : this[key] = {};
|
|
188
|
+
if (!(key === "env" && val)) {
|
|
189
|
+
_context2.n = 14;
|
|
190
|
+
break;
|
|
191
|
+
}
|
|
192
|
+
if (!(this.db.r2GetMemory && !val.memory)) {
|
|
193
|
+
_context2.n = 9;
|
|
194
|
+
break;
|
|
195
|
+
}
|
|
196
|
+
_context2.p = 6;
|
|
197
|
+
_context2.n = 7;
|
|
198
|
+
return this.db.r2GetMemory(field);
|
|
199
|
+
case 7:
|
|
200
|
+
r2mem = _context2.v;
|
|
201
|
+
if (r2mem) {
|
|
202
|
+
val.memory = r2mem;
|
|
203
|
+
val.compressed = true;
|
|
204
|
+
}
|
|
205
|
+
_context2.n = 9;
|
|
206
|
+
break;
|
|
207
|
+
case 8:
|
|
208
|
+
_context2.p = 8;
|
|
209
|
+
_t3 = _context2.v;
|
|
210
|
+
case 9:
|
|
211
|
+
if (!(val.memory && (0, _ramda.is)(Uint8Array, val.memory))) {
|
|
212
|
+
_context2.n = 14;
|
|
213
|
+
break;
|
|
214
|
+
}
|
|
215
|
+
val.compressed = true;
|
|
216
|
+
// Lazy migrate: move inline memory to R2
|
|
217
|
+
if (!this.db.r2PutMemory) {
|
|
218
|
+
_context2.n = 14;
|
|
219
|
+
break;
|
|
220
|
+
}
|
|
221
|
+
_context2.p = 10;
|
|
222
|
+
_context2.n = 11;
|
|
223
|
+
return this.db.r2PutMemory(field, val.memory);
|
|
224
|
+
case 11:
|
|
225
|
+
// Remove memory from DO entry to save space
|
|
226
|
+
meta = _objectSpread({}, val);
|
|
227
|
+
delete meta.memory;
|
|
228
|
+
meta._r2_memory = true;
|
|
229
|
+
_context2.n = 12;
|
|
230
|
+
return this.db.put("".concat(key, ".").concat(field), meta);
|
|
231
|
+
case 12:
|
|
232
|
+
_context2.n = 14;
|
|
233
|
+
break;
|
|
234
|
+
case 13:
|
|
235
|
+
_context2.p = 13;
|
|
236
|
+
_t4 = _context2.v;
|
|
237
|
+
case 14:
|
|
238
|
+
this[key][field] = val;
|
|
239
|
+
case 15:
|
|
240
|
+
return _context2.a(2, (_this$key3 = this[key]) === null || _this$key3 === void 0 ? void 0 : _this$key3[field]);
|
|
139
241
|
}
|
|
140
|
-
}, _callee2, this);
|
|
242
|
+
}, _callee2, this, [[10, 13], [6, 8]]);
|
|
141
243
|
}));
|
|
142
244
|
function get(_x2, _x3) {
|
|
143
245
|
return _get.apply(this, arguments);
|
|
@@ -148,9 +250,9 @@ var ArMemBase = exports["default"] = /*#__PURE__*/function () {
|
|
|
148
250
|
key: "set",
|
|
149
251
|
value: function () {
|
|
150
252
|
var _set = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(val, key, field) {
|
|
151
|
-
var _this$
|
|
253
|
+
var _this$key4, memory, meta, _t5;
|
|
152
254
|
return _regenerator().w(function (_context3) {
|
|
153
|
-
while (1) switch (_context3.n) {
|
|
255
|
+
while (1) switch (_context3.p = _context3.n) {
|
|
154
256
|
case 0:
|
|
155
257
|
_context3.n = 1;
|
|
156
258
|
return this.init();
|
|
@@ -167,17 +269,21 @@ var ArMemBase = exports["default"] = /*#__PURE__*/function () {
|
|
|
167
269
|
_context3.n = 2;
|
|
168
270
|
return this.db.put("".concat(key), this[key]);
|
|
169
271
|
case 2:
|
|
170
|
-
_context3.n =
|
|
272
|
+
_context3.n = 15;
|
|
171
273
|
break;
|
|
172
274
|
case 3:
|
|
173
|
-
(_this$
|
|
275
|
+
(_this$key4 = this[key]) !== null && _this$key4 !== void 0 ? _this$key4 : this[key] = {};
|
|
174
276
|
this[key][field] = val;
|
|
175
277
|
if (!this.db) {
|
|
176
|
-
_context3.n =
|
|
278
|
+
_context3.n = 15;
|
|
177
279
|
break;
|
|
178
280
|
}
|
|
179
281
|
if (!(key === "env")) {
|
|
180
|
-
_context3.n =
|
|
282
|
+
_context3.n = 13;
|
|
283
|
+
break;
|
|
284
|
+
}
|
|
285
|
+
if (!val.memory) {
|
|
286
|
+
_context3.n = 11;
|
|
181
287
|
break;
|
|
182
288
|
}
|
|
183
289
|
memory = val.memory;
|
|
@@ -187,23 +293,104 @@ var ArMemBase = exports["default"] = /*#__PURE__*/function () {
|
|
|
187
293
|
console.log(e);
|
|
188
294
|
}
|
|
189
295
|
this[key][field].original_size = val.memory.length;
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
296
|
+
|
|
297
|
+
// R2 path: store compressed memory in R2, metadata in DO
|
|
298
|
+
if (!this.db.r2PutMemory) {
|
|
299
|
+
_context3.n = 9;
|
|
300
|
+
break;
|
|
301
|
+
}
|
|
302
|
+
_context3.p = 4;
|
|
303
|
+
_context3.n = 5;
|
|
304
|
+
return this.db.r2PutMemory(field, memory);
|
|
195
305
|
case 5:
|
|
306
|
+
// Store metadata without memory in DO
|
|
307
|
+
meta = _objectSpread({}, this[key][field]);
|
|
308
|
+
delete meta.memory;
|
|
309
|
+
meta._r2_memory = true;
|
|
196
310
|
_context3.n = 6;
|
|
197
|
-
return this.db.put("".concat(key, ".").concat(field),
|
|
311
|
+
return this.db.put("".concat(key, ".").concat(field), meta);
|
|
198
312
|
case 6:
|
|
313
|
+
_context3.n = 8;
|
|
314
|
+
break;
|
|
315
|
+
case 7:
|
|
316
|
+
_context3.p = 7;
|
|
317
|
+
_t5 = _context3.v;
|
|
318
|
+
_context3.n = 8;
|
|
319
|
+
return this.db.put("".concat(key, ".").concat(field), (0, _ramda.assoc)("memory", memory, this[key][field]));
|
|
320
|
+
case 8:
|
|
321
|
+
_context3.n = 10;
|
|
322
|
+
break;
|
|
323
|
+
case 9:
|
|
324
|
+
_context3.n = 10;
|
|
325
|
+
return this.db.put("".concat(key, ".").concat(field), (0, _ramda.assoc)("memory", memory, this[key][field]));
|
|
326
|
+
case 10:
|
|
327
|
+
_context3.n = 12;
|
|
328
|
+
break;
|
|
329
|
+
case 11:
|
|
330
|
+
_context3.n = 12;
|
|
331
|
+
return this.db.put("".concat(key, ".").concat(field), this[key][field]);
|
|
332
|
+
case 12:
|
|
333
|
+
_context3.n = 15;
|
|
334
|
+
break;
|
|
335
|
+
case 13:
|
|
336
|
+
if (!(key === "txs" && this._d1Ready)) {
|
|
337
|
+
_context3.n = 14;
|
|
338
|
+
break;
|
|
339
|
+
}
|
|
340
|
+
// D1 + R2 are authoritative for tx metadata, skip DO storage
|
|
341
|
+
this._txCache.set(field, val);
|
|
342
|
+
_context3.n = 15;
|
|
343
|
+
break;
|
|
344
|
+
case 14:
|
|
345
|
+
_context3.n = 15;
|
|
346
|
+
return this.db.put("".concat(key, ".").concat(field), this[key][field]);
|
|
347
|
+
case 15:
|
|
199
348
|
return _context3.a(2);
|
|
200
349
|
}
|
|
201
|
-
}, _callee3, this);
|
|
350
|
+
}, _callee3, this, [[4, 7]]);
|
|
202
351
|
}));
|
|
203
352
|
function set(_x4, _x5, _x6) {
|
|
204
353
|
return _set.apply(this, arguments);
|
|
205
354
|
}
|
|
206
355
|
return set;
|
|
356
|
+
}() // Get all field keys for a given prefix (e.g. all process IDs under "env")
|
|
357
|
+
}, {
|
|
358
|
+
key: "getFieldKeys",
|
|
359
|
+
value: function () {
|
|
360
|
+
var _getFieldKeys = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(key) {
|
|
361
|
+
var _this$key5, _this$key6;
|
|
362
|
+
var stored, dbKeys, memKeys;
|
|
363
|
+
return _regenerator().w(function (_context4) {
|
|
364
|
+
while (1) switch (_context4.n) {
|
|
365
|
+
case 0:
|
|
366
|
+
_context4.n = 1;
|
|
367
|
+
return this.init();
|
|
368
|
+
case 1:
|
|
369
|
+
if (this.db) {
|
|
370
|
+
_context4.n = 2;
|
|
371
|
+
break;
|
|
372
|
+
}
|
|
373
|
+
return _context4.a(2, Object.keys((_this$key5 = this[key]) !== null && _this$key5 !== void 0 ? _this$key5 : {}));
|
|
374
|
+
case 2:
|
|
375
|
+
_context4.n = 3;
|
|
376
|
+
return this.db.getKeys({
|
|
377
|
+
start: key + ".",
|
|
378
|
+
end: key + "0"
|
|
379
|
+
});
|
|
380
|
+
case 3:
|
|
381
|
+
stored = _context4.v;
|
|
382
|
+
dbKeys = (stored || []).map(function (k) {
|
|
383
|
+
return k.split(".")[1];
|
|
384
|
+
}).filter(Boolean);
|
|
385
|
+
memKeys = Object.keys((_this$key6 = this[key]) !== null && _this$key6 !== void 0 ? _this$key6 : {});
|
|
386
|
+
return _context4.a(2, _toConsumableArray(new Set([].concat(memKeys, _toConsumableArray(dbKeys)))));
|
|
387
|
+
}
|
|
388
|
+
}, _callee4, this);
|
|
389
|
+
}));
|
|
390
|
+
function getFieldKeys(_x7) {
|
|
391
|
+
return _getFieldKeys.apply(this, arguments);
|
|
392
|
+
}
|
|
393
|
+
return getFieldKeys;
|
|
207
394
|
}()
|
|
208
395
|
}, {
|
|
209
396
|
key: "initSync",
|
|
@@ -249,6 +436,7 @@ var ArMemBase = exports["default"] = /*#__PURE__*/function () {
|
|
|
249
436
|
this.txs[key] = {
|
|
250
437
|
id: key,
|
|
251
438
|
block: 0,
|
|
439
|
+
owner: this.scheduler || "",
|
|
252
440
|
tags: (0, _utils.buildTags)(null, {
|
|
253
441
|
"Data-Protocol": "ao",
|
|
254
442
|
Variant: (_ref2 = (_w$variant = w.variant) !== null && _w$variant !== void 0 ? _w$variant : this.variant) !== null && _ref2 !== void 0 ? _ref2 : "ao.TN.1",
|
|
@@ -290,34 +478,35 @@ var ArMemBase = exports["default"] = /*#__PURE__*/function () {
|
|
|
290
478
|
id: "0"
|
|
291
479
|
};
|
|
292
480
|
this.blocks.push("0");
|
|
481
|
+
this.lastBlockId = "0";
|
|
293
482
|
this.height = 1;
|
|
294
483
|
}
|
|
295
484
|
}, {
|
|
296
485
|
key: "putAll",
|
|
297
486
|
value: function () {
|
|
298
|
-
var _putAll = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
299
|
-
var k,
|
|
300
|
-
return _regenerator().w(function (
|
|
301
|
-
while (1) switch (
|
|
487
|
+
var _putAll = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(key) {
|
|
488
|
+
var k, _t6, _t7;
|
|
489
|
+
return _regenerator().w(function (_context5) {
|
|
490
|
+
while (1) switch (_context5.n) {
|
|
302
491
|
case 0:
|
|
303
|
-
|
|
492
|
+
_t6 = _regeneratorKeys(this[key]);
|
|
304
493
|
case 1:
|
|
305
|
-
if ((
|
|
306
|
-
|
|
494
|
+
if ((_t7 = _t6()).done) {
|
|
495
|
+
_context5.n = 3;
|
|
307
496
|
break;
|
|
308
497
|
}
|
|
309
|
-
k =
|
|
310
|
-
|
|
498
|
+
k = _t7.value;
|
|
499
|
+
_context5.n = 2;
|
|
311
500
|
return this.set(this[key][k], key, k);
|
|
312
501
|
case 2:
|
|
313
|
-
|
|
502
|
+
_context5.n = 1;
|
|
314
503
|
break;
|
|
315
504
|
case 3:
|
|
316
|
-
return
|
|
505
|
+
return _context5.a(2);
|
|
317
506
|
}
|
|
318
|
-
},
|
|
507
|
+
}, _callee5, this);
|
|
319
508
|
}));
|
|
320
|
-
function putAll(
|
|
509
|
+
function putAll(_x8) {
|
|
321
510
|
return _putAll.apply(this, arguments);
|
|
322
511
|
}
|
|
323
512
|
return putAll;
|
|
@@ -325,148 +514,405 @@ var ArMemBase = exports["default"] = /*#__PURE__*/function () {
|
|
|
325
514
|
}, {
|
|
326
515
|
key: "init",
|
|
327
516
|
value: function () {
|
|
328
|
-
var _init = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
329
|
-
var _i, _arr, v, val, _i2,
|
|
330
|
-
return _regenerator().w(function (
|
|
331
|
-
while (1) switch (
|
|
517
|
+
var _init = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6() {
|
|
518
|
+
var _this$db, fresh, _i, _arr, v, val, lbid, collections, _i2, _collections, _this$_v, _v, items, _iterator, _step, v2, key, field, v3, r2mem, scalarKeys, _i3, _scalarKeys, _v2, _i4, _arr2, _v3, probe, _iterator2, _step2, bId, block, txId, _tx$block_id, _tx$block, tx, addr, name, id, txKeys, _i5, _txKeys, _txId, existing, _tx$block_id2, _tx$block2, _tx, _addr, _existing, _i6, _arr3, _v4, _i7, _arr4, _v5, _t8, _t9, _t0, _t1, _t10, _t11, _t12, _t13, _t14, _t15, _t16, _t17, _t18, _t19, _t20;
|
|
519
|
+
return _regenerator().w(function (_context6) {
|
|
520
|
+
while (1) switch (_context6.p = _context6.n) {
|
|
332
521
|
case 0:
|
|
333
522
|
if (!this.isInit) {
|
|
334
|
-
|
|
523
|
+
_context6.n = 1;
|
|
335
524
|
break;
|
|
336
525
|
}
|
|
337
|
-
return
|
|
526
|
+
return _context6.a(2);
|
|
338
527
|
case 1:
|
|
339
528
|
this.isInit = true;
|
|
340
529
|
if (!(typeof this._init === "function")) {
|
|
341
|
-
|
|
530
|
+
_context6.n = 2;
|
|
342
531
|
break;
|
|
343
532
|
}
|
|
344
|
-
|
|
533
|
+
_context6.n = 2;
|
|
345
534
|
return this._init();
|
|
346
535
|
case 2:
|
|
347
536
|
if (!this.db) {
|
|
348
|
-
|
|
537
|
+
_context6.n = 68;
|
|
349
538
|
break;
|
|
350
539
|
}
|
|
540
|
+
fresh = true; // Probe D1 readiness: binding exists AND schema is applied
|
|
541
|
+
this._d1Ready = false;
|
|
542
|
+
if (!this.db.d1) {
|
|
543
|
+
_context6.n = 6;
|
|
544
|
+
break;
|
|
545
|
+
}
|
|
546
|
+
_context6.p = 3;
|
|
547
|
+
_context6.n = 4;
|
|
548
|
+
return this.db.d1.prepare("SELECT 1 FROM blocks LIMIT 0").all();
|
|
549
|
+
case 4:
|
|
550
|
+
this._d1Ready = true;
|
|
551
|
+
_context6.n = 6;
|
|
552
|
+
break;
|
|
553
|
+
case 5:
|
|
554
|
+
_context6.p = 5;
|
|
555
|
+
_t8 = _context6.v;
|
|
556
|
+
case 6:
|
|
351
557
|
_i = 0, _arr = ["height", "blocks"];
|
|
352
|
-
case
|
|
558
|
+
case 7:
|
|
353
559
|
if (!(_i < _arr.length)) {
|
|
354
|
-
|
|
560
|
+
_context6.n = 10;
|
|
355
561
|
break;
|
|
356
562
|
}
|
|
357
563
|
v = _arr[_i];
|
|
358
|
-
|
|
564
|
+
_context6.n = 8;
|
|
359
565
|
return this.db.get(v);
|
|
360
|
-
case
|
|
361
|
-
val =
|
|
362
|
-
if (val
|
|
363
|
-
|
|
566
|
+
case 8:
|
|
567
|
+
val = _context6.v;
|
|
568
|
+
if (val !== null) {
|
|
569
|
+
this[v] = val;
|
|
570
|
+
fresh = false;
|
|
571
|
+
}
|
|
572
|
+
case 9:
|
|
364
573
|
_i++;
|
|
365
|
-
|
|
574
|
+
_context6.n = 7;
|
|
366
575
|
break;
|
|
367
|
-
case
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
if (!(_i2 < _arr2.length)) {
|
|
371
|
-
_context5.n = 19;
|
|
576
|
+
case 10:
|
|
577
|
+
if (!this._d1Ready) {
|
|
578
|
+
_context6.n = 12;
|
|
372
579
|
break;
|
|
373
580
|
}
|
|
374
|
-
|
|
581
|
+
_context6.n = 11;
|
|
582
|
+
return this.db.get("lastBlockId");
|
|
583
|
+
case 11:
|
|
584
|
+
lbid = _context6.v;
|
|
585
|
+
if (lbid !== null) {
|
|
586
|
+
this.lastBlockId = lbid;
|
|
587
|
+
fresh = false;
|
|
588
|
+
}
|
|
589
|
+
// Migration: derive lastBlockId from blocks if not yet stored
|
|
590
|
+
if (this.lastBlockId === "0" && this.blocks.length > 0) {
|
|
591
|
+
this.lastBlockId = this.blocks[this.blocks.length - 1];
|
|
592
|
+
}
|
|
593
|
+
case 12:
|
|
594
|
+
// Always load blocks + blockmap so the O(n) scan fallback in tgql.js works.
|
|
595
|
+
// Skip eagerly loading txs when D1 is ready (D1 is authoritative for tx queries).
|
|
596
|
+
collections = this._d1Ready ? ["items", "env", "modules", "wasms", "addrmap", "blockmap", "modmap", "msgs"] : ["items", "txs", "env", "modules", "wasms", "addrmap", "blockmap", "modmap", "msgs"];
|
|
597
|
+
_i2 = 0, _collections = collections;
|
|
598
|
+
case 13:
|
|
599
|
+
if (!(_i2 < _collections.length)) {
|
|
600
|
+
_context6.n = 29;
|
|
601
|
+
break;
|
|
602
|
+
}
|
|
603
|
+
_v = _collections[_i2];
|
|
375
604
|
(_this$_v = this[_v]) !== null && _this$_v !== void 0 ? _this$_v : this[_v] = {};
|
|
376
|
-
|
|
605
|
+
_context6.n = 14;
|
|
377
606
|
return this.db.getKeys({
|
|
378
607
|
start: _v,
|
|
379
608
|
end: _v + "a"
|
|
380
609
|
});
|
|
381
|
-
case
|
|
382
|
-
items =
|
|
610
|
+
case 14:
|
|
611
|
+
items = _context6.v;
|
|
612
|
+
if (items !== null && items !== void 0 && items.length) fresh = false;
|
|
383
613
|
_iterator = _createForOfIteratorHelper(items || []);
|
|
384
|
-
|
|
614
|
+
_context6.p = 15;
|
|
385
615
|
_iterator.s();
|
|
386
|
-
case
|
|
616
|
+
case 16:
|
|
387
617
|
if ((_step = _iterator.n()).done) {
|
|
388
|
-
|
|
618
|
+
_context6.n = 25;
|
|
389
619
|
break;
|
|
390
620
|
}
|
|
391
621
|
v2 = _step.value;
|
|
392
622
|
key = v2.split(".")[0];
|
|
393
623
|
field = v2.split(".")[1];
|
|
394
|
-
if (!(key === _v)) {
|
|
395
|
-
|
|
624
|
+
if (!(key === _v && field)) {
|
|
625
|
+
_context6.n = 24;
|
|
396
626
|
break;
|
|
397
627
|
}
|
|
398
|
-
if (!key
|
|
399
|
-
|
|
628
|
+
if (!(key === "env")) {
|
|
629
|
+
_context6.n = 22;
|
|
400
630
|
break;
|
|
401
631
|
}
|
|
402
|
-
|
|
632
|
+
_context6.n = 17;
|
|
403
633
|
return this.db.get(v2);
|
|
404
|
-
case
|
|
405
|
-
v3 =
|
|
406
|
-
if ((0, _ramda.is)(Uint8Array, v3.memory)) {
|
|
634
|
+
case 17:
|
|
635
|
+
v3 = _context6.v;
|
|
636
|
+
if (v3 && (0, _ramda.is)(Uint8Array, v3.memory)) {
|
|
407
637
|
v3.compressed = true;
|
|
408
638
|
}
|
|
639
|
+
// If memory was offloaded to R2, fetch it
|
|
640
|
+
if (!(v3 && !v3.memory && v3._r2_memory && this.db.r2GetMemory)) {
|
|
641
|
+
_context6.n = 21;
|
|
642
|
+
break;
|
|
643
|
+
}
|
|
644
|
+
_context6.p = 18;
|
|
645
|
+
_context6.n = 19;
|
|
646
|
+
return this.db.r2GetMemory(field);
|
|
647
|
+
case 19:
|
|
648
|
+
r2mem = _context6.v;
|
|
649
|
+
if (r2mem) {
|
|
650
|
+
v3.memory = r2mem;
|
|
651
|
+
v3.compressed = true;
|
|
652
|
+
}
|
|
653
|
+
_context6.n = 21;
|
|
654
|
+
break;
|
|
655
|
+
case 20:
|
|
656
|
+
_context6.p = 20;
|
|
657
|
+
_t9 = _context6.v;
|
|
658
|
+
case 21:
|
|
409
659
|
this[_v][field] = v3;
|
|
410
|
-
|
|
660
|
+
_context6.n = 24;
|
|
411
661
|
break;
|
|
412
|
-
case
|
|
413
|
-
|
|
662
|
+
case 22:
|
|
663
|
+
_context6.n = 23;
|
|
414
664
|
return this.db.get(v2);
|
|
415
|
-
case
|
|
416
|
-
this[_v][field] =
|
|
417
|
-
case
|
|
418
|
-
|
|
665
|
+
case 23:
|
|
666
|
+
this[_v][field] = _context6.v;
|
|
667
|
+
case 24:
|
|
668
|
+
_context6.n = 16;
|
|
419
669
|
break;
|
|
420
|
-
case
|
|
421
|
-
|
|
670
|
+
case 25:
|
|
671
|
+
_context6.n = 27;
|
|
422
672
|
break;
|
|
423
|
-
case
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
_iterator.e(
|
|
427
|
-
case
|
|
428
|
-
|
|
673
|
+
case 26:
|
|
674
|
+
_context6.p = 26;
|
|
675
|
+
_t0 = _context6.v;
|
|
676
|
+
_iterator.e(_t0);
|
|
677
|
+
case 27:
|
|
678
|
+
_context6.p = 27;
|
|
429
679
|
_iterator.f();
|
|
430
|
-
return
|
|
431
|
-
case
|
|
680
|
+
return _context6.f(27);
|
|
681
|
+
case 28:
|
|
432
682
|
_i2++;
|
|
433
|
-
|
|
434
|
-
break;
|
|
435
|
-
case 19:
|
|
436
|
-
_context5.n = 26;
|
|
683
|
+
_context6.n = 13;
|
|
437
684
|
break;
|
|
438
|
-
case
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
685
|
+
case 29:
|
|
686
|
+
if (!fresh) {
|
|
687
|
+
_context6.n = 35;
|
|
688
|
+
break;
|
|
689
|
+
}
|
|
690
|
+
// First boot: persist initial state from initSync()
|
|
691
|
+
scalarKeys = this._d1Ready ? ["height", "blocks", "lastBlockId"] : ["height", "blocks"];
|
|
692
|
+
_i3 = 0, _scalarKeys = scalarKeys;
|
|
693
|
+
case 30:
|
|
694
|
+
if (!(_i3 < _scalarKeys.length)) {
|
|
695
|
+
_context6.n = 32;
|
|
443
696
|
break;
|
|
444
697
|
}
|
|
445
|
-
_v2 =
|
|
446
|
-
|
|
698
|
+
_v2 = _scalarKeys[_i3];
|
|
699
|
+
_context6.n = 31;
|
|
447
700
|
return this.set(this[_v2], _v2);
|
|
448
|
-
case
|
|
701
|
+
case 31:
|
|
449
702
|
_i3++;
|
|
450
|
-
|
|
703
|
+
_context6.n = 30;
|
|
451
704
|
break;
|
|
452
|
-
case
|
|
453
|
-
_i4 = 0,
|
|
454
|
-
case
|
|
455
|
-
if (!(_i4 <
|
|
456
|
-
|
|
705
|
+
case 32:
|
|
706
|
+
_i4 = 0, _arr2 = ["modules", "wasms", "addrmap", "blockmap", "txs"];
|
|
707
|
+
case 33:
|
|
708
|
+
if (!(_i4 < _arr2.length)) {
|
|
709
|
+
_context6.n = 35;
|
|
457
710
|
break;
|
|
458
711
|
}
|
|
459
|
-
_v3 =
|
|
460
|
-
|
|
712
|
+
_v3 = _arr2[_i4];
|
|
713
|
+
_context6.n = 34;
|
|
461
714
|
return this.putAll(_v3);
|
|
462
|
-
case
|
|
715
|
+
case 34:
|
|
463
716
|
_i4++;
|
|
464
|
-
|
|
717
|
+
_context6.n = 33;
|
|
465
718
|
break;
|
|
466
|
-
case
|
|
467
|
-
|
|
719
|
+
case 35:
|
|
720
|
+
if (!(this._d1Ready && (_this$db = this.db) !== null && _this$db !== void 0 && _this$db.d1WriteBlock)) {
|
|
721
|
+
_context6.n = 67;
|
|
722
|
+
break;
|
|
723
|
+
}
|
|
724
|
+
_context6.p = 36;
|
|
725
|
+
_context6.n = 37;
|
|
726
|
+
return this.db.d1.prepare("SELECT COUNT(*) as cnt FROM blocks").first();
|
|
727
|
+
case 37:
|
|
728
|
+
probe = _context6.v;
|
|
729
|
+
if (!(!probe || probe.cnt === 0)) {
|
|
730
|
+
_context6.n = 57;
|
|
731
|
+
break;
|
|
732
|
+
}
|
|
733
|
+
_iterator2 = _createForOfIteratorHelper(this.blocks);
|
|
734
|
+
_context6.p = 38;
|
|
735
|
+
_iterator2.s();
|
|
736
|
+
case 39:
|
|
737
|
+
if ((_step2 = _iterator2.n()).done) {
|
|
738
|
+
_context6.n = 41;
|
|
739
|
+
break;
|
|
740
|
+
}
|
|
741
|
+
bId = _step2.value;
|
|
742
|
+
block = this.blockmap[bId];
|
|
743
|
+
if (!block) {
|
|
744
|
+
_context6.n = 40;
|
|
745
|
+
break;
|
|
746
|
+
}
|
|
747
|
+
_context6.n = 40;
|
|
748
|
+
return this.db.d1WriteBlock(block);
|
|
749
|
+
case 40:
|
|
750
|
+
_context6.n = 39;
|
|
751
|
+
break;
|
|
752
|
+
case 41:
|
|
753
|
+
_context6.n = 43;
|
|
754
|
+
break;
|
|
755
|
+
case 42:
|
|
756
|
+
_context6.p = 42;
|
|
757
|
+
_t1 = _context6.v;
|
|
758
|
+
_iterator2.e(_t1);
|
|
759
|
+
case 43:
|
|
760
|
+
_context6.p = 43;
|
|
761
|
+
_iterator2.f();
|
|
762
|
+
return _context6.f(43);
|
|
763
|
+
case 44:
|
|
764
|
+
_t10 = _regeneratorKeys(this.txs);
|
|
765
|
+
case 45:
|
|
766
|
+
if ((_t11 = _t10()).done) {
|
|
767
|
+
_context6.n = 47;
|
|
768
|
+
break;
|
|
769
|
+
}
|
|
770
|
+
txId = _t11.value;
|
|
771
|
+
tx = this.txs[txId];
|
|
772
|
+
if (!tx) {
|
|
773
|
+
_context6.n = 46;
|
|
774
|
+
break;
|
|
775
|
+
}
|
|
776
|
+
_context6.n = 46;
|
|
777
|
+
return this.db.d1WriteTx(tx, (_tx$block_id = tx.block_id) !== null && _tx$block_id !== void 0 ? _tx$block_id : "0", (_tx$block = tx.block) !== null && _tx$block !== void 0 ? _tx$block : 1);
|
|
778
|
+
case 46:
|
|
779
|
+
_context6.n = 45;
|
|
780
|
+
break;
|
|
781
|
+
case 47:
|
|
782
|
+
_t12 = _regeneratorKeys(this.addrmap);
|
|
783
|
+
case 48:
|
|
784
|
+
if ((_t13 = _t12()).done) {
|
|
785
|
+
_context6.n = 50;
|
|
786
|
+
break;
|
|
787
|
+
}
|
|
788
|
+
addr = _t13.value;
|
|
789
|
+
_context6.n = 49;
|
|
790
|
+
return this.db.d1WriteAddrmap(addr, this.addrmap[addr]);
|
|
791
|
+
case 49:
|
|
792
|
+
_context6.n = 48;
|
|
793
|
+
break;
|
|
794
|
+
case 50:
|
|
795
|
+
_t14 = _regeneratorKeys(this.modules);
|
|
796
|
+
case 51:
|
|
797
|
+
if ((_t15 = _t14()).done) {
|
|
798
|
+
_context6.n = 53;
|
|
799
|
+
break;
|
|
800
|
+
}
|
|
801
|
+
name = _t15.value;
|
|
802
|
+
_context6.n = 52;
|
|
803
|
+
return this.db.d1WriteModule(name, this.modules[name]);
|
|
804
|
+
case 52:
|
|
805
|
+
_context6.n = 51;
|
|
806
|
+
break;
|
|
807
|
+
case 53:
|
|
808
|
+
_t16 = _regeneratorKeys(this.wasms);
|
|
809
|
+
case 54:
|
|
810
|
+
if ((_t17 = _t16()).done) {
|
|
811
|
+
_context6.n = 56;
|
|
812
|
+
break;
|
|
813
|
+
}
|
|
814
|
+
id = _t17.value;
|
|
815
|
+
_context6.n = 55;
|
|
816
|
+
return this.db.d1WriteWasm(id, this.wasms[id]);
|
|
817
|
+
case 55:
|
|
818
|
+
_context6.n = 54;
|
|
819
|
+
break;
|
|
820
|
+
case 56:
|
|
821
|
+
_context6.n = 65;
|
|
822
|
+
break;
|
|
823
|
+
case 57:
|
|
824
|
+
// D1 has data but seed txs from initSync() might be missing
|
|
825
|
+
// (e.g. Scheduler-Location added after initial boot)
|
|
826
|
+
txKeys = Object.keys(this.txs);
|
|
827
|
+
_i5 = 0, _txKeys = txKeys;
|
|
828
|
+
case 58:
|
|
829
|
+
if (!(_i5 < _txKeys.length)) {
|
|
830
|
+
_context6.n = 61;
|
|
831
|
+
break;
|
|
832
|
+
}
|
|
833
|
+
_txId = _txKeys[_i5];
|
|
834
|
+
_context6.n = 59;
|
|
835
|
+
return this.db.d1.prepare("SELECT 1 FROM txs WHERE id = ?").bind(_txId).first();
|
|
836
|
+
case 59:
|
|
837
|
+
existing = _context6.v;
|
|
838
|
+
if (existing) {
|
|
839
|
+
_context6.n = 60;
|
|
840
|
+
break;
|
|
841
|
+
}
|
|
842
|
+
_tx = this.txs[_txId];
|
|
843
|
+
if (!_tx) {
|
|
844
|
+
_context6.n = 60;
|
|
845
|
+
break;
|
|
846
|
+
}
|
|
847
|
+
_context6.n = 60;
|
|
848
|
+
return this.db.d1WriteTx(_tx, (_tx$block_id2 = _tx.block_id) !== null && _tx$block_id2 !== void 0 ? _tx$block_id2 : "0", (_tx$block2 = _tx.block) !== null && _tx$block2 !== void 0 ? _tx$block2 : 1);
|
|
849
|
+
case 60:
|
|
850
|
+
_i5++;
|
|
851
|
+
_context6.n = 58;
|
|
852
|
+
break;
|
|
853
|
+
case 61:
|
|
854
|
+
_t18 = _regeneratorKeys(this.addrmap);
|
|
855
|
+
case 62:
|
|
856
|
+
if ((_t19 = _t18()).done) {
|
|
857
|
+
_context6.n = 65;
|
|
858
|
+
break;
|
|
859
|
+
}
|
|
860
|
+
_addr = _t19.value;
|
|
861
|
+
_context6.n = 63;
|
|
862
|
+
return this.db.d1.prepare("SELECT 1 FROM addrmap WHERE address = ?").bind(_addr).first();
|
|
863
|
+
case 63:
|
|
864
|
+
_existing = _context6.v;
|
|
865
|
+
if (_existing) {
|
|
866
|
+
_context6.n = 64;
|
|
867
|
+
break;
|
|
868
|
+
}
|
|
869
|
+
_context6.n = 64;
|
|
870
|
+
return this.db.d1WriteAddrmap(_addr, this.addrmap[_addr]);
|
|
871
|
+
case 64:
|
|
872
|
+
_context6.n = 62;
|
|
873
|
+
break;
|
|
874
|
+
case 65:
|
|
875
|
+
_context6.n = 67;
|
|
876
|
+
break;
|
|
877
|
+
case 66:
|
|
878
|
+
_context6.p = 66;
|
|
879
|
+
_t20 = _context6.v;
|
|
880
|
+
console.error("[ArMem] D1 seed/backfill error:", (_t20 === null || _t20 === void 0 ? void 0 : _t20.message) || _t20);
|
|
881
|
+
case 67:
|
|
882
|
+
_context6.n = 74;
|
|
883
|
+
break;
|
|
884
|
+
case 68:
|
|
885
|
+
_i6 = 0, _arr3 = ["height", "blocks"];
|
|
886
|
+
case 69:
|
|
887
|
+
if (!(_i6 < _arr3.length)) {
|
|
888
|
+
_context6.n = 71;
|
|
889
|
+
break;
|
|
890
|
+
}
|
|
891
|
+
_v4 = _arr3[_i6];
|
|
892
|
+
_context6.n = 70;
|
|
893
|
+
return this.set(this[_v4], _v4);
|
|
894
|
+
case 70:
|
|
895
|
+
_i6++;
|
|
896
|
+
_context6.n = 69;
|
|
897
|
+
break;
|
|
898
|
+
case 71:
|
|
899
|
+
_i7 = 0, _arr4 = ["modules", "wasms", "addrmap", "blockmap"];
|
|
900
|
+
case 72:
|
|
901
|
+
if (!(_i7 < _arr4.length)) {
|
|
902
|
+
_context6.n = 74;
|
|
903
|
+
break;
|
|
904
|
+
}
|
|
905
|
+
_v5 = _arr4[_i7];
|
|
906
|
+
_context6.n = 73;
|
|
907
|
+
return this.putAll(_v5);
|
|
908
|
+
case 73:
|
|
909
|
+
_i7++;
|
|
910
|
+
_context6.n = 72;
|
|
911
|
+
break;
|
|
912
|
+
case 74:
|
|
913
|
+
return _context6.a(2);
|
|
468
914
|
}
|
|
469
|
-
},
|
|
915
|
+
}, _callee6, this, [[38, 42, 43, 44], [36, 66], [18, 20], [15, 26, 27, 28], [3, 5]]);
|
|
470
916
|
}));
|
|
471
917
|
function init() {
|
|
472
918
|
return _init.apply(this, arguments);
|
|
@@ -476,107 +922,209 @@ var ArMemBase = exports["default"] = /*#__PURE__*/function () {
|
|
|
476
922
|
}, {
|
|
477
923
|
key: "getTx",
|
|
478
924
|
value: function () {
|
|
479
|
-
var _getTx = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
480
|
-
var
|
|
481
|
-
|
|
482
|
-
|
|
925
|
+
var _getTx = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(id) {
|
|
926
|
+
var _this$txs$id, _this$db3;
|
|
927
|
+
var tx, _e$message, val, _this$txs$tx$bundle, bundleTx, _this$db2, bdata, b64, bundle, _iterator3, _step3, di, data, data_size, data_type, _iterator4, _step4, t, owner, _tx$id, _t21, _t22, _t23, _t24, _t25, _t26, _t27, _t28, _t29, _t30, _t31, _t32;
|
|
928
|
+
return _regenerator().w(function (_context7) {
|
|
929
|
+
while (1) switch (_context7.p = _context7.n) {
|
|
483
930
|
case 0:
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
_context6.n = 1;
|
|
931
|
+
if (!this._txCache.has(id)) {
|
|
932
|
+
_context7.n = 1;
|
|
487
933
|
break;
|
|
488
934
|
}
|
|
489
|
-
return
|
|
935
|
+
return _context7.a(2, this._txCache.get(id));
|
|
490
936
|
case 1:
|
|
491
|
-
|
|
492
|
-
|
|
937
|
+
// Check in-memory txs (always available for non-DB path, seed data for DB path)
|
|
938
|
+
tx = (_this$txs$id = this.txs[id]) !== null && _this$txs$id !== void 0 ? _this$txs$id : null; // Try D1 first (indexed lookup), then DO storage fallback
|
|
939
|
+
if (!(!tx && this.db)) {
|
|
940
|
+
_context7.n = 8;
|
|
493
941
|
break;
|
|
494
942
|
}
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
943
|
+
_context7.n = 2;
|
|
944
|
+
return this.init();
|
|
945
|
+
case 2:
|
|
946
|
+
if (!this.db.d1GetTxById) {
|
|
947
|
+
_context7.n = 6;
|
|
948
|
+
break;
|
|
949
|
+
}
|
|
950
|
+
_context7.p = 3;
|
|
951
|
+
_context7.n = 4;
|
|
952
|
+
return this.db.d1GetTxById(id);
|
|
500
953
|
case 4:
|
|
501
|
-
|
|
502
|
-
|
|
954
|
+
tx = _context7.v;
|
|
955
|
+
_context7.n = 6;
|
|
956
|
+
break;
|
|
957
|
+
case 5:
|
|
958
|
+
_context7.p = 5;
|
|
959
|
+
_t21 = _context7.v;
|
|
960
|
+
if (_t21 !== null && _t21 !== void 0 && (_e$message = _t21.message) !== null && _e$message !== void 0 && _e$message.includes("no such table")) {
|
|
961
|
+
_context7.n = 6;
|
|
503
962
|
break;
|
|
504
963
|
}
|
|
505
|
-
|
|
964
|
+
throw _t21;
|
|
965
|
+
case 6:
|
|
966
|
+
if (tx) {
|
|
967
|
+
_context7.n = 8;
|
|
968
|
+
break;
|
|
969
|
+
}
|
|
970
|
+
_context7.n = 7;
|
|
971
|
+
return this.db.get("txs.".concat(id));
|
|
972
|
+
case 7:
|
|
973
|
+
val = _context7.v;
|
|
974
|
+
if (val !== null) tx = val;
|
|
975
|
+
case 8:
|
|
976
|
+
if (!(!tx && this._remote)) {
|
|
977
|
+
_context7.n = 10;
|
|
978
|
+
break;
|
|
979
|
+
}
|
|
980
|
+
_context7.n = 9;
|
|
981
|
+
return this._remote.getTx(id);
|
|
982
|
+
case 9:
|
|
983
|
+
tx = _context7.v;
|
|
984
|
+
case 10:
|
|
985
|
+
if (!(0, _ramda.isNil)(tx)) {
|
|
986
|
+
_context7.n = 11;
|
|
987
|
+
break;
|
|
988
|
+
}
|
|
989
|
+
return _context7.a(2, null);
|
|
990
|
+
case 11:
|
|
991
|
+
if (!tx.bundle) {
|
|
992
|
+
_context7.n = 27;
|
|
993
|
+
break;
|
|
994
|
+
}
|
|
995
|
+
_context7.p = 12;
|
|
996
|
+
bundleTx = (_this$txs$tx$bundle = this.txs[tx.bundle]) !== null && _this$txs$tx$bundle !== void 0 ? _this$txs$tx$bundle : null;
|
|
997
|
+
if (!(!bundleTx && this.db)) {
|
|
998
|
+
_context7.n = 14;
|
|
999
|
+
break;
|
|
1000
|
+
}
|
|
1001
|
+
_context7.n = 13;
|
|
1002
|
+
return this.db.get("txs.".concat(tx.bundle));
|
|
1003
|
+
case 13:
|
|
1004
|
+
bundleTx = _context7.v;
|
|
1005
|
+
case 14:
|
|
1006
|
+
if (!bundleTx) {
|
|
1007
|
+
_context7.n = 25;
|
|
1008
|
+
break;
|
|
1009
|
+
}
|
|
1010
|
+
if (!(!bundleTx.data && (_this$db2 = this.db) !== null && _this$db2 !== void 0 && _this$db2.r2GetTxData)) {
|
|
1011
|
+
_context7.n = 16;
|
|
1012
|
+
break;
|
|
1013
|
+
}
|
|
1014
|
+
_context7.n = 15;
|
|
1015
|
+
return this.db.r2GetTxData(tx.bundle);
|
|
1016
|
+
case 15:
|
|
1017
|
+
bundleTx.data = _context7.v;
|
|
1018
|
+
case 16:
|
|
1019
|
+
if (!bundleTx.data) {
|
|
1020
|
+
_context7.n = 25;
|
|
1021
|
+
break;
|
|
1022
|
+
}
|
|
1023
|
+
bdata = bundleTx.data;
|
|
1024
|
+
if (typeof bdata === "string") {
|
|
1025
|
+
b64 = bdata.replace(/-/g, "+").replace(/_/g, "/");
|
|
1026
|
+
bdata = Buffer.from(b64, "base64");
|
|
1027
|
+
}
|
|
1028
|
+
bundle = new _arbundles.Bundle(bdata);
|
|
1029
|
+
_iterator3 = _createForOfIteratorHelper(bundle.items);
|
|
1030
|
+
_context7.p = 17;
|
|
1031
|
+
_iterator3.s();
|
|
1032
|
+
case 18:
|
|
1033
|
+
if ((_step3 = _iterator3.n()).done) {
|
|
1034
|
+
_context7.n = 22;
|
|
1035
|
+
break;
|
|
1036
|
+
}
|
|
1037
|
+
di = _step3.value;
|
|
506
1038
|
if (!(id === di.id)) {
|
|
507
|
-
|
|
1039
|
+
_context7.n = 21;
|
|
508
1040
|
break;
|
|
509
1041
|
}
|
|
510
1042
|
data = di.data;
|
|
511
1043
|
data_size = Buffer.byteLength(di.rawData).toString();
|
|
512
1044
|
data_type = "";
|
|
513
|
-
|
|
1045
|
+
_iterator4 = _createForOfIteratorHelper(di.tags);
|
|
514
1046
|
try {
|
|
515
|
-
for (
|
|
516
|
-
t =
|
|
1047
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
1048
|
+
t = _step4.value;
|
|
517
1049
|
if (t.name === "Content-Type") data_type = t.value;
|
|
518
1050
|
}
|
|
519
1051
|
} catch (err) {
|
|
520
|
-
|
|
1052
|
+
_iterator4.e(err);
|
|
521
1053
|
} finally {
|
|
522
|
-
|
|
1054
|
+
_iterator4.f();
|
|
523
1055
|
}
|
|
524
|
-
|
|
1056
|
+
_context7.n = 19;
|
|
525
1057
|
return this.owner(di);
|
|
526
|
-
case
|
|
527
|
-
owner =
|
|
528
|
-
|
|
1058
|
+
case 19:
|
|
1059
|
+
owner = _context7.v;
|
|
1060
|
+
_t22 = {
|
|
529
1061
|
size: data_size,
|
|
530
1062
|
type: data_type
|
|
531
1063
|
};
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
1064
|
+
_t23 = di.anchor;
|
|
1065
|
+
_t24 = di.signature;
|
|
1066
|
+
_t25 = di.target;
|
|
1067
|
+
_context7.n = 20;
|
|
536
1068
|
return di.id;
|
|
537
|
-
case
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
1069
|
+
case 20:
|
|
1070
|
+
_t26 = _context7.v;
|
|
1071
|
+
_t27 = di;
|
|
1072
|
+
_t28 = owner;
|
|
1073
|
+
_t29 = di.tags;
|
|
1074
|
+
_t30 = data;
|
|
543
1075
|
tx = {
|
|
544
|
-
_data:
|
|
545
|
-
anchor:
|
|
546
|
-
signature:
|
|
547
|
-
recipient:
|
|
548
|
-
id:
|
|
549
|
-
item:
|
|
550
|
-
owner:
|
|
551
|
-
tags:
|
|
552
|
-
data:
|
|
1076
|
+
_data: _t22,
|
|
1077
|
+
anchor: _t23,
|
|
1078
|
+
signature: _t24,
|
|
1079
|
+
recipient: _t25,
|
|
1080
|
+
id: _t26,
|
|
1081
|
+
item: _t27,
|
|
1082
|
+
owner: _t28,
|
|
1083
|
+
tags: _t29,
|
|
1084
|
+
data: _t30
|
|
553
1085
|
};
|
|
554
|
-
case
|
|
555
|
-
|
|
1086
|
+
case 21:
|
|
1087
|
+
_context7.n = 18;
|
|
556
1088
|
break;
|
|
557
|
-
case
|
|
558
|
-
|
|
1089
|
+
case 22:
|
|
1090
|
+
_context7.n = 24;
|
|
559
1091
|
break;
|
|
560
|
-
case
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
case
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
return
|
|
568
|
-
case
|
|
569
|
-
|
|
1092
|
+
case 23:
|
|
1093
|
+
_context7.p = 23;
|
|
1094
|
+
_t31 = _context7.v;
|
|
1095
|
+
_iterator3.e(_t31);
|
|
1096
|
+
case 24:
|
|
1097
|
+
_context7.p = 24;
|
|
1098
|
+
_iterator3.f();
|
|
1099
|
+
return _context7.f(24);
|
|
1100
|
+
case 25:
|
|
1101
|
+
_context7.n = 27;
|
|
570
1102
|
break;
|
|
571
|
-
case
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
case
|
|
575
|
-
|
|
1103
|
+
case 26:
|
|
1104
|
+
_context7.p = 26;
|
|
1105
|
+
_t32 = _context7.v;
|
|
1106
|
+
case 27:
|
|
1107
|
+
if (!(tx && !tx.data && (_this$db3 = this.db) !== null && _this$db3 !== void 0 && _this$db3.r2GetTxData)) {
|
|
1108
|
+
_context7.n = 29;
|
|
1109
|
+
break;
|
|
1110
|
+
}
|
|
1111
|
+
_context7.n = 28;
|
|
1112
|
+
return this.db.r2GetTxData((_tx$id = tx.id) !== null && _tx$id !== void 0 ? _tx$id : id);
|
|
1113
|
+
case 28:
|
|
1114
|
+
tx.data = _context7.v;
|
|
1115
|
+
case 29:
|
|
1116
|
+
// Add to LRU cache
|
|
1117
|
+
if (tx) {
|
|
1118
|
+
if (this._txCache.size >= this._TX_CACHE_MAX) {
|
|
1119
|
+
this._txCache["delete"](this._txCache.keys().next().value);
|
|
1120
|
+
}
|
|
1121
|
+
this._txCache.set(id, tx);
|
|
1122
|
+
}
|
|
1123
|
+
return _context7.a(2, tx);
|
|
576
1124
|
}
|
|
577
|
-
},
|
|
1125
|
+
}, _callee7, this, [[17, 23, 24, 25], [12, 26], [3, 5]]);
|
|
578
1126
|
}));
|
|
579
|
-
function getTx(
|
|
1127
|
+
function getTx(_x9) {
|
|
580
1128
|
return _getTx.apply(this, arguments);
|
|
581
1129
|
}
|
|
582
1130
|
return getTx;
|
|
@@ -584,64 +1132,127 @@ var ArMemBase = exports["default"] = /*#__PURE__*/function () {
|
|
|
584
1132
|
}, {
|
|
585
1133
|
key: "getWasm",
|
|
586
1134
|
value: function () {
|
|
587
|
-
var _getWasm = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
588
|
-
var mod, format, _wasm, wasm, tx;
|
|
589
|
-
return _regenerator().w(function (
|
|
590
|
-
while (1) switch (
|
|
1135
|
+
var _getWasm = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(module) {
|
|
1136
|
+
var mod, format, val, _wasm, wasm, _this$db4, remoteData, tx, _this$db5, _t33, _t34;
|
|
1137
|
+
return _regenerator().w(function (_context8) {
|
|
1138
|
+
while (1) switch (_context8.p = _context8.n) {
|
|
591
1139
|
case 0:
|
|
592
1140
|
mod = module !== null && module !== void 0 ? module : this.modules.aos2_0_1;
|
|
593
1141
|
if (mod) {
|
|
594
|
-
|
|
1142
|
+
_context8.n = 1;
|
|
595
1143
|
break;
|
|
596
1144
|
}
|
|
597
1145
|
throw Error("module not found");
|
|
598
1146
|
case 1:
|
|
599
|
-
format = null;
|
|
600
|
-
|
|
601
|
-
|
|
1147
|
+
format = null; // Lazy load wasm entry if needed
|
|
1148
|
+
if (!(!this.wasms[mod] && this.db)) {
|
|
1149
|
+
_context8.n = 3;
|
|
1150
|
+
break;
|
|
1151
|
+
}
|
|
1152
|
+
_context8.n = 2;
|
|
1153
|
+
return this.db.get("wasms.".concat(mod));
|
|
602
1154
|
case 2:
|
|
603
|
-
|
|
1155
|
+
val = _context8.v;
|
|
1156
|
+
if (val !== null) this.wasms[mod] = val;
|
|
1157
|
+
case 3:
|
|
1158
|
+
_context8.n = 4;
|
|
1159
|
+
return this.wasms[mod];
|
|
1160
|
+
case 4:
|
|
1161
|
+
_wasm = _context8.v;
|
|
604
1162
|
wasm = _wasm === null || _wasm === void 0 ? void 0 : _wasm.data;
|
|
605
1163
|
if (wasm) {
|
|
606
|
-
|
|
1164
|
+
_context8.n = 20;
|
|
607
1165
|
break;
|
|
608
1166
|
}
|
|
609
1167
|
if (!(_wasm !== null && _wasm !== void 0 && _wasm.file)) {
|
|
610
|
-
|
|
1168
|
+
_context8.n = 6;
|
|
611
1169
|
break;
|
|
612
1170
|
}
|
|
613
|
-
|
|
1171
|
+
_context8.n = 5;
|
|
614
1172
|
return this._getWasm(this.wasms[mod].file);
|
|
615
|
-
case
|
|
616
|
-
wasm =
|
|
1173
|
+
case 5:
|
|
1174
|
+
wasm = _context8.v;
|
|
617
1175
|
format = _wasm.format;
|
|
618
|
-
|
|
1176
|
+
_context8.n = 19;
|
|
619
1177
|
break;
|
|
620
|
-
case
|
|
621
|
-
|
|
1178
|
+
case 6:
|
|
1179
|
+
if (!((_this$db4 = this.db) !== null && _this$db4 !== void 0 && _this$db4.r2GetWasm)) {
|
|
1180
|
+
_context8.n = 10;
|
|
1181
|
+
break;
|
|
1182
|
+
}
|
|
1183
|
+
_context8.p = 7;
|
|
1184
|
+
_context8.n = 8;
|
|
1185
|
+
return this.db.r2GetWasm(mod);
|
|
1186
|
+
case 8:
|
|
1187
|
+
wasm = _context8.v;
|
|
1188
|
+
_context8.n = 10;
|
|
1189
|
+
break;
|
|
1190
|
+
case 9:
|
|
1191
|
+
_context8.p = 9;
|
|
1192
|
+
_t33 = _context8.v;
|
|
1193
|
+
case 10:
|
|
1194
|
+
if (!(!wasm && this._remote)) {
|
|
1195
|
+
_context8.n = 12;
|
|
1196
|
+
break;
|
|
1197
|
+
}
|
|
1198
|
+
_context8.n = 11;
|
|
1199
|
+
return this._remote.data(mod);
|
|
1200
|
+
case 11:
|
|
1201
|
+
remoteData = _context8.v;
|
|
1202
|
+
if (remoteData) {
|
|
1203
|
+
wasm = remoteData instanceof Uint8Array ? remoteData : Buffer.from(remoteData, "base64");
|
|
1204
|
+
format = _wasm === null || _wasm === void 0 ? void 0 : _wasm.format;
|
|
1205
|
+
}
|
|
1206
|
+
case 12:
|
|
1207
|
+
if (wasm) {
|
|
1208
|
+
_context8.n = 18;
|
|
1209
|
+
break;
|
|
1210
|
+
}
|
|
1211
|
+
_context8.n = 13;
|
|
622
1212
|
return this.getTx(mod);
|
|
623
|
-
case
|
|
624
|
-
tx =
|
|
625
|
-
if (tx) {
|
|
626
|
-
|
|
627
|
-
|
|
1213
|
+
case 13:
|
|
1214
|
+
tx = _context8.v;
|
|
1215
|
+
if (!tx) {
|
|
1216
|
+
_context8.n = 17;
|
|
1217
|
+
break;
|
|
628
1218
|
}
|
|
629
|
-
|
|
630
|
-
|
|
1219
|
+
wasm = Buffer.from(tx.data, "base64");
|
|
1220
|
+
format = (0, _utils.tags)(tx.tags)["Module-Format"];
|
|
1221
|
+
// Cache to R2 for future reads
|
|
1222
|
+
if (!((_this$db5 = this.db) !== null && _this$db5 !== void 0 && _this$db5.r2PutWasm)) {
|
|
1223
|
+
_context8.n = 17;
|
|
1224
|
+
break;
|
|
1225
|
+
}
|
|
1226
|
+
_context8.p = 14;
|
|
1227
|
+
_context8.n = 15;
|
|
1228
|
+
return this.db.r2PutWasm(mod, wasm);
|
|
1229
|
+
case 15:
|
|
1230
|
+
_context8.n = 17;
|
|
631
1231
|
break;
|
|
632
|
-
case
|
|
1232
|
+
case 16:
|
|
1233
|
+
_context8.p = 16;
|
|
1234
|
+
_t34 = _context8.v;
|
|
1235
|
+
case 17:
|
|
1236
|
+
_context8.n = 19;
|
|
1237
|
+
break;
|
|
1238
|
+
case 18:
|
|
1239
|
+
format = _wasm === null || _wasm === void 0 ? void 0 : _wasm.format;
|
|
1240
|
+
case 19:
|
|
1241
|
+
_context8.n = 21;
|
|
1242
|
+
break;
|
|
1243
|
+
case 20:
|
|
633
1244
|
format = _wasm.format;
|
|
634
|
-
case
|
|
1245
|
+
case 21:
|
|
635
1246
|
format !== null && format !== void 0 ? format : format = "wasm64-unknown-emscripten-draft_2024_02_15";
|
|
636
|
-
return
|
|
1247
|
+
return _context8.a(2, {
|
|
637
1248
|
format: format,
|
|
638
1249
|
mod: mod,
|
|
639
1250
|
wasm: wasm
|
|
640
1251
|
});
|
|
641
1252
|
}
|
|
642
|
-
},
|
|
1253
|
+
}, _callee8, this, [[14, 16], [7, 9]]);
|
|
643
1254
|
}));
|
|
644
|
-
function getWasm(
|
|
1255
|
+
function getWasm(_x0) {
|
|
645
1256
|
return _getWasm.apply(this, arguments);
|
|
646
1257
|
}
|
|
647
1258
|
return getWasm;
|