wao 0.11.0 → 0.11.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/weavedrive.js CHANGED
@@ -10,10 +10,9 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
10
10
  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; }
11
11
  function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
12
12
  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."); }
13
+ 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; } }
13
14
  function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
14
15
  function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
15
- 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; } } }; }
16
- 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; } }
17
16
  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; }
18
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; }
19
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); }
@@ -25,59 +24,60 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
25
24
  function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
26
25
  var KB = 1024;
27
26
  var MB = KB * 1024;
28
- var CACHE_SZ = 32 * KB;
29
- var CHUNK_SZ = 128 * MB;
30
- var NOTIFY_SZ = 512 * MB;
27
+ var CACHE_SZ = 32 * KB; // Keep small cache size
28
+ var CHUNK_SZ = 1 * MB; // Reduced from 128MB to 1MB for better memory management
29
+ var STREAM_CHUNK = 256 * KB; // Added smaller streaming chunk size
31
30
  var log = console.log;
32
31
  var WeaveDrive = exports["default"] = /*#__PURE__*/_createClass(function WeaveDrive(ar) {
33
32
  _classCallCheck(this, WeaveDrive);
34
33
  this.ext = function (mod, FS) {
35
34
  return {
36
35
  reset: function reset(fd) {
37
- //console.log("WeaveDrive: Resetting fd: ", fd)
38
36
  FS.streams[fd].node.position = 0;
39
37
  FS.streams[fd].node.cache = new Uint8Array(0);
40
38
  },
41
39
  create: function create(id) {
42
40
  var _this = this;
43
41
  return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
44
- var _data$length;
45
- var properties, node, data, bytesLength, stream;
42
+ var properties, node, bytesLength, _data$length, data, stream;
46
43
  return _regeneratorRuntime().wrap(function _callee$(_context) {
47
44
  while (1) switch (_context.prev = _context.next) {
48
45
  case 0:
49
- properties = {
50
- isDevice: false,
51
- contents: null
52
- }; //console.log("WeaveDrive: Arweave ID is not admissable! ", id)
53
- _context.next = 3;
46
+ _context.next = 2;
54
47
  return _this.checkAdmissible(id);
55
- case 3:
48
+ case 2:
56
49
  if (_context.sent) {
57
- _context.next = 5;
50
+ _context.next = 4;
58
51
  break;
59
52
  }
60
53
  return _context.abrupt("return", 0);
61
- case 5:
62
- // Create the file in the emscripten FS
63
-
54
+ case 4:
64
55
  if (!FS.analyzePath("/data/").exists) FS.mkdir("/data/");
65
- node = FS.createFile("/", "data/" + id, properties, true, false); // Set initial parameters
66
- /*
67
- var bytesLength = await this.customFetch(`/${id}`, {
68
- method: "HEAD",
69
- }).then(res => res.headers.get("Content-Length"))
70
- */
71
- _context.next = 9;
56
+ properties = {
57
+ isDevice: false,
58
+ contents: null
59
+ };
60
+ node = FS.createFile("/", "data/" + id, properties, true, false);
61
+ bytesLength = 0;
62
+ _context.prev = 8;
63
+ _context.next = 11;
72
64
  return ar.data(id);
73
- case 9:
65
+ case 11:
74
66
  data = _context.sent;
75
67
  bytesLength = (_data$length = data === null || data === void 0 ? void 0 : data.length) !== null && _data$length !== void 0 ? _data$length : 0;
68
+ _context.next = 19;
69
+ break;
70
+ case 15:
71
+ _context.prev = 15;
72
+ _context.t0 = _context["catch"](8);
73
+ console.error("Failed to get data length:", _context.t0);
74
+ return _context.abrupt("return", 0);
75
+ case 19:
76
76
  node.total_size = Number(bytesLength);
77
77
  node.cache = new Uint8Array(0);
78
78
  node.position = 0;
79
+ node.chunks = new Map(); // Add chunk cache
79
80
 
80
- // Add a function that defers querying the file size until it is asked the first time.
81
81
  Object.defineProperties(node, {
82
82
  usedBytes: {
83
83
  get: function get() {
@@ -85,15 +85,13 @@ var WeaveDrive = exports["default"] = /*#__PURE__*/_createClass(function WeaveDr
85
85
  }
86
86
  }
87
87
  });
88
-
89
- // Now we have created the file in the emscripten FS, we can open it as a stream
90
- stream = FS.open("/data/" + id, "r"); //console.log("JS: Created file: ", id, " fd: ", stream.fd);
88
+ stream = FS.open("/data/" + id, "r");
91
89
  return _context.abrupt("return", stream);
92
- case 17:
90
+ case 26:
93
91
  case "end":
94
92
  return _context.stop();
95
93
  }
96
- }, _callee);
94
+ }, _callee, null, [[8, 15]]);
97
95
  }))();
98
96
  },
99
97
  createBlockHeader: function createBlockHeader(id) {
@@ -104,8 +102,6 @@ var WeaveDrive = exports["default"] = /*#__PURE__*/_createClass(function WeaveDr
104
102
  case 0:
105
103
  result = "";
106
104
  try {
107
- // todo: implement indep_hash
108
- // fetch(`/block/height/${id}`)
109
105
  block = ar.mem.blockmap[ar.mem.blocks[id]];
110
106
  if (block) {
111
107
  result = JSON.stringify({
@@ -133,7 +129,7 @@ var WeaveDrive = exports["default"] = /*#__PURE__*/_createClass(function WeaveDr
133
129
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
134
130
  while (1) switch (_context3.prev = _context3.next) {
135
131
  case 0:
136
- result = ""; // fetch(`/tx/${id}`)
132
+ result = "";
137
133
  try {
138
134
  tx = ar.mem.txs[id];
139
135
  if (tx) result = JSON.stringify(tx);
@@ -174,460 +170,262 @@ var WeaveDrive = exports["default"] = /*#__PURE__*/_createClass(function WeaveDr
174
170
  }, _callee4);
175
171
  }))();
176
172
  },
177
- open: function open(filename) {
178
- var _this2 = this;
173
+ // Chunk management helpers
174
+ getChunkKey: function getChunkKey(position) {
175
+ return Math.floor(position / CHUNK_SZ);
176
+ },
177
+ fetchChunk: function fetchChunk(stream, chunkKey) {
179
178
  return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
180
- var pathCategory, id, stream, _stream, _stream2, _stream3, _stream4;
179
+ var start, end, data;
181
180
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
182
181
  while (1) switch (_context5.prev = _context5.next) {
183
182
  case 0:
184
- pathCategory = filename.split("/")[1];
185
- id = filename.split("/")[2];
186
- console.log("JS: Opening ID: ", id);
187
- if (!(pathCategory === "tx")) {
188
- _context5.next = 16;
189
- break;
190
- }
191
- FS.createPath("/", "tx", true, false);
192
- if (!FS.analyzePath(filename).exists) {
193
- _context5.next = 12;
194
- break;
195
- }
196
- stream = FS.open(filename, "r");
197
- if (!stream.fd) {
198
- _context5.next = 9;
199
- break;
200
- }
201
- return _context5.abrupt("return", stream.fd);
183
+ start = chunkKey * CHUNK_SZ;
184
+ end = Math.min(start + CHUNK_SZ, stream.node.total_size);
185
+ _context5.prev = 2;
186
+ _context5.next = 5;
187
+ return ar.data(stream.node.name);
188
+ case 5:
189
+ data = _context5.sent;
190
+ return _context5.abrupt("return", data.subarray(start, end));
202
191
  case 9:
203
- return _context5.abrupt("return", 0);
204
- case 12:
205
- _context5.next = 14;
206
- return _this2.createTxHeader(id);
207
- case 14:
208
- _stream = _context5.sent;
209
- return _context5.abrupt("return", _stream.fd);
210
- case 16:
211
- if (!(pathCategory === "tx2")) {
212
- _context5.next = 31;
213
- break;
214
- }
215
- FS.createPath("/", "tx2", true, false);
216
- if (!FS.analyzePath(filename).exists) {
217
- _context5.next = 25;
218
- break;
219
- }
220
- stream = FS.open(filename, "r");
221
- if (!stream.fd) {
222
- _context5.next = 22;
223
- break;
224
- }
225
- return _context5.abrupt("return", stream.fd);
226
- case 22:
227
- return _context5.abrupt("return", 0);
228
- case 25:
229
- _context5.next = 27;
230
- return _this2.createDataItemTxHeader(id);
231
- case 27:
232
- _stream2 = _context5.sent;
233
- if (!_stream2.fd) {
234
- _context5.next = 30;
235
- break;
236
- }
237
- return _context5.abrupt("return", _stream2.fd);
238
- case 30:
239
- return _context5.abrupt("return", 0);
240
- case 31:
241
- if (!(pathCategory === "block")) {
242
- _context5.next = 44;
243
- break;
244
- }
245
- FS.createPath("/", "block", true, false);
246
- if (!FS.analyzePath(filename).exists) {
247
- _context5.next = 40;
248
- break;
249
- }
250
- stream = FS.open(filename, "r");
251
- if (!stream.fd) {
252
- _context5.next = 37;
253
- break;
254
- }
255
- return _context5.abrupt("return", stream.fd);
256
- case 37:
257
- return _context5.abrupt("return", 0);
258
- case 40:
259
- _context5.next = 42;
260
- return _this2.createBlockHeader(id);
261
- case 42:
262
- _stream3 = _context5.sent;
263
- return _context5.abrupt("return", _stream3.fd);
264
- case 44:
265
- if (!(pathCategory === "data")) {
266
- _context5.next = 59;
267
- break;
268
- }
269
- if (!FS.analyzePath(filename).exists) {
270
- _context5.next = 53;
271
- break;
272
- }
273
- stream = FS.open(filename, "r");
274
- if (!stream.fd) {
275
- _context5.next = 49;
276
- break;
277
- }
278
- return _context5.abrupt("return", stream.fd);
279
- case 49:
280
- console.log("JS: File not found: ", filename);
281
- return _context5.abrupt("return", 0);
282
- case 53:
283
- _context5.next = 55;
284
- return _this2.create(id);
285
- case 55:
286
- _stream4 = _context5.sent;
287
- return _context5.abrupt("return", _stream4.fd);
288
- case 57:
289
- _context5.next = 66;
290
- break;
291
- case 59:
292
- if (!(pathCategory === "headers")) {
293
- _context5.next = 64;
294
- break;
295
- }
296
- console.log("Header access not implemented yet.");
297
- return _context5.abrupt("return", 0);
298
- case 64:
299
- console.log("JS: Invalid path category: ", pathCategory);
300
- return _context5.abrupt("return", 0);
301
- case 66:
192
+ _context5.prev = 9;
193
+ _context5.t0 = _context5["catch"](2);
194
+ console.error("Failed to fetch chunk:", _context5.t0);
195
+ return _context5.abrupt("return", new Uint8Array(0));
196
+ case 13:
302
197
  case "end":
303
198
  return _context5.stop();
304
199
  }
305
- }, _callee5);
200
+ }, _callee5, null, [[2, 9]]);
306
201
  }))();
307
202
  },
308
- read: function read(fd, raw_dst_ptr, raw_length) {
309
- var _this3 = this;
203
+ ensureChunkLoaded: function ensureChunkLoaded(stream, position) {
204
+ var _this2 = this;
310
205
  return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
311
- var to_read, dst_ptr, stream, i, bytes_read, chunk_download_sz, to, data, start, end, chunk, response, reader, bytes_until_cache, bytes_until_notify, downloaded_bytes, cache_chunks, _yield$reader$read, done, chunk_bytes, write_length, chunk_to_cache;
206
+ var chunkKey, oldestKey, chunk;
312
207
  return _regeneratorRuntime().wrap(function _callee6$(_context6) {
313
208
  while (1) switch (_context6.prev = _context6.next) {
314
209
  case 0:
315
- // Note: The length and dst_ptr are 53 bit integers in JS, so this _should_ be ok into a large memspace.
316
- to_read = Number(raw_length);
317
- dst_ptr = Number(raw_dst_ptr);
318
- stream = 0;
319
- for (i = 0; i < FS.streams.length; i++) {
320
- if (FS.streams[i].fd === fd) stream = FS.streams[i];
321
- }
322
- // read block headers
323
- if (!stream.path.includes("/block")) {
210
+ chunkKey = _this2.getChunkKey(position);
211
+ if (stream.node.chunks.has(chunkKey)) {
324
212
  _context6.next = 7;
325
213
  break;
326
214
  }
327
- mod.HEAP8.set(stream.node.contents.subarray(0, to_read), dst_ptr);
328
- return _context6.abrupt("return", to_read);
215
+ // Remove old chunks if we have too many
216
+ if (stream.node.chunks.size >= 3) {
217
+ // Keep only 3 chunks in memory
218
+ oldestKey = stream.node.chunks.keys().next().value;
219
+ stream.node.chunks["delete"](oldestKey);
220
+ }
221
+ _context6.next = 5;
222
+ return _this2.fetchChunk(stream, chunkKey);
223
+ case 5:
224
+ chunk = _context6.sent;
225
+ stream.node.chunks.set(chunkKey, chunk);
329
226
  case 7:
330
- if (!stream.path.includes("/tx")) {
331
- _context6.next = 10;
227
+ return _context6.abrupt("return", stream.node.chunks.get(chunkKey));
228
+ case 8:
229
+ case "end":
230
+ return _context6.stop();
231
+ }
232
+ }, _callee6);
233
+ }))();
234
+ },
235
+ read: function read(fd, raw_dst_ptr, raw_length) {
236
+ var _this3 = this;
237
+ return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
238
+ var to_read, dst_ptr, stream, bytesRead, chunk, chunkOffset, available, readSize, data;
239
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
240
+ while (1) switch (_context7.prev = _context7.next) {
241
+ case 0:
242
+ to_read = Number(raw_length);
243
+ dst_ptr = Number(raw_dst_ptr);
244
+ stream = FS.streams.find(function (s) {
245
+ return s.fd === fd;
246
+ });
247
+ if (stream) {
248
+ _context7.next = 5;
332
249
  break;
333
250
  }
334
- mod.HEAP8.set(stream.node.contents.subarray(0, to_read), dst_ptr);
335
- return _context6.abrupt("return", to_read);
336
- case 10:
337
- // Satisfy what we can with the cache first
338
- bytes_read = _this3.readFromCache(stream, dst_ptr, to_read);
339
- stream.position += bytes_read;
340
- stream.lastReadPosition = stream.position;
341
- dst_ptr += bytes_read;
342
- to_read -= bytes_read;
343
-
344
- // Return if we have satisfied the request
345
-
346
- //console.log("WeaveDrive: Satisfied request with cache. Returning...")
347
- if (!(to_read === 0)) {
348
- _context6.next = 17;
251
+ return _context7.abrupt("return", 0);
252
+ case 5:
253
+ if (!(stream.path.includes("/block") || stream.path.includes("/tx"))) {
254
+ _context7.next = 8;
349
255
  break;
350
256
  }
351
- return _context6.abrupt("return", bytes_read);
352
- case 17:
353
- //console.log("WeaveDrive: Read from cache: ", bytes_read, " Remaining to read: ", to_read)
354
- chunk_download_sz = Math.max(to_read, CACHE_SZ);
355
- to = Math.min(stream.node.total_size, stream.position + chunk_download_sz); //console.log("WeaveDrive: fd: ", fd, " Read length: ", to_read, " Reading ahead:", to - to_read - stream.position)
356
- // fetch(`/${stream.node.name}`)
357
- _context6.next = 21;
358
- return ar.data(stream.node.name, null, log);
359
- case 21:
360
- data = _context6.sent;
361
- // Extract the Range header to determine the start and end of the requested chunk
362
- start = stream.position;
363
- end = to; // Create a ReadableStream for the requested chunk
364
- chunk = data.subarray(start, end);
365
- response = new Response(new ReadableStream({
366
- start: function start(controller) {
367
- controller.enqueue(chunk);
368
- controller.close();
369
- }
370
- }), {
371
- headers: {
372
- "content-length": chunk.length.toString()
373
- }
374
- });
375
- reader = response.body.getReader();
376
- bytes_until_cache = CHUNK_SZ;
377
- bytes_until_notify = NOTIFY_SZ;
378
- downloaded_bytes = 0;
379
- cache_chunks = [];
380
- _context6.prev = 31;
381
- case 32:
382
- if (!true) {
383
- _context6.next = 50;
257
+ mod.HEAP8.set(stream.node.contents.subarray(0, to_read), dst_ptr);
258
+ return _context7.abrupt("return", to_read);
259
+ case 8:
260
+ bytesRead = 0;
261
+ case 9:
262
+ if (!(to_read > 0)) {
263
+ _context7.next = 26;
384
264
  break;
385
265
  }
386
- _context6.next = 35;
387
- return reader.read();
388
- case 35:
389
- _yield$reader$read = _context6.sent;
390
- done = _yield$reader$read.done;
391
- chunk_bytes = _yield$reader$read.value;
392
- if (!done) {
393
- _context6.next = 40;
266
+ _context7.next = 12;
267
+ return _this3.ensureChunkLoaded(stream, stream.position);
268
+ case 12:
269
+ chunk = _context7.sent;
270
+ chunkOffset = stream.position % CHUNK_SZ; // Calculate how much we can read from this chunk
271
+ available = chunk.length - chunkOffset;
272
+ readSize = Math.min(to_read, available);
273
+ if (!(readSize <= 0)) {
274
+ _context7.next = 18;
394
275
  break;
395
276
  }
396
- return _context6.abrupt("break", 50);
397
- case 40:
398
- // Update the number of downloaded bytes to be _all_, not just the write length
399
- downloaded_bytes += chunk_bytes.length;
400
- bytes_until_cache -= chunk_bytes.length;
401
- bytes_until_notify -= chunk_bytes.length;
277
+ return _context7.abrupt("break", 26);
278
+ case 18:
279
+ // Copy data to destination
280
+ data = chunk.subarray(chunkOffset, chunkOffset + readSize);
281
+ mod.HEAP8.set(data, dst_ptr);
402
282
 
403
- // Write bytes from the chunk and update the pointer if necessary
404
- write_length = Math.min(chunk_bytes.length, to_read);
405
- if (write_length > 0) {
406
- //console.log("WeaveDrive: Writing: ", write_length, " bytes to: ", dst_ptr)
407
- mod.HEAP8.set(chunk_bytes.subarray(0, write_length), dst_ptr);
408
- dst_ptr += write_length;
409
- bytes_read += write_length;
410
- stream.position += write_length;
411
- to_read -= write_length;
412
- }
413
- if (to_read == 0) {
414
- // Add excess bytes to our cache
415
- chunk_to_cache = chunk_bytes.subarray(write_length); //console.log("WeaveDrive: Cacheing excess: ", chunk_to_cache.length)
416
- cache_chunks.push(chunk_to_cache);
417
- }
418
- if (bytes_until_cache <= 0) {
419
- console.log("WeaveDrive: Chunk size reached. Compressing cache...");
420
- stream.node.cache = _this3.addChunksToCache(stream.node.cache, cache_chunks);
421
- cache_chunks = [];
422
- bytes_until_cache = CHUNK_SZ;
423
- }
424
- if (bytes_until_notify <= 0) {
425
- console.log("WeaveDrive: Downloaded: ", downloaded_bytes / stream.node.total_size * 100, "%");
426
- bytes_until_notify = NOTIFY_SZ;
427
- }
428
- _context6.next = 32;
429
- break;
430
- case 50:
431
- _context6.next = 55;
283
+ // Update pointers
284
+ stream.position += readSize;
285
+ dst_ptr += readSize;
286
+ to_read -= readSize;
287
+ bytesRead += readSize;
288
+ _context7.next = 9;
432
289
  break;
433
- case 52:
434
- _context6.prev = 52;
435
- _context6.t0 = _context6["catch"](31);
436
- console.error("WeaveDrive: Error reading the stream: ", _context6.t0);
437
- case 55:
438
- _context6.prev = 55;
439
- reader.releaseLock();
440
- return _context6.finish(55);
441
- case 58:
442
- // If we have no cache, or we have not satisfied the full request, we need to download the rest
443
- // Rebuild the cache from the new cache chunks
444
- stream.node.cache = _this3.addChunksToCache(stream.node.cache, cache_chunks);
445
-
446
- // Update the last read position
447
- stream.lastReadPosition = stream.position;
448
- return _context6.abrupt("return", bytes_read);
449
- case 61:
290
+ case 26:
291
+ return _context7.abrupt("return", bytesRead);
292
+ case 27:
450
293
  case "end":
451
- return _context6.stop();
294
+ return _context7.stop();
452
295
  }
453
- }, _callee6, null, [[31, 52, 55, 58]]);
296
+ }, _callee7);
454
297
  }))();
455
298
  },
299
+ // Keep existing helper methods
456
300
  close: function close(fd) {
457
- var stream = 0;
458
- for (var i = 0; i < FS.streams.length; i++) {
459
- if (FS.streams[i].fd === fd) stream = FS.streams[i];
301
+ var stream = FS.streams.find(function (s) {
302
+ return s.fd === fd;
303
+ });
304
+ if (stream) {
305
+ var _stream$node$chunks;
306
+ (_stream$node$chunks = stream.node.chunks) === null || _stream$node$chunks === void 0 || _stream$node$chunks.clear(); // Clean up chunks
307
+ FS.close(stream);
460
308
  }
461
- FS.close(stream);
462
309
  },
463
- // Readahead cache functions
464
- readFromCache: function readFromCache(stream, dst_ptr, length) {
465
- // Check if the cache has been invalidated by a seek
466
- if (stream.lastReadPosition !== stream.position) {
467
- //console.log("WeaveDrive: Invalidating cache for fd: ", stream.fd, " Current pos: ", stream.position, " Last read pos: ", stream.lastReadPosition)
468
- stream.node.cache = new Uint8Array(0);
469
- return 0;
470
- }
471
- // Calculate the bytes of the request that can be satisfied with the cache
472
- var cache_part_length = Math.min(length, stream.node.cache.length);
473
- var cache_part = stream.node.cache.subarray(0, cache_part_length);
474
- mod.HEAP8.set(cache_part, dst_ptr);
475
- // Set the new cache to the remainder of the unused cache and update pointers
476
- stream.node.cache = stream.node.cache.subarray(cache_part_length);
477
- return cache_part_length;
478
- },
479
- addChunksToCache: function addChunksToCache(old_cache, chunks) {
480
- // Make a new cache array of the old cache length + the sum of the chunk lengths, capped by the max cache size
481
- var new_cache_length = Math.min(old_cache.length + chunks.reduce(function (acc, chunk) {
482
- return acc + chunk.length;
483
- }, 0), CACHE_SZ);
484
- var new_cache = new Uint8Array(new_cache_length);
485
- // Copy the old cache to the new cache
486
- new_cache.set(old_cache, 0);
487
- // Load the cache chunks into the new cache
488
- var current_offset = old_cache.length;
489
- var _iterator = _createForOfIteratorHelper(chunks),
490
- _step;
491
- try {
492
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
493
- var chunk = _step.value;
494
- if (current_offset < new_cache_length) {
495
- new_cache.set(chunk.subarray(0, new_cache_length - current_offset), current_offset);
496
- current_offset += chunk.length;
497
- }
498
- }
499
- } catch (err) {
500
- _iterator.e(err);
501
- } finally {
502
- _iterator.f();
503
- }
504
- return new_cache;
505
- },
506
- // General helpder functions
310
+ // ... rest of the existing methods (checkAdmissible, getTagValues, etc.) ...
507
311
  checkAdmissible: function checkAdmissible(ID) {
508
312
  var _this4 = this;
509
- return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
313
+ return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
510
314
  var bootTag, blockHeight, moduleExtensions, moduleHasWeaveDrive, processExtensions, processHasWeaveDrive, modes, moduleAvailabilityType, moduleMode, processAvailabilityType, processMode, attestors, exists, assignmentsHaveID, individualsHaveID;
511
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
512
- while (1) switch (_context8.prev = _context8.next) {
315
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
316
+ while (1) switch (_context9.prev = _context9.next) {
513
317
  case 0:
514
318
  if (!(mod.mode && mod.mode == "test")) {
515
- _context8.next = 2;
319
+ _context9.next = 2;
516
320
  break;
517
321
  }
518
- return _context8.abrupt("return", true);
322
+ return _context9.abrupt("return", true);
519
323
  case 2:
520
- // Check if we are attempting to load the On-Boot id, if so allow it
521
- // this was added for AOP 6 Boot loader See: https://github.com/permaweb/aos/issues/342
522
324
  bootTag = _this4.getTagValue("On-Boot", mod.spawn.tags);
523
325
  if (!(bootTag && bootTag === ID)) {
524
- _context8.next = 5;
326
+ _context9.next = 5;
525
327
  break;
526
328
  }
527
- return _context8.abrupt("return", true);
329
+ return _context9.abrupt("return", true);
528
330
  case 5:
529
- // Check that this module or process set the WeaveDrive tag on spawn
530
331
  blockHeight = mod.blockHeight;
531
332
  moduleExtensions = _this4.getTagValues("Extension", mod.module.tags);
532
333
  moduleHasWeaveDrive = moduleExtensions.includes("WeaveDrive");
533
334
  processExtensions = _this4.getTagValues("Extension", mod.spawn.tags);
534
335
  processHasWeaveDrive = moduleHasWeaveDrive || processExtensions.includes("WeaveDrive");
535
336
  if (processHasWeaveDrive) {
536
- _context8.next = 13;
337
+ _context9.next = 13;
537
338
  break;
538
339
  }
539
340
  console.log("WeaveDrive: Process tried to call WeaveDrive, but extension not set!");
540
- return _context8.abrupt("return", false);
341
+ return _context9.abrupt("return", false);
541
342
  case 13:
542
- modes = ["Assignments", "Individual", "Library"]; // Get the Availability-Type from the spawned process's Module or Process item
543
- // First check the module for its defaults
343
+ modes = ["Assignments", "Individual", "Library"];
544
344
  moduleAvailabilityType = _this4.getTagValue("Availability-Type", mod.module.tags);
545
- moduleMode = moduleAvailabilityType ? moduleAvailabilityType : "Assignments"; // Default to assignments
546
- // Now check the process's spawn item. These settings override Module item settings.
345
+ moduleMode = moduleAvailabilityType ? moduleAvailabilityType : "Assignments";
547
346
  processAvailabilityType = _this4.getTagValue("Availability-Type", mod.spawn.tags);
548
347
  processMode = processAvailabilityType ? processAvailabilityType : moduleMode;
549
348
  if (modes.includes(processMode)) {
550
- _context8.next = 20;
349
+ _context9.next = 20;
551
350
  break;
552
351
  }
553
352
  throw "Unsupported WeaveDrive mode: ".concat(processMode);
554
353
  case 20:
555
354
  attestors = _this4.serializeStringArr([_this4.getTagValue("Scheduler", mod.spawn.tags)].concat(_toConsumableArray(_this4.getTagValues("Attestor", mod.spawn.tags))).filter(function (t) {
556
355
  return !!t;
557
- })); // Init a set of GraphQL queries to run in order to find a valid attestation
558
- // Every WeaveDrive process has at least the "Assignments" availability check form.
356
+ }));
559
357
  exists = /*#__PURE__*/function () {
560
- var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(tags) {
358
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(tags) {
561
359
  var common;
562
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
563
- while (1) switch (_context7.prev = _context7.next) {
360
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
361
+ while (1) switch (_context8.prev = _context8.next) {
564
362
  case 0:
565
363
  common = {
566
364
  owners: attestors,
567
365
  block: [0, blockHeight],
568
366
  fields: ["tags"]
569
367
  };
570
- _context7.next = 3;
368
+ _context8.next = 3;
571
369
  return ar.gql.txs(_objectSpread(_objectSpread({}, common), {}, {
572
370
  tags: tags
573
371
  }));
574
372
  case 3:
575
- _context7.t0 = _context7.sent.length;
576
- return _context7.abrupt("return", _context7.t0 > 0);
373
+ _context8.t0 = _context8.sent.length;
374
+ return _context8.abrupt("return", _context8.t0 > 0);
577
375
  case 5:
578
376
  case "end":
579
- return _context7.stop();
377
+ return _context8.stop();
580
378
  }
581
- }, _callee7);
379
+ }, _callee8);
582
380
  }));
583
381
  return function exists(_x) {
584
382
  return _ref.apply(this, arguments);
585
383
  };
586
384
  }();
587
- _context8.next = 24;
385
+ _context9.next = 24;
588
386
  return exists({
589
387
  Type: "Attestation",
590
388
  Message: ID,
591
389
  "Data-Protocol": "ao"
592
390
  });
593
391
  case 24:
594
- assignmentsHaveID = _context8.sent;
392
+ assignmentsHaveID = _context9.sent;
595
393
  if (!assignmentsHaveID) {
596
- _context8.next = 27;
394
+ _context9.next = 27;
597
395
  break;
598
396
  }
599
- return _context8.abrupt("return", true);
397
+ return _context9.abrupt("return", true);
600
398
  case 27:
601
399
  if (!(processMode == "Individual")) {
602
- _context8.next = 33;
400
+ _context9.next = 33;
603
401
  break;
604
402
  }
605
- _context8.next = 30;
403
+ _context9.next = 30;
606
404
  return exists({
607
405
  Type: "Available",
608
406
  ID: ID,
609
407
  "Data-Protocol": "WeaveDrive"
610
408
  });
611
409
  case 30:
612
- individualsHaveID = _context8.sent;
410
+ individualsHaveID = _context9.sent;
613
411
  if (!individualsHaveID) {
614
- _context8.next = 33;
412
+ _context9.next = 33;
615
413
  break;
616
414
  }
617
- return _context8.abrupt("return", true);
415
+ return _context9.abrupt("return", true);
618
416
  case 33:
619
417
  if (!(processMode == "Library")) {
620
- _context8.next = 35;
418
+ _context9.next = 35;
621
419
  break;
622
420
  }
623
421
  throw "This WeaveDrive implementation does not support Library attestations yet!";
624
422
  case 35:
625
- return _context8.abrupt("return", false);
423
+ return _context9.abrupt("return", false);
626
424
  case 36:
627
425
  case "end":
628
- return _context8.stop();
426
+ return _context9.stop();
629
427
  }
630
- }, _callee8);
428
+ }, _callee9);
631
429
  }))();
632
430
  },
633
431
  serializeStringArr: function serializeStringArr() {
@@ -646,6 +444,137 @@ var WeaveDrive = exports["default"] = /*#__PURE__*/_createClass(function WeaveDr
646
444
  getTagValue: function getTagValue(key, tags) {
647
445
  var values = this.getTagValues(key, tags);
648
446
  return values.pop();
447
+ },
448
+ open: function open(filename) {
449
+ var _this5 = this;
450
+ return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
451
+ var pathCategory, id, stream, _stream, _stream2, _stream3, _stream4;
452
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
453
+ while (1) switch (_context10.prev = _context10.next) {
454
+ case 0:
455
+ pathCategory = filename.split("/")[1];
456
+ id = filename.split("/")[2];
457
+ console.log("JS: Opening ID: ", id);
458
+ if (!(pathCategory === "tx")) {
459
+ _context10.next = 16;
460
+ break;
461
+ }
462
+ FS.createPath("/", "tx", true, false);
463
+ if (!FS.analyzePath(filename).exists) {
464
+ _context10.next = 12;
465
+ break;
466
+ }
467
+ stream = FS.open(filename, "r");
468
+ if (!stream.fd) {
469
+ _context10.next = 9;
470
+ break;
471
+ }
472
+ return _context10.abrupt("return", stream.fd);
473
+ case 9:
474
+ return _context10.abrupt("return", 0);
475
+ case 12:
476
+ _context10.next = 14;
477
+ return _this5.createTxHeader(id);
478
+ case 14:
479
+ _stream = _context10.sent;
480
+ return _context10.abrupt("return", _stream.fd);
481
+ case 16:
482
+ if (!(pathCategory === "tx2")) {
483
+ _context10.next = 31;
484
+ break;
485
+ }
486
+ FS.createPath("/", "tx2", true, false);
487
+ if (!FS.analyzePath(filename).exists) {
488
+ _context10.next = 25;
489
+ break;
490
+ }
491
+ stream = FS.open(filename, "r");
492
+ if (!stream.fd) {
493
+ _context10.next = 22;
494
+ break;
495
+ }
496
+ return _context10.abrupt("return", stream.fd);
497
+ case 22:
498
+ return _context10.abrupt("return", 0);
499
+ case 25:
500
+ _context10.next = 27;
501
+ return _this5.createDataItemTxHeader(id);
502
+ case 27:
503
+ _stream2 = _context10.sent;
504
+ if (!_stream2.fd) {
505
+ _context10.next = 30;
506
+ break;
507
+ }
508
+ return _context10.abrupt("return", _stream2.fd);
509
+ case 30:
510
+ return _context10.abrupt("return", 0);
511
+ case 31:
512
+ if (!(pathCategory === "block")) {
513
+ _context10.next = 44;
514
+ break;
515
+ }
516
+ FS.createPath("/", "block", true, false);
517
+ if (!FS.analyzePath(filename).exists) {
518
+ _context10.next = 40;
519
+ break;
520
+ }
521
+ stream = FS.open(filename, "r");
522
+ if (!stream.fd) {
523
+ _context10.next = 37;
524
+ break;
525
+ }
526
+ return _context10.abrupt("return", stream.fd);
527
+ case 37:
528
+ return _context10.abrupt("return", 0);
529
+ case 40:
530
+ _context10.next = 42;
531
+ return _this5.createBlockHeader(id);
532
+ case 42:
533
+ _stream3 = _context10.sent;
534
+ return _context10.abrupt("return", _stream3.fd);
535
+ case 44:
536
+ if (!(pathCategory === "data")) {
537
+ _context10.next = 59;
538
+ break;
539
+ }
540
+ if (!FS.analyzePath(filename).exists) {
541
+ _context10.next = 53;
542
+ break;
543
+ }
544
+ stream = FS.open(filename, "r");
545
+ if (!stream.fd) {
546
+ _context10.next = 49;
547
+ break;
548
+ }
549
+ return _context10.abrupt("return", stream.fd);
550
+ case 49:
551
+ console.log("JS: File not found: ", filename);
552
+ return _context10.abrupt("return", 0);
553
+ case 53:
554
+ _context10.next = 55;
555
+ return _this5.create(id);
556
+ case 55:
557
+ _stream4 = _context10.sent;
558
+ return _context10.abrupt("return", _stream4.fd);
559
+ case 57:
560
+ _context10.next = 66;
561
+ break;
562
+ case 59:
563
+ if (!(pathCategory === "headers")) {
564
+ _context10.next = 64;
565
+ break;
566
+ }
567
+ console.log("Header access not implemented yet.");
568
+ return _context10.abrupt("return", 0);
569
+ case 64:
570
+ console.log("JS: Invalid path category: ", pathCategory);
571
+ return _context10.abrupt("return", 0);
572
+ case 66:
573
+ case "end":
574
+ return _context10.stop();
575
+ }
576
+ }, _callee10);
577
+ }))();
649
578
  }
650
579
  };
651
580
  };